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

APCPHPOV.m

Go to the documentation of this file.
APCPHPOV ; IHS/TUCSON/LAB - GET POV INFO FOR INPATIENT RECORD AUGUST 14, 1992 ; [ 02/14/00 2:23 PM ]
 ;;2.0;IHS PCC DATA EXTRACTION SYSTEM;**4**;APR 03, 1998
 ;IHS/CMI/LAB - patch 4 # of dxs increased to 9
 ;
 K APCPE("ERROR")
START ;
 S (APCPH("AAC"),APCPH("AAP"),APCPH("INJ"),APCPHDX1,APCPHDX2,APCPHDX3,APCPHDX4,APCPHDX5,APCPHDX6,APCPHHA1,APCPHHA2,APCPHHA3,APCPHHA4,APCPHHA5,APCPHHA6)=""
 S (C,O)=0 F  S O=$O(^AUPNVPOV("AD",APCP("V DFN"),O)) Q:C>0!(O'=+O)!($D(APCPE("ERROR")))  I $P(^AUPNVPOV(O,0),U,12)="P" S C=C+1 D GETPOV
 I $D(APCPE("ERROR")) Q
 S O=0 F  S O=$O(^AUPNVPOV("AD",APCP("V DFN"),O)) Q:O'=+O!($D(APCPE("ERROR")))!(C>8)  I $P(^AUPNVPOV(O,0),U,12)'="P" S C=C+1 D GETPOV ;IHS/CMI/LAB - fix # of povs per Cheryl Chase
EOJ ;
 K APCPT,X,Y,I,M,N,O,C
 Q
 ;
GETPOV ;
 S APCPT("ICD PTR")=$P(^AUPNVPOV(O,0),U),APCPT("ICD")=$P(^ICD9(APCPT("ICD PTR"),0),U) D ^APCPCICD
 Q:$D(APCPE("ERROR"))
 I $D(APCPT("AGEE")),APCPV("SRV CAT")="H",'$D(^APCDINPT(9,11,"AC",APCPT("ICD"))) S APCPE("ERROR")="E046" Q
 I $D(APCPT("AGEE")),'$D(APCPV("ACC")) S APCPE("ERROR")="E048" Q
 S APCPH("POV",C)=APCPT("ICD")
 I $P(APCPT("ICD"),".")>799,APCPH("INJ")="" D RIJ
 I $P(APCPT("ICD"),".")>799,APCPH("AAP")="" S X=$P(^AUPNVPOV(O,0),U,11) I X]"" S APCPH("AAP")=$S(X="A":"01",X="B":"02",X="C":"03",X="D":"04",X="E":"05",X="F":"06",X="G":"07",X="H":"08",X="I":"09",X="J":"10",X="K":"11",X="L":"12",1:"  ")
 S APCPH("HOSP AQ")=$P(^AUPNVPOV(O,0),U,7) I APCPH("HOSP AQ")'=1 S APCPH("HOSP AQ")=""
 S APCPT("ICD")=$P(APCPT("ICD"),".")_$P(APCPT("ICD"),".",2),N=$L(APCPT("ICD"))+1 F M=N:1:5 S APCPT("ICD")=APCPT("ICD")_" "
SETPOV S APCPH("VAR")="APCPHDX"_C S @APCPH("VAR")=APCPT("ICD")
 S APCPH("VAR")="APCPHHA"_C S @APCPH("VAR")=APCPH("HOSP AQ")
 Q
RIJ ;
 S APCPH("INJP")=$P(^AUPNVPOV(O,0),U,9) Q:APCPH("INJP")=""
 S APCPH("HOLD")=APCPT("ICD"),APCPT("ICD")=$P(^ICD9(APCPH("INJP"),0),U)
 I $E(APCPT("ICD"))'="E" S APCPE("ERROR")="E005" Q
 S APCPT("ICD")=$E(APCPT("ICD"),2,99)
 D ^APCPCICD
 S APCPH("INJ")=APCPT("ICD"),APCPT("ICD")=APCPH("HOLD") K APCPH("HOLD")
 Q:$D(APCPE("ERROR"))
 S APCPH("INJ")=$P(APCPH("INJ"),".")_$P(APCPH("INJ"),".",2),N=$L(APCPH("INJ"))+1 F M=N:1:4 S APCPH("INJ")=APCPH("INJ")_" "
 ;
 Q