source: WorldVistAEHR/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGMSTL1.m@ 623

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

initial load of WorldVistAEHR

File size: 5.3 KB
Line 
1DGMSTL1 ;ALB/SCK - MST Status entry cont. ; 11/15/01 2:27pm
2 ;;5.3;Registration;**195,379**;Aug 13, 1993
3 Q
4PAT ;
5 N MSTDFN,DGMST,MSTST,MSTPV,MSTDT,DGDTFLG,MSTX,Y
6 ;
7 D FULL^VALM1
8ASKP S MSTDFN=$$SELECT
9 Q:MSTDFN<0
10 ;
11 S DGMST=$$GETSTAT^DGMSTAPI(MSTDFN)
12 K DIRUT
13 S DIR(0)="29.11,3AO",DIR("B")=$P(DGMST,U,2),DIR("A")="Enter MST Status: "
14 D ^DIR K DIR
15 G:$D(DIRUT) ASKP
16 ;
17 I Y=$P(DGMST,U,2) D G ASKP
18 . W !!," MST Status has not been changed, Nothing done.",!
19 S MSTST=Y
20 ;
21 S MSTDT=$$ASKDATE^DGMSTL2("",+$P(DGMST,U,3))
22 G:'MSTDT ASKP
23 ;
24 S MSTPV=$$ASKPROV^DGMSTL2($P(DGMST,U,4))
25 G:'MSTPV ASKP
26 ;
27 S MSTX=$$NEWSTAT^DGMSTAPI(MSTDFN,MSTST,MSTDT,MSTPV,"",0)
28 I +MSTX>0 D
29 . D ADDSTR^DGMSTL2(MSTDFN,MSTST,MSTDT,MSTPV,+MSTX)
30 ;
31 I +MSTX<0 D
32 . W !!,"The following occurred when saving this status:"
33 . W !,$$EZBLD^DIALOG($P(MSTX,U,2)),!
34 ;
35 G ASKP
36 Q
37 ;
38STAT ;
39 N MSTST,MSTDT,MSTPV,MSTDFN,DGMST,DGDTFLG,Y
40 ;
41 D FULL^VALM1
42 ;
43ASKS K DIRUT S DIR(0)="29.11,3AO",DIR("A")="Enter MST status: "
44 D ^DIR K DIR
45 Q:$D(DIRUT)!(Y']"")
46 S MSTST=Y
47 ;
48ASKS1 S MSTDFN=$$SELECT
49 G:MSTDFN<0 ASKS
50 S DGMST=$$GETSTAT^DGMSTAPI(MSTDFN)
51 ;
52 S MSTDT=$$ASKDATE^DGMSTL2
53 G:'MSTDT ASKS1
54 ;
55 S MSTPV=$$ASKPROV^DGMSTL2($S($G(MSTPV)>0:MSTPV,1:""))
56 G:'MSTPV ASKS1
57 ;
58 S MSTX=$$NEWSTAT^DGMSTAPI(MSTDFN,MSTST,MSTDT,MSTPV,"",0)
59 I +MSTX>0 D
60 . D ADDSTR^DGMSTL2(MSTDFN,MSTST,MSTDT,MSTPV,MSTX)
61 ;
62 I +MSTX<0 D
63 . W !!,"The following occurred when saving this status:"
64 . W !,$$EZBLD^DIALOG($P(MSTX,U,2)),!
65 ;
66 G ASKS1
67 Q
68 ;
69EL ; Edit MST status in current List Manager Display
70 N MSTDFN,DGMST,MSTST,MSTPRV,MSTDT,MSTIEN,DGMSG,MSTIENC,MSTNEW
71 ;
72 Q:$$CHKNUL^DGMSTL2
73 D FULL^VALM1
74 D EN^VALM2(XQORNOD(0),"S")
75 S VALMI=0,VALMI=$O(VALMY(VALMI)) Q:'VALMI
76 S MSTIEN=$O(^TMP("DGMST",$J,"IEN",VALMI,0))
77 Q:(MSTIEN<0)
78 ;
79 ; Retreive information from file entry to be changed
80 S MSTIENC=+MSTIEN_","
81 D GETS^DIQ(29.11,MSTIENC,"*","IE","DGMST","DGMSG")
82 I $D(DGMSG) D Q
83 . W !!,"Unable to retrieve data at this time."
84 ;
85 W !!,"Edit MST status for "_DGMST(29.11,MSTIENC,2,"E")
86 ; Enter new MST status code, default is current MST status entered
87 K DIRUT
88 S DIR(0)="29.11,3AO",DIR("B")=DGMST(29.11,MSTIENC,3,"E"),DIR("A")="Enter MST Status: "
89 D ^DIR K DIR
90 Q:$D(DIRUT)
91 S MSTST=Y
92 ;
93 ; Ask for provider
94 S MSTPRV=$$ASKPROV^DGMSTL2(DGMST(29.11,MSTIENC,4,"I"))
95 Q:'MSTPRV
96 ;
97 ; Ask for status date
98 S MSTDT=$$ASKDATE^DGMSTL2(DGMST(29.11,MSTIENC,.01,"I"))
99 Q:'MSTDT
100 ;
101 W !
102 K DIRUT
103 S DIR(0)="YA",DIR("B")="NO",DIR("A")="Save Changes? "
104 D ^DIR K DIR
105 Q:$D(DIRUT)!('Y)
106 ;
107 ; Process edit
108 S MSTNEW(1,29.11,MSTIENC,.01)=MSTDT
109 S MSTNEW(1,29.11,MSTIENC,3)=MSTST
110 S MSTNEW(1,29.11,MSTIENC,4)=MSTPRV
111 S MSTNEW(1,29.11,MSTIENC,5)=DUZ
112 ;
113 L +^DGMS(29.11,MSTIEN)
114 D FILE^DIE("S","MSTNEW(1)","DGERR")
115 L -^DGMS(29.11,MSTIEN)
116 ;
117 ; Update List Manager display
118 D FLDTEXT^VALM10(VALMI,"DATE",$$FMTE^XLFDT(MSTDT))
119 D FLDTEXT^VALM10(VALMI,"PROVIDER",$$NAME^DGMSTAPI(MSTPRV))
120 D FLDTEXT^VALM10(VALMI,"STATUS",MSTST)
121 Q
122 ;
123DL ; Delete entry from list and from the MST HISTORY File (#29.11)
124 N MSTDFN,DGMST,MSG,MSTST,DGRSLT,DGERR,MSTCNT,MSTIEN,MSTIENC
125 ;
126 Q:$$CHKNUL^DGMSTL2
127 ;
128 D FULL^VALM1
129 ; Retrieve entry to delete
130 D EN^VALM2(XQORNOD(0)) S VALMI=0
131 M ^TMP("DGMST RENUM",$J)=^TMP("DGMST",$J)
132 F S VALMI=$O(VALMY(VALMI)) Q:'VALMI D
133 . S MSTIEN=$O(^TMP("DGMST",$J,"IEN",VALMI,0))
134 . D GETS^DIQ(29.11,MSTIEN_",","*","I","DGMST","DGERR")
135 . Q:$D(DGERR)
136 . Q:'($$CONFIRM(DGMST(29.11,MSTIEN_",",2,"I"),DGMST(29.11,MSTIEN_",",3,"I")))
137 . S DGRSLT=$$DELMST^DGMSTAPI(MSTIEN)
138 . I DGRSLT D
139 .. K ^TMP("DGMST RENUM",$J,"IDX",VALMI)
140 . E D
141 . W !!,$P(DGRSLT,U,2)
142 ;
143 S (VALMCNT,MSTCNT,IDX)=0
144 K ^TMP("DGMST",$J)
145 F S IDX=$O(^TMP("DGMST RENUM",$J,"IDX",IDX)) Q:'IDX D
146 . S MSTIEN=$O(^TMP("DGMST RENUM",$J,"IEN",IDX,0)),MSTIENC=MSTIEN_","
147 . D GETS^DIQ(29.11,MSTIENC,"*","I","DGMST")
148 . D ADDSTR^DGMSTL2(DGMST(29.11,MSTIENC,2,"I"),DGMST(29.11,MSTIENC,3,"I"),DGMST(29.11,MSTIENC,.01,"I"),DGMST(29.11,MSTIENC,4,"I"),MSTIEN)
149 ;
150 D NUL^DGMSTL2
151 Q
152 ;
153DP ; Display patient MST status history for a patient not in the current liST
154 ;
155 N DIC,MSTDFN
156 K ^TMP("DGMST DP",$J)
157 ;
158 D FULL^VALM1
159 S MSTDFN=$$SELECT
160 ;
161 I MSTDFN<0 D Q
162 . W !?5,"No patient found"
163 . S VALMBCK="R"
164 ;
165 D EN^VALM("DGMST STATUS DISPLAY")
166 S VALMBCK="R"
167 Q
168 ;
169SENDMST ; Send HL7 messages for current list
170 N MSTDFN,DGRSLT,IDX
171 S MSTDFN=""
172 D FULL^VALM1
173 Q:'$D(^TMP("DGMST",$J,"DFN"))
174 W !!,"Queuing MST updates for HL7 processing..." D HANG
175 S IDX=""
176 F S IDX=$O(^TMP("DGMST",$J,"DFN",IDX)) Q:'IDX D
177 . S MSTDFN=$O(^TMP("DGMST",$J,"DFN",IDX,0))
178 . Q:'MSTDFN
179 . D SEND(MSTDFN,"Z07")
180 W !!,"Queuing completed..." D HANG
181 Q
182 ;
183SEND(DFN,EVNT) ; Send HL7 message
184 N HLRSLT
185 S DFN=$G(DFN)
186 S EVNT=$G(EVNT)
187 I EVNT="Z07" D AUTOUPD^DGENA2(DFN)
188 Q
189 ;
190SELECT() ;
191 N DGRSLT
192 ;
193 K DIRUT
194 S DIC=2,DIC(0)="AEMQZ",DIC("A")="Select Patient: "
195 S DIC("S")="I $G(^(""VET""))=""Y"",'+$G(^(.35))>0!(+$G(^(.35))>0&(+$G(^(.35))'<2921001))"
196 D ^DIC K DIC
197 I $D(DIRUT)!(Y="") S DGRSLT=-1
198 E D
199 . S DGRSLT=+Y
200 Q $G(DGRSLT)
201 ;
202CONFIRM(MSTDFN,MSTST) ; Confirm deletion of patient's MST status
203 ; Confirm deletion for this patient
204 K DIRUT
205 S DIR("A",1)=""
206 S DIR("A",2)=$P(^DPT(MSTDFN,0),U)_" has a current status of "_$$EXTMST^DGMSTL2(MSTST)
207 S DIR(0)="YA",DIR("B")="NO"
208 S DIR("A")="Delete this MST status entry? "
209 D ^DIR K DIR
210 Q:$D(DIRUT) 0
211 Q $G(Y)
212 ;
213HANG ; This logic allows the messages to display briefly to the User.
214 R DGPTHANG:4 K DGPTHANG
215 Q
Note: See TracBrowser for help on using the repository browser.