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

IBDFN.m

Go to the documentation of this file.
  1. IBDFN ;ALB/CJM - ENCOUNTER FORM - INTERFACE ROUTINES ;NOV 16,1992
  1. ;;3.0;AUTOMATED INFO COLLECTION SYS;**11,36**;APR 24, 1997
  1. VADPT ;returns patient demographic data
  1. ;input variables - DFN
  1. N ARY
  1. S ARY="^TMP(""IB"",$J,""INTERFACES"",+$G(DFN))"
  1. D DEM^VADPT
  1. I VAERR S (@ARY@("DPT PATIENT'S NAME"),@ARY@("DPT PATIENT'S DOB/AGE"),@ARY@("DPT PATIENT'S SEX"),@ARY@("DPT PATIENT'S PID"),@ARY@("DPT PATIENT'S MARITAL STATUS"))="" Q
  1. S @ARY@("DPT PATIENT'S NAME")=VADM(1),@ARY@("DPT PATIENT'S SEX")=$P(VADM(5),"^",2)_"^"_$E($P(VADM(5),"^",2)),@ARY@("DPT PATIENT'S DOB/AGE")=$P(VADM(3),"^",2)_"^"_VADM(4),@ARY@("DPT PATIENT'S PID")=VA("PID")
  1. S @ARY@("DPT PATIENT'S MARITAL STATUS")=$P(VADM(10),"^",2)
  1. S @ARY@("DPT PATIENT'S RACE")=$P(VADM(8),"^",2)
  1. S @ARY@("DPT PATIENT'S REMARKS")=$P($G(^DPT(+$G(DFN),0)),"^",10)
  1. K VADM,VA,VAERR,VAEL
  1. Q
  1. EMPLMNT ;returns patient's employment status
  1. ;input variables - DFN
  1. D OPD^VADPT
  1. I VAERR S @IBARY="" Q
  1. S @IBARY=$P(VAPD(7),"^",2)
  1. K VAPD,VA,VAERR,VAEL
  1. Q
  1. ;
  1. DATE(Y) ; Y=date in FM form, this function translates the date to its
  1. ;external form
  1. D DD^%DT
  1. Q Y
  1. Q
  1. ;
  1. ELIG ;for output of eligibility information & service connected conditions
  1. N COUNT,ARY,VAEL,VAERR,NODE0,COND,DESCR,PERC,EC,VASV,DATA,I,SARY
  1. S ARY="^TMP(""IB"",$J,""INTERFACES"",+$G(DFN))"
  1. S SARY="^TMP(""IB"",$J,""INTERFACES"")"
  1. D ELIG^VADPT
  1. I VAERR F I=1:1:6 S VAEL(I)=""
  1. S PERC=$P(VAEL(3),"^",2),PERC=$S(PERC="":"",1:$J(PERC,3,0))
  1. S @ARY@("DPT PATIENT ELIGIBILITY DATA")=$P(VAEL(1),"^",2)_"^"_$P(VAEL(2),"^",2)_"^"_$S(VAEL(3):"YES",VAEL(3)=0:"NO",1:"")_"^"_$S(VAEL(4):"YES",VAEL(4)=0:"NO",1:"")_"^"_$S(VAEL(5):"YES",VAEL(5)=0:"NO",1:"")_"^"_$P(VAEL(6),"^",2)_"^"_PERC
  1. S @ARY@("DPT SC HIDDEN LABELS")=$S(((+VAEL(3))!($O(^DPT(DFN,.372,0)))):"%^% - SERVICE CONNECTED^SERVICE CONNECTED:^SC CONDITIONS:^S/C",1:" ^ ^ ^ ^ ")
  1. I $O(^DPT(DFN,.372,0)),VAEL(4)!$$GET1^DIQ(391,+VAEL(6),.02) S (COUNT,COND)=0 F S COND=$O(^DPT(DFN,.372,COND)) Q:COND="" D
  1. .S NODE0=$G(^DPT(DFN,.372,COND,0)) Q:'$P(NODE0,"^",3) S DESCR=$G(^DIC(31,+NODE0,0)),COUNT=COUNT+1
  1. .S PERC=$P(NODE0,"^",2),PERC=$S(PERC="":"",1:$J(PERC,3,0))
  1. .S @SARY@("DPT PATIENT'S SC CONDITIONS",COUNT)=$S($P(DESCR,"^",4)'="":$P(DESCR,"^",4),1:$P(DESCR,"^",1))_"^"_PERC_"^"_PERC_"%"_"^"_PERC_"%SC"_"^"_PERC_"% - SERVICE CONNECTED"
  1. ;
  1. ;get service data
  1. D SVC^VADPT
  1. I VAERR S DATA="^^^^"
  1. E S DATA=$S(VASV(1):"YES",1:"NO")_"^"_$S(VASV(2):"YES",1:"NO")_"^"_$S(VASV(3):"YES",1:"NO")_"^"_$S(VASV(4):"YES",1:"NO")_"^"_$S(VASV(5):"YES",1:"NO")
  1. ;
  1. ;get the persian gulf indicator - not returned by VADPT
  1. S EC=$$EC^SDCO22(DFN,0)
  1. ;S EC=$P($G(^DPT(DFN,.322)),"^",13)
  1. S @ARY@("DPT SERVICE HISTORY RELATED DATA")=DATA_"^"_$S(EC=1:"YES",1:"NO")
  1. ;
  1. ;displays questions concerning treatment related to service only
  1. ;if they apply
  1. ;
  1. S DATA=$S(VAEL(3):"Was treatment for a SC condition? __ YES __ NO",1:"")_"^"
  1. S DATA=DATA_$S(VASV(2):"Was treatment related to exposure to Agent Orange? __ YES __ NO",1:"")_"^"
  1. S DATA=DATA_$S(VASV(3):"Was treatment related to exposure to Ionization Radiation? __ YES __ NO",1:"")
  1. S @ARY@("DPT SC TREATMENT QUESTIONS")=DATA
  1. ;
  1. ;note: must store the 4th question in an annex node
  1. S DATA="^^^"_$S(EC=1:"Was treatment related to exposure to Environmental Contaminants? __ YES __ NO",1:"")_"^"
  1. I VASV(2)!VASV(3)!(EC=1) D
  1. .S DATA=DATA_"Was treatment related to: "_$S(VASV(2):"AO __ ",1:"")_$S(VASV(3):"IR __ ",1:"")_$S(EC=1:"EC __ ",1:"")
  1. S @ARY@("DPT SC TREATMENT QUESTIONS",1)=DATA
  1. Q
  1. ;
  1. BLANKS ;returns NOTHING for printing blank lines
  1. S @IBARY=""
  1. Q
  1. LABELS ;returns NOTHING for printing labels only, ie, no data
  1. S @IBARY=""
  1. Q
  1. ELIG1 ;for output of hidden service connected conditions
  1. N COUNT,ARY,VAEL,VAERR,VASV,EC
  1. S ARY="^TMP(""IB"",$J,""INTERFACES"")",COUNT=0
  1. D ELIG^VADPT
  1. I 'VAERR,(VAEL(3)) S COUNT=COUNT+1,@ARY@("DPT SC HIDDEN TREATMENT QUESTIONS",COUNT)="SC^Was treatment for an SC condition?"
  1. ;
  1. ;get service data
  1. D SVC^VADPT
  1. I 'VAERR D
  1. .I VASV(2) S COUNT=COUNT+1,@ARY@("DPT SC HIDDEN TREATMENT QUESTIONS",COUNT)="AO^Was treatment related to exposure to Agent Orange?"
  1. .I VASV(3) S COUNT=COUNT+1,@ARY@("DPT SC HIDDEN TREATMENT QUESTIONS",COUNT)="IR^Was treatment related to exposure to Ionization Radiation?"
  1. ;
  1. ;get the persian gulf indicator - not returned by VADPT
  1. ;S EC=$P($G(^DPT(DFN,.322)),"^",13)
  1. I $$EC^SDCO22(DFN,0) S COUNT=COUNT+1,@ARY@("DPT SC HIDDEN TREATMENT QUESTIONS",COUNT)="EC^Was treatment related to exposure to Environmental Contaminants?"
  1. Q
  1. ;
  1. ELIG2 ; -- for output of hidden classification questions
  1. N COUNT,ARY
  1. I $G(IBCLINIC) I '$$REQ^IBDFDE0(DFN,IBAPPT,IBCLINIC,0) Q
  1. ;
  1. S ARY="^TMP(""IB"",$J,""INTERFACES"")",COUNT=0
  1. ;
  1. I $$SC^SDCO22(DFN,0) D SETARY(ARY,.COUNT,"SC^Was treatment for an SC condition?")
  1. I $$AO^SDCO22(DFN,0) D SETARY(ARY,.COUNT,"AO^Was treatment related to exposure to Agent Orange?")
  1. I $$IR^SDCO22(DFN,0) D SETARY(ARY,.COUNT,"IR^Was treatment related to exposure to Ionization Radiation?")
  1. I $$EC^SDCO22(DFN,0) D SETARY(ARY,.COUNT,"EC^Was treatment related to exposure to Environmental Contaminants?")
  1. ;
  1. ELIG2Q Q
  1. ;
  1. SETARY(ARY,CNT,TEXT) ; -- build array
  1. S CNT=CNT+1
  1. S @ARY@("DPT SC HIDDEN TREATMENT QUESTIONS",CNT)=TEXT
  1. Q
  1. ;
  1. ELIGMST ;-- Adds the MST indicator to existing hidden classification questions
  1. ; (patch IBD*3*36)
  1. ;
  1. N ARY,DATA,MST,MSTSTAT
  1. D ELIG
  1. S ARY="^TMP(""IB"",$J,""INTERFACES"",+$G(DFN))"
  1. S MST=$$MST^SDCO22(DFN,0)
  1. S MSTSTAT=$P($$GETSTAT^DGMSTAPI(DFN),"^",2),MSTSTAT=$S(MSTSTAT="Y":"YES",MSTSTAT="N":"NO",MSTSTAT="U":"UNKNOWN",MSTSTAT="D":"DECLINED",1:"")
  1. I $D(@ARY@("DPT SERVICE HISTORY RELATED DATA")) S @ARY@("DPT SERVICE HISTORY RELATED DATA (MST)")=$G(@ARY@("DPT SERVICE HISTORY RELATED DATA"))_"^"_MSTSTAT
  1. ;
  1. I $D(@ARY@("DPT SC TREATMENT QUESTIONS")) S @ARY@("DPT SC TREATMENT QUESTIONS (MST)")=$G(@ARY@("DPT SC TREATMENT QUESTIONS"))
  1. I $D(@ARY@("DPT SC TREATMENT QUESTIONS",1)) D
  1. . S DATA=$G(@ARY@("DPT SC TREATMENT QUESTIONS",1))
  1. . I MST D
  1. .. S DATA=DATA_$S($L($P(DATA,"^",5))>1:"MST __",1:"Was treatment related to: MST __")
  1. .. S $P(DATA,"^",6)=$S(MST:"Was treatment related to MST? __ YES __ NO",1:"")
  1. . S @ARY@("DPT SC TREATMENT QUESTIONS (MST)",1)=DATA
  1. Q
  1. ;
  1. ELIG1MST ;-- Similar to ELIG1 but adds MST indicator (if applicable) to hidden classification questions array
  1. ;
  1. K ^TMP("IB",$J,"INTERFACES","DPT SC HIDDEN TREATMENT QUESTIONS")
  1. K ^TMP("IB",$J,"INTERFACES","DPT SC HIDDEN TREATMENT QUESTIONS (MST)")
  1. D ELIG1
  1. D ELIGSET
  1. Q
  1. ;
  1. ELIG2MST ;-- Similar to ELIG2 but adds MST indicator (if applicable) to hidden classification questions array
  1. ;
  1. K ^TMP("IB",$J,"INTERFACES","DPT SC HIDDEN TREATMENT QUESTIONS")
  1. K ^TMP("IB",$J,"INTERFACES","DPT SC HIDDEN TREATMENT QUESTIONS (MST)")
  1. D ELIG2
  1. D ELIGSET
  1. Q
  1. ;
  1. ELIGSET ;-- Checks for MST and adds MST question to hidden classification array
  1. ;
  1. N ARY,COUNT,I
  1. S ARY="^TMP(""IB"",$J,""INTERFACES"")"
  1. S (COUNT,I)=0
  1. M @ARY@("DPT SC HIDDEN TREATMENT QUESTIONS (MST)")=@ARY@("DPT SC HIDDEN TREATMENT QUESTIONS")
  1. I $$MST^SDCO22(DFN,0) D
  1. . F S I=$O(@ARY@("DPT SC HIDDEN TREATMENT QUESTIONS (MST)",I)) Q:'I S COUNT=I
  1. . S COUNT=COUNT+1,@ARY@("DPT SC HIDDEN TREATMENT QUESTIONS (MST)",COUNT)="MST^Was treatment related to MST? (Ask provider only)"
  1. Q