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

PSJBCBU.m

Go to the documentation of this file.
  1. PSJBCBU ;BIR/LDT-RETURN INFORMATION FOR AN ORDER IN HL7 FORMAT FOR BCMA CONTINGENCY PLAN;16 Mar 99 / 10:59 AM
  1. ;;5.0; INPATIENT MEDICATIONS ;**102**;16 DEC 97
  1. ;
  1. ; Reference to ^PS(55 is supported by DBIA 2191.
  1. ; Reference to ^%DTC is supported by DBIA 10000.
  1. ; Usage of this routine by BCMA BACKUP Software is supported by DBIA 3876.
  1. ;
  1. EN(DFN,ON,PSJNAME) ; return detail data for Inpatient Meds.
  1. ;Input
  1. ; DFN - Patient's IEN
  1. ; ON - Order number for patient including "U" for Unit Dose, "V" for IV, and "P" for pending orders
  1. ; PSJNAME - Array name to return information in
  1. N PSJBCBU S PSJBCBU=1
  1. I $G(ON)["U",$D(^PS(55,+$G(DFN),5,+ON,0)) D EN1^PSJHL2(DFN,"XX",ON)
  1. I $G(ON)["V",$D(^PS(55,+$G(DFN),"IV",+ON,0)) D EN1^PSJHL2(DFN,"XX",ON)
  1. I $G(ON)["P",$D(^PS(53.1,+ON,0)),$P($G(^PS(53.1,+ON,0)),"^",15)=DFN D EN1^PSJHL2(DFN,"XX",ON)
  1. I '$D(PSJNAME) S PSJNAME(0)=-1
  1. K ^TMP("PSJHLS",$J,"PS")
  1. Q
  1. ;
  1. EN2(DFN,BDT) ; return condensed list of inpat meds
  1. K ^TMP("PSJBU",$J)
  1. NEW FON,ON,WBDT,Y,%
  1. D:+$G(DFN) ORDER
  1. I '$D(^TMP("PSJBU",$J,1,0)) S ^(0)=-1
  1. K PSJINX
  1. Q
  1. ORDER ;Loop thru the orders.
  1. I '+$G(BDT) D NOW^%DTC S BDT=%
  1. I BDT'["." S BDT=BDT_".0001"
  1. S PSJINX=0
  1. ;* U/D orders
  1. S WBDT=BDT
  1. F S WBDT=$O(^PS(55,DFN,5,"AUS",WBDT)) Q:'WBDT D
  1. . F ON=0:0 S ON=$O(^PS(55,DFN,5,"AUS",WBDT,ON)) Q:'ON S FON=ON_"U" D TMP
  1. ;* IV orders
  1. S WBDT=BDT
  1. F S WBDT=$O(^PS(55,DFN,"IV","AIS",WBDT)) Q:'WBDT D
  1. . F ON=0:0 S ON=$O(^PS(55,DFN,"IV","AIS",WBDT,ON)) Q:'ON S FON=ON_"V" D TMP
  1. ;* Pending orders
  1. F PST="P","N" F ON=0:0 S ON=$O(^PS(53.1,"AS",PST,DFN,ON)) Q:'ON D
  1. . S FON=ON_"P" D TMP
  1. Q
  1. ;
  1. TMP ;* Setup ^TMP that have common fields between IV and U/D
  1. S PSJINX=PSJINX+1
  1. S ^TMP("PSJBU",$J,PSJINX,0)=DFN_U_+ON_U_FON
  1. Q