40 lines
1.8 KiB
Mathematica
40 lines
1.8 KiB
Mathematica
QAOC1061 ;HISC/DAD-OCCURRENCE SCREEN AUTO ENROLLMENT ;5/13/93 09:05
|
|
;;3.0;Occurrence Screen;;09/14/1993
|
|
;SCREEN 106.1 -- TRANSFER TO A SPECIAL CARE UNIT
|
|
Q:$$INACTIVE^QAOC0(106.1)
|
|
S QAOSEND=QAMTODAY+.24,QAOSW=""
|
|
F S QAOSW=$O(^DPT("CN",QAOSW)) Q:QAOSW="" F QAOSDFN=0:0 S QAOSDFN=$O(^DPT("CN",QAOSW,QAOSDFN)) Q:QAOSDFN'>0 S QAOSADM=^DPT("CN",QAOSW,QAOSDFN) I QAOSADM,$D(^DGPM(QAOSADM,0))#2 D MAIN
|
|
Q
|
|
MAIN ;
|
|
S QAOSQUIT=0,QAOVISIT="" K TDATE
|
|
F QAOSTDT=9999999.9999999-QAOSEND:0 S QAOSTDT=$O(^DGPM("ATS",QAOSDFN,QAOSADM,QAOSTDT)) Q:QAOSTDT'>0!(QAOSTDT\1'?7N)!QAOSQUIT F QAOSSPEC=0:0 S QAOSSPEC=$O(^DGPM("ATS",QAOSDFN,QAOSADM,QAOSTDT,QAOSSPEC)) Q:QAOSSPEC'>0!QAOSQUIT D
|
|
. F QAOSD0P=0:0 S QAOSD0P=$O(^DGPM("ATS",QAOSDFN,QAOSADM,QAOSTDT,QAOSSPEC,QAOSD0P)) Q:QAOSD0P'>0!QAOSQUIT D LOOP1
|
|
. Q
|
|
Q
|
|
LOOP1 ;
|
|
S QAOSZERO(0)=$G(^DGPM(QAOSD0P,0)) Q:QAOSZERO(0)=""
|
|
S TRANTYPE=$P(QAOSZERO(0),"^",2) Q:TRANTYPE'=2&(TRANTYPE'=6)
|
|
G:$D(TDATE(1))#2 LOOP2
|
|
I 9999999.9999999-QAOSTDT'>(QAMTODAY-.0000001) S QAOSQUIT=1 Q
|
|
Q:$$TXSP^QAOC0("S",$P(QAOSZERO(0),"^",9))=-1
|
|
S TDATE(1)=QAOSZERO(0)
|
|
Q
|
|
LOOP2 ;
|
|
S Y=$$TXSP^QAOC0("S",$P(QAOSZERO(0),"^",9))
|
|
I $D(TDATE(2))[0,+Y>0 S QAOSQUIT=1 Q
|
|
I $D(TDATE(2))#2,+Y>0 D LOOP3 S QAOSQUIT=1 Q
|
|
S Y=$$TXSP^QAOC0("S",$P(QAOSZERO(0),"^",9))
|
|
I +Y=-1 S (TDATE(2),X2)=QAOSZERO(0),X2=+X2,X1=+TDATE(1) D ^%DTC S:X>3 QAOSQUIT=1 Q
|
|
Q
|
|
LOOP3 ;
|
|
D VADPT^QAOC0(QAOSDFN,QAOSD0P)
|
|
S QAOVISIT=9999999.9999999-QAOSTDT
|
|
S ^UTILITY($J,"QAM CONDITION",QAMD1,QAOSDFN,QAMTODAY)=""
|
|
S WARDCLIN=+VAIP(5)_"^"
|
|
S ^UTILITY($J,"QAM FALL OUT",QAMD0,QAOSDFN,QAMTODAY,"WARD")=WARDCLIN
|
|
S ^UTILITY($J,"QAM FALL OUT",QAMD0,QAOSDFN,QAMTODAY,"TXSP")=+VAIP(8)
|
|
S ^UTILITY($J,"QAM FALL OUT",QAMD0,QAOSDFN,QAMTODAY,"MVDT")=QAOVISIT
|
|
S ^UTILITY($J,"QAM FALL OUT",QAMD0,QAOSDFN,QAMTODAY,"DIAG")=VAIP(9)
|
|
S ^UTILITY($J,"QAM FALL OUT",QAMD0,QAOSDFN,QAMTODAY,"AADM")=VAIP(13)
|
|
Q
|