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

BKMVSUP3.m

Go to the documentation of this file.
BKMVSUP3 ;PRXM/HC/WOM - Continuation of BKMVSUP, HIV SUPPLEMENT; [ 1/19/2005 7:16 PM ] ; 10 Jun 2005  12:46 PM
 ;;2.2;HIV MANAGEMENT SYSTEM;;Apr 01, 2015;Build 40
 Q
RET(DFN) ; EP - Retrieve Eye taxonomies (P.03)
 ; Several calls below used to use $H-360.
 ; Replaced with BKMCKDT (FileMan format date).
 N BKMCKDT,PRV,CLN
 S BKMCKDT=$$FMADD^XLFDT(DT,-360)
 K BKMT("EYE")
 S GLOBAL="BKMT(""EYE"",VSTDT,TEST,""CPT"")"
 D CPTTAX^BKMIXX(DFN,"BGP DM EYE EXAM CPTS","",BKMCKDT,GLOBAL)
 D CPTTAX^BKMIXX(DFN,"BGP RETINAL EXAM CPTS","",BKMCKDT,GLOBAL)
 S GLOBAL="BKMT(""EYE"",VSTDT,TEST,""EXAM"")"
 D EXAMTAX^BKMIXX1(DFN,"03","",BKMCKDT,GLOBAL)
 ; Added provider, clinic code and procedure checks
 S GLOBAL="BKMT(""EYE"",VSTDT,TEST,""PRV"")"
 ; Check provider codes
 F PRV="79","24","08" D
 . D PRVTAX^BKMIXX2(DFN,PRV,"",BKMCKDT,GLOBAL)
 S GLOBAL="BKMT(""EYE"",VSTDT,TEST,""CLN"")"
 ; Check clinic codes
 F CLN="17","18","64","A2" D
 . D CLNTAX^BKMIXX2(DFN,CLN,"",BKMCKDT,GLOBAL)
 ; Check procedure code
 ;D PROCTAX^BKMIXX2(DFN,95.02,"",BKMCKDT,GLOBAL)
 D PRCTAX^BKMIXX1(DFN,"BQI EYE EXAM PROCS","",BKMCKDT,GLOBAL)
 ; Check POVs
 ;D POVTAX^BKMIXX2(DFN,"V72.0","",BKMCKDT,GLOBAL)
 D ICDTAX^BKMIXX1(DFN,"BQI EYE EXAM DXS","",BKMCKDT,GLOBAL)
 ; Print results
 S LINE=" Dilated eye exam: "
 D LTAXPRT^BKMVSUP1("EYE",1)
 I $D(BKMT("EYE")) K BKMT("EYE") D UPD^BKMVSUP D UPD^BKMVSUP:LINE'="" Q
 ; If no eye exams found check refusals
 ; The following has been replaced with D REFUSAL^BKMIXX2 call
 ; S EXIEN=$O(^AUTTEXAM("C","03",""))
 ; I EXIEN S TST(EXIEN)="" W $$REF^BKMVSUP2(DFN,9999999.15,.TST)
 D REFUSAL^BKMIXX2(DFN,9999999.15,"03","",BKMCKDT,GLOBAL)
 ; Print results
 D LTAXPRT^BKMVSUP1("EYE",1,1,1)
 I '$D(BKMT("EYE")) S LINE=$$LINE^BKMVSUP(LINE,"Date:",24)
 D UPD^BKMVSUP
 I LNCNT>MAXCT D NEWPG^BKMVSUP
 Q
MAM(DFN) ; EP - Retrieve mammogram taxonomies
 ; Several calls below used to use $H-360.
 ; Replaced with BKMCKDT (FileMan format date).
 N BKMCKDT
 S BKMCKDT=$$FMADD^XLFDT(DT,-360)
 ; *** Examine V Rad and V CPT; if others are needed will have to add
 ; Q:$P(^DPT(DFN,0),U,2)'="F"  ; - removed and replaced with N/A as per IHS
 S LINE=" Mammogram: "
 I $P(^DPT(DFN,0),U,2)'="F" S LINE=LINE_"Not Applicable" Q  ;Females only
 K BKMT("MAM")
 S GLOBAL="BKMT(""MAM"",VSTDT,TEST,""PROC"")"
 D PRCTAX^BKMIXX1(DFN,"BGP MAMMOGRAM PROCEDURES","",BKMCKDT,GLOBAL)
 S GLOBAL="BKMT(""MAM"",VSTDT,TEST,""ICD"")"
 D ICDTAX^BKMIXX1(DFN,"BGP MAMMOGRAM ICDS","",BKMCKDT,GLOBAL)
 S GLOBAL="BKMT(""MAM"",VSTDT,TEST,""CPT"")"
 D CPTTAX^BKMIXX(DFN,"BGP CPT MAMMOGRAM","",BKMCKDT,GLOBAL)
 ; Additional check of V-Rad file for mammography.
 S GLOBAL="BKMT(""MAM"",VSTDT,TEST,""RAD"")"
 D RADTAX^BKMIXX1(DFN,"BGP CPT MAMMOGRAM","",BKMCKDT,GLOBAL)
 I $D(BKMT("MAM")) D LTAXPRT^BKMVSUP1("MAM",1) K BKMT("MAM") D UPD^BKMVSUP:LINE'="" Q
 D REFUSAL^BKMIXX2(DFN,71,"BGP CPT MAMMOGRAM","",BKMCKDT,GLOBAL)
 ; Print results
 D LTAXPRT^BKMVSUP1("MAM",1,1,1)
 I '$D(BKMT("MAM")) S LINE=$$LINE^BKMVSUP(LINE,"Date:",24)
 K BKMT("MAM")
 I LINE'="" D UPD^BKMVSUP
 Q
DEN(DFN) ; EP - Dental exam
 ; Several calls below used to use $H-360.
 ; Replaced with BKMCKDT (FileMan format date).
 N BKMCKDT
 S BKMCKDT=$$FMADD^XLFDT(DT,-360)
 K BKMT("DEN")
 S GLOBAL="BKMT(""DEN"",VSTDT,TEST,""PRC"")"
 D ICDTAX^BKMIXX1(DFN,"BKM DENTAL EXAMINATION","",BKMCKDT,GLOBAL)
 S GLOBAL="BKMT(""DEN"",VSTDT,TEST,""ADA"")"
 D ADATAX^BKMIXX(DFN,"BGP DENTAL EXAM DENTAL CODE","",BKMCKDT,GLOBAL)
 S GLOBAL="BKMT(""DEN"",VSTDT,TEST,""EXAM"")"
 D EXAMTAX^BKMIXX1(DFN,"30","",BKMCKDT,GLOBAL)
 ; Print results
 S LINE=" Dental exam: "
 D LTAXPRT^BKMVSUP1("DEN",1)
 I $D(BKMT("DEN")) K BKMT("DEN") D UPD^BKMVSUP D UPD^BKMVSUP:LINE'="" Q
 ; If no dental exams found check refusals
 ; The following has been replaced with D REFUSAL^BKMIXX2 call
 ; S EXIEN=$O(^AUTTEXAM("C","30",""))
 ; I EXIEN S TST(EXIEN)="" W $$REF^BKMVSUP2(DFN,9999999.15,.TST)
 D REFUSAL^BKMIXX2(DFN,9999999.15,"30","",BKMCKDT,GLOBAL)
 ; Print results
 D LTAXPRT^BKMVSUP1("DEN",1,1,1)
 I '$D(BKMT("DEN")) S LINE=$$LINE^BKMVSUP(LINE,"Date:",24)
 D UPD^BKMVSUP
 I LNCNT>MAXCT D NEWPG^BKMVSUP
 Q
DRUGS(DFN) ; EP - Get medications
 D HAART(DFN)
 D MAC(DFN)
 D PCP(DFN)
 D PRTMP(DFN)
 D NEW(DFN)
 F TYPE="MAC","PCP","NEW" K ^TMP("BKMSUPP",$J,TYPE)
 Q
HAART(DFN) ; GATHER HAART DRUG DATA (using Taxonomy)
 N MEDDT,MEDIEN,DISC,STDT,SIG,QTY,DISPDT,RXNAME
 K ^TMP("BKMSUPP",$J,"HAART") ;,^TMP("BKMSUPP",$J,"HAARTD")
 S LINE=" Current ARV Medications (past 6 months): " D UPD^BKMVSUP
 S GLOBAL="^TMP(""BKMSUPP"",$J,""HAART"",VSTDT,TEST)"
 D NDCTAX^BKMIXX1(DFN,"BKMV EI MED NDCS","","",GLOBAL)
 D MEDTAX^BKMIXX(DFN,"BKMV EI MEDS","","",GLOBAL)
 D NDCTAX^BKMIXX1(DFN,"BKMV NNRTI MED NDCS","","",GLOBAL)
 D MEDTAX^BKMIXX(DFN,"BKMV NNRTI MEDS","","",GLOBAL)
 D NDCTAX^BKMIXX1(DFN,"BKMV NRTI MED NDCS","","",GLOBAL)
 D MEDTAX^BKMIXX(DFN,"BKMV NRTI MEDS","","",GLOBAL)
 D NDCTAX^BKMIXX1(DFN,"BKMV PI MED NDCS","","",GLOBAL)
 D MEDTAX^BKMIXX(DFN,"BKMV PI MEDS","","",GLOBAL)
 D NDCTAX^BKMIXX1(DFN,"BKMV II MED NDCS","","",GLOBAL)
 D MEDTAX^BKMIXX(DFN,"BKMV II MEDS","","",GLOBAL)
 D NDCTAX^BKMIXX1(DFN,"BKMV NRTI/NNRTI MED NDCS","","",GLOBAL)
 D MEDTAX^BKMIXX(DFN,"BKMV NRTI/NNRTI MEDS","","",GLOBAL)
 D NDCTAX^BKMIXX1(DFN,"BKMV NRTI COMBO MED NDCS","","",GLOBAL)
 D MEDTAX^BKMIXX(DFN,"BKMV NRTI COMBO MEDS","","",GLOBAL)
 D NDCTAX^BKMIXX1(DFN,"BKMV PI BOOSTER MED NDCS","","",GLOBAL)
 D MEDTAX^BKMIXX(DFN,"BKMV PI BOOSTER MEDS","","",GLOBAL)
 ; *** separate list into active and discontinued
 ; *** NOTE: last 6 months for active HAART; **ALL** disc'd HAART
 S MEDDT=""
 F  S MEDDT=$O(^TMP("BKMSUPP",$J,"HAART",MEDDT)) Q:MEDDT=""  D
 . S MEDIEN="" F  S MEDIEN=$O(^TMP("BKMSUPP",$J,"HAART",MEDDT,MEDIEN)) Q:MEDIEN=""  D
 .. S DISC=$$GET1^DIQ(9000010.14,MEDIEN,.08,"I")
 .. I DISC D
 ... S BKMT("HAARTD",DISC,MEDDT,MEDIEN)="" ;Needed for flow sheet
 ... ;S ^TMP("BKMSUPP",$J,"HAARTD",MEDDT,MEDIEN)=^TMP("BKMSUPP",$J,"HAART",MEDDT,MEDIEN)
 ... K ^TMP("BKMSUPP",$J,"HAART",MEDDT,MEDIEN)
 D DRPRT("HAART",$$FMADD^XLFDT(DT,-183))
 I '$D(^TMP("BKMSUPP",$J,"HAART")) D
 . ; Check refusals
 . S GLOBAL="BKMT(""HAART"",VSTDT,TEST)"
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV EI MED NDCS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV EI MEDS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV NNRTI MED NDCS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV NNRTI MEDS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV NRTI MED NDCS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV NRTI MEDS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV PI MED NDCS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV PI MEDS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV II MED NDCS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV II MEDS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV NRTI/NNRTI MED NDCS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV NRTI/NNRTI MEDS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV NRTI COMBO MED NDCS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV NRTI COMBO MEDS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV PI BOOSTER MED NDCS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV PI BOOSTER MEDS","","",GLOBAL)
 . ; Print results
 . D DRFPRT("HAART",1) K BKMT("HAART")
 D UPD^BKMVSUP
 ; Discontinued drugs were disabled as per IHS
 ; S LINE=" Discontinued ARV Medications: [Data not currently available]"; ***
 ; D UPD^BKMVSUP ;***
 ; D DRPRT("HAARTD") ;inactivated print as per IHS
 ; keep drugs to identify "other" drugs
 Q
MAC(DFN) ; GATHER MAC Prophylaxis DRUG DATA (using Taxonomy)
 ; Several calls below used to use $H-183.
 ; Replaced with BKMCKDT (FileMan format date).
 N BKMCKDT
 S BKMCKDT=$$FMADD^XLFDT(DT,-183)
 I LNCNT>MAXCT D NEWPG^BKMVSUP
 S GLOBAL="^TMP(""BKMSUPP"",$J,""MAC"",VSTDT,TEST)"
 D NDCTAX^BKMIXX1(DFN,"BKMV MAC PROPH MED NDCS","",BKMCKDT,GLOBAL)
 D MEDTAX^BKMIXX(DFN,"BKMV MAC PROPH MEDS","",BKMCKDT,GLOBAL)
 I '$D(^TMP("BKMSUPP",$J,"MAC")) D
 . ; Check refusals
 . S GLOBAL="BKMT(""MAC"",VSTDT,TEST)"
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV MAC PROPH MED NDCS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV MAC PROPH MEDS","","",GLOBAL)
 ; keep drugs to identify "other" drugs
 I LNCNT>MAXCT D NEWPG^BKMVSUP
 Q
PCP(DFN) ; GATHER PCP Prophylaxis DRUG DATA (using Taxonomy)
 ; Several calls below used to use $H-183.
 ; Replaced with BKMCKDT (FileMan format date).
 N BKMCKDT
 S BKMCKDT=$$FMADD^XLFDT(DT,-183)
 S GLOBAL="^TMP(""BKMSUPP"",$J,""PCP"",VSTDT,TEST)"
 D NDCTAX^BKMIXX1(DFN,"BKMV PCP PROPH MED NDCS","",BKMCKDT,GLOBAL)
 D MEDTAX^BKMIXX(DFN,"BKMV PCP PROPH MEDS","",BKMCKDT,GLOBAL)
 I '$D(^TMP("BKMSUPP",$J,"PCP")) D
 . ; Check refusals
 . S GLOBAL="BKMT(""PCP"",VSTDT,TEST)"
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV PCP PROPH MED NDCS","","",GLOBAL)
 . D REFUSAL^BKMIXX2(DFN,50,"BKMV PCP PROPH MEDS","","",GLOBAL)
 ; keep drugs to identify "new" drugs
 I LNCNT>MAXCT D NEWPG^BKMVSUP
 Q
PRTMP(DFN) ; Combine MAC and PCP results for printing purposes
 K ^TMP("BKMSUPP",$J,"MACPCP"),BKMT("MACPCP")
 M ^TMP("BKMSUPP",$J,"MACPCP")=^TMP("BKMSUPP",$J,"MAC")
 M ^TMP("BKMSUPP",$J,"MACPCP")=^TMP("BKMSUPP",$J,"PCP")
 D UPD^BKMVSUP S LINE=" Prophylaxis Medications for MAC and/or PCP (past 6 months): "
 D UPD^BKMVSUP
 I $D(^TMP("BKMSUPP",$J,"MACPCP")) D DRPRT("MACPCP",$$FMADD^XLFDT(DT,-183))
 I '$D(^TMP("BKMSUPP",$J,"MACPCP")) D
 . M BKMT("MACPCP")=BKMT("MAC")
 . M BKMT("MACPCP")=BKMT("PCP")
 . D DRFPRT("MACPCP",1)
 . K BKMT("PCP"),BKMT("MAC"),BKMT("MACPCP")
 K ^TMP("BKMSUPP",$J,"MACPCP")
 Q
NEW(DFN) ; GATHER "New" DRUG DATA (drugs dispensed during last 6 mos excluding previously listed drugs)
 ; Disabled as per IHS ***
 Q
 N TEST,VISIT,VSTDT,OLD,TYPE
 S TEST=""
 F  S TEST=$O(^AUPNVMED("AC",DFN,TEST)) Q:TEST=""  D
 . S VISIT=$$GET1^DIQ(9000010.14,TEST,.03,"I")
 . S VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
 . S OLD=""
 . F TYPE="HAART","HAARTD","MAC","PCP" I $D(^TMP("BKMSUPP",$J,TYPE,VSTDT,TEST)) S OLD=1 Q
 . Q:OLD
 . ; Build same data string as BKMIXX* routines used in other sections.
 . N MED,SIG,QTY,DAY
 . S MED=$$GET1^DIQ(9000010.14,TEST,.01,"E")
 . S SIG=$$GET1^DIQ(9000010.14,TEST,.05,"E")
 . S QTY=$$GET1^DIQ(9000010.14,TEST,.06,"E")
 . S DAY=$$GET1^DIQ(9000010.14,TEST,.07,"E")
 . S ^TMP("BKMSUPP",$J,"NEW",VSTDT,TEST)=MED_U_SIG_U_QTY_U_DAY
 D UPD^BKMVSUP
 S LINE=" Any Other Medications prescribed (past 6 months): " D UPD^BKMVSUP
 D DRPRT("NEW",$$FMADD^XLFDT(DT,-183))
 I LNCNT>MAXCT D NEWPG^BKMVSUP
 Q
DRPRT(TYPE,STDT) ; Print Drugs
 Q:'$D(^TMP("BKMSUPP",$J,TYPE))
 N MEDDT,DISPDT,MEDIEN,SIG,QTY,RXIEN,RXNAME
 S STDT=$G(STDT)
 I STDT,'$O(^TMP("BKMSUPP",$J,TYPE,STDT-.01)) Q
 I LNCNT>(MAXCT-2) D NEWPG^BKMVSUP
 D UPD^BKMVSUP
 S LINE="      [Date]",LINE=$$LINE^BKMVSUP(LINE,"[Med Name]",18)
 S LINE=$$LINE^BKMVSUP(LINE,"[SIG]",50),LINE=$$LINE^BKMVSUP(LINE,"[Qty]",66)
 S MEDDT="" F  S MEDDT=$O(^TMP("BKMSUPP",$J,TYPE,MEDDT),-1) Q:MEDDT<STDT!'MEDDT  D
 . ; PRXM/HC/BHS - 11/01/2005 - Modified external date format to MM/DD/CCYY to eliminate time
 . S DISPDT=$$FMTE^XLFDT(MEDDT\1,"5Z")
 . S MEDIEN="" F  S MEDIEN=$O(^TMP("BKMSUPP",$J,TYPE,MEDDT,MEDIEN)) Q:MEDIEN=""  D
 .. N TEMP
 .. S TEMP=^TMP("BKMSUPP",$J,TYPE,MEDDT,MEDIEN)
 .. S RXNAME=$P(TEMP,U,1),SIG=$P(TEMP,U,2),QTY=$P(TEMP,U,3)
 .. D UPD^BKMVSUP
 .. S LINE="      "_DISPDT,LINE=$$LINE^BKMVSUP(LINE,$E(RXNAME,1,30),18)
 .. S LINE=$$LINE^BKMVSUP(LINE,$E(SIG,1,14),50),LINE=$$LINE^BKMVSUP(LINE,QTY,66)
 .. I LNCNT>MAXCT D NEWPG^BKMVSUP
 D UPD^BKMVSUP
 I LNCNT>MAXCT D NEWPG^BKMVSUP
 Q
 ;
DRFPRT(TYP,MAX) ; Print Drug Refusals
 ; TYP = Type of test (subscript in BKMT array)
 ; MAX = Maximum number of results to print
 N DDT,CNT,Y,TST
 S MAX=$G(MAX,1)
 S (DDT,CNT)=""
 F  S DDT=$O(BKMT(TYP,DDT),-1) Q:'DDT  D  Q:CNT>MAX
 . S Y=$P($$FMTE^XLFDT(DDT,"5Z"),"@")
 . S TST=""
 . F  S TST=$O(BKMT(TYP,DDT,TST)) Q:TST=""  D  Q:CNT>MAX
 .. S LINE=" Date: "_Y,LINE=$$LINE^BKMVSUP(LINE,"[Refusal Type: ",22)_$P(BKMT(TYP,DDT,TST),U)_"]"
 .. S CNT=CNT+1
 .. D UPD^BKMVSUP
 .. I LNCNT>MAXCT D NEWPG^BKMVSUP
 Q
 ;
PAUSE() ; EP - For screen displays pause and allow user to stop
 ; Returns a 1 if the user elected to stop
 ; Matches Health Summary
 I IOST'["C-" Q 0
 N READ
 R !,"<>",READ:DTIME I '$T Q 1
 I READ="^" Q 1
 Q 0
 ;
XIT ; QUIT POINT
 Q