| 1 | IB20PT6 ;ALB/AAS - Insurance post init stuff ; 2/22/93 | 
|---|
| 2 | ;;Version 2.0 ; INTEGRATED BILLING ;; 21-MAR-94 | 
|---|
| 3 | ; | 
|---|
| 4 | % S IBFORCE=1 | 
|---|
| 5 | I '$O(^IBA(355.3,0)) D  ; -- one time updates (ins policy alerady exists | 
|---|
| 6 | .D PAT ;            x-ref patient file by ins. co., add hip pointer | 
|---|
| 7 | .D 399^IB20PT61 ;   add ae x-ref to file 399 | 
|---|
| 8 | .D INPT ;           load current inpatients into claims tracking | 
|---|
| 9 | ; | 
|---|
| 10 | K IBFORCE | 
|---|
| 11 | Q | 
|---|
| 12 | ; | 
|---|
| 13 | PAT ; -- create AB x-ref on patient file for all insurance co. pointers | 
|---|
| 14 | W !!!,"<<< Patient file insurance conversion" | 
|---|
| 15 | W !,"    Cross-reference patient file by Insurance company and",!,"    Update Health Insurance Policy Pointers" | 
|---|
| 16 | S ZTRTN="PATDQ^IB20PT6",ZTDESC="IB - v2 PATIENT FILE POST INIT UPDATE",ZTIO="" S:$G(IBFORCE) ZTDTH=$$15 | 
|---|
| 17 | W ! D ^%ZTLOAD I '$D(ZTSK) D  Q:'IBOK | 
|---|
| 18 | .D MANUAL^IB20PT61 | 
|---|
| 19 | .I 'IBOK,$P($G(^IBE(350.9,1,3)),"^",18)="" W !!,"You must run the v2.0 post init routine IB20PT6 before allowing users to",!,"edit insurance information" | 
|---|
| 20 | I $D(ZTSK) W !,"    Patient file update queued as task ",ZTSK K ZTSK Q | 
|---|
| 21 | ; | 
|---|
| 22 | PATDQ D NOW^%DTC S IBSPDT=% | 
|---|
| 23 | I '$D(ZTQUEUED) D | 
|---|
| 24 | .W !!,"    I'll write a dot for each 100 entries" | 
|---|
| 25 | .W !,"    Start time: " S Y=IBSPDT D DT^DIQ | 
|---|
| 26 | N DFN,IBI,IBCPOL,IBCDFND,DA,DR,DIE,DIC,IBCNT,IBCNTP,IBCNTPP,IBCNTI | 
|---|
| 27 | S (IBCNT,IBCNTP,IBCNTPP,IBCNTI,DFN)=0 | 
|---|
| 28 | F  S DFN=$O(^DPT(DFN)) Q:'DFN  S IBCNT=IBCNT+1,IBI=0 S:$O(^DPT(DFN,.312,IBI)) IBCNTI=IBCNTI+1 F  S IBI=$O(^DPT(DFN,.312,IBI)) Q:'IBI  D | 
|---|
| 29 | .I '$D(ZTQUEUED) W:'(IBCNTPP#100) "." | 
|---|
| 30 | .S IBCDFND=$G(^DPT(DFN,.312,IBI,0)) | 
|---|
| 31 | .S ^DPT("AB",+IBCDFND,DFN,IBI)="" | 
|---|
| 32 | .S ^DPT(DFN,.312,"B",+IBCDFND,IBI)="" | 
|---|
| 33 | .Q:$P(IBCDFND,U,18) | 
|---|
| 34 | .S IBCPOL=$$CHIP^IBCNSU(IBCDFND) | 
|---|
| 35 | .Q:'IBCPOL | 
|---|
| 36 | .Q:+IBCDFND'=+$G(^IBA(355.3,+IBCPOL,0))  ; patient ins. and policy must have same ins. company file. | 
|---|
| 37 | .S IBCNTPP=IBCNTPP+1 | 
|---|
| 38 | .S DA=IBI,DA(1)=DFN,DIE="^DPT("_DFN_",.312," | 
|---|
| 39 | .S DR="1.09////1;.18////"_IBCPOL | 
|---|
| 40 | .D ^DIE K DA,DR,DIE,DIC | 
|---|
| 41 | .Q | 
|---|
| 42 | S $P(^IBE(350.9,1,3),"^",18)=DT | 
|---|
| 43 | D NOW^%DTC S IBEPDT=% | 
|---|
| 44 | D BULL1^IB20PT61 | 
|---|
| 45 | I '$D(ZTQUEUED) D | 
|---|
| 46 | .W !!,"<<< Health Insurance Policy information updated" | 
|---|
| 47 | .W !,"    there were ",IBCNTPP," Policies for ",IBCNT," Patients were updated" | 
|---|
| 48 | .W !,"    causing ",IBCNTP," Health Insurance Policies to be added" | 
|---|
| 49 | .W !,"    Finish Time: " S Y=IBEPDT D DT^DIQ | 
|---|
| 50 | Q | 
|---|
| 51 | ; | 
|---|
| 52 | ; | 
|---|
| 53 | INPT ; -- load current inpatients into claims tracking | 
|---|
| 54 | W !!!,"<<< Load current inpatients into Claims Tracking" | 
|---|
| 55 | S ZTRTN="INPTDQ^IB20PT6",ZTDESC="IB - v2 CLAIMS TRACKING POST INIT UPDATE",ZTIO="" S:$G(IBFORCE) ZTDTH=$$15 | 
|---|
| 56 | W ! D ^%ZTLOAD I '$D(ZTSK) D  Q:'IBOK | 
|---|
| 57 | .D MANUAL^IB20PT61 | 
|---|
| 58 | .I 'IBOK,$P($G(^IBE(350.9,1,3)),"^",20)="" W !!,"You must run the v2.0 post init routine IB20PT6 to automatically add",!,"Current inpatient into Claims Tracking." | 
|---|
| 59 | I $D(ZTSK) W !,"    Claims Tracking update queued as task ",ZTSK K ZTSK Q | 
|---|
| 60 | ; | 
|---|
| 61 | INPTDQ D NOW^%DTC S IBSTDT=% | 
|---|
| 62 | N WARD,DGPMDA,IBCNT,IB20 | 
|---|
| 63 | S WARD="",DGPDMA=0,IBCNT=0,IB20=1 | 
|---|
| 64 | F  S WARD=$O(^DGPM("CN",WARD)) Q:WARD=""  S DGPMDA=0 F  S DGPMDA=$O(^DGPM("CN",WARD,DGPMDA)) Q:'DGPMDA  D | 
|---|
| 65 | .S DGPMP="" | 
|---|
| 66 | .S DGPMA=$G(^DGPM(DGPMDA,0)) Q:DGPMA="" | 
|---|
| 67 | .S DFN=$P(DGPMA,"^",3) Q:'DFN | 
|---|
| 68 | .D INP^VADPT | 
|---|
| 69 | .K IBNEW D INP^IBTRKR | 
|---|
| 70 | .I $G(IBNEW) S IBCNT=IBCNT+1 I '$D(ZTQUEUED) W !,"    Patient ",$P(^DPT(DFN,0),U)," added to the Claims tracking module" | 
|---|
| 71 | ; | 
|---|
| 72 | I '$D(ZTQUEUED) W !!,"<<< ",IBCNT," Patients added to the Claims Tracking Module" | 
|---|
| 73 | D NOW^%DTC S IBETDT=% | 
|---|
| 74 | D BULL3^IB20PT61 | 
|---|
| 75 | S $P(^IBE(350.9,1,3),"^",20)=DT | 
|---|
| 76 | Q | 
|---|
| 77 | ; | 
|---|
| 78 | 15() ; -- Add 15 minutes to now and return in $h format | 
|---|
| 79 | Q $P($H,",")_","_($P($H,",",2)+(15*60)) | 
|---|