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

APCLTAX1.m

Go to the documentation of this file.
APCLTAX1 ; IHS/CMI/LAB - TAXONOMY SYSTEM CON'T ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;;
 ;
EN D CLEAR^VALM1
 W !?5,"Select diagnosis(es) to add to the"
 W !!?5,APCLTNAM," Taxonomy"
 S DIR(0)="FO^1:20"
 S DIR("A",1)="Enter a Diagnosis, an ICD Code"
 S DIR("A")="or a Range of ICD9 codes"
 S DIR("?",1)="    Enter a diagnosis such as: 'DIABETES'"
 S DIR("?",2)="      or an ICD9 Code such as: '250.00'"
 S DIR("?")="a range of ICD9 Codes such as: '250.00-250.93'"
 W !
 D DIR^APCLDIC
 I X=""!$D(APCLQUIT) S APCLQUIT="" Q
 D EVAL
 Q
EVAL ;EVALUATE USERS INPUT
 K APCL,APCLX
 N APCL1,APCL2
 S APCL1=+$P(X,"-")
 S APCL2=+$P(X,"-",2)
 S APCL1=$TR(APCL1," ","")
 S APCL2=$TR(APCL2," ","")
 S:APCL1 APCLX(APCL1)=""
 S:APCL2 APCLX(APCL2)=""
 S APCLLOW=$O(APCLX(""))
 S APCLHIGH=$S(APCLLOW]"":$O(APCLX(APCLLOW)),1:"")
 S APCL("LOW")=""
 S APCL("HIGH")=""
 F APCLX="APCLLOW","APCLHIGH" D:APCLX]""
 .S X=@APCLX
 .S DIC="^ICD9("
 .S DIC(0)="EMQZ"
 .W !!
 .D DIC^APCLDIC
 .I +Y>0 D
 ..S:APCLX="APCLLOW" APCL("LOW")=$P(Y(0),U)_U_$P(Y(0),U,3)
 ..S:APCLX="APCLHIGH" APCL("HIGH")=$P(Y(0),U)_U_$P(Y(0),U,3)
 I APCL("LOW")="",APCL("HIGH")="" S APCLQUIT="" Q
 I APCL("LOW")="",APCL("HIGH")]"" S APCL("LOW")=APCL("HIGH"),APCL("HIGH")=""
 D VERIFY
 Q
VERIFY W @IOF
 D IN
 I '$D(APCL("FINAL")) D
 .W !!?5,"Add the following diagnos",$S(APCL("HIGH")]"":"es",1:"is")," to the"
 .W !?5,APCLTNAM," Taxonomy"
 I $D(APCL("FINAL")) D
 .W !!?5,"You selected the range of diagnoses"
 .W !?5,"listed below to add to this Taxonomy:"
 I APCL("HIGH")]"" D
 .W !!?5,$P(APCL("LOW"),U),?35,"-",?40,$P(APCL("HIGH"),U)
 .W !?5,$P(APCL("LOW"),U,2),?35,"-",?40,$P(APCL("HIGH"),U,2)
 I APCL("HIGH")="" D
 .W !!?5,$P(APCL("LOW"),U),?35,$P(APCL("LOW"),U,2)
 I $D(APCL("IN")) D
 .W !!?5,"The diagnos",$S(APCL("HIGH")]"":"es",1:"is")," you chose overlap the existing range:"
 .W !!?5,$P(APCL("IN"),U),?35,"-",?40,$P(APCL("IN"),U,2)
 I $D(APCL("FINAL")) D
 .W !!?5,"The range which includes all these diagnoses is:"
 .W !!?5,$P(APCL("FINAL"),U),?35,"-",?40,$P(APCL("FINAL"),U,2)
 S DIR(0)="YO"
 S DIR("A")="Is this what you want"
 S DIR("B")="YES"
 W !
 D DIR^APCLDIC
 I Y'=1 S APCLQUIT="" Q
 I $D(APCL("IN")) D
 .S DA(1)=APCLTDA
 .S DA=$P(APCL("IN"),U,3)
 .S DIK="^ATXAX("_DA(1)_",21,"
 .D DIK^APCLDIC
 I $D(APCL("FINAL")) D
 .S APCL("LOW")=$P(APCL("FINAL"),U)
 .S APCL("HIGH")=$P(APCL("FINAL"),U,2)
 Q
IN ;CHECK IF SELECTED DX OR RANGE IS ALREADY IN ANOTHER RANGE
 N X,Y,Z,APCLX
 S X=0
 F  S X=$O(^ATXAX(APCLTDA,21,X)) Q:'X  D
 .S Y=$G(^ATXAX(APCLTDA,21,X,0))
 .I $P(Y,U)]"",$P(Y,U)'=$P(Y,U,2) S APCLX($P(Y,U))=X_U_$S($P(Y,U,2)]"":$P(Y,U,2),1:$P(Y,U))
 S X=""
 F  S X=$O(APCLX(X)) Q:X=""  D
 .I $P(APCL("LOW"),U)=X!($P(APCL("LOW"),U)>X),$P(APCL("LOW"),U)<$P(APCLX(X),U,2) D
 ..S APCL("IN")=X_U_$P(APCLX(X),U,2)_U_+APCLX(X)
 ..S APCL("FINAL")=X_U_$S($P(APCLX(X),U,2)>$P(APCL("HIGH"),U):$P(APCLX(X),U,2),1:$P(APCL("HIGH"),U))
 .I $P(APCL("LOW"),U)=X!($P(APCL("LOW"),U)<X),$P(APCL("HIGH"),U)>X D
 ..S APCL("IN")=X_U_$P(APCLX(X),U,2)_U_+APCLX(X)
 ..S APCL("FINAL")=$P(APCL("LOW"),U)_U_$S($P(APCLX(X),U,2)>$P(APCL("HIGH"),U):$P(APCLX(X),U,2),1:$P(APCL("HIGH"),U))
 .I $P(APCL("LOW"),U)=X!($P(APCL("LOW"),U)<X),$P(APCL("HIGH"),U)>$P(APCLX(X),U,2) D
 ..S APCL("IN")=X_U_$P(APCLX(X),U,2)_U_+APCLX(X)
 ..S APCL("FINAL")=$P(APCL("LOW"),U)_U_$P(APCL("HIGH"),U)
 Q
Y ;EP;EVALUATE OUTPUT FROM TAXONOMY FOR PROPER EXTERNAL DISPLAY
 S APCLLOW=$P(X,U),APCLHIGH=$P(X,U,2)
 I "^RX^PATIENT ED TOPIC^HEALTH FACTORS^PROVIDER^OTHER^ADA CODE^"[(U_APCLANAM_U) D YCON
 Q
X ;EP;EVALUATE X FOR PROPER INTERNAL VALUE
 I APCLANAM="OTHER",APCLCANN=0 D  Q
 .I '+Y S X=Y(0,0)
 .E  S X=+Y
 .I $G(APCLTFNA)="COMMUNITY" S X=$P(^AUTTCOM(X,0),U)
 I APCLANAM="OTHER",APCLCANN=1 S X=Y(0,0) Q
 I APCLANAM="RX" S X=+Y Q
 I APCLANAM="PATIENT ED TOPIC" S X=+Y Q
 I APCLANAM="ADA CODE" S X=+Y Q
 I APCLANAM="HEALTH FACTORS" S X=+Y Q
 I APCLANAM="PROBLEM LIST DIAGNOSIS" S X=Y(0,0) Q
 I APCLANAM="PROVIDER" S X=+Y Q
 I APCLANAM="CURRENT COMMUNITY" S X=$P(^AUTTCOM(+Y,0),U)
 Q
LABTAX ;EP;PROCESS LAB TAXONOMIES
 S APCLTNAM="DM AUDIT "_APCLX_" TAX"
 S APCLTDA=$O(^ATXLAB("B",APCLTNAM,0))
 I 'APCLTDA D LABTADD
 Q:'APCLTDA
 D LABTEST
 Q
LABTADD ;EP;ADD NEW LAB TAXONOMY
 D CLEAR^VALM1
 S DIR(0)="FO^3:30"
 S DIR("A")="Taxonomy Name"
 W !
 D DIR^APCLDIC
 I Y="" S APCLQUIT="" Q
 I $D(^ATXLAB("B",Y)) W !!,"The ",Y," taxonomy already exists." G LABTADD
 S (X,APCLTNAM)=Y
 S APCLTNAM=Y
 W !!,"The ",APCLTNAM," Lab Taxonomy does not exist on this system"
 S DIR(0)="YO"
 S DIR("A")="Do you want to create it now"
 S DIR("B")="NO"
 W !
 D DIR^APCLDIC
 I +Y'=1 S APCLTDA="" Q
 S X=APCLTNAM
 S DIC="^ATXLAB("
 S DIC(0)="L"
 S DIC("DR")=".02////"_($P(APCLTNAM," TAX")_" TEST TAX")_";.05////"_DUZ_";.06////"_DT_";.08////B;.09////60"
 D FILE^APCLDIC
 S APCLTDA=+Y
 Q
YCON ;CONVERT IEN TO EXTERNAL FORMAT FOR DISPLAY
 I APCLANAM="OTHER" D OTHER Q
 I APCLANAM="RX" D  Q
 .N XX
 .S XX=APCLLOW
 .S APCLLOW=$P($G(^PSDRUG(+APCLLOW,0)),U)
 .S APCLHIGH=""
 .I $O(^PSDRUG(+XX,1,0)) D  ;IHS/CIM/THL PATCH 9
 ..N X,Y,Z
 ..S X=0
 ..F  S X=$O(^PSDRUG(XX,1,X)) Q:'X  D
 ...S Z="("
 ...S Y=$P($G(^PSDRUG(XX,1,X,0)),U)
 ...S:Y["" APCLHIGH=$S($G(Y)'["(":Z,1:"")_Y_", "
 ..S:$L(APCLHIGH)>41 APCLHIGH=$E($G(APCLHIGH),1,40)_", "
 ..S:$E(APCLHIGH,$L(APCLHIGH)-1,$L(APCLHIGH))=", " APCLHIGH=$E(APCLHIGH,1,$L(APCLHIGH)-2)_")"
 ..;IHS/CIM/THL PATCH 9 END
 .S:$G(APCLHIGH) APCLHIGH=$P($G(^PSDRUG(+APCLHIGH,0)),U)
 .S APCLHIGH=APCLHIGH_"  ien: "_+XX
 .D YCON1
 I APCLANAM="PATIENT ED TOPIC" D  Q
 .S APCLLOW=$P($G(^AUTTEDT(+APCLLOW,0)),U)
 .S APCLHIGH=$P($G(^AUTTEDT(+APCLHIGH,0)),U)
 .D YCON1
 I APCLANAM="HEALTH FACTORS" D  Q
 .S APCLLOW=$P($G(^AUTTHF(+APCLLOW,0)),U)
 .S APCLHIGH=$P($G(^AUTTHF(+APCLHIGH,0)),U)
 .D YCON1
 I APCLANAM="ADA CODE" D  Q
 .S APCLLOW=$P($G(^AUTTADA(+APCLLOW,0)),U)
 .S APCLHIGH=$P($G(^AUTTADA(+APCLHIGH,0)),U)
 .D YCON1
 I APCLANAM="PROVIDER" D
 .;S APCLLOW=$P($G(^DIC(16,+APCLLOW,0)),U)
 .S APCLLOW=$$VAL^XBDIQ1($S($P(^DD(9000010.06,.01,0),U,2)[200:200,1:6),APCLLOW,.01)
 .;S APCLHIGH=$P($G(^DIC(16,+APCLHIGH,0)),U)
 .I APCLHIGH]"" S APCLHIGH=$$VAL^XBDIQ1($S($P(^DD(9000010.06,.01,0),U,2)[200:200,1:6),APCLHIGH,.01)
YCON1 S:APCLHIGH=APCLLOW APCLHIGH=""
 Q
OTHER ;PROCESS FOR DISPLAY
 Q:APCLCANN=1
 Q:'APCLLOW
 I APCLTFNA="ADA CODE" D  Q
 .S APCLHIGH=$P($G(^AUTTADA(+APCLLOW,0)),U,2)
 .S APCLLOW=$P($G(^AUTTADA(+APCLLOW,0)),U)
 N X
 S X=$G(^DIC(APCLFILE,0,"GL"))
 Q:X=""
 I $E(X,$L(X))="(" S X=$E(X,1,$L(X)-1)
 E  I $E(X,$L(X))="," S X=$E(X,1,$L(X)-1)_")"
 E  S X=X_")"
 S APCLLOW=$P($G(@X@(+APCLLOW,0)),U)
 S APCLHIGH=$P($G(@X@(+APCLHIGH,0)),U)
 D YCON1
 Q
LABTEST ;EP;
 D VALM^APCLTAX0("APCL LAB TAXONOMY DISPLAY")
 Q
TAXHEAD ;EP;PRINT HEADER FOR TAXONOMY MANAGEMENT
 W @IOF
TAXHEAD1 N X
 F X="RPMS PATIENT CARE COMPONENT","TAXONOMY MANAGEMENT" D
 .W !?(80-$L(X))\2,X
 Q
DXHEAD ;PRINT HEADER FOR TAXONOMY MANAGEMENT
 W @IOF
 D TAXHEAD1
 N X
 F X="Diagnosti/Medication Taxonomies"
 W !?(80-$L(X))\2,X
 Q
LABHEAD ;EP;PRINT HEADER FOR TAXONOMY MANAGEMENT
 W @IOF
 N X
 F X="Laboratory Taxonomies" D
 .W !?(80-$L(X))\2,X
 Q
TAXDH ;DISPLAY HEADER FOR TAXONOMY SYSTEM
 Q
RXCLASS ;EP;ALLOW ADD OF ALL MEDS OF THE SAME DRUG CLASSIFICATION 
 Q:'$P($G(^PSDRUG(APCLRXDA,"ND")),U,6)  S APCLRXVC=$P(^("ND"),U,6)
 S DIR(0)="YO"
 S DIR("A",1)="Add all Medications with the same"
 S DIR("A")="VA Classification to this taxonomy"
 S DIR("B")="NO"
 W !
 D DIR^APCLDIC
 Q:Y'=1
 N APCLX,APCLY,APCLZ
 S APCLX=0
 F  S APCLX=$O(^PSDRUG("VAC",APCLRXVC,APCLX)) Q:'APCLX  D
 .S X=APCLX
 .Q:$D(^ATXAX(APCLTDA,21,"B",X))
 .S DA(1)=APCLTDA
 .S DIC="^ATXAX("_APCLTDA_",21,"
 .S DIC(0)="L"
 .S DIC("DR")=".02////"_$P(APCL("HIGH"),U)
 .S:'$D(^ATXAX(APCLTDA,21,0)) ^ATXAX(APCLTDA,21,0)="^9002226.02101A"
 .D FILE^APCLDIC
 Q
LAB ;EP;
 D VALM^APCLTAX0("APCL LAB TAXONOMY LIST")
 Q
SLAB ;EP;SELECT LAB TAXONOMY TO EDIT
 Q:'$G(APCLJ)
 S DIR(0)="NO^1:"_APCLJ
 S DIR("A")="Edit which Lab Taxonomy"
 W !
 D DIR^APCLDIC
 I '+Y S APCLQUIT="" Q
 S APCLTDA=+APCLJ(Y)
 S APCLTNAM=$P(APCLJ(Y),U,2)
 D LABTEST
 Q
LABH ;LAB TAXONOMY HEADER
 D VALM^APCLTAX0("APCL LAB TAXONOMY LIST")
 Q
 W @IOF
 W !?10,"Select one of the LAB Taxonomies"
 W !?10,"or ADD a NEW Lab Taxonomy"
 W !!?5,"Select one of the following"
 W !
 S J=0
 S X="DM AUDIT "
 F  S X=$O(^ATXLAB("B",X)) Q:X=""!(X'["DM AUDIT")  D
 .S Y=0
 .F  S Y=$O(^ATXLAB("B",X,Y)) Q:'Y  D
 ..S J=J+1
 ..W !?10,$J(J,2),?15,$P($P(X,"DM AUDIT ",2)," TAX")
 ..S J(J)=Y_U_X
 S J=J+1
 S APCLJ=J
 W !?10,$J(J,2),?15,"Add NEW Lab Taxonomy"
 Q
TABACK S APCLGO="TAX"
 D BACK^APCLTAX0
 Q