QAMC2 ;HISC/DAD-CONDITION: SEX ;4/30/93 12:36
;;1.0;Clinical Monitoring System;;09/13/1993
EN1 ; *** CONDITION CODE
S GENDER=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:^("P1"),1:"")
Q:GENDER=""
S PATYPE=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:^("P2"),1:"1,2")
; All patients
I PATYPE["3" D G DONE
. F QAMDFN=0:0 S QAMDFN=$O(^DPT("ASX",GENDER,QAMDFN)) Q:QAMDFN'>0 D LP1
. 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 LP1
; 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 LP1
DONE ;
K GENDER,SEX,PATYPE,QAMWARD,QAMAEB
Q
LP1 S SEX=$P($G(^DPT(QAMDFN,0)),"^",2) Q:SEX'=GENDER
S ^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN)="",^(QAMDFN,QAMTODAY)=QAMDFN
Q
EN2 ; *** PARAMETER CODE
K DIR,DIRUT S DIR(0)="SOB^M:Male;F:Female;",DIR("A")="SEX",DIR("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:^("P1"),1:"") K:DIR("B")="" DIR("B")
S DIR("?",1)="CHOOSE FROM:",DIR("?",2)=" M Male",DIR("?",3)=" F Female",DIR("?")="Select one of the codes listed."
S QAMPARAM="P1" D EN3^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P1")=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
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HQAMC2 2007 printed Nov 22, 2024@16:52:16 Page 2
QAMC2 ;HISC/DAD-CONDITION: SEX ;4/30/93 12:36
+1 ;;1.0;Clinical Monitoring System;;09/13/1993
EN1 ; *** CONDITION CODE
+1 SET GENDER=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:^("P1"),1:"")
+2 if GENDER=""
QUIT
+3 SET PATYPE=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:^("P2"),1:"1,2")
+4 ; All patients
+5 IF PATYPE["3"
Begin DoDot:1
+6 FOR QAMDFN=0:0
SET QAMDFN=$ORDER(^DPT("ASX",GENDER,QAMDFN))
if QAMDFN'>0
QUIT
DO LP1
+7 QUIT
End DoDot:1
GOTO DONE
+8 ; Outpatients
+9 IF PATYPE["2"
FOR QAMAEB=0:0
SET QAMAEB=$ORDER(^DPT("AEB",QAMAEB))
if (QAMAEB'>0)!(QAMAEB>(QAMTODAY+.9999999))!(QAMAEB\1'?7N)
QUIT
FOR QAMDFN=0:0
SET QAMDFN=$ORDER(^DPT("AEB",QAMAEB,QAMDFN))
if QAMDFN'>0
QUIT
DO LP1
+10 ; Inpatients
+11 IF PATYPE["1"
SET QAMWARD=""
FOR
SET QAMWARD=$ORDER(^DPT("CN",QAMWARD))
if QAMWARD=""
QUIT
FOR QAMDFN=0:0
SET QAMDFN=$ORDER(^DPT("CN",QAMWARD,QAMDFN))
if QAMDFN'>0
QUIT
DO LP1
DONE ;
+1 KILL GENDER,SEX,PATYPE,QAMWARD,QAMAEB
+2 QUIT
LP1 SET SEX=$PIECE($GET(^DPT(QAMDFN,0)),"^",2)
if SEX'=GENDER
QUIT
+1 SET ^UTILITY($JOB,"QAM CONDITION",QAMD1,QAMDFN)=""
SET ^(QAMDFN,QAMTODAY)=QAMDFN
+2 QUIT
EN2 ; *** PARAMETER CODE
+1 KILL DIR,DIRUT
SET DIR(0)="SOB^M:Male;F:Female;"
SET DIR("A")="SEX"
SET DIR("B")=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:^("P1"),1:"")
if DIR("B")=""
KILL DIR("B")
+2 SET DIR("?",1)="CHOOSE FROM:"
SET DIR("?",2)=" M Male"
SET DIR("?",3)=" F Female"
SET DIR("?")="Select one of the codes listed."
+3 SET QAMPARAM="P1"
DO EN3^QAMUTL1
IF $DATA(DIRUT)
SET Y=-1
GOTO Y
+4 if Y]""
SET ^QA(743,QAMD0,"COND",QAMD1,"P1")=Y
22 KILL DIR
SET DIR(0)="LO^1:3^K:X[""."" X"
SET DIR("A")="PATIENT TYPE LIST"
SET DIR("B")=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:^("P2"),1:"1,2")
if DIR("B")=""
KILL DIR("B")
+1 SET DIR("?",1)="Choose from:"
SET DIR("?",2)=" 1 INPATIENTS"
SET DIR("?",3)=" 2 OUTPATIENTS"
SET DIR("?",4)=" 3 ALL PATIENTS"
SET DIR("?",5)="Choose any or all that you wish to monitor, e.g. 1,2 or 3, etc."
+2 SET DIR("?",6)="WARNING: NUMBER 3 WILL SELECT EVERY PATIENT IN DHCP !!"
+3 SET DIR("?")="Press RETURN for INPATIENTS and OUTPATIENTS."
+4 SET QAMPARAM="P2"
DO EN3^QAMUTL1
IF $DATA(DIRUT)
SET Y=-1
GOTO Y
+5 if Y]""
SET ^QA(743,QAMD0,"COND",QAMD1,"P2")=$SELECT($EXTRACT(Y,$LENGTH(Y))=",":$EXTRACT(Y,1,$LENGTH(Y)-1),1:Y)
EXIT KILL Y
+1 KILL QAMPARAM
Y QUIT