source: FOIAVistA/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCMED.m@ 635

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

initial load of FOIAVistA 6/30/08 version

File size: 6.1 KB
Line 
1GMRCMED ;SLC/JFR - MEDICINE INTERFACE ROUTINES; 2/20/01 13:32
2 ;;3.0;CONSULT/REQUEST TRACKING;**15,47**;DEC 27, 1997
3 ;
4 ; This routine invokes IA #147,#2757,#3160,#3171
5 ;
6SET(NUM) ; set selected med result into GMRCMEDR
7 I NUM<1!(NUM>VALMCNT) D Q
8 . W !,$C(7),NUM_" is not a valid selection. "
9 . W !,"Choose a number between 1 and "_VALMCNT
10 I '$D(^TMP("GMRCR",$J,"DT",NUM,1)) D Q
11 . D EXAC^GMRCADC("The displayed item is not selectable")
12 I $D(GMRCMEDR) D RESETIT(GMRCMEDR)
13 S GMRCMEDR=NUM
14 D CNTRL^VALM10(NUM,1,80,IORVON,IORVOFF)
15 D WRITE^VALM10(NUM)
16 S VALMBCK=""
17 Q
18RESETIT(NUM) ;return prev. selected number to normal video
19 D CNTRL^VALM10(NUM,1,80,IOINORM,IOINORM)
20 D WRITE^VALM10(NUM)
21 S VALMBCK="" K GMRCSEL
22 Q
23RESULTS(ROOT,GMRCDFN) ;get list of results from Medicine
24 ; ROOT = "MCAR(691","MCAR(691.5" etc. (global root w/o comma)
25 ; return list formatted in ^TMP("GMRCMC",$J
26 N S5,CNT,REC
27 K ^TMP("GMRCMC",$J)
28 S S5=ROOT D EN^MCARPS2(GMRCDFN)
29 I '$D(^TMP("OR",$J,"MCAR")) D Q
30 . ;D EXAC^GMRCADC("No results found for"_$P(ROOT,U,2))
31 S CNT=1,REC=0
32 F S REC=$O(^TMP("OR",$J,"MCAR","OT",REC)) Q:'REC D
33 . N MCDATA,DATA,ONEDATA
34 . S MCDATA=^TMP("OR",$J,"MCAR","OT",REC),DATA=""
35 . Q:$D(^GMR(123,"R",$P(MCDATA,U,2)_";"_ROOT_","))
36 . Q:$$SCRNDRFT($P(MCDATA,U,2),$P(ROOT,"(",2))
37 . S DATA=$$SETSTR^VALM1(CNT,DATA,2,$L(REC))
38 . S DATA=$$SETSTR^VALM1($P(MCDATA,U),DATA,6,23)
39 . S DATA=$$SETSTR^VALM1($P(MCDATA,U,6),DATA,30,$L($P(MCDATA,U,6)))
40 . S DATA=$$SETSTR^VALM1($P(MCDATA,U,7),DATA,50,$L($P(MCDATA,U,7)))
41 . S ^TMP("GMRCR",$J,"DT",CNT,0)=DATA
42 . ;S ONEDATA=REC_U_$P(MCDATA,U,2)_";"_ROOT_","_U_$P(MCDATA,U,3,5)
43 . ;S ONEDATA=ONEDATA_U_$P(MCDATA,U,11)
44 . S ONEDATA=$P(MCDATA,U,2)_";"_ROOT_","
45 . S ^TMP("GMRCR",$J,"DT",CNT,1)=ONEDATA
46 . S CNT=CNT+1
47 K ^TMP("OR",$J,"MCAR")
48 Q
49PHDR ;set protocols into actions
50 S VALMSG=$$CJ^XLFSTR("Select action or item number ?? for help",80)
51 S XQORM("M")=3
52 D SHOW^VALM
53 S XQORM("#")=$O(^ORD(101,"B","GMRCACT SELECT MED RESULT",0))_"^1:"_VALMCNT
54 S XQORM("KEY","EX")=$O(^ORD(101,"B","GMRCACT QUIT",0))_"^1"
55 S XQORM("KEY","Q")=$O(^ORD(101,"B","GMRCACT QUIT",0))_"^1"
56 S XQORM("KEY","CLOSE")=$O(^ORD(101,"B","GMRCACT QUIT",0))_"^1"
57 S XQORM("KEY","NX")=$O(^ORD(101,"B","GMRCACT NEXT SCREEN",0))_"^1"
58 S XQORM("KEY","AR")=$O(^ORD(101,"B","GMRCACT ASSOCIATE RESULTS",0))_"^1"
59 S XQORM("KEY","DR")=$O(^ORD(101,"B","GMRCACT DISPLAY MED RESULT",0))_"^1"
60 Q
61 ;
62SELECT(CNT) ;grab an item from list
63 N DIR,DUOUT,DTOUT,DIRUT,X,Y
64 S DIR(0)="NO^1:"_CNT,DIR("A")="Select item"
65 D ^DIR I $D(DIRUT) Q 0
66 Q +Y
67 ;
68DISPRES(ITEM) ;
69 I '+$G(^TMP("GMRCR",$J,"DT",1,1)) D Q ; no result there
70 . D EXAC^GMRCADC("There are no results to display")
71 N GMRCDFN
72 I '$G(ITEM),'$G(GMRCMEDR) D Q:'ITEM
73 . S ITEM=$$SELECT(VALMCNT)
74 . D SET(ITEM)
75 I $G(GMRCMEDR) S ITEM=GMRCMEDR
76 N I,GMRCRES,GMRCDFN,GMRCVTIT
77 S GMRCRES=$G(^TMP("GMRCR",$J,"DT",ITEM,1))
78 Q:'$L(GMRCRES)
79 M ^TMP("GMRCR",$J,"DTSV")=^TMP("GMRCR",$J,"DT")
80 K ^TMP("GMRCR",$J,"DT")
81 S GMRCDFN=$G(DFN)
82 D START^ORWRP(80,"EN^MCAPI(GMRCRES)")
83 I '$D(^TMP("ORDATA",$J,1)) D Q
84 . S ^TMP("GMRCR",$J,"DTLIST",1,0)="Unable to locate result"
85 S I=0 F S I=$O(^TMP("ORDATA",$J,1,I)) Q:'I D
86 . S ^TMP("GMRCR",$J,"DTLIST",I,0)=^TMP("ORDATA",$J,1,I)
87 K ^TMP("ORDATA",$J) ; clean up from OR WORKSTATION
88 S DFN=$S(+GMRCDFN:GMRCDFN,$G(ORVP):+ORVP,1:0)
89 S GMRCVTIT="Medicine Result Display"
90 S VALMCNT=$O(^TMP("GMRCR",$J,"DTLIST",999999),-1)
91 D EN^VALM("GMRC DETAILED DISPLAY")
92 M ^TMP("GMRCR",$J,"DT")=^TMP("GMRCR",$J,"DTSV")
93 K ^TMP("GMRCR",$J,"DTSV")
94 S VALMBCK="R",VALMCNT=$O(^TMP("GMRCR",$J,"DT",999999),-1)
95 Q
96 ;
97AR(ITEM) ;associate specific result and complete consult
98 I '+$G(^TMP("GMRCR",$J,"DT",1,1)) D Q ; no result there
99 . D EXAC^GMRCADC("There are no results to associate")
100 N DIR,X,Y,RESTXT,RESULT
101 I '$G(ITEM),'$G(GMRCMEDR) D Q:'ITEM
102 . S ITEM=$$SELECT(VALMCNT)
103 . D SET(ITEM)
104 I $G(GMRCMEDR) S ITEM=GMRCMEDR
105 D FULL^VALM1
106 S RESTXT=$E(^TMP("GMRCR",$J,"DT",ITEM,0),6,80)
107 S RESULT=^TMP("GMRCR",$J,"DT",ITEM,1) Q:'+RESULT
108 I $D(^GMR(123,"R",RESULT)) D Q
109 . D EXAC^GMRCADC("This result is already associated with a procedure.")
110 S DIR(0)="YA",DIR("B")="NO"
111 S DIR("A",1)="",DIR("A",2)=" "_RESTXT,DIR("A",3)=""
112 S DIR("A")="Are you sure you want to associate this result? "
113 D ^DIR I Y<1 Q
114 D MEDCOMP(GMRCO,RESULT,$$NOW^XLFDT,DUZ)
115 Q
116MEDCOMP(GMRCDA,GMRCRSLT,GMRCAD,GMRCORNP,GMRCALRT) ;add medicine result
117 ; update status and send alerts
118 ; Input:
119 ; GMRCDA - ien from file 123
120 ; GMRCRSLT - medicine result in var ptr form (e.g. "19;MCAR(691.5,")
121 ; GMRCAD - FM date/time of action (optional)
122 ; GMRCORNP - DUZ of person taking action
123 ; GMRCALRT - array of users to receive alert (optional)
124 ;
125 I '$D(GMRCDA)!'$D(GMRCRSLT) Q
126 N GMRCO,GMRCSTS,GMRCA,GMRCDR,GMRCTYP,MSG
127 S GMRCO=GMRCDA,GMRCA=10,GMRCSTS=2
128 S GMRCDR="8////^S X=GMRCSTS;9////^S X=GMRCA;11////^S X=GMRCRSLT"
129 D STATUS^GMRCP
130 I $D(GMRCAD) D AUDIT^GMRCP
131 I '$D(GMRCAD) D AUDIT0^GMRCP
132 D ADDRSLT^GMRCTIUA(GMRCDA,GMRCRSLT)
133 S MSG="NEW RESULT ASSOCIATED",GMRCDFN=$P(^GMR(123,GMRCO,0),U,2)
134 D MSG^GMRCP(GMRCDFN,MSG,GMRCDA,23,.GMRCALRT,0)
135 S GMRCTYP=$P(^GMR(123,+GMRCDA,0),U,17)
136 D EN^GMRCHL7(GMRCDFN,GMRCDA,GMRCTYP,"","RE",$G(GMRCORNP),"")
137 Q
138REFRESH(GMRCIEN) ;update list of available results
139 N MCROOT,MCPROC,GMRCPROC
140 I $G(GMRCMEDR) D RESETIT(GMRCMEDR)
141 K ^TMP("GMRCR",$J,"DT"),GMRCMEDR
142 S GMRCPROC=$P(^GMR(123,GMRCIEN,0),"^",8)
143 S MCROOT=$$GET1^DIQ(697.2,+$P(^GMR(123.3,+GMRCPROC,0),U,5),1)
144 D RESULTS^GMRCMED(MCROOT,$P(^GMR(123,+GMRCIEN,0),U,2))
145 I '$O(^TMP("GMRCR",$J,"DT",0)) D
146 . S ^TMP("GMRCR",$J,"DT",1,0)="No further results to associate"
147 S VALMCNT=$O(^TMP("GMRCR",$J,"DT",""),-1)
148 S VALMBCK="R"
149 Q
150 ;
151SCRNDRFT(GMRCMCDA,GMRCMCFL) ;screen out draft or marked for del med results
152 ; Input:
153 ; GMRCDA - ien from a MEDICINE file
154 ; GMRCMCFL - file # from MEDICINE (e.g. 691, 691.5, 699 etc.)
155 ; Output: Boolean 1=screen it out 0=include it
156 ;
157 N GMRCMCST,GMRCMFD
158 I '$D(GMRCMCDA)!('$D(GMRCMCFL)) Q 0
159 S GMRCMCST=$$GET1^DIQ(GMRCMCFL,GMRCMCDA,1506,"I") ;get release code
160 S GMRCMCST=$S(GMRCMCST="D":0,GMRCMCST="PD":0,1:1) ;no D or PD
161 S GMRCMFD=$$GET1^DIQ(GMRCMCFL,GMRCMCDA,1511,"I") ;marked for del?
162 I GMRCMFD=1 Q 1 ;marked for del
163 I GMRCMCST=0 Q 1 ;screen out draft or prob draft
164 Q 0
Note: See TracBrowser for help on using the repository browser.