source: FOIAVistA/tag/r/DIETETICS-FH/FHWOR4.m@ 1121

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

initial load of FOIAVistA 6/30/08 version

File size: 3.2 KB
Line 
1FHWOR4 ; HISC/NCA - HL7 NPO ;10/10/00 14:57
2 ;;5.5;DIETETICS;;Jan 28, 2005
3 S (DATE,D1)=SDT I DATE="" S TXT="No Start Date." D ERR^FHWOR Q
4 D CVT^FHWOR S D1=DATE
5 S (DATE,D2)=$P(DUR,"^",5)
6 I DATE D CVT^FHWOR S D2=DATE
7 I D2,D1>D2 S TXT="Wrong Stop Date." D ERR^FHWOR Q
8 S DATE=NOW D CVT^FHWOR S NOW=DATE
9 S COM=$E($P(MSG(5),"|",5),1,80)
10 ; Process NPO
11 D F7^FHORD3
12 G KIL
13CAN ; process cancel or discontinue
14 S FHORD=$P(FILL,";",3) I 'FHORD D CSEND^FHWOR Q
15 D GADM^FHWORR
16 S FHREA=$P(DATA,"|",17),FHREA=$P(FHREA,"^",5) I FHREA="Discharge" D DIS,CSEND^FHWOR K FHREA Q
17 D NC
18 D CSEND^FHWOR G KIL
19NC ; Cancel NPO
20 D NOW^%DTC S NOW=% S OLD=""
21 I '$D(^FHPT(FHDFN,"A",+ADM,"DI",+FHORD,0)) Q
22 I $P($G(^FHPT(FHDFN,"A",ADM,"DI",+FHORD,0)),"^",19)'="" Q
23 S NSTR=0 F KK=0:0 S KK=$O(^FHPT(FHDFN,"A",ADM,"AC",KK)) Q:KK<1!(KK'<NOW) S NSTR=KK
24 F KK=NSTR-.000001:0 S KK=$O(^FHPT(FHDFN,"A",ADM,"AC",KK)) Q:KK<1 I $P(^(KK,0),"^",2)=FHORD G F1
25 Q
26F1 D T0^FHORD3 Q
27KIL G KIL^FHORD3
28NPO ; Code NPO Order
29 K MSG S FILL=$G(FHNEW) Q:FILL=""
30 S SDT=D1,DATE1="" D SET
31 ; Code MSH, PID, and PV1
32 D MSH^FHWOR
33 ; code ORC
34 S MSG(4)="ORC|SN||"_FILL_"^FH||||^^^"_SDT_"^"_DATE1_"|||"_DUZ_"||"_DUZ_"|||"_DATE
35 ; Code ODS
36 S MSG(5)="ODS|D||^^^FH-5^NPO^99OTH|"_COM
37 K DATE,DATE1,FILL,FHWRD,HOSP,RM,SITE,SDT
38 Q
39SET ; Set Date/Time in HL7 format
40 S:SDT SDT=$$FMTHL7^XLFDT(SDT)
41 S:NOW DATE=$$FMTHL7^XLFDT(NOW)
42 S:D2 DATE1=$$FMTHL7^XLFDT(D2) S:'DATE1 DATE1=""
43 Q
44CODE ; Code Cancel/Discontinue NPO Order Status Change
45 K MSG N ACT,FILL S FILL=$G(FHMSG1) Q:FILL="" S ACT=$S(FHSTS=6:"IP",FHSTS=8:"SC",FHSTS=1:"DC",1:"") Q:ACT="" D SITE^FH
46 ; code MSH
47 S MSG(1)="MSH|^~\&|DIETETICS|"_SITE(1)_"|||||"_$S($D(FHORR):"ORR",1:"ORM")
48 ; code PID
49 S MSG(2)="PID|||"_DFN_"||"_$P($G(^DPT(DFN,0)),"^",1)
50 ; code ORC
51 S DATE=$S(FHDAT'="":$P(FHDAT,"^",1),1:"")
52 I DATE S DATE=$$FMTHL7^XLFDT(DATE) S $P(FHDAT,"^",1)=DATE
53 S DATE=$S(FHDAT'="":$P(FHDAT,"^",2),1:"")
54 I DATE S DATE=$$FMTHL7^XLFDT(DATE) S $P(FHDAT,"^",2)=DATE
55 S MSG(3)="ORC|"_$S($D(FHORR):"SR",1:"SC")_"|"_FHORN_"^OR|"_FILL_"^FH||"_ACT
56 I FHDAT'="" S MSG(3)=MSG(3)_"||^^^"_FHDAT
57 I ACT="DC" S MSG(3)=MSG(3)_"|||"_$S($D(FHPV):FHPV,1:"")_"||"_$S($D(FHPV):FHPV,1:"")
58 K ACT,FHORR,FILL,SITE,WKDAYS Q
59NA ; OE/RR Number Assign
60 S FHORD=+$P(FILL,";",3) Q:'FHORD S:ADM'=$P(FILL,";",2) ADM=$P(FILL,";",2)
61 S $P(^FHPT(FHDFN,"A",ADM,"DI",FHORD,0),"^",14)=+FHORN Q
62DIS ; Process Cancel of Diet/NPO for Discharge
63 S FHGET=$G(^FHPT(FHDFN,"A",ADM,"DI",FHORD,0))
64 I $P(FHGET,"^",14)>0,$P(FHGET,"^",15)>2 S $P(^FHPT(FHDFN,"A",ADM,"DI",FHORD,0),"^",15)=1
65 D NOW^%DTC S NOW=%
66 F A1=NOW:0 S A1=$O(^FHPT(FHDFN,"A",ADM,"AC",A1)) Q:A1="" K ^FHPT(FHDFN,"A",ADM,"AC",A1)
67 F FHDR=0:0 S FHDR=$O(^FHPT(FHDFN,"A",ADM,"DI",FHDR)) Q:FHDR<1 D D1
68 S FHGET=$G(^FHPT(FHDFN,"A",ADM,0)),FHGET=$P(FHGET,"^",2) Q:'FHGET
69 S FHX=$G(^FHPT(FHDFN,"A",ADM,"DI",FHGET,0))
70 Q:$P(FHX,"^",7)="X"
71 D ORD^FHORD7 S ^FHPT(FHDFN,"A",ADM,"DI",FHORD,0)=FHORD_"^^^^^^X^^"_NOW_"^^"_DUZ_"^"_NOW
72 S ^FHPT(FHDFN,"A",ADM,"AC",NOW,0)=NOW_"^"_FHORD
73 S $P(^FHPT(FHDFN,"A",ADM,0),"^",2,3)=FHORD_"^" K A1,FHDR,FHGET,FHX,FHOX1 Q
74D1 ; Get all filler fields for Diet
75 S FHOX1=$P($G(^FHPT(FHDFN,"A",ADM,"DI",FHDR,0)),"^",14,15)
76 I +FHOX1>0,$P(FHOX1,"^",2)>2 S FHOX1=+FHOX1,$P(^FHPT(FHDFN,"A",ADM,"DI",FHDR,0),"^",15)=1
77 Q
Note: See TracBrowser for help on using the repository browser.