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

CIMGAGPR.m

Go to the documentation of this file.
CIMGAGPR ; CMI/TUCSON/LAB - ABERDEEN IMM REPORT ;  
 ;;1.0;ABERDEEN GPRA REPORT;;JAN 22, 2000
 ;;
 ;;INPUT VARIABLE
 ;;
 ;;     CIMDFN = PATIENT DFN
 ;;     CIMDAT = DATE FOR IMMUNIZATION STATUS
 ;;
 ;;OUTPUT VARIABLE = UPTODATE
 ;;
 ;;     UPTODATE = 1 = UPTODATE
 ;;     UPTODATE = 2 = NOT UPTODATE
 ;;
 ;;OUTPUT GLOBAL ARRAY
 ;;
 ;; ^TMP("CIMGAGPR",$J,"LASTNAME,FIRST NAME",CIMDFN,"NEEDS")="LIST OF IMMUNIZATIONS THE CHILD NEEDS"
 ;;
KIDS(CIMDFN,CIMDAT) ;EP;DETERMINE CHILDS IMMUNIZATION STATUS
 K ^TMP("CIMGAGPR",$J)
 ;D VARICELL
 N CIMIVDA,UPTODATE
 S CIMIVDA=0
 F  S CIMIVDA=$O(^AUPNVIMM("AC",CIMDFN,CIMIVDA)) Q:'CIMIVDA  D IMM
 S UPTODATE=2
 D COUNT
 Q UPTODATE
IMM ;EP;EVALUATE IMMUNIZATION
 N S,X,Y,Z,CIMS
 S X=$G(^AUPNVIMM(CIMIVDA,0))
 Q:'X
 Q:$P(+$G(^AUPNVSIT(+$P(X,U,3),0)),".")>$G(CIMDAT)
 S Y=$S($L($P($G(^AUTTIMM(+X,0)),U,20))=2:$P(^(0),U,20),1:$P($G(^(0)),U,3))
 Q:Y=""
 S CIMS=""
 I "^02^03^34^42^"[(U_Y_U) S Y="DTP"
 I "^06^07^"[(U_Y_U) S Y="IPV"
 I "^11^14^15^17^18^"[(U_Y_U) S Y="MMR"
 I "^35^37^38^39^"[(U_Y_U) S Y="HIB"
 I Y=10 S Y="HEPB"
 ;I Y=41 S Y="VAR"
 ;I Y=85 S Y="HEPA"
 Q:Y'?3U&(Y'?4U)
 S S=$P(X,U,4)
 I Y="DTP" D  Q:$G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,Y))>3
 .S:S>3 CIMS=4
 I Y="IPV" D  Q:$G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,Y))>2
 .S:S>2 CIMS=3
 I Y="MMR" D  Q:$G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,Y))>0
 .S:S>0 CIMS=1
 I Y="HIB" D  Q:$G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,Y))>2
 .S:S>2 CIMS=3
 I Y="HEPB" D  Q:$G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,Y))>2
 .S:S>2 CIMS=3
 S:S>CIMS S=CIMS
 S ^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,Y)=$S(S>($G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,Y))):S,1:$G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,Y))+1)
 Q
COUNT ;COUNT KIDS AND IMMUNIZATIONS
 ;I $G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,"HEPB"))>2,$G(^("DTP"))>3,$G(^("HIB"))>2,$G(^("IPV"))>1,$G(^("MMR"))>0,$G(^("VAR"))>0 S UPTODATE=1
 I $G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,"HEPB"))>2,$G(^("DTP"))>3,$G(^("HIB"))>2,$G(^("IPV"))>1,$G(^("MMR"))>0 S UPTODATE=1
 D NEEDS
 Q
NEEDS N HRN,NAME,NEEDS,COMMUNIT,DOB
 S NAME=$P($G(^DPT(CIMDFN,0)),U)
 Q:NAME=""
 S Y=$P($G(^DPT(CIMDFN,0)),U,3)
 X ^DD("DD")
 S DOB=Y
 S HRN=$P($G(^AUPNPAT(CIMDFN,41,DUZ(2),0)),U,2)
 S COMMUNIT=$P($G(^AUTTCOM(+$P($G(^AUPNPAT(CIMDFN,11)),U,17),0)),U)
 S:COMMUNIT="" COMMUNIT="NOT STATED"
 S NEEDS=""
 I $G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,"DTP"))<4 S NEEDS="DTaP"
 I $G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,"IPV"))<3 S NEEDS=NEEDS_$S(NEEDS]"":" & ",1:"")_"IPV"
 I $G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,"MMR"))<1 S NEEDS=NEEDS_$S(NEEDS]"":" & ",1:"")_"MMR"
 ;I $G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,"VAR"))<1 S NEEDS=NEEDS_$S(NEEDS]"":" & ",1:"")_"VAR"
 I $G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,"HIB"))<3 S NEEDS=NEEDS_$S(NEEDS]"":" & ",1:"")_"HIB"
 I $G(^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,"HEPB"))<3 S NEEDS=NEEDS_$S(NEEDS]"":" & ",1:"")_"HEPB"
 I '$D(UPTODATE) S ^TMP("CIMGAGPR",$J,"NOTUPTODATE",COMMUNIT,NAME)=DOB_U_HRN_U_NEEDS
 S:$G(NEEDS)]"" ^TMP("CIMGAGPR",$J,"CHILD",NAME,CIMDFN,"NEEDS")=NEEDS
 K ^TMP("CIMGAGPR",$J,"CHILD",CIMDFN)
 Q
VARICELL ;SET ARRAY OF ICD9 IEN'S FOR VARICELLA AND DETERMINE IF CHILD HAD DX OF
 ;VARICELLA, ICD9 DX 052.7, 052.8, OR 052.9
 N X,Y
 D:'$D(CIMT("VARICELLA"))  Q:'$D(CIMT("VARICELLA"))
 .F X="052.7","052.8","052.9" D
 ..S Y=$O(^ICD9("AB",X,0))
 ..Q:'Y
 ..S CIMT("VARICELLA",Y)=""
 S X=0
 F  S X=$O(^AUPNVPOV("AC",CIMDFN,X)) Q:'X  D
 .S Y=$G(^AUPNVPOV(X,0))
 .Q:'$D(CIMT("VARICELLA",+Y))
 .Q:$P(+$G(^AUPNVSIT(+$P(Y,U,3),0)),".")>CIMDAT
 .S ^TMP("CIMGAGPR",$J,"CHILD",CIMDFN,"VAR")=1
 Q