Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FHWORR

FHWORR.m

Go to the documentation of this file.
  1. FHWORR ; HISC/NCA - Decode HL7 Utility (Cont.) ;1/30/97 14:22
  1. ;;5.5;DIETETICS;**2**;Jan 28, 2005
  1. GETOR ; Call to Get FHORN
  1. F FHD=0:0 S FHD=$O(FHMSG(FHD)) Q:FHD<1 S XX=$G(FHMSG(FHD)) S FHD1=$$RETURN(XX) I FHD1'="" Q
  1. S FHORN=FHD1
  1. Q
  1. MSH ; Code MSH message
  1. D SITE^FH
  1. S MSG(1)="MSH|^~\&|DIETETICS|"_SITE(1)_"|||||ORM"
  1. ; code PID
  1. S MSG(2)="PID|||"_DFN_"||"_$P($G(^DPT(DFN,0)),"^",1)
  1. ; code PV1
  1. S WARD=$G(^DPT(DFN,.1)) Q:WARD="" S FHWRD=$O(^DIC(42,"B",WARD,0)) Q:'FHWRD S HOSP=+$P($G(^DIC(42,+FHWRD,44)),"^",1) Q:'HOSP S RM=$G(^DPT(DFN,.108)) S:RM RM=$P($G(^DG(405.4,+RM,0)),"^",1)
  1. S MSG(3)="PV1||I|"_HOSP_"^"_RM_"||||||||||||||||"
  1. Q
  1. GADM ; Get the correct Admission number with order.
  1. S:ADM'=$P(FILL,";",2) ADM=+$P(FILL,";",2)
  1. Q
  1. RETURN(FHDOR) ; Return FHORN
  1. S FHD2=""
  1. I $E(FHDOR,1,3)="ORC" S FHD2=$P(FHDOR,"|",3)
  1. Q FHD2
  1. CHK ; Check if Cancelling Discharged
  1. S CHK=0 S FHC=$G(FHMSG(3)) I $E(FHC,1,3)'="ORC" Q
  1. I $P(FHC,"|",2)="DC"!($P(FHC,"|",2)="CA") S CHK=1,X=$G(FHMSG(3)),ADM=$P(X,"|",4),ADM=+$P(ADM,";",2)
  1. Q
  1. STATUS ; Send Status As Requested
  1. I FOR=1 G KIL
  1. I FOR=2 D NOW^%DTC S NOW=% S FHORN1=+FHORN D OEU^FHORD71 G KIL
  1. I FOR=3 S FHSTS=$P(DATA,"|",6) I FHSTS="IP" S FHSTS="ZE" D STS G KIL
  1. I FOR=4 D NOW^%DTC S NOW=% S FHORN1=+FHORN D OEU^FHORD71 G KIL
  1. I FOR=5 G KIL
  1. G KIL
  1. STS ; Send Early/Late Tray Status
  1. D MSH^FHWOR S $P(MSG(1),"|",9)="ORR"
  1. S MSG(3)="ORC|SR|"_FHORN_"|"_FILL_"^FH||"_FHSTS
  1. D MSG^XQOR("FH EVSEND OR",.MSG) K MSG
  1. Q
  1. OMSTAT ; Send Outpatient Meals Status
  1. S FHORN=$P($P(MSG(4),"|",3),"^",1),FILL=$P(MSG(4),"|",4),FHSTTS="IP"
  1. S FHORNTMP=FHORN,FHCNORS="" D NOW^%DTC S FHTDAT=$P(%,".",1)
  1. I $E(FILL,1)="R" S FHREND=$P(FILL,";",4),FHMPNUM=$P(FILL,";",2) I FHTDAT>FHREND S FHSTTS="ZE",FHCNORS=FHCNORS_"^"_FHORN K MSG D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG) K MSG D
  1. .F FHRM=0:0 S FHRM=$O(^FHPT(FHDFN,"OP","C",FHMPNUM,FHRM)) Q:FHRM'>0 D
  1. ..I $D(^FHPT(FHDFN,"OP",FHRM,1)) S FHORN=$P(^FHPT(FHDFN,"OP",FHRM,1),U,4) I FHCNORS'[FHORN S FHCNORS=FHCNORS_"^"_FHORN D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG) K MSG
  1. ..I $D(^FHPT(FHDFN,"OP",FHRM,2)) S FHORN=$P(^FHPT(FHDFN,"OP",FHRM,2),U,5) I FHCNORS'[FHORN S FHCNORS=FHCNORS_"^"_FHORN D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG) K MSG
  1. ..I $D(^FHPT(FHDFN,"OP",FHRM,3)) S FHORN=$P(^FHPT(FHDFN,"OP",FHRM,3),U,4) I FHCNORS'[FHORN S FHCNORS=FHCNORS_"^"_FHORN D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG) K MSG
  1. .Q
  1. I $E(FILL,1)="S" S FHSEND=$P($P(FILL,";",2),"^",1) I FHTDAT>FHSEND S FHSTTS="ZE" D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG) K MSG D
  1. .I $D(^FHPT(FHDFN,"SM",FHSEND,1)) S FHORN=$P(^FHPT(FHDFN,"SM",FHSEND,1),U,4) D MSHSS^FHOMUTL,MSG^XQOR("FH EVSEND OR",.MSG)
  1. .Q
  1. K ACT,FILL,FHORN,MSG S FHORN=FHORNTMP Q
  1. RESUME(DFN) ; Check whether to prompt resume tray
  1. ; Return Null for No Current Diet Order in file
  1. ; Return 0 for not to prompt the user
  1. ; Return 1 to prompt the user
  1. ; Return 2 to prompt the user and notify that it's a WITHHOLD SERVICE
  1. N ADM,A1,A2,D1,D2,FHLD,FHOR,FHORD,K1,TIM,WARD,X,X1,X2,Y
  1. S Y=0 S WARD=$G(^DPT(DFN,.1)) G:WARD="" EXIT
  1. S ADM=$G(^DPT("CN",WARD,DFN)) G:ADM<1 EXIT
  1. ; Get Diet
  1. S FHZ115="P"_DFN D CHECK^FHOMDPA I FHDFN="" Q
  1. S X1=^FHPT(FHDFN,"A",ADM,0),FHORD=$P(X1,"^",2),X1=$P(X1,"^",3),(FHLD,FHOR,X)="",Y=""
  1. G:'FHORD EXIT G:'$D(^FHPT(FHDFN,"A",ADM,"DI",FHORD,0)) EXIT
  1. ; Set FHOR & FHLD variables
  1. S X=^FHPT(FHDFN,"A",ADM,"DI",FHORD,0),FHOR=$P(X,"^",2,6),FHLD=$P(X,"^",7),Y=0
  1. G:"^^^^"'[FHOR EXIT
  1. G:FHLD="" EXIT
  1. D NOW^%DTC S TIM=%
  1. S (D1,FHORD)=0 F K1=0:0 S K1=$O(^FHPT(FHDFN,"A",ADM,"AC",K1)) Q:K1<1!(K1>TIM) S D1=K1
  1. G:'D1 EXIT
  1. S0 ; Set AC cross-ref data field
  1. S X2=D1,D2=$O(^FHPT(FHDFN,"A",ADM,"AC",D1)) S:D2<1 D2=""
  1. S1 S A2=0 F A1=0:0 S A1=$O(^FHPT(FHDFN,"A",ADM,"AC",A1)) Q:A1<1!(A1'<X2) S A2=A1
  1. I A2 S X2=A2,A2=$P(^FHPT(FHDFN,"A",ADM,"AC",A2,0),"^",2),X1=$P(^FHPT(FHDFN,"A",ADM,"DI",A2,0),"^",10) I X1'="",X1'>D1 G S1
  1. G:'A2 EXIT
  1. S X=$G(^FHPT(FHDFN,"A",ADM,"DI",A2,0)),FHOR=$P(X,"^",2,6),FHLD=$P(X,"^",7)
  1. I "^^^^"'[FHOR S Y=1 G EXIT
  1. I FHLD="N" S Y=2 G EXIT
  1. EXIT Q Y
  1. KIL D KIL^FHWOR K FHORN1,FHSTS Q