BKMIXX1 ;PRXM/HC/BWF - TAXONOMY ACCESS UTILITIES ; 13 Apr 2005 4:50 PM
;;2.1;HIV MANAGEMENT SYSTEM;;Feb 07, 2011
; Generic Taxonomy Utilities
; Checks V-Files for patients that meet a Taxonomy's criteria, within
; a specific date range.
;
;**************NOTE***********************
; Input for all entry points are the same
;*****************************************
;
; Input:
; DFN = IEN from Patient file (#90000001)
; (required)
; TAX = Name of Taxonomy (From Lab Taxonomy ^ATXLAB or ICD Taxonomy ^ATXAX)
; (required)
; EDATE = End date of the report. The default is "Today"
; (optional)
; SDATE = Start date of the report.
; (optional)
; TARGET = Target root (global or local) for collection of data
; (optional)
; Example: ^TMP("RTN NAME",$J,"DESC",DFN,VSTDT,VISIT) or TEMP(VSTDT,VISIT)
; Output:
; LDATE = Last date found in the selected date range
; (optional - pass by reference)
; LIEN = Last IEN found in the selected date range
; (optional - pass by reference)
; CNT = Count of number of records found in selected date range
; (optional - pass by reference)
;
Q
ICDTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
; ICD Taxonomy Check (using V POV file) (includes POV)
;
N TXIEN,TEST,VISIT,VSTDT,RESULT,ICD,CODE
I DFN="" Q
I TAX="" Q
S TXIEN=$O(^ATXAX("B",TAX,""))
I TXIEN="" Q
S TEST="",CNT=0,LDATE=$G(LDATE,""),LIEN=$G(LIEN,"")
F S TEST=$O(^AUPNVPOV("AC",DFN,TEST)) Q:TEST="" D
.S ICD=$$GET1^DIQ(9000010.07,TEST,.01,"I")
.I ICD="" Q
.I $$ICD^BKMIXX5(ICD,TXIEN,9)=0 Q
.S VISIT=$$GET1^DIQ(9000010.07,TEST,.03,"I")
.S VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
.I $G(SDATE)'="",(VSTDT<SDATE) Q
.I $G(EDATE)'="",(VSTDT\1>EDATE) Q
.I VSTDT>LDATE S LDATE=VSTDT,LIEN=TEST
.I VSTDT=LDATE,TEST>LIEN S LDATE=VSTDT,LIEN=TEST
.S RESULT=$$GET1^DIQ(9000010.07,TEST,.04,"E")
.S CODE=$$GET1^DIQ(9000010.07,TEST,.01,"E")
.S CNT=CNT+1
.I $G(TARGET)]"" S @TARGET=RESULT_U_CODE
Q
;
PRCTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
; ICD Procedure Taxonomy Check
;
N TXIEN,TEST,VISIT,VSTDT,RESULT,PRC
I DFN="" Q
I TAX="" Q
S TXIEN=$O(^ATXAX("B",TAX,""))
I TXIEN="" Q
S TEST="",CNT=0,LDATE=$G(LDATE,""),LIEN=$G(LIEN,"")
F S TEST=$O(^AUPNVPRC("AC",DFN,TEST)) Q:TEST="" D
.S PRC=$$GET1^DIQ(9000010.08,TEST,.01,"I")
.I PRC="" Q
.I $$ICD^BKMIXX5(PRC,TXIEN,0)=0 Q
.S VISIT=$$GET1^DIQ(9000010.08,TEST,.03,"I")
.S VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
.I $G(SDATE)'="",(VSTDT<SDATE) Q
.I $G(EDATE)'="",(VSTDT\1>EDATE) Q
.I VSTDT>LDATE S LDATE=VSTDT,LIEN=TEST
.I VSTDT=LDATE,TEST>LIEN S LDATE=VSTDT,LIEN=TEST
.S RESULT=$$GET1^DIQ(9000010.08,TEST,.04,"E")
.S CNT=CNT+1
.I $G(TARGET)]"" S @TARGET=RESULT
Q
;
PTEDTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
; Patient Education Taxonomy check (by Taxonomy)
; PTEDTAX^BKMIXX does this by Education Code List
;
N TXIEN,TEST,VISIT,VSTDT,RESULT,PTED
I DFN="" Q
I TAX="" Q
S TXIEN=$O(^ATXAX("B",TAX,""))
I TXIEN="" Q
S TEST="",CNT=0,LDATE=$G(LDATE,""),LIEN=$G(LIEN,"")
F S TEST=$O(^AUPNVPED("AC",DFN,TEST)) Q:TEST="" D
.S PTED=$$GET1^DIQ(9000010.16,TEST,.01,"E")
.I PTED="" Q
.I '$D(^ATXAX(TXIEN,21,"B",PTED)) Q
.S VISIT=$$GET1^DIQ(9000010.16,TEST,.03,"I")
.S VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
.I $G(SDATE)'="",(VSTDT<SDATE) Q
.I $G(EDATE)'="",(VSTDT\1>EDATE) Q
.I VSTDT>LDATE S LDATE=VSTDT,LIEN=TEST
.I VSTDT=LDATE,TEST>LIEN S LDATE=VSTDT,LIEN=TEST
.S RESULT=$$GET1^DIQ(9000010.16,TEST,.04,"E")
.S CNT=CNT+1
.I $G(TARGET)]"" S @TARGET=RESULT
Q
;
CVXTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
; Immunization Taxonomy Check (includes Contraindicated Status)
;
N TXIEN,TEST,VISIT,VSTDT,RESULT,CVX,CVXCODE,CONTRIND
I DFN="" Q
I TAX="" Q
S TXIEN=$O(^ATXAX("B",TAX,""))
I TXIEN="" Q
S TEST="",CNT=0,LDATE=$G(LDATE,""),LIEN=$G(LIEN,"")
F S TEST=$O(^AUPNVIMM("AC",DFN,TEST)) Q:TEST="" D
.S CVX=$$GET1^DIQ(9000010.11,TEST,.01,"I")
.I CVX="" Q
.S CVXCODE=$$GET1^DIQ(9999999.14,CVX,.03,"E")
.I CVXCODE="" Q
.I '$D(^ATXAX(TXIEN,21,"B",CVXCODE)) Q
.S VISIT=$$GET1^DIQ(9000010.11,TEST,.03,"I")
.S VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
.I $G(SDATE)'="",(VSTDT<SDATE) Q
.I $G(EDATE)'="",(VSTDT\1>EDATE) Q
.I VSTDT>LDATE S LDATE=VSTDT,LIEN=TEST
.I VSTDT=LDATE,TEST>LIEN S LDATE=VSTDT,LIEN=TEST
.S CONTRIND=$$GET1^DIQ(9000010.11,TEST,.07,"I")
.S RESULT=$$GET1^DIQ(9000010.11,TEST,.04,"I")
.S CNT=CNT+1
.I $G(TARGET)]"" S @TARGET=RESULT_U_CONTRIND
Q
;
NDCTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
; Medication Taxonomy Check (using NDC Codes)
;
N TXIEN,TEST,VISIT,VSTDT,RESULT,DRGPTR,NDC,SIG,QTY,DAY
I DFN="" Q
I TAX="" Q
S TXIEN=$O(^ATXAX("B",TAX,""))
I TXIEN="" Q
S TEST="",CNT=0,LDATE=$G(LDATE,""),LIEN=$G(LIEN,"")
F S TEST=$O(^AUPNVMED("AC",DFN,TEST)) Q:TEST="" D
.S DRGPTR=$$GET1^DIQ(9000010.14,TEST,.01,"I")
.I DRGPTR="" Q
.S NDC=$$GET1^DIQ(50,DRGPTR,31,"I")
.I NDC="" Q
.I '$D(^ATXAX(TXIEN,21,"B",NDC)) Q
.S VISIT=$$GET1^DIQ(9000010.14,TEST,.03,"I")
.S VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
.I $G(SDATE)'="",(VSTDT<SDATE) Q
.I $G(EDATE)'="",(VSTDT\1>EDATE) Q
.I VSTDT>LDATE S LDATE=VSTDT,LIEN=TEST
.I VSTDT=LDATE,TEST>LIEN S LDATE=VSTDT,LIEN=TEST
.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 RESULT=$$GET1^DIQ(9000010.14,TEST,.01,"E")
.S CNT=CNT+1
.I $G(TARGET)]"" S @TARGET=RESULT_U_SIG_U_QTY_U_DAY
Q
;
RADTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
; Radiology Taxonomy Check (using CPT Taxonomy)
;
N TXIEN,TEST,VISIT,VSTDT,RESULT,RAD
I DFN="" Q
I TAX="" Q
S TXIEN=$O(^ATXAX("B",TAX,""))
I TXIEN="" Q
S TEST="",CNT=0,LDATE=$G(LDATE,""),LIEN=$G(LIEN,"")
F S TEST=$O(^AUPNVRAD("AC",DFN,TEST)) Q:TEST="" D
.S RAD=$$GET1^DIQ(9000010.22,TEST,.019,"E")
.I RAD="" Q
.I $$ICD^BKMIXX5(RAD,TXIEN,1)=0 Q
.S VISIT=$$GET1^DIQ(9000010.22,TEST,.03,"I")
.S VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
.I $G(SDATE)'="",(VSTDT<SDATE) Q
.I $G(EDATE)'="",(VSTDT\1>EDATE) Q
.I VSTDT>LDATE S LDATE=VSTDT,LIEN=TEST
.I VSTDT=LDATE,TEST>LIEN S LDATE=VSTDT,LIEN=TEST
.S RESULT=$$GET1^DIQ(9000010.22,TEST,.05,"E")
.I RESULT="" S RESULT=$$GET1^DIQ(9000010.22,TEST,1101,"E")
.S CNT=CNT+1
.I $G(TARGET)]"" S @TARGET=RESULT
Q
;
; For this entry point only:
;
; Input:
; TAX = EXAM CODE (external) to search for
; (required)
;
; Taxonomies not available for this type of data.
; Variables are still named the same for consistency with other functions.
;
EXAMTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
; Patient Examination check (includes exam)
;
N TXIEN,TEST,VISIT,VSTDT,RESULT,EXAM,CODE
I DFN="" Q
I TAX="" Q
S TXIEN=$O(^AUTTEXAM("C",TAX,""))
I TXIEN="" Q
S TEST="",CNT=0,LDATE=$G(LDATE,""),LIEN=$G(LIEN,"")
F S TEST=$O(^AUPNVXAM("AC",DFN,TEST)) Q:TEST="" D
.S EXAM=$$GET1^DIQ(9000010.13,TEST,.01,"I")
.I EXAM="" Q
.I EXAM'=TXIEN Q
.S VISIT=$$GET1^DIQ(9000010.13,TEST,.03,"I")
.S VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
.I $G(SDATE)'="",(VSTDT<SDATE) Q
.I $G(EDATE)'="",(VSTDT\1>EDATE) Q
.I VSTDT>LDATE S LDATE=VSTDT,LIEN=TEST
.I VSTDT=LDATE,TEST>LIEN S LDATE=VSTDT,LIEN=TEST
.S RESULT=$$GET1^DIQ(9000010.13,TEST,.04,"E")
.S CODE=$$GET1^DIQ(9000010.13,TEST,.01,"E")
.S CNT=CNT+1
.I $G(TARGET)]"" S @TARGET=RESULT_U_CODE
Q
;
; For this entry point only:
;
; Input:
; TAX = SKIN TEST CODE (external) to search for
; (required)
;
; Taxonomies not available for this type of data.
; Variables are still named the same for consistency with other functions.
;
SKNTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
; Skin Test check
;
N TXIEN,TEST,VISIT,VSTDT,RESULT,SKIN
I DFN="" Q
I TAX="" Q
S TXIEN=$O(^AUTTSK("C",TAX,""))
I TXIEN="" Q
S TEST="",CNT=0,LDATE=$G(LDATE,""),LIEN=$G(LIEN,"")
F S TEST=$O(^AUPNVSK("AC",DFN,TEST)) Q:TEST="" D
.S SKIN=$$GET1^DIQ(9000010.12,TEST,.01,"I")
.I SKIN="" Q
.I SKIN'=TXIEN Q
.S VISIT=$$GET1^DIQ(9000010.12,TEST,.03,"I")
.S VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
.I $G(SDATE)'="",(VSTDT<SDATE) Q
.I $G(EDATE)'="",(VSTDT\1>EDATE) Q
.I VSTDT>LDATE S LDATE=VSTDT,LIEN=TEST
.I VSTDT=LDATE,TEST>LIEN S LDATE=VSTDT,LIEN=TEST
.; Modified code to include the result as well as the reading
.S RESULT=$$GET1^DIQ(9000010.12,TEST,.05,"E")_U_$$GET1^DIQ(9000010.12,TEST,.04,"E")
.S CNT=CNT+1
.I $G(TARGET)]"" S @TARGET=RESULT
Q
BKMIXX1 ;PRXM/HC/BWF - TAXONOMY ACCESS UTILITIES ; 13 Apr 2005 4:50 PM
+1 ;;2.1;HIV MANAGEMENT SYSTEM;;Feb 07, 2011
+2 ; Generic Taxonomy Utilities
+3 ; Checks V-Files for patients that meet a Taxonomy's criteria, within
+4 ; a specific date range.
+5 ;
+6 ;**************NOTE***********************
+7 ; Input for all entry points are the same
+8 ;*****************************************
+9 ;
+10 ; Input:
+11 ; DFN = IEN from Patient file (#90000001)
+12 ; (required)
+13 ; TAX = Name of Taxonomy (From Lab Taxonomy ^ATXLAB or ICD Taxonomy ^ATXAX)
+14 ; (required)
+15 ; EDATE = End date of the report. The default is "Today"
+16 ; (optional)
+17 ; SDATE = Start date of the report.
+18 ; (optional)
+19 ; TARGET = Target root (global or local) for collection of data
+20 ; (optional)
+21 ; Example: ^TMP("RTN NAME",$J,"DESC",DFN,VSTDT,VISIT) or TEMP(VSTDT,VISIT)
+22 ; Output:
+23 ; LDATE = Last date found in the selected date range
+24 ; (optional - pass by reference)
+25 ; LIEN = Last IEN found in the selected date range
+26 ; (optional - pass by reference)
+27 ; CNT = Count of number of records found in selected date range
+28 ; (optional - pass by reference)
+29 ;
+30 QUIT
ICDTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
+1 ; ICD Taxonomy Check (using V POV file) (includes POV)
+2 ;
+3 NEW TXIEN,TEST,VISIT,VSTDT,RESULT,ICD,CODE
+4 IF DFN=""
QUIT
+5 IF TAX=""
QUIT
+6 SET TXIEN=$ORDER(^ATXAX("B",TAX,""))
+7 IF TXIEN=""
QUIT
+8 SET TEST=""
SET CNT=0
SET LDATE=$GET(LDATE,"")
SET LIEN=$GET(LIEN,"")
+9 FOR
SET TEST=$ORDER(^AUPNVPOV("AC",DFN,TEST))
IF TEST=""
QUIT
Begin DoDot:1
+10 SET ICD=$$GET1^DIQ(9000010.07,TEST,.01,"I")
+11 IF ICD=""
QUIT
+12 IF $$ICD^BKMIXX5(ICD,TXIEN,9)=0
QUIT
+13 SET VISIT=$$GET1^DIQ(9000010.07,TEST,.03,"I")
+14 SET VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
+15 IF $GET(SDATE)'=""
IF (VSTDT<SDATE)
QUIT
+16 IF $GET(EDATE)'=""
IF (VSTDT\1>EDATE)
QUIT
+17 IF VSTDT>LDATE
SET LDATE=VSTDT
SET LIEN=TEST
+18 IF VSTDT=LDATE
IF TEST>LIEN
SET LDATE=VSTDT
SET LIEN=TEST
+19 SET RESULT=$$GET1^DIQ(9000010.07,TEST,.04,"E")
+20 SET CODE=$$GET1^DIQ(9000010.07,TEST,.01,"E")
+21 SET CNT=CNT+1
+22 IF $GET(TARGET)]""
SET @TARGET=RESULT_U_CODE
End DoDot:1
+23 QUIT
+24 ;
PRCTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
+1 ; ICD Procedure Taxonomy Check
+2 ;
+3 NEW TXIEN,TEST,VISIT,VSTDT,RESULT,PRC
+4 IF DFN=""
QUIT
+5 IF TAX=""
QUIT
+6 SET TXIEN=$ORDER(^ATXAX("B",TAX,""))
+7 IF TXIEN=""
QUIT
+8 SET TEST=""
SET CNT=0
SET LDATE=$GET(LDATE,"")
SET LIEN=$GET(LIEN,"")
+9 FOR
SET TEST=$ORDER(^AUPNVPRC("AC",DFN,TEST))
IF TEST=""
QUIT
Begin DoDot:1
+10 SET PRC=$$GET1^DIQ(9000010.08,TEST,.01,"I")
+11 IF PRC=""
QUIT
+12 IF $$ICD^BKMIXX5(PRC,TXIEN,0)=0
QUIT
+13 SET VISIT=$$GET1^DIQ(9000010.08,TEST,.03,"I")
+14 SET VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
+15 IF $GET(SDATE)'=""
IF (VSTDT<SDATE)
QUIT
+16 IF $GET(EDATE)'=""
IF (VSTDT\1>EDATE)
QUIT
+17 IF VSTDT>LDATE
SET LDATE=VSTDT
SET LIEN=TEST
+18 IF VSTDT=LDATE
IF TEST>LIEN
SET LDATE=VSTDT
SET LIEN=TEST
+19 SET RESULT=$$GET1^DIQ(9000010.08,TEST,.04,"E")
+20 SET CNT=CNT+1
+21 IF $GET(TARGET)]""
SET @TARGET=RESULT
End DoDot:1
+22 QUIT
+23 ;
PTEDTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
+1 ; Patient Education Taxonomy check (by Taxonomy)
+2 ; PTEDTAX^BKMIXX does this by Education Code List
+3 ;
+4 NEW TXIEN,TEST,VISIT,VSTDT,RESULT,PTED
+5 IF DFN=""
QUIT
+6 IF TAX=""
QUIT
+7 SET TXIEN=$ORDER(^ATXAX("B",TAX,""))
+8 IF TXIEN=""
QUIT
+9 SET TEST=""
SET CNT=0
SET LDATE=$GET(LDATE,"")
SET LIEN=$GET(LIEN,"")
+10 FOR
SET TEST=$ORDER(^AUPNVPED("AC",DFN,TEST))
IF TEST=""
QUIT
Begin DoDot:1
+11 SET PTED=$$GET1^DIQ(9000010.16,TEST,.01,"E")
+12 IF PTED=""
QUIT
+13 IF '$DATA(^ATXAX(TXIEN,21,"B",PTED))
QUIT
+14 SET VISIT=$$GET1^DIQ(9000010.16,TEST,.03,"I")
+15 SET VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
+16 IF $GET(SDATE)'=""
IF (VSTDT<SDATE)
QUIT
+17 IF $GET(EDATE)'=""
IF (VSTDT\1>EDATE)
QUIT
+18 IF VSTDT>LDATE
SET LDATE=VSTDT
SET LIEN=TEST
+19 IF VSTDT=LDATE
IF TEST>LIEN
SET LDATE=VSTDT
SET LIEN=TEST
+20 SET RESULT=$$GET1^DIQ(9000010.16,TEST,.04,"E")
+21 SET CNT=CNT+1
+22 IF $GET(TARGET)]""
SET @TARGET=RESULT
End DoDot:1
+23 QUIT
+24 ;
CVXTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
+1 ; Immunization Taxonomy Check (includes Contraindicated Status)
+2 ;
+3 NEW TXIEN,TEST,VISIT,VSTDT,RESULT,CVX,CVXCODE,CONTRIND
+4 IF DFN=""
QUIT
+5 IF TAX=""
QUIT
+6 SET TXIEN=$ORDER(^ATXAX("B",TAX,""))
+7 IF TXIEN=""
QUIT
+8 SET TEST=""
SET CNT=0
SET LDATE=$GET(LDATE,"")
SET LIEN=$GET(LIEN,"")
+9 FOR
SET TEST=$ORDER(^AUPNVIMM("AC",DFN,TEST))
IF TEST=""
QUIT
Begin DoDot:1
+10 SET CVX=$$GET1^DIQ(9000010.11,TEST,.01,"I")
+11 IF CVX=""
QUIT
+12 SET CVXCODE=$$GET1^DIQ(9999999.14,CVX,.03,"E")
+13 IF CVXCODE=""
QUIT
+14 IF '$DATA(^ATXAX(TXIEN,21,"B",CVXCODE))
QUIT
+15 SET VISIT=$$GET1^DIQ(9000010.11,TEST,.03,"I")
+16 SET VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
+17 IF $GET(SDATE)'=""
IF (VSTDT<SDATE)
QUIT
+18 IF $GET(EDATE)'=""
IF (VSTDT\1>EDATE)
QUIT
+19 IF VSTDT>LDATE
SET LDATE=VSTDT
SET LIEN=TEST
+20 IF VSTDT=LDATE
IF TEST>LIEN
SET LDATE=VSTDT
SET LIEN=TEST
+21 SET CONTRIND=$$GET1^DIQ(9000010.11,TEST,.07,"I")
+22 SET RESULT=$$GET1^DIQ(9000010.11,TEST,.04,"I")
+23 SET CNT=CNT+1
+24 IF $GET(TARGET)]""
SET @TARGET=RESULT_U_CONTRIND
End DoDot:1
+25 QUIT
+26 ;
NDCTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
+1 ; Medication Taxonomy Check (using NDC Codes)
+2 ;
+3 NEW TXIEN,TEST,VISIT,VSTDT,RESULT,DRGPTR,NDC,SIG,QTY,DAY
+4 IF DFN=""
QUIT
+5 IF TAX=""
QUIT
+6 SET TXIEN=$ORDER(^ATXAX("B",TAX,""))
+7 IF TXIEN=""
QUIT
+8 SET TEST=""
SET CNT=0
SET LDATE=$GET(LDATE,"")
SET LIEN=$GET(LIEN,"")
+9 FOR
SET TEST=$ORDER(^AUPNVMED("AC",DFN,TEST))
IF TEST=""
QUIT
Begin DoDot:1
+10 SET DRGPTR=$$GET1^DIQ(9000010.14,TEST,.01,"I")
+11 IF DRGPTR=""
QUIT
+12 SET NDC=$$GET1^DIQ(50,DRGPTR,31,"I")
+13 IF NDC=""
QUIT
+14 IF '$DATA(^ATXAX(TXIEN,21,"B",NDC))
QUIT
+15 SET VISIT=$$GET1^DIQ(9000010.14,TEST,.03,"I")
+16 SET VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
+17 IF $GET(SDATE)'=""
IF (VSTDT<SDATE)
QUIT
+18 IF $GET(EDATE)'=""
IF (VSTDT\1>EDATE)
QUIT
+19 IF VSTDT>LDATE
SET LDATE=VSTDT
SET LIEN=TEST
+20 IF VSTDT=LDATE
IF TEST>LIEN
SET LDATE=VSTDT
SET LIEN=TEST
+21 SET SIG=$$GET1^DIQ(9000010.14,TEST,.05,"E")
+22 SET QTY=$$GET1^DIQ(9000010.14,TEST,.06,"E")
+23 SET DAY=$$GET1^DIQ(9000010.14,TEST,.07,"E")
+24 SET RESULT=$$GET1^DIQ(9000010.14,TEST,.01,"E")
+25 SET CNT=CNT+1
+26 IF $GET(TARGET)]""
SET @TARGET=RESULT_U_SIG_U_QTY_U_DAY
End DoDot:1
+27 QUIT
+28 ;
RADTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
+1 ; Radiology Taxonomy Check (using CPT Taxonomy)
+2 ;
+3 NEW TXIEN,TEST,VISIT,VSTDT,RESULT,RAD
+4 IF DFN=""
QUIT
+5 IF TAX=""
QUIT
+6 SET TXIEN=$ORDER(^ATXAX("B",TAX,""))
+7 IF TXIEN=""
QUIT
+8 SET TEST=""
SET CNT=0
SET LDATE=$GET(LDATE,"")
SET LIEN=$GET(LIEN,"")
+9 FOR
SET TEST=$ORDER(^AUPNVRAD("AC",DFN,TEST))
IF TEST=""
QUIT
Begin DoDot:1
+10 SET RAD=$$GET1^DIQ(9000010.22,TEST,.019,"E")
+11 IF RAD=""
QUIT
+12 IF $$ICD^BKMIXX5(RAD,TXIEN,1)=0
QUIT
+13 SET VISIT=$$GET1^DIQ(9000010.22,TEST,.03,"I")
+14 SET VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
+15 IF $GET(SDATE)'=""
IF (VSTDT<SDATE)
QUIT
+16 IF $GET(EDATE)'=""
IF (VSTDT\1>EDATE)
QUIT
+17 IF VSTDT>LDATE
SET LDATE=VSTDT
SET LIEN=TEST
+18 IF VSTDT=LDATE
IF TEST>LIEN
SET LDATE=VSTDT
SET LIEN=TEST
+19 SET RESULT=$$GET1^DIQ(9000010.22,TEST,.05,"E")
+20 IF RESULT=""
SET RESULT=$$GET1^DIQ(9000010.22,TEST,1101,"E")
+21 SET CNT=CNT+1
+22 IF $GET(TARGET)]""
SET @TARGET=RESULT
End DoDot:1
+23 QUIT
+24 ;
+25 ; For this entry point only:
+26 ;
+27 ; Input:
+28 ; TAX = EXAM CODE (external) to search for
+29 ; (required)
+30 ;
+31 ; Taxonomies not available for this type of data.
+32 ; Variables are still named the same for consistency with other functions.
+33 ;
EXAMTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
+1 ; Patient Examination check (includes exam)
+2 ;
+3 NEW TXIEN,TEST,VISIT,VSTDT,RESULT,EXAM,CODE
+4 IF DFN=""
QUIT
+5 IF TAX=""
QUIT
+6 SET TXIEN=$ORDER(^AUTTEXAM("C",TAX,""))
+7 IF TXIEN=""
QUIT
+8 SET TEST=""
SET CNT=0
SET LDATE=$GET(LDATE,"")
SET LIEN=$GET(LIEN,"")
+9 FOR
SET TEST=$ORDER(^AUPNVXAM("AC",DFN,TEST))
IF TEST=""
QUIT
Begin DoDot:1
+10 SET EXAM=$$GET1^DIQ(9000010.13,TEST,.01,"I")
+11 IF EXAM=""
QUIT
+12 IF EXAM'=TXIEN
QUIT
+13 SET VISIT=$$GET1^DIQ(9000010.13,TEST,.03,"I")
+14 SET VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
+15 IF $GET(SDATE)'=""
IF (VSTDT<SDATE)
QUIT
+16 IF $GET(EDATE)'=""
IF (VSTDT\1>EDATE)
QUIT
+17 IF VSTDT>LDATE
SET LDATE=VSTDT
SET LIEN=TEST
+18 IF VSTDT=LDATE
IF TEST>LIEN
SET LDATE=VSTDT
SET LIEN=TEST
+19 SET RESULT=$$GET1^DIQ(9000010.13,TEST,.04,"E")
+20 SET CODE=$$GET1^DIQ(9000010.13,TEST,.01,"E")
+21 SET CNT=CNT+1
+22 IF $GET(TARGET)]""
SET @TARGET=RESULT_U_CODE
End DoDot:1
+23 QUIT
+24 ;
+25 ; For this entry point only:
+26 ;
+27 ; Input:
+28 ; TAX = SKIN TEST CODE (external) to search for
+29 ; (required)
+30 ;
+31 ; Taxonomies not available for this type of data.
+32 ; Variables are still named the same for consistency with other functions.
+33 ;
SKNTAX(DFN,TAX,EDATE,SDATE,TARGET,LDATE,LIEN,CNT) ; PEP
+1 ; Skin Test check
+2 ;
+3 NEW TXIEN,TEST,VISIT,VSTDT,RESULT,SKIN
+4 IF DFN=""
QUIT
+5 IF TAX=""
QUIT
+6 SET TXIEN=$ORDER(^AUTTSK("C",TAX,""))
+7 IF TXIEN=""
QUIT
+8 SET TEST=""
SET CNT=0
SET LDATE=$GET(LDATE,"")
SET LIEN=$GET(LIEN,"")
+9 FOR
SET TEST=$ORDER(^AUPNVSK("AC",DFN,TEST))
IF TEST=""
QUIT
Begin DoDot:1
+10 SET SKIN=$$GET1^DIQ(9000010.12,TEST,.01,"I")
+11 IF SKIN=""
QUIT
+12 IF SKIN'=TXIEN
QUIT
+13 SET VISIT=$$GET1^DIQ(9000010.12,TEST,.03,"I")
+14 SET VSTDT=$$GET1^DIQ(9000010,VISIT_",",.01,"I")
+15 IF $GET(SDATE)'=""
IF (VSTDT<SDATE)
QUIT
+16 IF $GET(EDATE)'=""
IF (VSTDT\1>EDATE)
QUIT
+17 IF VSTDT>LDATE
SET LDATE=VSTDT
SET LIEN=TEST
+18 IF VSTDT=LDATE
IF TEST>LIEN
SET LDATE=VSTDT
SET LIEN=TEST
+19 ; Modified code to include the result as well as the reading
+20 SET RESULT=$$GET1^DIQ(9000010.12,TEST,.05,"E")_U_$$GET1^DIQ(9000010.12,TEST,.04,"E")
+21 SET CNT=CNT+1
+22 IF $GET(TARGET)]""
SET @TARGET=RESULT
End DoDot:1
+23 QUIT