source: WorldVistAEHR/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCGUIC.m@ 1593

Last change on this file since 1593 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 7.9 KB
Line 
1GMRCGUIC ;SLC/DCM,JFR - GUI actions for editing consults; 3/13/03 12:21
2 ;;3.0;CONSULT/REQUEST TRACKING;**4,12,20,15,22,33**;DEC 27, 1997
3 ;
4 ; This routine invokes IA #2398,#2698,#2713,#2960,#3991
5 ;
6RFQ(GMRCO,MSG,ND,NOW) ;File Reason For Request field 20
7 N GMRCND,GMRCNT
8 S GMRCND=$O(^GMR(123,GMRCO,20,0)) I GMRCND="" S GMRCFLD(20)="Reason For Request: No Previous Value^20" Q
9 M ^TMP("GMRCFLD20",$J,20)=^GMR(123,GMRCO,20)
10 S GMRCFLD(20)=$NAME(^TMP("GMRCFLD20",$J,20))
11 K ^GMR(123,GMRCO,20)
12 S ^GMR(123,GMRCO,20,0)="^^^^"_DT_"^"
13 S GMRCND="",GMRCNT=1 F S GMRCND=$O(@MSG@(ND,GMRCND)) Q:GMRCND="" S ^GMR(123,GMRCO,20,GMRCNT,0)=@MSG@(ND,GMRCND),GMRCNT=GMRCNT+1
14 S $P(^GMR(123,GMRCO,20,0),"^",3)=GMRCNT-1,$P(^(0),"^",4)=GMRCNT-1
15 Q
16FILE(GMRCO,MSG,GMRCLM) ;File Edit changes
17 ;GMRCO=Record IEN, GMRCCOM=Comment Array
18 ;MSG=^TMP global where the data resides, i.e., MSG="^TMP(""GMRCR"",$J)"
19 ; Data is stored in subscripted nodes: ^TMP("GMRCR",$J,1)="GMRCSS^2"
20 ; Word processing data is stored in second subscripted node:
21 ; ^TMP("GMRCR",$J,9,1)="This is word processing data."
22 ;GMRCSS=To Service GMRCPROC=procedure/Request Type
23 ;GMRCURG=Urgency GMRCPL=Place Of Consultation
24 ;GMRCATN=Attention To GMRCINO=Service is In/Out Patient
25 ;GMRCDIAG=Provisional Diagnosis .GMRCRFQ=Reason For Request array
26 ;GMRCREQ=Procedure or Request; i.e., GMRCRQT=1727=^ORD(101,1727,0)='Procedure';GMRCRQT=1296=^ORD(101,1296,0)='Consult'
27 ;GMRCITM=Item ordered for field .1 (stored in ^GMR(123,GMRCO,1.11,
28 ;GMRCLM=coming from List Manager instead of the GUI
29 ;
30 I '$D(GMRCO)!('+GMRCO) Q
31 N GMRCSS,GMRCPROC,GMRCURG,GMRCPL,GMRCATN,GMRCRQT
32 N GMRCION,GMRCDIAG,GMRCDXCD,GMRCACTN
33 S GMRCDT=$$NOW^XLFDT
34 S GMRCMSG="",GMRCNOD=0
35 F S GMRCNOD=$O(@MSG@(GMRCNOD)) Q:GMRCNOD="" S GMRCMSG=@MSG@(GMRCNOD) D
36 .I $P(GMRCMSG,"^",1)="COMMENT" D COMMENT^GMRCGUIU(GMRCO,MSG,GMRCNOD,$P(GMRCMSG,"^",2)) Q
37 .I $P(GMRCMSG,"^",1)="GMRCRFQ" D RFQ(GMRCO,MSG,GMRCNOD,GMRCDT) Q
38 .I $P(GMRCMSG,"^",1)="GMRCSS" S GMRCSS=$P(GMRCMSG,"^",2),GMRCFLD(1)=$P(^GMR(123.5,$P(^GMR(123,GMRCO,0),"^",5),0),"^",1)_"^1" Q
39 .I $P(GMRCMSG,"^",1)="GMRCITM" S GMRCITM=$P(GMRCMSG,"^",2),GMRCFLD(.1)=^GMR(123,GMRCO,1.11)_"^.1" Q
40 .I $P(GMRCMSG,"^",1)="GMRCPROC" Q ;S GMRCFLD(4)=+$P(^GMR(123,+GMRCO,0),"^",8)_"^4" D Q ;ignore procedure, can't be changed currently
41 .; ..S GMRCPROC=$P(GMRCMSG,"^",2) I $L($P(^GMR(123,GMRCO,0),"^",8)),$P(GMRCMSG,"^",2)="" S GMRCPROC="DELETE"
42 .I $P(GMRCMSG,"^",1)="GMRCURG" S GMRCURG=$P(GMRCMSG,"^",2),GMRCFLD(5)=$S(+$P(^GMR(123,+GMRCO,0),"^",9):$P(^ORD(101,+$P(^GMR(123,+GMRCO,0),"^",9),0),"^",2),1:"")_"^"_$P(^GMR(123,+GMRCO,0),"^",9) Q
43 .I $P(GMRCMSG,"^",1)="GMRCPL" D Q
44 ..S GMRCPL=$P(GMRCMSG,"^",2) I '+GMRCPL D
45 ...S GMRCPL="GMRCPLACE - "_$S(GMRCPL="C":"ON CALL",GMRCPL="B":"BEDSIDE",GMRCPL="E":"EMERGENCY ROOM",1:GMRCPL),GMRCPL=$O(^ORD(101,"B",GMRCPL,0))
46 ..S GMRCFLD(6)=$S(+$P(^GMR(123,+GMRCO,0),"^",10):$P($P(^ORD(101,+$P(^GMR(123,+GMRCO,0),"^",10),0),"^",1)," - ",2),1:"")_"^6"
47 ..Q
48 .I $P(GMRCMSG,"^",1)="GMRCATN" S GMRCATN=$P(GMRCMSG,"^",2),GMRCFLD(7)=$S(+$P(^GMR(123,+GMRCO,0),"^",11):$P(^VA(200,+$P(^GMR(123,+GMRCO,0),"^",11),0),"^",1),1:"")_"^7" Q
49 .I $P(GMRCMSG,"^",1)="GMRCREQ" S GMRCREQ=$P(GMRCMSG,"^",2),GMRCFLD(13)=$S($P(^GMR(123,+GMRCO,0),"^",17)="P":"Procedure",1:"Consult")_"^13" Q
50 .I $P(GMRCMSG,"^",1)="GMRCION" S GMRCION=$P(GMRCMSG,"^",2),GMRCFLD(14)=$S($P(^GMR(123,+GMRCO,0),"^",18)="I":"Inpatient",$P(^(0),"^",18)="O":"Outpatient",1:"")_"^14" Q
51 .I $P(GMRCMSG,"^",1)="GMRCDIAG" D Q
52 ..S GMRCDIAG=$P(GMRCMSG,"^",2)
53 ..S GMRCFLD(30)=$G(^GMR(123,+GMRCO,30))_"^30"
54 ..I $P(GMRCFLD(30),U)="" S $P(GMRCFLD(30),U)="No Previous Value"
55 ..I $L($P(GMRCMSG,U,3)) D
56 ...S GMRCDXCD=$P(GMRCMSG,"^",3)
57 ...S GMRCFLD(30.1)=$G(^GMR(123,+GMRCO,30.1))
58 .Q
59 S:'$D(GMRCLM) GMRCGUIF=1
60 S GMRCACTN=$$EN^GMRCEDT3(GMRCO)
61 S DR=$$SETDA^GMRCGUIU($G(GMRCSS),$G(GMRCPROC),$G(GMRCURG),$G(GMRCPL),$G(GMRCATN),$G(GMRCRQT),$G(GMRCION),$G(GMRCDIAG),$G(GMRCDXCD)) I $L(DR) D
62 .S DIE="^GMR(123,",DA=GMRCO
63 .L +^GMR(123,GMRCO)
64 .D ^DIE
65 .S DR="8////^S X=5;9////^S X=11"
66 .D ^DIE
67 .L -^GMR(123,GMRCO)
68 .K DIE,DR,DA
69 .Q
70 S DFN=$P(^GMR(123,+GMRCO,0),"^",2),GMRCPROV=$P(^(0),"^",14),GMRCTYPE=$P(^(0),"^",17),GMRCTRLC="XX^RESUBMIT",VISIT="",RMBED=""
71 D EN^GMRCHL7(DFN,+GMRCO,GMRCTYPE,RMBED,GMRCTRLC,$G(DUZ),VISIT,.GMRCOM)
72 S GMRCSVC=$S($G(GMRCSS):GMRCSS,1:$P(^GMR(123,+GMRCO,0),U,5))
73 S GMRCORTX="Resubmitted consult "_$$ORTX^GMRCAU(+GMRCO)
74 S GMRCORTX=GMRCORTX_$S($G(GMRCURG):" ("_$P(^ORD(101,+GMRCURG,0),"^",2)_")",+$P(^GMR(123,+GMRCO,0),U,9):"( "_$P(^ORD(101,+$P(^GMR(123,+GMRCO,0),U,9),0),"^",2)_" )",1:"")
75 S GMRCFL=1
76 D MSG^GMRCP(DFN,GMRCORTX,+GMRCO,27,.GMRCADUZ,GMRCFL) ;Send notification of NEW consult
77 D PRNT^GMRCUTL1(+$P(^GMR(123,+GMRCO,0),U,5),+GMRCO) ;send 513 to service
78 ;Next line gets rid of alert
79 I $D(XQAID),$L(XQAID) D
80 . N GMRCCORY
81 . S XQAKILL=$$XQAKILL^ORB3F1 D DEL^ORB3FUP1(.GMRCCORY,XQAID)
82 I $P($G(^GMR(123,+GMRCO,12)),U,5)="P" D
83 . D TRIGR^GMRCIEVT(GMRCO,GMRCACTN)
84 D GUIC^GMRCGUIU
85 Q
86SEND(GMRCO,GLOBAL) ;Get data fields to send to GUI for editing consult
87 ;GMRCO=record being edited GLOBAL=Global Referece, i.e., "^TMP("GMRCR",$J)"
88 K @GLOBAL
89 N ND,GMRCSX,TYPE,NDX
90 S ND=1,GMRCSX=""
91 I '$D(GMRCO)!('+GMRCO) Q
92 S GMRC(0)=$G(^GMR(123,+GMRCO,0)) Q:'$L(GMRC(0))
93 S GMRCSS=$P(GMRC(0),"^",5),GMRCPROC=$P(GMRC(0),"^",8)
94 S GMRCURG=$P(GMRC(0),"^",9),GMRCPL=$P(GMRC(0),"^",10)
95 S GMRCATN=$P(GMRC(0),"^",11),GMRCINO=$P(GMRC(0),"^",18)
96 S GMRCREQ=$P(GMRC(0),"^",17)
97 S GMRCDIAG=$G(^GMR(123,+GMRCO,30)) I $L($G(^(30.1))) D
98 . S GMRCDIAG=GMRCDIAG_U_$G(^GMR(123,+GMRCO,30.1))
99 . I '$$STATCHK^ICDAPIU($P(GMRCDIAG,U,2),DT) S GMRCDIAG=GMRCDIAG_U_1
100 S GMRCPROV=$S($P(^GMR(123,+GMRCO,0),U,14):$$GET1^DIQ(200,+$P(^(0),U,14),.01),1:"")
101 S @GLOBAL@(ND,0)="~SERVICE",ND=ND+1
102 I +GMRCSS S GMRCSX=$P(^GMR(123.5,GMRCSS,0),"^",1),@GLOBAL@(ND,0)="d"_GMRCSX_"^"_GMRCSS_"^",ND=ND+1,GMRCSX=""
103 E S @GLOBAL@(ND,0)="d"_"^^",ND=ND+1
104 S @GLOBAL@(ND,0)="~PROCEDURE",ND=ND+1
105 I $L(GMRCPROC),+GMRCPROC D
106 .S GMRCSX=$$UP^XLFSTR($$GET1^DIQ(123.3,+GMRCPROC,.01))
107 .S GMRCSY=$$FIND1^DIC(101.43,,"QX",+GMRCPROC_";99PRC","ID")
108 .I +GMRCSY D
109 ..S @GLOBAL@(ND,0)="d"_GMRCSY_"^"_GMRCSX,ND=ND+1
110 ..Q
111 E S @GLOBAL@(ND,0)="d^^"
112 S @GLOBAL@(ND,0)="~TYPE",ND=ND+1
113 I $L(GMRCREQ) D I '$L(GMRCREQ) S @GLOBAL@(ND,0)="d^^"
114 . S GMRCSX=$S(GMRCREQ="P":"PROCEDURE",1:"CONSULT")
115 . S @GLOBAL@(ND,0)="d"_$E(GMRCSX,1)_"^"_GMRCSX_"^"_GMRCREQ
116 . S GMRCSX=""
117 S ND=ND+1
118 S @GLOBAL@(ND,0)="~CATEGORY",ND=ND+1
119 I $L(GMRCINO) D S ND=ND+1,GMRCSX=""
120 .S @GLOBAL@(ND,0)="d"_GMRCINO_"^"_$S(GMRCINO="I":"INPATIENT",1:"OUTPATIENT")_"^"
121 .S @GLOBAL@(ND,0)=@GLOBAL@(ND,0)_$S(GMRCINO="I":$O(^ORD(101,"B","GMRCURGENCYM CSLT - INPATIENT",0)),1:$O(^ORD(101,"B","GMRCURGENCYM - OUTPATIENT",0)))
122 .Q
123 E S @GLOBAL@(ND,0)="d^^"
124 S @GLOBAL@(ND,0)="~DIAGNOSIS",ND=ND+1
125 I $L(GMRCDIAG) S @GLOBAL@(ND,0)="d"_GMRCDIAG,ND=ND+1
126 E S @GLOBAL@(ND,0)="d"
127 S @GLOBAL@(ND,0)="~PLACE",ND=ND+1
128 I +GMRCPL D S ND=ND+1,GMRCSX=""
129 .S GMRCSX=$P($P(^ORD(101,GMRCPL,0),"^",1),"GMRCPLACE - ",2),GMRCSX=$S(GMRCSX="ON CALL":"CONSULTANTS CHOICE",1:GMRCSX),@GLOBAL@(ND,0)="d"_$E(GMRCSX,1)_"^"_GMRCSX_"^"_GMRCPL
130 .Q
131 E S @GLOBAL@(ND,0)="d^^",ND=ND+1
132 S @GLOBAL@(ND,0)="~ATTENTION",ND=ND+1
133 I +GMRCATN S GMRCSX=$P(^VA(200,GMRCATN,0),"^",1),@GLOBAL@(ND,0)="d"_GMRCATN_"^"_GMRCSX_"^"_GMRCATN,ND=ND+1,GMRCSX=""
134 E S @GLOBAL@(ND,0)="d^^",ND=ND+1
135 S @GLOBAL@(ND,0)="~URGENCY",ND=ND+1
136 I +GMRCURG S GMRCSX=$P($P(^ORD(101,GMRCURG,0),"^",1),"GMRCURGENCY - ",2),GMRCURGY=$O(^ORD(101.42,"S.GMRCO",GMRCSX,0)) I $L(GMRCSX) D
137 .S GMRCSY=$O(^ORD(101.42,"B",GMRCSX,0))
138 .S @GLOBAL@(ND,0)="d"_GMRCSY_"^"_GMRCSX_"^"_GMRCURG,ND=ND+1
139 .S GMRCSX="" K GMRCSY
140 .Q
141 E S @GLOBAL@(ND,0)="d^^",ND=ND+1
142 ;Get reason for request
143 S @GLOBAL@(ND,0)="~REASON",ND=ND+1
144 I $O(^GMR(123,+GMRCO,20,0)) S NDX=0 F S NDX=$O(^GMR(123,+GMRCO,20,NDX)) Q:NDX="" S @GLOBAL@(ND,0)="t"_^GMR(123,+GMRCO,20,NDX,0),ND=ND+1
145 E S @GLOBAL@(ND,0)="~REASON",ND=ND+1,@GLOBAL@(ND,0)="tREASON "
146 ;Get Comments, including Deny Comments
147 D SENDCOMT^GMRCGUIU(GMRCO,.ND)
148 D GUIC^GMRCGUIU
149 Q
Note: See TracBrowser for help on using the repository browser.