QAMC17 ;HISC/DAD-CONDITION: APPOINTMENT ;9/3/93 13:23
;;1.0;Clinical Monitoring System;;09/13/1993
EN1 ; *** CONDITION CODE
S CLINIC(0)=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:+^("P1"),1:0)
S STATUS(0)=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:^("P2"),1:"")
S PURPOSE(0)=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P3"))#2:^("P3"),1:"")
S TYPE(0)=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P4"))#2:+^("P4"),1:0)
S LOOKBACK=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P5"))#2:+^("P5"),1:0)
S X1=QAMTODAY,X2=-LOOKBACK D C^%DTC S QAMSTDT=X
F QAM44D0=0:0 S QAM44D0=$O(^SC(QAM44D0)) Q:QAM44D0'>0 D LOOP1
K QAM44D0,QAM44D1,QAM44D2,CLINIC,STATUS,PURPOSE,TYPE,QAMAPTDT,QAMSTDT
Q
LOOP1 I CLINIC(0) Q:$O(^QA(743.5,CLINIC(0),"GRP","AB",QAM44D0,0))'>0
F QAM44D1=(QAMSTDT-.0000001):0 S QAM44D1=$O(^SC(QAM44D0,"S",QAM44D1)) Q:(QAM44D1'>0)!(QAM44D1\1'?7N)!(QAM44D1>(QAMTODAY+.9999999)) F QAM44D2=0:0 S QAM44D2=$O(^SC(QAM44D0,"S",QAM44D1,1,QAM44D2)) Q:QAM44D2'>0 D LOOP2
Q
LOOP2 S QAMDFN=+^SC(QAM44D0,"S",QAM44D1,1,QAM44D2,0),QAM=$S($D(^DPT(QAMDFN,"S",QAM44D1,0))#2:^(0),1:"") Q:QAM44D0'=+QAM S STATUS=$P(QAM,"^",2),PURPOSE=$P(QAM,"^",7),TYPE=+$P(QAM,"^",16)
I STATUS(0)]"" Q:(STATUS="")!(STATUS(0)'[$L($P("N^C^NA^CA^I^PC^PCA",STATUS),"^"))
I PURPOSE(0)]"" Q:(PURPOSE="")!(PURPOSE(0)'[PURPOSE)
I TYPE(0) Q:$O(^QA(743.5,TYPE(0),"GRP","AB",TYPE,0))'>0
S ^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN)="",^(QAMDFN,QAM44D1)=QAMDFN_"^"_QAM44D1
Q
EN2 ; *** PARAMETER CODE
K DIC,DIR,DIRUT S DIC=743.5,DIC(0)="EMNQZ",DIC("S")="I $P(^(0),""^"",2)=44",DIC("A")="CLINIC GROUP: ",DIC("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:$P(^("P1"),"^",2),1:"") K:DIC("B")="" DIC("B")
S DIR("?",1)="Enter a GROUP name that contains MAS clinics.",DIR("?")="Press 'RETURN' for all clinics."
S QAMPARAM="P1" D EN2^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P1")=+Y_"^"_Y(0,0)
21 K DIR S DIR(0)="LO^1:7^K:X[""."" X",DIR("A")="STATUS",DIR("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:^("P2"),1:"") K:DIR("B")="" DIR("B")
S DIR("?",1)=" 1 N NO-SHOW",DIR("?",2)=" 2 C CANCELLED BY CLINIC",DIR("?",3)=" 3 NA NO-SHOW & AUTO RE-BOOK",DIR("?",4)=" 4 CA CANCELLED BY CLINIC & AUTO RE-BOOK",DIR("?",5)=" 5 I INPATIENT APPOINTMENT"
S DIR("?",6)=" 6 PC CANCELLED BY PATIENT",DIR("?",7)=" 7 PCA CANCELLED BY PATIENT & AUTO RE-BOOK",DIR("?",8)="Choose any or all that you wish to monitor, e.g. 1,3,5 or 2-5,7, etc.",DIR("?")="Press RETURN for all status types."
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)
22 K DIR S DIR(0)="LO^1:4^K:X[""."" X",DIR("A")="PURPOSE OF VISIT",DIR("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P3"))#2:^("P3"),1:"") K:DIR("B")="" DIR("B")
S DIR("?",1)=" 1 C&P",DIR("?",2)=" 2 10-10",DIR("?",3)=" 3 SCHEDULED VISIT",DIR("?",4)=" 4 UNSCHEDULED VISIT"
S DIR("?",5)="Choose any or all that you wish to monitor, e.g. 2,4 or 1-3, etc.",DIR("?")="Press RETURN for all purpose of visit types."
S QAMPARAM="P3" D EN3^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P3")=$S($E(Y,$L(Y))=",":$E(Y,1,$L(Y)-1),1:Y)
23 K DIC,DIR,DIRUT S DIC=743.5,DIC(0)="EMNQZ",DIC("S")="I $P(^(0),""^"",2)=409.1",DIC("A")="APPOINTMENT TYPE GROUP: ",DIC("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P4"))#2:$P(^("P4"),"^",2),1:"") K:DIC("B")="" DIC("B")
S DIR("?",1)="Enter a GROUP name that contains MAS appointment types.",DIR("?")="Press 'RETURN' for all appointment types."
S QAMPARAM="P4" D EN2^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P4")=+Y_"^"_Y(0,0)
24 K DIR,DIRUT S DIR(0)="NO^1:365:0",DIR("A")="LOOK BACK DAYS",DIR("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P5"))#2:^("P5"),1:"") K:DIR("B")="" DIR("B")
S DIR("?",1)="Enter the number of days the condition should 'look back'",DIR("?")="while trying to find a fall out for this monitor."
S QAMPARAM="P5" D EN3^QAMUTL1 I $D(DIRUT) S Y=-1 G Y
S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P5")=+Y
EXIT K Y
K QAMPARAM
Y Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HQAMC17 4049 printed Nov 22, 2024@16:52:13 Page 2
QAMC17 ;HISC/DAD-CONDITION: APPOINTMENT ;9/3/93 13:23
+1 ;;1.0;Clinical Monitoring System;;09/13/1993
EN1 ; *** CONDITION CODE
+1 SET CLINIC(0)=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:+^("P1"),1:0)
+2 SET STATUS(0)=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:^("P2"),1:"")
+3 SET PURPOSE(0)=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P3"))#2:^("P3"),1:"")
+4 SET TYPE(0)=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P4"))#2:+^("P4"),1:0)
+5 SET LOOKBACK=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P5"))#2:+^("P5"),1:0)
+6 SET X1=QAMTODAY
SET X2=-LOOKBACK
DO C^%DTC
SET QAMSTDT=X
+7 FOR QAM44D0=0:0
SET QAM44D0=$ORDER(^SC(QAM44D0))
if QAM44D0'>0
QUIT
DO LOOP1
+8 KILL QAM44D0,QAM44D1,QAM44D2,CLINIC,STATUS,PURPOSE,TYPE,QAMAPTDT,QAMSTDT
+9 QUIT
LOOP1 IF CLINIC(0)
if $ORDER(^QA(743.5,CLINIC(0),"GRP","AB",QAM44D0,0))'>0
QUIT
+1 FOR QAM44D1=(QAMSTDT-.0000001):0
SET QAM44D1=$ORDER(^SC(QAM44D0,"S",QAM44D1))
if (QAM44D1'>0)!(QAM44D1\1'?7N)!(QAM44D1>(QAMTODAY+.9999999))
QUIT
FOR QAM44D2=0:0
SET QAM44D2=$ORDER(^SC(QAM44D0,"S",QAM44D1,1,QAM44D2))
if QAM44D2'>0
QUIT
DO LOOP2
+2 QUIT
LOOP2 SET QAMDFN=+^SC(QAM44D0,"S",QAM44D1,1,QAM44D2,0)
SET QAM=$SELECT($DATA(^DPT(QAMDFN,"S",QAM44D1,0))#2:^(0),1:"")
if QAM44D0'=+QAM
QUIT
SET STATUS=$PIECE(QAM,"^",2)
SET PURPOSE=$PIECE(QAM,"^",7)
SET TYPE=+$PIECE(QAM,"^",16)
+1 IF STATUS(0)]""
if (STATUS="")!(STATUS(0)'[$LENGTH($PIECE("N^C^NA^CA^I^PC^PCA",STATUS),"^"))
QUIT
+2 IF PURPOSE(0)]""
if (PURPOSE="")!(PURPOSE(0)'[PURPOSE)
QUIT
+3 IF TYPE(0)
if $ORDER(^QA(743.5,TYPE(0),"GRP","AB",TYPE,0))'>0
QUIT
+4 SET ^UTILITY($JOB,"QAM CONDITION",QAMD1,QAMDFN)=""
SET ^(QAMDFN,QAM44D1)=QAMDFN_"^"_QAM44D1
+5 QUIT
EN2 ; *** PARAMETER CODE
+1 KILL DIC,DIR,DIRUT
SET DIC=743.5
SET DIC(0)="EMNQZ"
SET DIC("S")="I $P(^(0),""^"",2)=44"
SET DIC("A")="CLINIC GROUP: "
SET DIC("B")=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:$PIECE(^("P1"),"^",2),1:"")
if DIC("B")=""
KILL DIC("B")
+2 SET DIR("?",1)="Enter a GROUP name that contains MAS clinics."
SET DIR("?")="Press 'RETURN' for all clinics."
+3 SET QAMPARAM="P1"
DO EN2^QAMUTL1
IF $DATA(DIRUT)
SET Y=-1
GOTO Y
+4 if Y]""
SET ^QA(743,QAMD0,"COND",QAMD1,"P1")=+Y_"^"_Y(0,0)
21 KILL DIR
SET DIR(0)="LO^1:7^K:X[""."" X"
SET DIR("A")="STATUS"
SET DIR("B")=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:^("P2"),1:"")
if DIR("B")=""
KILL DIR("B")
+1 SET DIR("?",1)=" 1 N NO-SHOW"
SET DIR("?",2)=" 2 C CANCELLED BY CLINIC"
SET DIR("?",3)=" 3 NA NO-SHOW & AUTO RE-BOOK"
SET DIR("?",4)=" 4 CA CANCELLED BY CLINIC & AUTO RE-BOOK"
SET DIR("?",5)=" 5 I INPATIENT APPOINTMENT"
+2 SET DIR("?",6)=" 6 PC CANCELLED BY PATIENT"
SET DIR("?",7)=" 7 PCA CANCELLED BY PATIENT & AUTO RE-BOOK"
SET DIR("?",8)="Choose any or all that you wish to monitor, e.g. 1,3,5 or 2-5,7, etc."
SET DIR("?")="Press RETURN for all status types."
+3 SET QAMPARAM="P2"
DO EN3^QAMUTL1
IF $DATA(DIRUT)
SET Y=-1
GOTO Y
+4 if Y]""
SET ^QA(743,QAMD0,"COND",QAMD1,"P2")=$SELECT($EXTRACT(Y,$LENGTH(Y))=",":$EXTRACT(Y,1,$LENGTH(Y)-1),1:Y)
22 KILL DIR
SET DIR(0)="LO^1:4^K:X[""."" X"
SET DIR("A")="PURPOSE OF VISIT"
SET DIR("B")=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P3"))#2:^("P3"),1:"")
if DIR("B")=""
KILL DIR("B")
+1 SET DIR("?",1)=" 1 C&P"
SET DIR("?",2)=" 2 10-10"
SET DIR("?",3)=" 3 SCHEDULED VISIT"
SET DIR("?",4)=" 4 UNSCHEDULED VISIT"
+2 SET DIR("?",5)="Choose any or all that you wish to monitor, e.g. 2,4 or 1-3, etc."
SET DIR("?")="Press RETURN for all purpose of visit types."
+3 SET QAMPARAM="P3"
DO EN3^QAMUTL1
IF $DATA(DIRUT)
SET Y=-1
GOTO Y
+4 if Y]""
SET ^QA(743,QAMD0,"COND",QAMD1,"P3")=$SELECT($EXTRACT(Y,$LENGTH(Y))=",":$EXTRACT(Y,1,$LENGTH(Y)-1),1:Y)
23 KILL DIC,DIR,DIRUT
SET DIC=743.5
SET DIC(0)="EMNQZ"
SET DIC("S")="I $P(^(0),""^"",2)=409.1"
SET DIC("A")="APPOINTMENT TYPE GROUP: "
SET DIC("B")=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P4"))#2:$PIECE(^("P4"),"^",2),1:"")
if DIC("B")=""
KILL DIC("B")
+1 SET DIR("?",1)="Enter a GROUP name that contains MAS appointment types."
SET DIR("?")="Press 'RETURN' for all appointment types."
+2 SET QAMPARAM="P4"
DO EN2^QAMUTL1
IF $DATA(DIRUT)
SET Y=-1
GOTO Y
+3 if Y]""
SET ^QA(743,QAMD0,"COND",QAMD1,"P4")=+Y_"^"_Y(0,0)
24 KILL DIR,DIRUT
SET DIR(0)="NO^1:365:0"
SET DIR("A")="LOOK BACK DAYS"
SET DIR("B")=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P5"))#2:^("P5"),1:"")
if DIR("B")=""
KILL DIR("B")
+1 SET DIR("?",1)="Enter the number of days the condition should 'look back'"
SET DIR("?")="while trying to find a fall out for this monitor."
+2 SET QAMPARAM="P5"
DO EN3^QAMUTL1
IF $DATA(DIRUT)
SET Y=-1
GOTO Y
+3 if Y]""
SET ^QA(743,QAMD0,"COND",QAMD1,"P5")=+Y
EXIT KILL Y
+1 KILL QAMPARAM
Y QUIT