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

APCSSIL2.m

Go to the documentation of this file.
APCSSIL2 ; IHS/CMI/LAB - H1N1 SURVEILLANCE EXPORT 02 Nov 2009 8:28 AM ; 09 Dec 2009  2:54 PM
 ;;2.0;IHS PCC SUITE;**5**;MAY 14, 2009
 ;
 ;
SETREC ;EP - called from
 ;set delimited record
 S C=","
 S APCSREC=$$UID(DFN)
 S $P(APCSREC,",",2)=$S($$HRN^AUPNPAT(DFN,APCSLOC)]"":$$HRN^AUPNPAT(DFN,APCSLOC),1:$$HRN^AUPNPAT(DFN,DUZ(2)))   ;hrn at location of encounter, if none, then hrn at duz(2)
 S $P(APCSREC,",",3)=$P(^DPT(DFN,0),U,2)
 S $P(APCSREC,",",4)=$$JDATE($P(^DPT(DFN,0),U,3))
 S $P(APCSREC,",",5)=$$COMMRES^AUPNPAT(DFN,"C")
 S $P(APCSREC,",",6)=$P(^AUTTLOC(APCSLOC,0),U,10)
 S $P(APCSREC,",",7)=$$JDATE(APCSDATE)
 ;povs
 S X=0,APCSC=7 S Y=$P(APCSILI,U,2,99) F X=1:1 S Z=$P(Y,U,X) Q:APCSC>9!(Z="")  I Z]"" S APCSC=APCSC+1,$P(APCSREC,",",APCSC)=Z
 S APCSTEMP=""
 S X=0 F  S X=$O(^AUPNVMSR("AD",APCSV,X)) Q:X'=+X  D
 .Q:$P($G(^AUPNVMSR(X,2)),U,1)
 .Q:$$VAL^XBDIQ1(9000010.01,X,.01)'="TMP"  ;not a temperature
 .S V=$P(^AUPNVMSR(X,0),U,4)
 .S APCSTEMP=$S(V>APCSTEMP:V,1:APCSTEMP)
 .S $P(APCSREC,",",11)=APCSTEMP
 S $P(APCSREC,",",12)=$S($P($G(^AUPNVSIT(APCSV,11)),U,14)]"":$P($G(^AUPNVSIT(APCSV,11)),U,14),1:$$UIDV^AUPNVSIT(APCSV))
 S $P(APCSREC,",",14)=$$JDATE($P(^AUPNVSIT(APCSV,0),U,13))
 S $P(APCSREC,",",15)=$P(^AUPNVSIT(APCSV,0),U,7)
 S $P(APCSREC,",",16)=$$DSCHTYPE^APCLSIL2(APCSV)
 S $P(APCSREC,",",17)=$$JDATE($$DSCHDATE^APCLSIL2(APCSV))
 S APCSREF="" I APCSH1N1!(APCSILI) S APCSREF=$$REF^APCLSIL2(APCSV) D
 .S $P(APCSREC,",",18)=$P(APCSREF,U)
 .S $P(APCSREC,",",19)=$P(APCSREF,U,2)
 ;S $P(APCSREC,",",21)=$P(APCSHVAC,U,2)
 S $P(APCSREC,",",22)=$P(APCSIVAC,U,2)
 ;S APCSADV="" I APCSHVAC S $P(APCSREC,",",23)=$$ADV(APCSV)
 S APCSASDM=$$ASTDM^APCLSIL2(DFN,$$VD^APCLV(APCSV))
 S $P(APCSREC,",",33)=$P(APCSASDM,U,1)
 S $P(APCSREC,",",34)=$P(APCSASDM,U,2)
 S APCSBMI=$$BMI^APCLSIL2(DFN,$$VD^APCLV(APCSV))
 S $P(APCSREC,",",35)=$$OB^APCLSIL2(DFN,$P(APCSBMI,U,1),$$AGE^AUPNPAT(DFN,$P(APCSBMI,U,6)))
 S $P(APCSREC,",",36)=$$PN^APCLSIL1(DFN,APCSV)
 S $P(APCSREC,",",37)=$$R^APCLSIL2($P(APCSBMI,U,1))
 S $P(APCSREC,",",38)=$$JDATE($P(APCSBMI,U,6))
 S %=$$PNEU^APCLSIL2(DFN,DT)
 S $P(APCSREC,",",39)=$P(%,U,2)
 S $P(APCSREC,",",40)=$P(%,U,1)
 S $P(APCSREC,",",41)=$$CLINIC^APCLV(APCSV,"C")
 S $P(APCSREC,",",43)=$P(APCSH1N1,U,2)
 ;S $P(APCSREC,",",44)=$P(APCSADVE,U,2)
 S $P(APCSREC,",",45)=$P(APCSSRD,U,2)
 S $P(APCSREC,",",46)=$P(APCSSRD,U,3)
 S $P(APCSREC,",",47)=$P(APCSSRD,U,4)
 S $P(APCSREC,",",48)=$P(APCSSRD,U,5)
 ;S $P(APCSREC,",",49)=$P(APCSAV9,U,2)
 ;S $P(APCSREC,",",50)=$P(APCSAV9,U,3)
 ;S $P(APCSREC,",",51)=$P(APCSAV9,U,4)
 ;S $P(APCSREC,",",52)=$P(APCSAV9,U,5)
 ;I $P(APCSHVAC,U,2)=125 S $P(APCSREC,",",53)=$$H1N1LIVE(APCSV)
 S $P(APCSREC,",",59)=$$STRIP^XLFSTR($P(APCSAVM,U,2),",")
 S $P(APCSREC,",",60)=$$STRIP^XLFSTR($P(APCSAVM,U,3),",")
 ;S $P(APCSREC,",",61)=$$STRIP^XLFSTR($P(APCSHVAC,U,3),",")
 ;S $P(APCSREC,",",62)=$$STRIP^XLFSTR($P(APCSHVAC,U,4),",")
 S $P(APCSREC,",",63)="p27"
 S $P(APCSREC,",",64)=$$STRIP^XLFSTR($P(APCSIVAC,U,3),",")
 S $P(APCSREC,",",65)=$$STRIP^XLFSTR($P(APCSIVAC,U,4),",")
 S $P(APCSREC,",",66)=$P(APCSADVE,U,2)
 S $P(APCSREC,",",71)=APCSOVAC
 S APCSVTOT=APCSVTOT+1
 S ^APCSDATA($J,APCSVTOT)=APCSREC
 Q
 ;
DATE(D) ;
 Q (1700+$E(D,1,3))_$E(D,4,5)_$E(D,6,7)
 ;
JDATE(D) ;
 I $G(D)="" Q ""
 NEW A
 S A=$$FMTE^XLFDT(D)
 Q $E(D,6,7)_$$UP^XLFSTR($P(A," ",1))_(1700+$E(D,1,3))
 ;
UID(APCSA) ;Given DFN return unique patient record id.
 I '$G(APCSA) Q ""
 I '$D(^AUPNPAT(APCSA)) Q ""
 ;
 Q $$GET1^DIQ(9999999.06,$P(^AUTTSITE(1,0),U),.32)_$E("0000000000",1,10-$L(APCSA))_APCSA
 ;