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

PSIVBCID.m

Go to the documentation of this file.
  1. PSIVBCID ;BIR/JLC - BAR CODE ID SUBROUTINES ;16 FEB 01
  1. ;;5.0;INPATIENT MEDICATIONS;**58,80,146,397**;16 DEC 97;Build 7
  1. ;
  1. ; Reference to ^PS(55 supported by DBIA 2191.
  1. ;
  1. BCMA(PSJDFN,PSJON,PSIVCTD,PSIV1,PSIV2,PSIVNOL) ;determine unique ID# for bar code labels and update initial data for bar code ID
  1. ;Input: PSJDFN - patient's DFN
  1. ; PSJON - patient's ON - order number
  1. ; PSJBCID - bar code ID to be filed
  1. ; PSIVCTD - the $D(PSIVCT) from the calling routine, if PSIVCT was defined, then the labels won't be counted
  1. ; PSIV1 - current label number
  1. ; PSIV2 -
  1. ; PSIVNOL - total number of labels
  1. ;
  1. ;Output: PSJBCID - unique ID# for this label
  1. ; format: DFN_"A"_ON"_seq#
  1. ; If unable to calculate ID #, return "ERROR"
  1. ;
  1. S PSIV1=$G(PSIV1),PSIV2=$G(PSIV2),PSIVNOL=$G(PSIVNOL)
  1. L +^PS(55,PSJDFN,"IVBCMA"):10
  1. E W "Waiting for lock..." F L +^PS(55,PSJDFN,"IVBCMA"):5 Q:$T W "."
  1. S SEQ=$O(^PS(55,PSJDFN,"IVBCMA"," "),-1)
  1. S PSJBCID=PSJDFN_"V"_(SEQ+1)
  1. D UP1^PSIVBCID(DFN,ON,PSJBCID,PSIVCTD,PSIV1,PSIV2,PSIVNOL)
  1. L -^PS(55,PSJDFN,"IVBCMA")
  1. Q PSJBCID
  1. ;
  1. UP1(DFN,ON,PSJBCID,PSIVCTD,PSIV1,PSIV2,PSIVNOL) ;update initial data for bar code ID
  1. ;Input: DFN - patient's IEN
  1. ; ON - Order number for this bar code ID
  1. ; PSJBCID - bar code ID to be filed
  1. ; PSIVCTD - the $D(PSIVCT) from the calling routine, if PSIVCT was defined, then the labels won't be counted
  1. ; PSIV1 - current label number
  1. ; PSIV2 -
  1. ; PSIVNOL - total number of labels
  1. ;
  1. ;Output: PSJBLN - label sequence number
  1. ;
  1. S PSIV1=$G(PSIV1),PSIV2=$G(PSIV2),PSIVNOL=$G(PSIVNOL)
  1. K DIC,DIE,DO S DIC(0)="L",DA(1)=DFN,X=PSJBCID,DIC="^PS(55,"_DA(1)_",""IVBCMA""," D FILE^DICN
  1. K DA,DR,DIE S DIE=DIC,DA=+Y,DA(1)=DFN,PSJBLN=DA D NOW^%DTC
  1. S DR=".02////"_+ON_";3////"_$S(PSIVCTD:0,1:1)_";4////"_%_";6////"_PSIV1_"["_$S(PSIV1:PSIVNOL,1:PSIV2)_"]" D ^DIE
  1. K DIC,DIE,D0,DA,DR
  1. Q
  1. UP2(DFN,PSJBLN,PSIV,YY) ;update additive data for bar code ID
  1. ;
  1. ;Input: DFN - Patient's IEN
  1. ; PSJBLN - The IEN for the bar code ID
  1. ; PSIV - the sequence number for this additive
  1. ; YY - ADDITIVE ^ STRENGTH ^ BOTTLE
  1. ;
  1. K DA,DR,DIC,DO S DIC(0)="L",DA(1)=DFN,DA(2)=PSJBLN,X=PSIV,DIC="^PS(55,"_DA(1)_",""IVBCMA"","_DA(2)_",""AD""," D FILE^DICN
  1. K DA,DR,DIE S DIE=DIC,DA=+Y,DA(1)=PSJBLN,DA(2)=DFN S DR=".01////"_$P(YY,U)_";1////"_$P(YY,U,2)_";2////"_$P(YY,U,3) D ^DIE
  1. K DA,DR,DIC,D0,DIE
  1. Q
  1. ;
  1. UP3(DFN,PSJBLN,PSIV,YY) ;update solution data for bar code ID
  1. ;
  1. ;Input: DFN - Patient's IEN
  1. ; PSJBLN - The IEN for the bar code ID
  1. ; PSIV - the sequence number for this solution
  1. ; YY - SOLUTION ^ VOLUME
  1. ;
  1. K DA,DR,DIC,DO S DIC(0)="L",DA(1)=DFN,DA(2)=PSJBLN,X=$P(PSIV,U),DIC="^PS(55,"_DA(1)_",""IVBCMA"","_DA(2)_",""SOL""," D FILE^DICN
  1. K DA,DR,DIE S DIE=DIC,DA=+Y,DA(1)=PSJBLN,DA(2)=DFN S DR=".01////"_$P(YY,U)_";1////"_$P(YY,U,2) D ^DIE
  1. K DA,DR,DIC,D0,DIE
  1. Q