ORWDBA4 ; SLC/GU Billing Awareness - Phase II [11/26/04 15:44] ;05/23/12 10:37
;;3.0;ORDER ENTRY/RESULTS REPORTING;**195,243,361**;Dec 17, 1997;Build 39
;
;Miscellaneous CIDC functions utility.
;
;External References used by this routine
; $$GETS^DIQ DBIA 2056
; GETS^DIQ DBIA 2056
; $$ICDDX^ICDCODE DBIA 3990
; $$TFGBLGUI^ORWDBA1 DBIA none listed
; $$SETDXD^ORWDBA2 DBIA none listed
; $$NOW^XLFDT DBIA 10103
; $$GET^XPAR DBIA 2263
;
GETTFCI(Y,ORIEN) ;Get Treatment Factors Clinical Indicators
;Input Variable:
; ORIEN Order Internal Entry Number (array variable)
;Ouput Variable:
; Y Y(AI)=Order_IEN^Treatment_Factors^ICD9^ICD9_Description
; There can be up to 4 ICD9 codes and thier descriptions
; ICD901^DESC01^ICD902^DESC02^ICD903^DESC03^ICD904^DESC04
;Local Variables:
; AI Array Index
; CI Clinical Index
; TF Treatment Factors
; TFCI Treatment Factors Clinical Indicators
N AI,CI,CNT,DXS,TF,TFCI
S U="^",(CNT,TF)=""
F S CNT=$O(ORIEN(CNT)) Q:CNT="" D
. S TF=$$GTF(ORIEN(CNT))
. S DXS=$$GDCD(ORIEN(CNT))
. I TF="NNNNNNNN"&(DXS="") Q
. S TFCI(CNT)=ORIEN(CNT)_U_TF_$S(DXS="":"",1:U_DXS)
M Y=TFCI
Q
;
GTF(IEN) ;Get Treatment Factors
;Gets the Treatment Factors for the current order converted to the
;format used by the CPRS GUI display.
;
;Input Variable:
; IEN Internal Entry Number
;Local Variables:
; ORTF Order Record Treatment Factors
; OREM Order Record Error Message
; OTF Order Treatment Factors
; (Converted to GUI values and returned)
N ORTF,OREM,OTF
S OTF=""
D GETS^DIQ(100,IEN,"90;91;92;93;94;95;96;98","I","ORTF","OREM")
S OTF=$G(ORTF(100,IEN_",",90,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",91,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",92,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",93,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",94,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",95,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",96,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",98,"I"))
S OTF=$$TFGBLGUI^ORWDBA1(OTF)
I OTF'="NNNNNNNN" Q OTF
S OTF=""
K ORTF,OREM
D GETS^DIQ(100,IEN,"51;52;53;54;55;56;57;58","I","ORTF","OREM")
S OTF=$G(ORTF(100,IEN_",",51,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",52,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",53,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",54,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",55,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",56,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",57,"I"))
S OTF=OTF_U_$G(ORTF(100,IEN_",",58,"I"))
S OTF=$$TFGBLGUI^ORWDBA1(OTF)
Q OTF
;
GDCD(IEN) ;Get Diagnoses Codes / Description
;Builds and returns a text string delimited by the "^". The text string
;made from the ICD9 codes associated with the current order and thier
;descriptions pulled from the ICD DIAGNOSIS file #80. The string can
;contain up to four diagnoses codes and thier descriptions. The string
;with all four possiable diagnoses codes is formatted:
;ICD901^DESC01^ICD902^DESC02^ICD903^DESC03^ICD904^DESC04
;
;Input Variable:
; IEN
;Local Variables:
; DCD Diagnosis Code Description (retrun variable)
; DXDT Diagnosis Date (either Order date or system date)
; DXD Diagnosis Description
; DXIEN Diagnosis Internal Entry Number
; ICD9 ICD9 code (for GUI display)
; IENS Internale Entry Number Sequence
; (Array index variable for data returned from lookup)
; ORRF Order Record Found (returned data from lookup)
; OREM Order Record Error Message
N DCD,DXDT,DXD,DXIEN,ICD9,IENS,ORRF,OREM
S DCD=""
D GETS^DIQ(100,IEN,".8*;5.1*","I","ORRF","OREM")
I $D(ORRF) D
. S DXDT=""
. I $D(ORRF(100.008)) S DXDT=$G(ORRF(100.008,"1,"_IEN_",",.01,"I"))
. I DXDT="" S DXDT=$$NOW^XLFDT
. I $D(ORRF(100.051)) D
.. S IENS="" F S IENS=$O(ORRF(100.051,IENS)) Q:IENS="" D
... I ORRF(100.051,IENS,.01,"I")="" S DCD=DCD_U Q
... S DXIEN=ORRF(100.051,IENS,.01,"I")
... S ICD9=$$GET1^DIQ(80,DXIEN,.01,"")
... S DXD=$$SETDXD^ORWDBA2($P($$ICDDATA^ICDXCODE("DIAGNOSIS",ICD9,DT),U,4))
... S DCD=$S(DCD="":ICD9_U_DXD,1:DCD_U_ICD9_U_DXD)
Q DCD
;
GETBAUSR(Y,ORCIEN) ;GUI RPC CALL
;Get Billing Awareness By User parameter value
;Gets and returns the value of the Enabled Billing Awareness By User
;parameter assigned to a provider.
;Input Variable:
; ORCIEN Ordering Clinician's Internal Entry Number
;Output Variable:
; Y Parameter value, 1 if enabled, 0 if disabled
S Y=$$GET^XPAR(ORCIEN_";VA(200,","OR BILLING AWARENESS BY USER",1,"Q")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORWDBA4 4649 printed Nov 22, 2024@17:45:18 Page 2
ORWDBA4 ; SLC/GU Billing Awareness - Phase II [11/26/04 15:44] ;05/23/12 10:37
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**195,243,361**;Dec 17, 1997;Build 39
+2 ;
+3 ;Miscellaneous CIDC functions utility.
+4 ;
+5 ;External References used by this routine
+6 ; $$GETS^DIQ DBIA 2056
+7 ; GETS^DIQ DBIA 2056
+8 ; $$ICDDX^ICDCODE DBIA 3990
+9 ; $$TFGBLGUI^ORWDBA1 DBIA none listed
+10 ; $$SETDXD^ORWDBA2 DBIA none listed
+11 ; $$NOW^XLFDT DBIA 10103
+12 ; $$GET^XPAR DBIA 2263
+13 ;
GETTFCI(Y,ORIEN) ;Get Treatment Factors Clinical Indicators
+1 ;Input Variable:
+2 ; ORIEN Order Internal Entry Number (array variable)
+3 ;Ouput Variable:
+4 ; Y Y(AI)=Order_IEN^Treatment_Factors^ICD9^ICD9_Description
+5 ; There can be up to 4 ICD9 codes and thier descriptions
+6 ; ICD901^DESC01^ICD902^DESC02^ICD903^DESC03^ICD904^DESC04
+7 ;Local Variables:
+8 ; AI Array Index
+9 ; CI Clinical Index
+10 ; TF Treatment Factors
+11 ; TFCI Treatment Factors Clinical Indicators
+12 NEW AI,CI,CNT,DXS,TF,TFCI
+13 SET U="^"
SET (CNT,TF)=""
+14 FOR
SET CNT=$ORDER(ORIEN(CNT))
if CNT=""
QUIT
Begin DoDot:1
+15 SET TF=$$GTF(ORIEN(CNT))
+16 SET DXS=$$GDCD(ORIEN(CNT))
+17 IF TF="NNNNNNNN"&(DXS="")
QUIT
+18 SET TFCI(CNT)=ORIEN(CNT)_U_TF_$SELECT(DXS="":"",1:U_DXS)
End DoDot:1
+19 MERGE Y=TFCI
+20 QUIT
+21 ;
GTF(IEN) ;Get Treatment Factors
+1 ;Gets the Treatment Factors for the current order converted to the
+2 ;format used by the CPRS GUI display.
+3 ;
+4 ;Input Variable:
+5 ; IEN Internal Entry Number
+6 ;Local Variables:
+7 ; ORTF Order Record Treatment Factors
+8 ; OREM Order Record Error Message
+9 ; OTF Order Treatment Factors
+10 ; (Converted to GUI values and returned)
+11 NEW ORTF,OREM,OTF
+12 SET OTF=""
+13 DO GETS^DIQ(100,IEN,"90;91;92;93;94;95;96;98","I","ORTF","OREM")
+14 SET OTF=$GET(ORTF(100,IEN_",",90,"I"))
+15 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",91,"I"))
+16 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",92,"I"))
+17 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",93,"I"))
+18 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",94,"I"))
+19 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",95,"I"))
+20 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",96,"I"))
+21 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",98,"I"))
+22 SET OTF=$$TFGBLGUI^ORWDBA1(OTF)
+23 IF OTF'="NNNNNNNN"
QUIT OTF
+24 SET OTF=""
+25 KILL ORTF,OREM
+26 DO GETS^DIQ(100,IEN,"51;52;53;54;55;56;57;58","I","ORTF","OREM")
+27 SET OTF=$GET(ORTF(100,IEN_",",51,"I"))
+28 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",52,"I"))
+29 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",53,"I"))
+30 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",54,"I"))
+31 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",55,"I"))
+32 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",56,"I"))
+33 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",57,"I"))
+34 SET OTF=OTF_U_$GET(ORTF(100,IEN_",",58,"I"))
+35 SET OTF=$$TFGBLGUI^ORWDBA1(OTF)
+36 QUIT OTF
+37 ;
GDCD(IEN) ;Get Diagnoses Codes / Description
+1 ;Builds and returns a text string delimited by the "^". The text string
+2 ;made from the ICD9 codes associated with the current order and thier
+3 ;descriptions pulled from the ICD DIAGNOSIS file #80. The string can
+4 ;contain up to four diagnoses codes and thier descriptions. The string
+5 ;with all four possiable diagnoses codes is formatted:
+6 ;ICD901^DESC01^ICD902^DESC02^ICD903^DESC03^ICD904^DESC04
+7 ;
+8 ;Input Variable:
+9 ; IEN
+10 ;Local Variables:
+11 ; DCD Diagnosis Code Description (retrun variable)
+12 ; DXDT Diagnosis Date (either Order date or system date)
+13 ; DXD Diagnosis Description
+14 ; DXIEN Diagnosis Internal Entry Number
+15 ; ICD9 ICD9 code (for GUI display)
+16 ; IENS Internale Entry Number Sequence
+17 ; (Array index variable for data returned from lookup)
+18 ; ORRF Order Record Found (returned data from lookup)
+19 ; OREM Order Record Error Message
+20 NEW DCD,DXDT,DXD,DXIEN,ICD9,IENS,ORRF,OREM
+21 SET DCD=""
+22 DO GETS^DIQ(100,IEN,".8*;5.1*","I","ORRF","OREM")
+23 IF $DATA(ORRF)
Begin DoDot:1
+24 SET DXDT=""
+25 IF $DATA(ORRF(100.008))
SET DXDT=$GET(ORRF(100.008,"1,"_IEN_",",.01,"I"))
+26 IF DXDT=""
SET DXDT=$$NOW^XLFDT
+27 IF $DATA(ORRF(100.051))
Begin DoDot:2
+28 SET IENS=""
FOR
SET IENS=$ORDER(ORRF(100.051,IENS))
if IENS=""
QUIT
Begin DoDot:3
+29 IF ORRF(100.051,IENS,.01,"I")=""
SET DCD=DCD_U
QUIT
+30 SET DXIEN=ORRF(100.051,IENS,.01,"I")
+31 SET ICD9=$$GET1^DIQ(80,DXIEN,.01,"")
+32 SET DXD=$$SETDXD^ORWDBA2($PIECE($$ICDDATA^ICDXCODE("DIAGNOSIS",ICD9,DT),U,4))
+33 SET DCD=$SELECT(DCD="":ICD9_U_DXD,1:DCD_U_ICD9_U_DXD)
End DoDot:3
End DoDot:2
End DoDot:1
+34 QUIT DCD
+35 ;
GETBAUSR(Y,ORCIEN) ;GUI RPC CALL
+1 ;Get Billing Awareness By User parameter value
+2 ;Gets and returns the value of the Enabled Billing Awareness By User
+3 ;parameter assigned to a provider.
+4 ;Input Variable:
+5 ; ORCIEN Ordering Clinician's Internal Entry Number
+6 ;Output Variable:
+7 ; Y Parameter value, 1 if enabled, 0 if disabled
+8 SET Y=$$GET^XPAR(ORCIEN_";VA(200,","OR BILLING AWARENESS BY USER",1,"Q")
+9 QUIT