| 1 | BPSNCPD3 ;BHAM ISC/LJE - Continuation of BPSNCPDP - DUR HANDLING ;06/16/2004 | 
|---|
| 2 | ;;1.0;E CLAIMS MGMT ENGINE;**1,5**;JUN 2004;Build 45 | 
|---|
| 3 | ;;Per VHA Directive 2004-038, this routine should not be modified. | 
|---|
| 4 | ; DUR1 is called by PSO to get the reject info so that should NOT be removed | 
|---|
| 5 | ; | 
|---|
| 6 | ; | 
|---|
| 7 | ; | 
|---|
| 8 | ; Function call for DUR INFORMATION | 
|---|
| 9 | ; Parameters: BRXIEN = Prescription IEN | 
|---|
| 10 | ;             BFILL = fill number | 
|---|
| 11 | ;             DUR = DUR info passed back | 
|---|
| 12 | ;             ERROR = error passed back | 
|---|
| 13 | ; Note: | 
|---|
| 14 | ;    DUR("BILLED")=0 if ecme off for pharmacy or no transaction in ECME | 
|---|
| 15 | ;    DUR(<Insurance counter>,"BILLED")=1 if billed through ecme | 
|---|
| 16 | DUR1(BRXIEN,BFILL,DUR,ERROR) ; | 
|---|
| 17 | N SITE,DFILL,TRANIEN,JJ,DUR1,DURIEN,I | 
|---|
| 18 | ; | 
|---|
| 19 | ; Get Site info and check is ECME is turned on | 
|---|
| 20 | ; If not, set DUR("BILLED")=0 and quit | 
|---|
| 21 | I '$G(BFILL) S SITE=$$RXAPI1^BPSUTIL1(BRXIEN,20,"I") | 
|---|
| 22 | I $G(BFILL) S SITE=$$RXSUBF1^BPSUTIL1(BRXIEN,52,52.1,BFILL,8,"I") | 
|---|
| 23 | I '$$ECMEON^BPSUTIL(SITE) S DUR("BILLED")=0 Q | 
|---|
| 24 | ; | 
|---|
| 25 | ; Set up the Transaction IEN | 
|---|
| 26 | S DFILL="",DFILL=$E($TR($J("",4-$L(BFILL))," ","0")_BFILL,1,4)_1 | 
|---|
| 27 | S TRANIEN=BRXIEN_"."_DFILL | 
|---|
| 28 | ; | 
|---|
| 29 | ; If the transaction record does not exist, set DUR("BILLED")=0 and quit | 
|---|
| 30 | I '$D(^BPST(TRANIEN)) S DUR("BILLED")=0 Q | 
|---|
| 31 | ; | 
|---|
| 32 | ; Loop through the insurance multiple and set DUR array | 
|---|
| 33 | S JJ=0 | 
|---|
| 34 | F  S JJ=$O(^BPST(TRANIEN,10,JJ)) Q:JJ=""!(JJ'?1N.N)  D | 
|---|
| 35 | . ; | 
|---|
| 36 | . ; We are good so set Billed | 
|---|
| 37 | . S DUR(JJ,"BILLED")=1 | 
|---|
| 38 | . ; | 
|---|
| 39 | . ; Get Insurance Info and set into DUR array | 
|---|
| 40 | . D GETS^DIQ(9002313.59902,JJ_","_TRANIEN_",","902.05;902.06;902.24;902.25;902.26","E","DUR1","ERROR") | 
|---|
| 41 | . S DUR(JJ,"INSURANCE NAME")=$G(DUR1(9002313.59902,JJ_","_TRANIEN_",",902.24,"E"))  ; Insurance Company Name | 
|---|
| 42 | . S DUR(JJ,"GROUP NUMBER")=$G(DUR1(9002313.59902,JJ_","_TRANIEN_",",902.05,"E"))    ; Insurance Group Number | 
|---|
| 43 | . S DUR(JJ,"GROUP NAME")=$G(DUR1(9002313.59902,JJ_","_TRANIEN_",",902.25,"E"))      ; Insurance Group Name | 
|---|
| 44 | . S DUR(JJ,"PLAN CONTACT")=$G(DUR1(9002313.59902,JJ_","_TRANIEN_",",902.26,"E"))    ; Insurance Contact Number | 
|---|
| 45 | . S DUR(JJ,"CARDHOLDER ID")=$G(DUR1(9002313.59902,JJ_","_TRANIEN_",",902.06,"E"))   ; Cardholder ID | 
|---|
| 46 | . ; | 
|---|
| 47 | . ; Get Response IEN and Data | 
|---|
| 48 | . S DURIEN="",DURIEN=$P(^BPST(TRANIEN,0),"^",5)                             ;Note: in future will need to store/get DURIEN for each insurance | 
|---|
| 49 | . S DUR(JJ,"RESPONSE IEN")=DURIEN | 
|---|
| 50 | . D GETS^DIQ(9002313.0301,"1,"_DURIEN_",","501;567.01*;526","E","DUR1","ERROR") | 
|---|
| 51 | . S DUR(JJ,"PAYER MESSAGE")=$G(DUR1(9002313.0301,"1,"_DURIEN_",",526,"E"))           ;Additional free text message info from payer | 
|---|
| 52 | . S DUR(JJ,"STATUS")=$G(DUR1(9002313.0301,"1,"_DURIEN_",",501,"E"))                  ;Status of Response | 
|---|
| 53 | . S DUR(JJ,"REASON")=$G(DUR1(9002313.1101,"1,1,"_DURIEN_",",439,"E"))                ;Reason of Service Code | 
|---|
| 54 | . S DUR(JJ,"CLIN SIGNIFICANCE")=$G(DUR1(9002313.1101,"1,1,"_DURIEN_",",528,"E"))     ;Clinical Significance Code | 
|---|
| 55 | . S DUR(JJ,"OTH PHARM IND")=$G(DUR1(9002313.1101,"1,1,"_DURIEN_",",529,"E"))         ;Other Pharmacy Indicator Code | 
|---|
| 56 | . S DUR(JJ,"PREV FILL DATE")=$G(DUR1(9002313.1101,"1,1,"_DURIEN_",",530,"E"))        ;Previous Date of Fill | 
|---|
| 57 | . S DUR(JJ,"QTY OF PREV FILL")=$G(DUR1(9002313.1101,"1,1,"_DURIEN_",",531,"E"))      ;Quantity of Previous Fill | 
|---|
| 58 | . S DUR(JJ,"DATABASE IND")=$G(DUR1(9002313.1101,"1,1,"_DURIEN_",",532,"E"))          ;Database Indicator | 
|---|
| 59 | . S DUR(JJ,"OTH PRESCRIBER IND")=$G(DUR1(9002313.1101,"1,1,"_DURIEN_",",533,"E"))    ;Other Prescriber Indicator | 
|---|
| 60 | . S DUR(JJ,"DUR FREE TEXT DESC")=$G(DUR1(9002313.1101,"1,1,"_DURIEN_",",544,"E"))    ;DUR Free Text Message from Payer | 
|---|
| 61 | . ; | 
|---|
| 62 | . ; Get DUR reject codes and description and store in DUR | 
|---|
| 63 | . D GETS^DIQ(9002313.0301,"1,"_DURIEN_",","511*","I","DUR1","ERROR")                 ;get DUR codes and descriptions | 
|---|
| 64 | . S DUR(JJ,"REJ CODE LST")="" | 
|---|
| 65 | . F I=1:1 Q:'$D(DUR1(9002313.03511,I_",1,"_DURIEN_","))  D | 
|---|
| 66 | .. S DUR(JJ,"REJ CODES",I,DUR1(9002313.03511,I_",1,"_DURIEN_",",.01,"I"))=$$GET1^DIQ(9002313.93,DUR1(9002313.03511,I_",1,"_DURIEN_",",.01,"I"),".02") | 
|---|
| 67 | .. S DUR(JJ,"REJ CODE LST")=DUR(JJ,"REJ CODE LST")_","_DUR1(9002313.03511,I_",1,"_DURIEN_",",.01,"I") | 
|---|
| 68 | . S DUR(JJ,"REJ CODE LST")=$E(DUR(JJ,"REJ CODE LST"),2,9999) | 
|---|
| 69 | Q | 
|---|