VistA-WorldVistAEHR/r/PATIENT_DATA_EXCHANGE-VAQ/VAQPST40.m

60 lines
1.8 KiB
Mathematica

VAQPST40 ;JRP/ALB - UPDATE DATA SEGMENT FILE;09-SEP-93
;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
UPDATE ;MAIN ENTRY POINT
;INPUT : NONE
;OUTPUT : NONE
;
;DECLARE VARIABLES
N NODE,SEGPTR,HLTHSEG,DEFTIM,DEFOCC,TIMLIM,OCCLIM,TMP
N HLTHPTR,HLTHABB,CURTIM,CUROCC,COUNT
S DEFTIM=""
S DEFOCC=""
;GET DEFAULT TIME & OCCURANCE LIMIT FROM PARAMETER FILE
S TMP=+$O(^VAT(394.81,0))
I (TMP) D
.S NODE=$G(^VAT(394.81,TMP,"LIMITS"))
.S DEFTIM=$P(NODE,"^",1)
.S DEFOCC=$P(NODE,"^",2)
;DEFAULTS NOT SET - USE 1 YEAR & 10 OCCURRENCES
S:(DEFTIM="") DEFTIM="1Y"
S:('DEFOCC) DEFOCC=10
;LOOP THROUGH HEALTH SUMMARY COMPONENTS
W !!!,"Updating pointers to Health Summary components and initializing"
W !,"maximum time and occurrence limits (when appropriate) "
S COUNT=0
S HLTHABB=""
F S HLTHABB=$O(^GMT(142.1,"C",HLTHABB)) Q:(HLTHABB="") D
.S HLTHPTR=+$O(^GMT(142.1,"C",HLTHABB,0))
.Q:('HLTHPTR)
.S COUNT=COUNT+1
.W:('(COUNT#5)) "."
.;FIND ENTRY IN DATA SEGMENT FILE
.S SEGPTR=+$O(^VAT(394.71,"C",HLTHABB,0))
.Q:('SEGPTR)
.;DETERMINE IF LIMITS ARE APPLICABLE
.S TMP=$$LIMITS^VAQDBIH1(HLTHPTR)
.S TIMLIM=+$P(TMP,"^",1)
.S OCCLIM=+$P(TMP,"^",2)
.;GET DATA SEGMENT NODE CONTAINING HEALTH SUMMARY INFO
.S NODE=$G(^VAT(394.71,SEGPTR,0))
.;SET POINTER TO HEALTH SUMMARY COMPONENT
.S $P(NODE,"^",4)=HLTHPTR
.;GET CURRENT TIME & OCCURRENCE MAX VALUES
.S CURTIM=$P(NODE,"^",5)
.S CUROCC=$P(NODE,"^",6)
.;SET MAXIMUM TIME LIMIT - USE CURRENT VALUE IF THERE
.I (TIMLIM) S:(CURTIM="") CURTIM=DEFTIM
.;TIME LIMIT NOT APPLICABLE
.I ('TIMLIM) S CURTIM=""
.;SET MAXIMUM OCCURRENCE LIMIT - USE CURRENT VALUE IF THERE
.I (OCCLIM) S:(CUROCC="") CUROCC=DEFOCC
.;OCCURRENCE LIMIT NOT APPLICABLE
.I ('OCCLIM) S CUROCC=""
.;STORE MAXIMUM LIMITS
.S $P(NODE,"^",5)=CURTIM
.S $P(NODE,"^",6)=CUROCC
.S ^VAT(394.71,SEGPTR,0)=NODE
;DONE
W !!,"Updating completed",!!!
Q