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

41 lines
2.8 KiB
Mathematica

QAMC12 ;HISC/GJC-CONDITION: PREVIOUS DISCHARGE FOR A MOVEMENT TYPE ;8/4/92 08:24
;;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 QAMMVT=$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 QAMDISH=0:0 S QAMDISH=$O(^UTILITY($J,"QAM TEMP",QAMDFN,QAMDISH)) Q:QAMDISH'>0 D STR2
K DIR,DIRUT,QAMDATE,QAMDFN,QAMDIS,QAMDISH,QAMGJC,QAMIEN,QAMMVT,QAMMVT1,QAMPARAM,QAMSTRT,X,X1,X2,Y
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 QAMIEN=$O(^DGPM("AMV3",QAMDISH,QAMDFN,0)) Q:QAMIEN'>0
I QAMMVT S QAMMVT1=+$S($D(^DGPM(QAMIEN,0))#2:$P(^(0),U,18),1:0) Q:$O(^QA(743.5,QAMMVT,"GRP","AB",QAMMVT1,0))'>0
S ^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN)="",^UTILITY($J,"QAM CONDITION",QAMD1,QAMDFN,$S(QAMDATE:QAMDISH,1:QAMTODAY))=^UTILITY($J,"QAM TEMP",QAMDFN,QAMDISH)
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(^QA(743.5,+Y,0),U,2)=405.2",DIC("A")="MOVEMENT TYPE 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 MAS movement types.",DIR("?")="Enter a GROUP name that contains MAS movement type."
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