62 lines
3.5 KiB
Mathematica
62 lines
3.5 KiB
Mathematica
|
QAMUTL0 ;HISC/DAD-MONITORING TOOL UTILITIES ;10/22/93 08:34
|
||
|
;;1.0;Clinical Monitoring System;**1**;09/13/1993
|
||
|
EN1 ; *** CHECKS FOR A VALID RELATIONSHIP AMONG THE CONDITIONS
|
||
|
; *** USED BY FIELD: 743,25
|
||
|
N C S QAM("X")=X G:$TR(X,"(C!'&0123456789)")]"" XBAD1 G:X?1.N XBAD1
|
||
|
S X="I "_QAM("X") D ^DIM G:'$D(X) XBAD1 S QAM("C")=""
|
||
|
F QAM=0:0 S QAM=$O(^QA(743,D0,"COND",QAM)) Q:QAM'>0 S @("C"_QAM_"=1") S QAM("C")=QAM("C")_"C"_QAM_"^"
|
||
|
S X="XBAD1^QAMUTL0",@^%ZOSF("TRAP") S X="I "_QAM("X") X X
|
||
|
;F QAM=1:1 Q:$P(QAM("C"),"^",QAM)="" G:X'[$P(QAM("C"),"^",QAM) XBAD1
|
||
|
XOK1 S X="",@^%ZOSF("TRAP"),X=QAM("X") K QAM G 1
|
||
|
XBAD1 S X="",@^%ZOSF("TRAP") K QAM,X
|
||
|
1 F QAM=0:0 S QAM=$O(^QA(743,D0,"COND",QAM)) Q:QAM'>0 K @("C"_QAM)
|
||
|
Q
|
||
|
EN2 ; *** DISPLAY HELP SCREEN OF CONDITIONS
|
||
|
; *** USED BEFORE EDIT OF FALL OUT RELATIONSHIP FIELD (743,25)
|
||
|
Q:$D(^QA(743,DA,"COND",0))[0 Q:$P(^(0),"^",4)'>0
|
||
|
W !!?3,"CODE",?15,"CONDITION",!?2,"------",?14,"-----------"
|
||
|
F QAMD1=0:0 S QAMD1=$O(^QA(743,DA,"COND",QAMD1)) Q:QAMD1'>0 S QAM=$S($D(^QA(743,DA,"COND",QAMD1,0))#2:+^(0),1:0),QAM=$S($D(^QA(743.3,QAM,0))#2:$P(^(0),"^"),1:"") W !?3,$J("C"_QAMD1,3),?15,QAM
|
||
|
W !
|
||
|
Q
|
||
|
EN3 ; *** ASK PARAMETERS ON CONDITIONS
|
||
|
; *** USED BY ALL EDITS ON THE CONDITION MULTIPLE
|
||
|
K Y
|
||
|
S QAM=+$S($D(^QA(743,QAMD0,"COND",QAMD1,0))#2:^(0),1:0) Q:QAM'>0
|
||
|
Q:$P($G(^QA(743.3,QAM,0)),"^",2)'>0
|
||
|
S QAMPCODE=$S($D(^QA(743.3,QAM,"PARM"))#2:^("PARM"),1:"") Q:QAMPCODE=""
|
||
|
S X=$P(QAMPCODE,"^",$L(QAMPCODE,"^")) X ^%ZOSF("TEST") I X QAMPCODE
|
||
|
Q
|
||
|
EN4 ; *** CHECKS FOR A VALID RELATIONSHIP AMONG THE CONDITIONS
|
||
|
; *** USED BY FIELD: 743,26
|
||
|
Q:'$D(^QA(743,D0,"COND","AS",1))
|
||
|
N C S QAM("X")=X G:$TR(X,"(C!'&0123456789)")]"" XBAD4 G:X?1.N XBAD4
|
||
|
S X="I "_QAM("X") D ^DIM G:'$D(X) XBAD4 S QAM("C")=""
|
||
|
F QAM=0:0 S QAM=$O(^QA(743,D0,"COND",QAM)) Q:QAM'>0 I $P(^QA(743,D0,"COND",QAM,0),"^",2) S @("C"_QAM_"=1") S QAM("C")=QAM("C")_"C"_QAM_"^"
|
||
|
S X="XBAD4^QAMUTL0",@^%ZOSF("TRAP") S X="I "_QAM("X") X X
|
||
|
;F QAM=1:1 Q:$P(QAM("C"),"^",QAM)="" G:X'[$P(QAM("C"),"^",QAM) XBAD4
|
||
|
XOK4 S X="",@^%ZOSF("TRAP"),X=QAM("X") K QAM G 4
|
||
|
XBAD4 S X="",@^%ZOSF("TRAP") K QAM,X
|
||
|
4 F QAM=0:0 S QAM=$O(^QA(743,D0,"COND",QAM)) Q:QAM'>0 K @("C"_QAM)
|
||
|
Q
|
||
|
EN5 ; *** DISPLAY HELP SCREEN OF CONDITIONS
|
||
|
; *** USED BEFORE EDIT OF SAMPLE RELATIONSHIP FIELD (743,26)
|
||
|
Q:$D(^QA(743,DA,"COND",0))[0 Q:$P(^(0),"^",4)'>0 Q:'$D(^QA(743,DA,"COND","AS",1))
|
||
|
W !!?3,"CODE",?15,"CONDITION",!?2,"------",?14,"-----------"
|
||
|
F QAMD1=0:0 S QAMD1=$O(^QA(743,DA,"COND",QAMD1)) Q:QAMD1'>0 S QAM=$S($D(^QA(743,DA,"COND",QAMD1,0))#2:^(0),1:0) I $P(QAM,"^",2) S QAM=$S($D(^QA(743.3,+QAM,0))#2:$P(^(0),"^"),1:"") W !?3,$J("C"_QAMD1,3),?15,QAM
|
||
|
W !
|
||
|
Q
|
||
|
EN6 ; *** MOST RECENT PATIENT MOVEMENT (FILE #405)
|
||
|
; *** USED AS DATA BY FIELD 743.4,40
|
||
|
; PUT MOST DESIRED TRANSACTION TYPES AT THE BEGINNING OF QAMXREF E.G.
|
||
|
; QAMXREF="6^2^1^3" SCAN: SPECIALTY XFR, WARD XFR, ADMISSION, DISCHARGE
|
||
|
S QAMDTPT(1)=0 Q:$D(QAMXREF)[0
|
||
|
F QA=1:1:$L(QAMXREF,"^") S QA(0)=$P(QAMXREF,"^",QA),QAM=+$O(^DGPM("ATID"_QA(0),QAMDFN,9999999.9999998-QAMEVENT)),QAMDTPT(1)=+$O(^DGPM("ATID"_QA(0),QAMDFN,QAM,0)) Q:QAMDTPT(1)
|
||
|
K QAMXREF Q
|
||
|
EN7 ; *** SCREEN FOR OTHER DATA TO CAPTURE, USED BY FIELD 743,30
|
||
|
I 0
|
||
|
F QA=0:0 S QA=$O(^QA(743.3,"AELEM",+Y,QA)) Q:QA'>0 I $O(^QA(743,D0,"COND","B",QA,0))>0 Q
|
||
|
K QA Q
|
||
|
EN8 ; *** INPUT TRANSFORM FOR GROUP MEMBER SUB-FIELD 743.51,.01
|
||
|
N D,DIC,DICR,DIX,DO,Y S X=$S(X[";":$P(X,";"),1:X),Y=-1,DIC(0)="EMQZ",DIC=$S($D(^QA(743.5,DA(1),0))#2:+$P(^(0),"^",2),1:0),DIC=$S($D(^DIC(DIC,0,"GL"))#2:^("GL"),1:"") G:DIC="" 8 D DO^DIC1,^DIC S X=$S($D(Y(0,0))#2:Y(0,0)_";"_+Y,1:"")
|
||
|
8 K:Y'>0 X Q
|