QAMC11 ;HISC/GJC-CONDITION: PREVIOUS DISCHARGE FOR A TREATING SPECIALTY ;8/4/92 08:22
;;1.0;Clinical Monitoring System;;09/13/1993
EN1 ;*** CONDITION CODE
S QAMDIS=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:+^("P1"),1:0)
S QAMTSP=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:+^("P2"),1:0)
S QAMDATE=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P3"))#2:+^("P3"),1:0)
S X1=QAMTODAY,X2=-QAMDIS D C^%DTC S QAMSTRT=X,QAMSTRT=QAMSTRT-.0000001 K ^UTILITY($J,"QAM TEMP")
F QAMDISH=QAMSTRT:0 S QAMDISH=$O(^DGPM("AMV3",QAMDISH)) Q:(QAMDISH'>0)!(QAMDISH\1'?7N)!(QAMDISH>(QAMTODAY+.9999999)) F QAMDFN=0:0 S QAMDFN=$O(^DGPM("AMV3",QAMDISH,QAMDFN)) Q:QAMDFN'>0 D STR1
F QAMDFN=0:0 S QAMDFN=$O(^UTILITY($J,"QAM TEMP",QAMDFN)) Q:QAMDFN'>0 F QAMDC=0:0 S QAMDC=$O(^UTILITY($J,"QAM TEMP",QAMDFN,QAMDC)) Q:QAMDC'>0 D STR2
K DIR,DIRUT,QAMDATE,QAMDC,QAMDFN,QAMDIS,QAMDISH,QAMGJC,QAMIEN,QAMPARAM,QAMTSP,QAMTSP1,QAMSTRT,X,X1,X2,Y
K ^UTILITY($J,"QAM TEMP")
Q
STR1 ;
F QAMGJC=0:0 S QAMGJC=$O(^DGPM("AMV3",QAMDISH,QAMDFN,QAMGJC)) Q:QAMGJC'>0 D
. Q:$O(^DGPM("APTT1",QAMDFN,QAMDISH))'>0
. K ^UTILITY($J,"QAM TEMP",QAMDFN)
. S ^UTILITY($J,"QAM TEMP",QAMDFN,QAMDISH)=QAMGJC
. Q
Q
STR2 ;
S QAMDC(1)=QAMDC
S QAMDC=+$O(^DGPM("ATID6",QAMDFN,9999999.9999999-QAMDC))
S QAMIEN=+$O(^DGPM("ATID6",QAMDFN,QAMDC,0)) Q:QAMIEN'>0
I QAMTSP S QAMTSP1=+$S($D(^DGPM(QAMIEN,0))#2:$P(^(0),U,9),1:0) Q:$O(^QA(743.5,QAMTSP,"GRP","AB",QAMTSP1,0))'>0
S ^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN)="",^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN,$S(QAMDATE:QAMDC(1),1:QAMTODAY))=^UTILITY($J,"QAM TEMP",QAMDFN,QAMDC(1))
Q
EN2 ;*** LOOK BACK DATE
K DIR,DIRUT S DIR(0)="NO^1:365:0",DIR("A")="LOOK BACK DAYS",DIR("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:^("P1"),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="P1" D EN3^QAMUTL1 S:$D(DIRUT) Y=-1 Q:Y<0
S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P1")=+Y
PRT2 K DIC,DIR,DIRUT S DIC="^QA(743.5,",DIC(0)="EMNQZ",DIC("S")="I $P(^(0),U,2)=45.7",DIC("A")="TREATING SPECIALTY GROUP: ",DIC("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:$P(^("P2"),U,2),1:"") K:DIC("B")="" DIC("B")
S DIR("?",1)="Press 'RETURN' for ALL treating specialties.",DIR("?")="Enter a GROUP name that contains a MAS treating specialty."
S QAMPARAM="P2" D EN2^QAMUTL1 S:$D(DIRUT) Y=-1 Q:Y<0
S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P2")=+Y_"^"_Y(0,0)
PRT3 K DIR,DIRUT S DIR("A")="ENTER THE TYPE OF DATE",DIR(0)="SOB^0:AUTO ENROLL DATE;1:DISCHARGE DATE",DIR("?",1)="0 AUTO ENROLL DATE",DIR("?",2)=" 1 DISCHARGE DATE"
S DIR("?",3)="Enter the date you wish to be",DIR("?",4)="associated with this condition.",DIR("?")="Enter a 'RETURN' for the AUTO ENROLL DATE."
S DIR("B")=$S($D(^QA(743,QAMD0,"COND",QAMD1,"P3"))#2:$P(^("P3"),U,2),1:"") K:DIR("B")="" DIR("B")
S QAMPARAM="P3" D EN3^QAMUTL1 S:$D(DIRUT) Y=-1 Q:Y<0
S:Y]"" ^QA(743,QAMD0,"COND",QAMD1,"P3")=+Y_"^"_Y(0)
EXIT K Y
K QAMPARAM
Y Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HQAMC11 3032 printed Nov 22, 2024@16:52:07 Page 2
QAMC11 ;HISC/GJC-CONDITION: PREVIOUS DISCHARGE FOR A TREATING SPECIALTY ;8/4/92 08:22
+1 ;;1.0;Clinical Monitoring System;;09/13/1993
EN1 ;*** CONDITION CODE
+1 SET QAMDIS=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P1"))#2:+^("P1"),1:0)
+2 SET QAMTSP=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:+^("P2"),1:0)
+3 SET QAMDATE=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P3"))#2:+^("P3"),1:0)
+4 SET X1=QAMTODAY
SET X2=-QAMDIS
DO C^%DTC
SET QAMSTRT=X
SET QAMSTRT=QAMSTRT-.0000001
KILL ^UTILITY($JOB,"QAM TEMP")
+5 FOR QAMDISH=QAMSTRT:0
SET QAMDISH=$ORDER(^DGPM("AMV3",QAMDISH))
if (QAMDISH'>0)!(QAMDISH\1'?7N)!(QAMDISH>(QAMTODAY+.9999999))
QUIT
FOR QAMDFN=0:0
SET QAMDFN=$ORDER(^DGPM("AMV3",QAMDISH,QAMDFN))
if QAMDFN'>0
QUIT
DO STR1
+6 FOR QAMDFN=0:0
SET QAMDFN=$ORDER(^UTILITY($JOB,"QAM TEMP",QAMDFN))
if QAMDFN'>0
QUIT
FOR QAMDC=0:0
SET QAMDC=$ORDER(^UTILITY($JOB,"QAM TEMP",QAMDFN,QAMDC))
if QAMDC'>0
QUIT
DO STR2
+7 KILL DIR,DIRUT,QAMDATE,QAMDC,QAMDFN,QAMDIS,QAMDISH,QAMGJC,QAMIEN,QAMPARAM,QAMTSP,QAMTSP1,QAMSTRT,X,X1,X2,Y
+8 KILL ^UTILITY($JOB,"QAM TEMP")
+9 QUIT
STR1 ;
+1 FOR QAMGJC=0:0
SET QAMGJC=$ORDER(^DGPM("AMV3",QAMDISH,QAMDFN,QAMGJC))
if QAMGJC'>0
QUIT
Begin DoDot:1
+2 if $ORDER(^DGPM("APTT1",QAMDFN,QAMDISH))'>0
QUIT
+3 KILL ^UTILITY($JOB,"QAM TEMP",QAMDFN)
+4 SET ^UTILITY($JOB,"QAM TEMP",QAMDFN,QAMDISH)=QAMGJC
+5 QUIT
End DoDot:1
+6 QUIT
STR2 ;
+1 SET QAMDC(1)=QAMDC
+2 SET QAMDC=+$ORDER(^DGPM("ATID6",QAMDFN,9999999.9999999-QAMDC))
+3 SET QAMIEN=+$ORDER(^DGPM("ATID6",QAMDFN,QAMDC,0))
if QAMIEN'>0
QUIT
+4 IF QAMTSP
SET QAMTSP1=+$SELECT($DATA(^DGPM(QAMIEN,0))#2:$PIECE(^(0),U,9),1:0)
if $ORDER(^QA(743.5,QAMTSP,"GRP","AB",QAMTSP1,0))'>0
QUIT
+5 SET ^UTILITY($JOB,"QAM CONDITION",QAMD1,QAMDFN)=""
SET ^UTILITY($JOB,"QAM CONDITION",QAMD1,QAMDFN,$SELECT(QAMDATE:QAMDC(1),1:QAMTODAY))=^UTILITY($JOB,"QAM TEMP",QAMDFN,QAMDC(1))
+6 QUIT
EN2 ;*** LOOK BACK DATE
+1 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,"P1"))#2:^("P1"),1:"")
if DIR("B")=""
KILL DIR("B")
+2 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."
+3 SET QAMPARAM="P1"
DO EN3^QAMUTL1
if $DATA(DIRUT)
SET Y=-1
if Y<0
QUIT
+4 if Y]""
SET ^QA(743,QAMD0,"COND",QAMD1,"P1")=+Y
PRT2 KILL DIC,DIR,DIRUT
SET DIC="^QA(743.5,"
SET DIC(0)="EMNQZ"
SET DIC("S")="I $P(^(0),U,2)=45.7"
SET DIC("A")="TREATING SPECIALTY GROUP: "
SET DIC("B")=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P2"))#2:$PIECE(^("P2"),U,2),1:"")
if DIC("B")=""
KILL DIC("B")
+1 SET DIR("?",1)="Press 'RETURN' for ALL treating specialties."
SET DIR("?")="Enter a GROUP name that contains a MAS treating specialty."
+2 SET QAMPARAM="P2"
DO EN2^QAMUTL1
if $DATA(DIRUT)
SET Y=-1
if Y<0
QUIT
+3 if Y]""
SET ^QA(743,QAMD0,"COND",QAMD1,"P2")=+Y_"^"_Y(0,0)
PRT3 KILL DIR,DIRUT
SET DIR("A")="ENTER THE TYPE OF DATE"
SET DIR(0)="SOB^0:AUTO ENROLL DATE;1:DISCHARGE DATE"
SET DIR("?",1)="0 AUTO ENROLL DATE"
SET DIR("?",2)=" 1 DISCHARGE DATE"
+1 SET DIR("?",3)="Enter the date you wish to be"
SET DIR("?",4)="associated with this condition."
SET DIR("?")="Enter a 'RETURN' for the AUTO ENROLL DATE."
+2 SET DIR("B")=$SELECT($DATA(^QA(743,QAMD0,"COND",QAMD1,"P3"))#2:$PIECE(^("P3"),U,2),1:"")
if DIR("B")=""
KILL DIR("B")
+3 SET QAMPARAM="P3"
DO EN3^QAMUTL1
if $DATA(DIRUT)
SET Y=-1
if Y<0
QUIT
+4 if Y]""
SET ^QA(743,QAMD0,"COND",QAMD1,"P3")=+Y_"^"_Y(0)
EXIT KILL Y
+1 KILL QAMPARAM
Y QUIT