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

PSOHDR.m

Go to the documentation of this file.
  1. PSOHDR ;BIR/RTR-Send order update message to HDR ;06/27/03
  1. ;;7.0;OUTPATIENT PHARMACY;**181,205**;DEC 1997
  1. ;External reference to PSDRUG supported by DBIA 221
  1. ;External reference to VDEFQM supported by DBIA 4253
  1. ;
  1. ;PSOHDRTP = Type of message, PRES=fill, PPAR=partial, PREF=refill
  1. ;PSOHDRNM = Internal entry number of order
  1. ;
  1. EN(PSOHDRTP,PSOHDRNM) ; Entry point for VDEF calls
  1. Q:'$G(PSOHDRNM)
  1. Q:$G(PSOHDRTP)=""
  1. I $T(QUEUE^VDEFQM)']"" Q
  1. I '$D(^PSRX(PSOHDRNM,0)) Q
  1. ;Check for test patient
  1. I $T(TESTPAT^VADPT)]"" Q:$$TESTPAT^VADPT(+$P($G(^PSRX(PSOHDRNM,0)),"^",2))
  1. N PSOHDRX,PSOHDRA,PSOHDRB
  1. S PSOHDRA=$S(PSOHDRTP="PRES":"RDE^O11",PSOHDRTP="PPAR":"RDS^O13",PSOHDRTP="PREF":"RDS^O13",1:"")
  1. Q:PSOHDRA=""
  1. S PSOHDRB="SUBTYPE="_PSOHDRTP_"^IEN="_PSOHDRNM
  1. S PSOHDRX=$$QUEUE^VDEFQM(PSOHDRA,PSOHDRB)
  1. Q
  1. ;
  1. ;Return NDC number
  1. NDC(PSOVIEN,PSOVFILL,PSOVTYPE) ;
  1. ;PSOVIEN = Internal prescription number
  1. ;PSOVFILL = Fill Number
  1. ;PSOVTYPE = "R" for refill, "P" for Partial
  1. N PSOVNDC,PSOVNX,PSOVY,PSOVDRG
  1. S (PSOVNDC,PSOVNX)=""
  1. I $G(PSOVIEN)'>0 Q PSOVNDC
  1. I '$D(^PSRX(PSOVIEN,0)) Q PSOVNDC
  1. I $G(PSOVFILL)="" Q PSOVNDC
  1. I PSOVFILL=0 D D:PSOVNX'="" FORMAT Q PSOVNDC
  1. .D CMOP I PSOVNX'="" Q
  1. .;I $P($G(^PSRX(PSOVIEN,"NDC")),"^")'="" S PSOVNX=$P(^("NDC"),"^") Q
  1. .I $P($G(^PSRX(PSOVIEN,2)),"^",7)'="" S PSOVNX=$P(^(2),"^",7) Q
  1. .D DRUG
  1. I $G(PSOVFILL)'>0 Q PSOVNDC
  1. I $G(PSOVTYPE)'="R",$G(PSOVTYPE)'="P" Q PSOVNDC
  1. I PSOVTYPE="R" D D:PSOVNX'="" FORMAT Q PSOVNDC
  1. .D CMOP I PSOVNX'="" Q
  1. .;I $P($G(^PSRX(PSOVIEN,1,PSOVFILL,"NDC")),"^")'="" S PSOVNX=$P(^("NDC"),"^") Q
  1. .I $P($G(^PSRX(PSOVIEN,1,PSOVFILL,1)),"^",3)'="" S PSOVNX=$P(^(1),"^",3) Q
  1. .D DRUG
  1. I PSOVTYPE="P" D D:PSOVNX'="" FORMAT Q PSOVNDC
  1. .I $P($G(^PSRX(PSOVIEN,"P",PSOVFILL,0)),"^",12)'="" S PSOVNX=$P(^(0),"^",12) Q
  1. .D DRUG
  1. Q PSOVNDC
  1. ;
  1. FORMAT ;format NDC
  1. S PSOVNDC=$G(PSOVNX)
  1. Q
  1. CMOP ;Find NDC for CMOP fill
  1. F PSOVY=0:0 S PSOVY=$O(^PSRX(PSOVIEN,4,PSOVY)) Q:'PSOVY D
  1. .I $P($G(^PSRX(PSOVIEN,4,PSOVY,0)),"^",3)=PSOVFILL,$P($G(^(0)),"^",8)'="" S PSOVNX=$P($G(^(0)),"^",8)
  1. Q
  1. DRUG ;Get NDC from Drug file
  1. S PSOVDRG=$P($G(^PSRX(PSOVIEN,0)),"^",6) I PSOVDRG,$P($G(^PSDRUG(+$G(PSOVDRG),2)),"^",4)'="" S PSOVNX=$P(^(2),"^",4)
  1. Q