| 1 | ORWDBA4 ; SLC/GU Billing Awareness - Phase II [11/26/04 15:44] | 
|---|
| 2 | ;;3.0;ORDER ENTRY/RESULTS REPORTING;**195**;Dec 17, 1997 | 
|---|
| 3 | ; | 
|---|
| 4 | ;Miscellaneous CIDC functions utility. | 
|---|
| 5 | ; | 
|---|
| 6 | ;External References used by this routine | 
|---|
| 7 | ;  $$GETS^DIQ            DBIA 2056 | 
|---|
| 8 | ;  GETS^DIQ              DBIA 2056 | 
|---|
| 9 | ;  $$ICDDX^ICDCODE       DBIA 3990 | 
|---|
| 10 | ;  $$TFGBLGUI^ORWDBA1    DBIA none listed | 
|---|
| 11 | ;  $$SETDXD^ORWDBA2      DBIA none listed | 
|---|
| 12 | ;  $$NOW^XLFDT           DBIA 10103 | 
|---|
| 13 | ;  $$GET^XPAR            DBIA 2263 | 
|---|
| 14 | ; | 
|---|
| 15 | GETTFCI(Y,ORIEN) ;Get Treatment Factors Clinical Indicators | 
|---|
| 16 | ;Input Variable: | 
|---|
| 17 | ;  ORIEN    Order Internal Entry Number (array variable) | 
|---|
| 18 | ;Ouput Variable: | 
|---|
| 19 | ;  Y        Y(AI)=Order_IEN^Treatment_Factors^ICD9^ICD9_Description | 
|---|
| 20 | ;           There can be up to 4 ICD9 codes and thier descriptions | 
|---|
| 21 | ;           ICD901^DESC01^ICD902^DESC02^ICD903^DESC03^ICD904^DESC04 | 
|---|
| 22 | ;Local Variables: | 
|---|
| 23 | ;  AI       Array Index | 
|---|
| 24 | ;  CI       Clinical Index | 
|---|
| 25 | ;  TF       Treatment Factors | 
|---|
| 26 | ;  TFCI     Treatment Factors Clinical Indicators | 
|---|
| 27 | N AI,CI,CNT,DXS,TF,TFCI | 
|---|
| 28 | S U="^",(CNT,TF)="" | 
|---|
| 29 | F  S CNT=$O(ORIEN(CNT)) Q:CNT=""  D | 
|---|
| 30 | . S TF=$$GTF(ORIEN(CNT)) | 
|---|
| 31 | . S DXS=$$GDCD(ORIEN(CNT)) | 
|---|
| 32 | . I TF="NNNNNNN"&(DXS="") Q | 
|---|
| 33 | . S TFCI(CNT)=ORIEN(CNT)_U_TF_$S(DXS="":"",1:U_DXS) | 
|---|
| 34 | M Y=TFCI | 
|---|
| 35 | Q | 
|---|
| 36 | ; | 
|---|
| 37 | GTF(IEN) ;Get Treatment Factors | 
|---|
| 38 | ;Gets the Treatment Factors for the current order converted to the | 
|---|
| 39 | ;format used by the CPRS GUI display. | 
|---|
| 40 | ; | 
|---|
| 41 | ;Input Variable: | 
|---|
| 42 | ;  IEN     Internal Entry Number | 
|---|
| 43 | ;Local Variables: | 
|---|
| 44 | ;  ORTF    Order Record Treatment Factors | 
|---|
| 45 | ;  OREM    Order Record Error Message | 
|---|
| 46 | ;  OTF     Order Treatment Factors | 
|---|
| 47 | ;          (Converted to GUI values and returned) | 
|---|
| 48 | N ORTF,OREM,OTF | 
|---|
| 49 | S OTF="" | 
|---|
| 50 | D GETS^DIQ(100,IEN,"90;91;92;93;94;95;96","I","ORTF","OREM") | 
|---|
| 51 | S OTF=$G(ORTF(100,IEN_",",90,"I")) | 
|---|
| 52 | S OTF=OTF_U_$G(ORTF(100,IEN_",",91,"I")) | 
|---|
| 53 | S OTF=OTF_U_$G(ORTF(100,IEN_",",92,"I")) | 
|---|
| 54 | S OTF=OTF_U_$G(ORTF(100,IEN_",",93,"I")) | 
|---|
| 55 | S OTF=OTF_U_$G(ORTF(100,IEN_",",94,"I")) | 
|---|
| 56 | S OTF=OTF_U_$G(ORTF(100,IEN_",",95,"I")) | 
|---|
| 57 | S OTF=OTF_U_$G(ORTF(100,IEN_",",96,"I")) | 
|---|
| 58 | S OTF=$$TFGBLGUI^ORWDBA1(OTF) | 
|---|
| 59 | I OTF'="NNNNNNN" Q OTF | 
|---|
| 60 | S OTF="" | 
|---|
| 61 | K ORTF,OREM | 
|---|
| 62 | D GETS^DIQ(100,IEN,"51;52;53;54;55;56;57","I","ORTF","OREM") | 
|---|
| 63 | S OTF=$G(ORTF(100,IEN_",",51,"I")) | 
|---|
| 64 | S OTF=OTF_U_$G(ORTF(100,IEN_",",52,"I")) | 
|---|
| 65 | S OTF=OTF_U_$G(ORTF(100,IEN_",",53,"I")) | 
|---|
| 66 | S OTF=OTF_U_$G(ORTF(100,IEN_",",54,"I")) | 
|---|
| 67 | S OTF=OTF_U_$G(ORTF(100,IEN_",",55,"I")) | 
|---|
| 68 | S OTF=OTF_U_$G(ORTF(100,IEN_",",56,"I")) | 
|---|
| 69 | S OTF=OTF_U_$G(ORTF(100,IEN_",",57,"I")) | 
|---|
| 70 | S OTF=$$TFGBLGUI^ORWDBA1(OTF) | 
|---|
| 71 | Q OTF | 
|---|
| 72 | ; | 
|---|
| 73 | GDCD(IEN) ;Get Diagnoses Codes / Description | 
|---|
| 74 | ;Builds and returns a text string delimited by the "^". The text string | 
|---|
| 75 | ;made from the ICD9 codes associated with the current order and thier | 
|---|
| 76 | ;descriptions pulled from the ICD DIAGNOSIS file #80. The string can | 
|---|
| 77 | ;contain up to four diagnoses codes and thier descriptions. The string | 
|---|
| 78 | ;with all four possiable diagnoses codes is formatted: | 
|---|
| 79 | ;ICD901^DESC01^ICD902^DESC02^ICD903^DESC03^ICD904^DESC04 | 
|---|
| 80 | ; | 
|---|
| 81 | ;Input Variable: | 
|---|
| 82 | ;  IEN | 
|---|
| 83 | ;Local Variables: | 
|---|
| 84 | ;  DCD      Diagnosis Code Description (retrun variable) | 
|---|
| 85 | ;  DXDT     Diagnosis Date (either Order date or system date) | 
|---|
| 86 | ;  DXD      Diagnosis Description | 
|---|
| 87 | ;  DXIEN    Diagnosis Internal Entry Number | 
|---|
| 88 | ;  ICD9     ICD9 code (for GUI display) | 
|---|
| 89 | ;  IENS     Internale Entry Number Sequence | 
|---|
| 90 | ;           (Array index variable for data returned from lookup) | 
|---|
| 91 | ;  ORRF     Order Record Found (returned data from lookup) | 
|---|
| 92 | ;  OREM     Order Record Error Message | 
|---|
| 93 | N DCD,DXDT,DXD,DXIEN,ICD9,IENS,ORRF,OREM | 
|---|
| 94 | S DCD="" | 
|---|
| 95 | D GETS^DIQ(100,IEN,".8*;5.1*","I","ORRF","OREM") | 
|---|
| 96 | I $D(ORRF) D | 
|---|
| 97 | . S DXDT="" | 
|---|
| 98 | . I $D(ORRF(100.008)) S DXDT=$G(ORRF(100.008,"1,"_IEN_",",.01,"I")) | 
|---|
| 99 | . I DXDT="" S DXDT=$$NOW^XLFDT | 
|---|
| 100 | . I $D(ORRF(100.051)) D | 
|---|
| 101 | .. S IENS="" F  S IENS=$O(ORRF(100.051,IENS)) Q:IENS=""  D | 
|---|
| 102 | ... I ORRF(100.051,IENS,.01,"I")="" S DCD=DCD_U Q | 
|---|
| 103 | ... S DXIEN=ORRF(100.051,IENS,.01,"I") | 
|---|
| 104 | ... S ICD9=$$GET1^DIQ(80,DXIEN,.01,"") | 
|---|
| 105 | ... S DXD=$$SETDXD^ORWDBA2($P($$ICDDX^ICDCODE(ICD9,DT),U,4)) | 
|---|
| 106 | ... S DCD=$S(DCD="":ICD9_U_DXD,1:DCD_U_ICD9_U_DXD) | 
|---|
| 107 | Q DCD | 
|---|
| 108 | ; | 
|---|
| 109 | GETBAUSR(Y,ORCIEN) ;GUI RPC CALL | 
|---|
| 110 | ;Get Billing Awareness By User parameter value | 
|---|
| 111 | ;Gets and returns the value of the Enabled Billing Awareness By User | 
|---|
| 112 | ;parameter assigned to a provider. | 
|---|
| 113 | ;Input Variable: | 
|---|
| 114 | ;  ORCIEN    Ordering Clinician's Internal Entry Number | 
|---|
| 115 | ;Output Variable: | 
|---|
| 116 | ;  Y         Parameter value, 1 if enabled, 0 if disabled | 
|---|
| 117 | S Y=$$GET^XPAR(ORCIEN_";VA(200,","OR BILLING AWARENESS BY USER",1,"Q") | 
|---|
| 118 | Q | 
|---|