VistA-FOIAVistA/r/CLINICAL_MONITORING_SYSTEM-QAM/QAMC3.m

38 lines
2.1 KiB
Mathematica

QAMC3 ;HISC/DAD-CONDITION: SSN SAMPLE ;7/12/93 14:31
;;1.0;Clinical Monitoring System;;09/13/1993
EN1 ; *** CONDITION CODE
S QAMDIGIT=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:^("P1"),1:"")
S PATYPE=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:^("P2"),1:"1,2")
I QAMDIGIT]"" S:$E(QAMDIGIT)'="," QAMDIGIT=","_QAMDIGIT S:$E(QAMDIGIT,$L(QAMDIGIT))'="," QAMDIGIT=QAMDIGIT_","
; All Patients
I PATYPE["3" D G DONE
. F QAMDFN=0:0 S QAMDFN=$O(^DPT(QAMDFN)) Q:QAMDFN'>0 D LOOP1
. Q
; Outpatients
I PATYPE["2" F QAMAEB=0:0 S QAMAEB=$O(^DPT("AEB",QAMAEB)) Q:(QAMAEB'>0)!(QAMAEB>(QAMTODAY+.9999999))!(QAMAEB\1'?7N) F QAMDFN=0:0 S QAMDFN=$O(^DPT("AEB",QAMAEB,QAMDFN)) Q:QAMDFN'>0 D LOOP1
Q
; Inpatients
I PATYPE["1" S QAMWARD="" F S QAMWARD=$O(^DPT("CN",QAMWARD)) Q:QAMWARD="" F QAMDFN=0:0 S QAMDFN=$O(^DPT("CN",QAMWARD,QAMDFN)) Q:QAMDFN'>0 D LOOP1
Q
DONE ;
K QAMDIGIT,QAMSSN,PATYPE,QAMWARD,QAMAEB
Q
LOOP1 K VADM S DFN=QAMDFN D DEM^VADPT
S QAMSSN=$P(VADM(2),"^") K DFN,VADM,VAERR Q:QAMSSN=""
S QAMSSN=","_$E(QAMSSN,$L(QAMSSN))_"," Q:QAMDIGIT'[QAMSSN
S ^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN)="",^(QAMDFN,QAMTODAY)=QAMDFN
Q
EN2 ; *** PARAMETER CODE
K DIR S DIR(0)="LO^0:9^K:X[""."" X",DIR("A")="LAST DIGIT(S) OF SSN",DIR("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:^("P1"),1:"") K:DIR("B")="" DIR("B")
S QAMPARAM="P1" D EN3^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P1")=$S($E(Y,$L(Y))=",":$E(Y,1,$L(Y)-1),1:Y)
22 K DIR S DIR(0)="LO^1:3^K:X[""."" X",DIR("A")="PATIENT TYPE LIST",DIR("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:^("P2"),1:"1,2") K:DIR("B")="" DIR("B")
S DIR("?",1)="Choose from:",DIR("?",2)=" 1 INPATIENTS",DIR("?",3)=" 2 OUTPATIENTS",DIR("?",4)=" 3 ALL PATIENTS",DIR("?",5)="Choose any or all that you wish to monitor, e.g. 1,2 or 3, etc."
S DIR("?",6)="WARNING: NUMBER 3 WILL SELECT EVERY PATIENT IN DHCP !!"
S DIR("?")="Press RETURN for INPATIENTS and OUTPATIENTS."
S QAMPARAM="P2" D EN3^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P2")=$S($E(Y,$L(Y))=",":$E(Y,1,$L(Y)-1),1:Y)
EXIT K Y
K QAMPARAM
Y Q