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

APCLVDR.m

Go to the documentation of this file.
APCLVDR ; IHS/CMI/LAB - driver for visit record generation ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;
 ;
VREC(APCLVIEN,APCLRTYP) ;PEP - called to send back a visit record as
 ;apcdfv=visit ien
 ;apcdrtyp=type of record in output definition file
 NEW APCLREC,APCLX,APCL
 S APCLREC=""
 I '$G(APCLVIEN) Q APCLREC
 I '$D(^AUPNVSIT(APCLVIEN)) Q APCLREC
 I $P(^AUPNVSIT(APCLVIEN,0),U,11) Q APCLREC
 I '$D(^AUPNVPOV("AD",APCLVIEN)) Q APCLREC
 I '$D(^AUPNVPRV("AD",APCLVIEN)) Q APCLREC
 S APCLRTYP("IEN")=$O(^APCLRECD("B",APCLRTYP,0))
 I 'APCLRTYP("IEN") Q APCLREC
 X:$G(^APCLRECD(APCLRTYP("IEN"),12))]"" ^APCLRECD(APCLRTYP("IEN"),12)
PROC ;
 S APCLX=0
 F  S APCLX=$O(^APCLRECD(APCLRTYP("IEN"),11,"AC",APCLX)) Q:APCLX'=+APCLX!(APCLREC=-1)  S APCL=$O(^APCLRECD(APCLRTYP("IEN"),11,"AC",APCLX,0))  D
 .S X="" X:$D(^APCLRECD(APCLRTYP("IEN"),11,APCL,11)) ^APCLRECD(APCLRTYP("IEN"),11,APCL,11)
 .I X["-1" S APCLREC=-1 Q
 .I X="",$P(^APCLRECD(APCLRTYP("IEN"),11,APCL,0),U,5) S APCLREC=-1 Q
 .;I X'[-1 S APCLREC=APCLREC_X
 .I X'[-1 S $E(APCLREC,$P(^APCLRECD(APCLRTYP("IEN"),11,APCL,0),U,2))=X
 ;S $E(APCLREC)=$P(^APCLRECD(APCLRTYP("IEN"),0),U,2)
 K APCLV0
 Q APCLREC
PREC(DFN,APCLRTYP) ;EP -create a patient record
 NEW APCLREC,APCLX,APCL
 S APCLREC=""
 I '$G(DFN) Q APCLREC
 I '$D(^DPT(DFN)) Q APCLREC
 S APCLRTYP("IEN")=$O(^APCLRECD("B",APCLRTYP,0))
 I 'APCLRTYP("IEN") Q APCLREC
 X:$G(^APCLRECD(APCLRTYP("IEN"),12))]"" ^APCLRECD(APCLRTYP("IEN"),12)
PPROC ;
 S APCLX=0
 F  S APCLX=$O(^APCLRECD(APCLRTYP("IEN"),11,"AC",APCLX)) Q:APCLX'=+APCLX!(APCLREC=-1)  S APCL=$O(^APCLRECD(APCLRTYP("IEN"),11,"AC",APCLX,0))  D
 .S X="" X:$D(^APCLRECD(APCLRTYP("IEN"),11,APCL,11)) ^APCLRECD(APCLRTYP("IEN"),11,APCL,11)
 .I X["-1" S APCLREC=-1 Q
 .I X="",$P(^APCLRECD(APCLRTYP("IEN"),11,APCL,0),U,5) S APCLREC=-1 Q
 .;I X'[-1 S APCLREC=APCLREC_X
 .I X'[-1 S $E(APCLREC,$P(^APCLRECD(APCLRTYP("IEN"),11,APCL,0),U,2))=X
 ;S $E(APCLREC)=$P(^APCLRECD(APCLRTYP("IEN"),0),U,2)
 Q APCLREC