source: WorldVistAEHR/trunk/r/INPATIENT_MEDICATIONS-PSJ-PSIV-PSG--PSGW/PSJHL6.m@ 1147

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

initial load of WorldVistAEHR

File size: 5.5 KB
Line 
1PSJHL6 ;BIR/LDT-ACTIONS ON HL7 MESSAGES FROM OE/RR (CONT) ;02 Mar 99 / 9:26 AM
2 ;;5.0; INPATIENT MEDICATIONS ;**1,11,27,34,40,42,51,59,88,98**;16 DEC 97
3 ;
4 ; Reference to EN^ORERR is supported by DBIA# 2187.
5 ; Reference to ^PS(55 is supported by DBIA# 2191.
6 ;
7CANCEL ;Cancel or Discontinue orders thru OE/RR
8 N DA,DR,DIE,STATUS,STPDT,NODE,NODE2,PSREASON,PSIVACT,PSIVALT,ON55,PSIVREA,PSIVALCK,P
9 S NODE=$G(@(RXORDER_"0)")),NODE2=$G(@(RXORDER_"2)"))
10 I 'NODE S PSREASON="Invalid Pharmacy order number" D Q
11 .S X="ORERR" X ^%ZOSF("TEST") I D EN^ORERR(PSREASON_"/DC Msg",.PSJMSG)
12 .D EN1^PSJHLERR(PSJHLDFN,$S(PSOC="CA":"UC",1:"UD"),$P(ORDER,U),PSREASON)
13 I RXON["P",PSJHLDFN'=$P(NODE,U,15) S ORDCON="Patient does not match/Discontinue Msg" D Q
14 .S X="ORERR" X ^%ZOSF("TEST") I D EN^ORERR(ORDCON,.PSJMSG)
15 .D EN1^PSJHLERR(PSJHLDFN,$S(PSOC="CA":"UC",1:"UD"),$P(ORDER,U),ORDCON)
16 S $P(@(RXORDER_"0)"),"^",21)=$P(ORDER,"^",1)
17 S STATUS=$S(RXON["V":$P(NODE,"^",17),1:$P(NODE,"^",9))
18 S STPDT=$S(RXON["V":$P(NODE,"^",3),1:$P(NODE2,"^",4))
19 I "AHNOPR"'[STATUS D @STATUS S PSREASON=PSREASON_" orders may not be "_$S(PSOC="CA":"cancelled",1:"discontinued") D EN1^PSJHL2(PSJHLDFN,$S(PSOC="CA":"UC",1:"UD"),RXON,PSREASON) Q
20 S:(RXON["A")!(RXON["U")!(RXON["V") DA(1)=PSJHLDFN,DA=+RXON
21 D NOW^%DTC
22 S DIE=$S(RXON["V":"^PS(55,"_PSJHLDFN_",""IV"",",(RXON["N")!(RXON["P"):"^PS(53.1,",1:"^PS(55,"_PSJHLDFN_",5,"),DA=+RXON
23 S DR=$S(RXON["V":"100////D;116////^S X=STPDT;.03////",(RXON["N")!(RXON["P"):"28////D;25////",1:"25////^S X=STPDT;28////D;34////")_$S($G(ORDCON)="A"&($G(PSJASTP)'=""):$G(PSJASTP),1:%)
24 I RXON["A"!(RXON["U") S PSGAL("C")=$S($G(ORDCON)="A":1040,1:4000) D ^PSGAL5
25 I RXON["V" S PSIVACT=1,PSIVALT=$S($G(ORDCON)="A":"",1:2),PSIVAL=$S($G(ORDCON)="A":"AUTO DISCONTINUED (TREATING SPECIALTY TRANSFER)",1:""),ON55=RXON,PSIVREA="D",P(3)=STPDT
26 S:$G(ORDCON)="A" DR=$S(RXON["V":DR_";121////1",RXON["N"!(RXON["P"):DR_";42////1",1:DR_";49////1")
27 D ^DIE
28 S:$G(ORDCON)="A" $P(^PS(55,PSJHLDFN,5.1),"^")=""
29 I RXON["V" N DFN S DFN=PSJHLDFN D LOG^PSIVORAL
30 D EN1^PSJHL2(PSJHLDFN,$S(PSOC="CA":"CR",1:"DR"),RXON)
31 D NOW^%DTC I "ANR"[STATUS I STPDT<% D EXPIR Q
32 D AUE(PSJHLDFN,RXON)
33 Q
34 ;
35HOLD ;Place orders on hold thru OE/RR and check for expired orders
36 N DA,DR,DIE,STATUS,STPDT,NODE,NODE2,PSREASON,PSIVACT,PSIVALT,PSIVREA,ON55
37 S NODE=$G(@(RXORDER_"0)")),NODE2=$G(@(RXORDER_"2)"))
38 I 'NODE S PSREASON="Invalid Pharmacy order number" D Q
39 .S X="ORERR" X ^%ZOSF("TEST") I D EN^ORERR(PSREASON_"/Hold Msg",.PSJMSG)
40 .D EN1^PSJHLERR(PSJHLDFN,"UH",$P(ORDER,U),PSREASON)
41 S $P(@(RXORDER_"0)"),"^",21)=$P(ORDER,"^",1)
42 S STATUS=$S(RXON["V":$P(NODE,"^",17),1:$P(NODE,"^",9))
43 S STPDT=$S(RXON["V":$P(NODE,"^",3),1:$P(NODE2,"^",4))
44 D NOW^%DTC I "ANR"[STATUS I STPDT<% D EXPIR
45 I STATUS'="A" D @STATUS S PSREASON=PSREASON_" orders may not be placed on hold" D EN1^PSJHL2(PSJHLDFN,"UH",RXON,PSREASON) Q
46 I STATUS="A" S DA(1)=PSJHLDFN,DA=+RXON,DIE=$S(RXON["V":"^PS(55,"_PSJHLDFN_",""IV"",",1:"^PS(55,"_PSJHLDFN_",5,"),DR=$S(RXON["V":"100////H;120////1;149////1",1:"28////H;56////1;59////A;59.1////1;60////@;61////@;62////@;58////"_%)
47 I RXON["A"!(RXON["U") S PSGAL("C")=8500 D ^PSGAL5
48 S:RXON["V" PSIVACT=1,PSIVALT=2,PSIVREA="H",ON55=RXON
49 D ^DIE
50 I RXON["V" N DFN S DFN=PSJHLDFN D LOG^PSIVORAL
51 D EN1^PSJHL2(PSJHLDFN,"HR",RXON)
52 D NOW^%DTC I "ANR"[STATUS I STPDT<% D EXPIR Q
53 D AUE(PSJHLDFN,RXON)
54 Q
55 ;
56UNHOLD ;Change status of orders palced on hold thru OE/RR & check for expired orders
57 N DA,DR,DIE,STATUS,STPDT,NODE,NODE2,NODE4,HFLAG,PSREASON,PSIVACT,PSIVALT,PSIVREA,ON55
58 S NODE=$G(@(RXORDER_"0)")),NODE2=$G(@(RXORDER_"2)")),NODE4=$G(@(RXORDER_"4)"))
59 I 'NODE S PSREASON="Invalid Pharmacy order number" D Q
60 .S X="ORERR" X ^%ZOSF("TEST") I D EN^ORERR(PSREASON_"/Unhold Msg",.PSJMSG)
61 .D EN1^PSJHLERR(PSJHLDFN,"UR",$P(ORDER,U),PSREASON)
62 S $P(@(RXORDER_"0)"),"^",21)=$P(ORDER,"^",1)
63 S STATUS=$S(RXON["V":$P(NODE,"^",17),1:$P(NODE,"^",9))
64 S STPDT=$S(RXON["V":$P(NODE,"^",3),1:$P(NODE2,"^",4))
65 S HFLAG=$S(RXON["V":$P(NODE,"^",10),1:$P(NODE4,"^",26))
66 I 'HFLAG S PSREASON="Orders placed on hold by Pharmacy may not be removed from hold through CPRS." D EN1^PSJHL2(PSJHLDFN,"UR",RXON,PSREASON) Q
67 I "H"'[STATUS D @STATUS S PSREASON=PSREASON_" orders may not be taken off hold" D EN1^PSJHL2(PSJHLDFN,"UR",RXON,PSREASON) Q
68 I STATUS="H" S DA(1)=PSJHLDFN,DA=+RXON,DIE=$S(RXON["V":"^PS(55,"_PSJHLDFN_",""IV"",",1:"^PS(55,"_PSJHLDFN_",5,")
69 D NOW^%DTC
70 S DR=$S(RXON["V":"100////A;120////@;149////@",1:"28////A;56////@;57////@;58////@;59////@;59.1////@;60////1;62////"_%)
71 I RXON["A"!(RXON["U") S PSGAL("C")=8000 D ^PSGAL5
72 S:RXON["V" PSIVACT=1,PSIVALT=2,PSIVREA="U",ON55=RXON
73 D ^DIE
74 I RXON["V" N DFN S DFN=PSJHLDFN D LOG^PSIVORAL
75 D EN1^PSJHL2(PSJHLDFN,"OR",RXON)
76 D NOW^%DTC I "A"[STATUS I STPDT<% D EXPIR Q
77 D AUE(PSJHLDFN,RXON)
78 Q
79EXPIR ;Change status of order to expired and send notice to OE/RR
80 N DA,DIE,DR,PSGPO,PSIVACT
81 S STATUS="E",(PSGPO,PSIVACT)=1,DA=+RXON,DA(1)=PSJHLDFN,DIE=$S(RXON["V":"^PS(55,"_PSJHLDFN_",""IV"",",1:"^PS(55,"_PSJHLDFN_",5,"),DR=$S(RXON["V":"100////E",1:"28////E") D ^DIE
82 S PSJHLMTN="ORM" D EN1^PSJHL2(PSJHLDFN,"SC",RXON) S PSJHLMTN="ORR"
83 ;D AUE(PSJHLDFN,RXON)
84 Q
85AUE(PSJHLDFN,ON) ; Set "AUE" xref for 55.06 if hold/unhold
86 I ON["A"!(ON["U") S ^PS(55,"AUE",PSJHLDFN,+ON)=""
87 Q
88 ;
89A S PSREASON="Active" Q
90D S PSREASON="Discontinued" Q
91I S PSREASON="Incomplete" Q
92N S PSREASON="Non-verified" Q
93U S PSREASON="Unreleased" Q
94P S PSREASON="Pending" Q
95DE S PSREASON="Discontinued (edit)" Q
96E S PSREASON="Expired" Q
97H S PSREASON="Hold" Q
98R S PSREASON="Renewed" Q
99RE S PSREASON="Reinstated" Q
100DR S PSREASON="Discontinued (renewal)" Q
101O S PSREASON="On call" Q
Note: See TracBrowser for help on using the repository browser.