PSOHLEXC ;BIR/RTR-Process exceptions in HL7 message ;07/01/02 ;;7.0;OUTPATIENT PHARMACY;**111**;DEC 1997 ;External reference to ^PSDRUG supported by DBIA 221 ;External reference to ^VA(200 supported by DBIA 224 ; ;Don't worry about ICN, just get it when you build message CHECK ;Check for application acknowledgement exceptions I $G(HL("SAN"))="" S PSOEXMS="Missing sending application name." D NAK Q S PSOHY("EXAPP")=HL("SAN") I '$G(PSOHY("PAT"))!('$D(^DPT(+$G(PSOHY("PAT")),0))) S PSOEXMS="Invalid patient entry." D NAK Q I +$P($G(^DPT(PSOHY("PAT"),.35)),"^") S PSOEXMS="Patient is deceased." D NAK Q I $G(PSOHY("OCC"))'="NW" S PSOEXMS="Invalid Order Control Code." D NAK Q I '$G(PSOHY("LOC")) S PSOEXMS="No Patient Location." D NAK Q I $G(PSOHY("CHNUM"))="" S PSOEXMS="Missing CHCS Placer Order Number." D NAK Q I $D(^PS(52.41,"C",PSOHY("CHNUM"),PSOHY("EXAPP"))) S PSOEXMS="Duplicate order number in Outpatient Pending file." D NAK Q I $D(^PSRX("D",PSOHY("CHNUM"),PSOHY("EXAPP"))) S PSOEXMS="Duplicate order number in Outpatient Prescription file." D NAK Q I $G(PSOHY("REF"))="" S PSOEXMS="Missing number of refills." D NAK Q I $G(PSOHY("SDT"))="" S PSOEXMS="Missing effective date." D NAK Q I '$G(PSOHY("ENTER")) S PSOEXMS="Missing Entered by data." D NAK Q ;Drug exceptions I '$G(PSOHY("DRUG"))!('$D(^PSDRUG(+$G(PSOHY("DRUG")),0))) S PSOEXMS="Invalid drug entry." D NAK Q I $P($G(^PSDRUG(PSOHY("DRUG"),2)),"^",3)'["O" S PSOEXMS="Drug not marked for outpatient use." D NAK Q I $P($G(^PSDRUG(PSOHY("DRUG"),"I")),"^"),$P($G(^("I")),"^")