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

APCLDM8.m

Go to the documentation of this file.
  1. APCLDM8 ; IHS/CMI/LAB - PPD STUFF ;
  1. ;;2.0;IHS PCC SUITE;;MAY 14, 2009
  1. ;IHS/TUCSON/LAB - patch 1 - 05/27/97 fixed cumulative TB STATUS calculation modified subroutine TBTXST and PPDCODE
  1. ;
  1. ;
  1. START ;
  1. PPD ;EP
  1. S APCLX=APCLPD_"^LAST SKIN PPD" S APCLER=$$START1^APCLDF(APCLX,APCLY)
  1. I '$D(APCL(1)) S ^TMP("APCL",$J,20)="No recorded PPD"
  1. I $D(APCL(1)) S Y=$P(APCL(1),U) D DD^%DT S ^TMP("APCL",$J,20)=$S($P(^AUPNVSK(+$P(APCL(1),U,4),0),U,5)]"":$P(^(0),U,5)_"mm;",1:"")_$S($P(APCL(1),U,2)'="P":"NEGATIVE - "_Y,1:"POSITIVE - "_Y)
  1. TBTXST ;TB Treatment Status, 21 get last TB related health factor
  1. S %=$O(^ATXAX("B","DM AUDIT TB HEALTH FACTORS",0))
  1. I '% S ^TMP("APCL",$J,21)="TB Health Factor TAXONOMY MISSING!!" G PPDCODE ;IHS/TUCSON/LAB patch 1 - 05/27/97 - added this line
  1. I % D
  1. .S (X,Y)=0 F S X=$O(^AUPNHF("AA",APCLPD,X)) Q:X'=+X!(Y) I $D(^ATXAX(%,21,"B",X)) S Y=X
  1. .I Y S Y=$P(^AUTTHF(Y,0),U),^TMP("APCL",$J,21)=Y ;IHS/TUCSON/LAB - patch 1 - 05/27/97 modified this line
  1. ;I Y]"" S ^TMP("APCL",$J,21)=Y G TBCUML ;IHS/TUCSON/LAB - patch 1 - commented out this line and added line below
  1. I $D(^TMP("APCL",$J,21)) G TBCUML
  1. K APCL S APCLY="APCL(",APCLX=APCLPD_"^LAST HEALTH [DM AUDIT TB HEALTH FACTORS" S APCLER=$$START1^APCLDF(APCLX,APCLY)
  1. S ^TMP("APCL",$J,21)=$S($D(APCL(1)):$P(APCL(1),U,3),1:"TB Health Factor Not recorded")
  1. TBCUML I APCLCUML D
  1. .I ^TMP("APCL",$J,21)["Not recorded" S APCLGOT1=1,APCLSUB=94 D CUML^APCLDM1 F APCLSUB=90:1:93 S APCLGOT1=0 D CUML^APCLDM1
  1. .I ^TMP("APCL",$J,21)["TB - TX COMPLETE" S APCLGOT1=1,APCLSUB=90 D CUML^APCLDM1 F APCLSUB=91:1:94 S APCLGOT1=0 D CUML^APCLDM1
  1. .I ^TMP("APCL",$J,21)["TB - TX INCOMPLETE" S APCLGOT1=1,APCLSUB=91 D CUML^APCLDM1 F APCLSUB=90,92,93,94 S APCLGOT1=0 D CUML^APCLDM1
  1. .I ^TMP("APCL",$J,21)["TB - TX UNKNOWN" S APCLGOT1=1,APCLSUB=93 D CUML^APCLDM1 F APCLSUB=90,91,92,94 S APCLGOT1=0 D CUML^APCLDM1
  1. .I ^TMP("APCL",$J,21)["TB - TX UNTREATED" S APCLGOT1=1,APCLSUB=92 D CUML^APCLDM1 F APCLSUB=90,91,93,94 S APCLGOT1=0 D CUML^APCLDM1
  1. PPDCODE ;PPD STATUS CODE
  1. S APCLJ=""
  1. ;IHS/TUCSON/LAB - patch 1 - added the 2 lines below
  1. I $G(^TMP("APCL",$J,21))="TB - TX COMPLETE" S APCLJ=1 G PPDCUML
  1. I $G(^TMP("APCL",$J,21))["TB - " S APCLJ=2 G PPDCUML
  1. I ^TMP("APCL",$J,20)["POSITIVE" D G PPDCUML
  1. .I $G(^TMP("APCL",$J,21))="TB - TX COMPLETE" S APCLJ=1
  1. .S APCLJ=2
  1. .Q
  1. I ^TMP("APCL",$J,20)["NEGATIVE" S APCLJ=5 D G PPDCUML
  1. .I ^TMP("APCL",$J,37)["not recorded" S APCLJ=5 Q
  1. .S X=^TMP("APCL",$J,37),%DT="" D ^%DT S APCLI=Y,X=$P(^TMP("APCL",$J,20),"- ",2),%DT="" D ^%DT S APCLJ=$S(Y>APCLI:3,1:4)
  1. .Q
  1. S APCLJ=6
  1. PPDCUML ;cumulative PPD
  1. S ^TMP("APCL",$J,36)=$P($T(@APCLJ),";;",2)_" ("_APCLJ_")"
  1. Q:'APCLCUML
  1. S APCLI="70,71,72,73,74,75" F APCLX=1:1:6 S APCLSUB=$P(APCLI,",",APCLX),APCLGOT1=$S(APCLJ=APCLX:1,1:0) D CUML^APCLDM1
  1. Q
  1. ;
  1. TBCODE(DFN) ;
  1. NEW APCLJ,APCLI
  1. S APCLJ=""
  1. ;return computed TB Status Code
  1. I ^TMP("APCL",$J,20)["POSITIVE" D Q APCLJ
  1. .I $G(^TMP("APCL",$J,21))="TB - TX COMPLETE" S APCLJ=1
  1. .S APCLJ=2
  1. .Q
  1. I ^TMP("APCL",$J,20)["NEGATIVE" S APCLJ=4 D Q APCLJ
  1. .I ^TMP("APCL",$J,37)["not recorded" S APCLJ=4 Q
  1. .S X=^TMP("APCL",$J,37),%DT="" D ^%DT S APCLI=Y,X=$P(^TMP("APCL",$J,20),"- ",2),%DT="" D ^%DT S X=$S(Y>APCLI:3,1:4)
  1. .Q
  1. S APCLJ=4
  1. Q APCLJ
  1. ;;
  1. 1 ;;PPD +, treatment complete
  1. 2 ;;PPD +, not treated or unknown treatment
  1. 3 ;;PPD -, up-to-date (placed after dm dx)
  1. 4 ;;PPD -, before DM dx
  1. 5 ;;PPD -, DM dx date unknown
  1. 6 ;;PPD Status unknown