| 1 | IB20P297 ;OAK/ELZ - POST INSTALL ROUTINE FOR IB*2*297 ;03-JAN-2005
 | 
|---|
| 2 |  ;;2.0;INTEGRATED BILLING;**297**;21-MAR-94
 | 
|---|
| 3 |  ;;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 |  ;
 | 
|---|
| 5 |  ; This is the post install routine for IB*2*297.  This routine will
 | 
|---|
| 6 |  ; run through the patient's insurance companies and identify insurance
 | 
|---|
| 7 |  ; companies that do not have a plan associated with them.
 | 
|---|
| 8 |  ; This routine can be deleted after the install, but you may want to
 | 
|---|
| 9 |  ; keep it to review the insurance data again in the future.
 | 
|---|
| 10 |  ;
 | 
|---|
| 11 | POST ;
 | 
|---|
| 12 |  N IBMSG,ZTRTN,ZTDESC,ZTSK
 | 
|---|
| 13 |  S IBMSG(1)="I need to search for patient's with bad insurance data.  You should queue"
 | 
|---|
| 14 |  S IBMSG(2)="this task to run a non-peek hours."
 | 
|---|
| 15 |  D MES^XPDUTL(.IBMSG)
 | 
|---|
| 16 |  ;
 | 
|---|
| 17 |  S ZTRTN="DQ^IB20P297",ZTDESC="BAD INSURANCE DATA LIST",ZTIO=""
 | 
|---|
| 18 |  D ^%ZTLOAD
 | 
|---|
| 19 |  D MES^XPDUTL($S($G(ZTSK):"Task Queued #"_ZTSK,1:"Task not scheduled, you can run this by calling POST^IB20P297"))
 | 
|---|
| 20 |  ;
 | 
|---|
| 21 |  Q
 | 
|---|
| 22 |  ;
 | 
|---|
| 23 | DQ ; tasked entry point
 | 
|---|
| 24 |  N DFN,IBINS,IBINSM,IBGRP,IBLINE,IBSAVE,XMDUZ,XMSUBJ,XMBODY,XMTO,XMINSTR,XMZ,DIK,DA
 | 
|---|
| 25 |  K ^TMP("IB297",$J)
 | 
|---|
| 26 |  S IBLINE=8,IBSAVE=""
 | 
|---|
| 27 |  ;
 | 
|---|
| 28 |  ;
 | 
|---|
| 29 |  ; first check out the AB xref to make sure everything is there
 | 
|---|
| 30 |  S DFN=0 F  S DFN=$O(^DPT(DFN)) Q:'DFN  S IBINSM=0 F  S IBINSM=$O(^DPT(DFN,.312,IBINSM)) Q:'IBINSM  S IBINS=+$G(^DPT(DFN,.312,IBINSM,0)) D
 | 
|---|
| 31 |  . I $D(^DPT("AB",IBINS,DFN,IBINSM)) Q
 | 
|---|
| 32 |  . I IBINS,DFN,IBINSM S DIK="^DPT("_DFN_",.312,",DA(1)=DFN,DA=IBINSM,DIK(1)=.01 D EN^DIK
 | 
|---|
| 33 |  ;
 | 
|---|
| 34 |  ;
 | 
|---|
| 35 |  S IBINS=0 F  S IBINS=$O(^DPT("AB",IBINS)) Q:'IBINS  S DFN=0 F  S DFN=$O(^DPT("AB",IBINS,DFN)) Q:'DFN  S IBINSM=0 F  S IBINSM=$O(^DPT("AB",IBINS,DFN,IBINSM)) Q:'IBINSM  D
 | 
|---|
| 36 |  . ;
 | 
|---|
| 37 |  . ; first verify good x-ref or clean up
 | 
|---|
| 38 |  . S IBINS0=$G(^DPT(DFN,.312,IBINSM,0))
 | 
|---|
| 39 |  . I 'IBINS0 K ^DPT("AB",IBINS,DFN,IBINSM) Q
 | 
|---|
| 40 |  . ;
 | 
|---|
| 41 |  . ; do i have a plan?
 | 
|---|
| 42 |  . I '$P(IBINS0,"^",18) D SET(DFN,IBINS,IBINSM,"No Plan in Patient File") Q
 | 
|---|
| 43 |  . ;
 | 
|---|
| 44 |  . ; good pointer to 36?
 | 
|---|
| 45 |  . I '$D(^DIC(36,+IBINS0,0)) D SET(DFN,IBINS,IBINSM,"Ins Co not in File 36") Q
 | 
|---|
| 46 |  . ;
 | 
|---|
| 47 |  . ; good pointer in 355.3?
 | 
|---|
| 48 |  . I '$D(^IBA(355.3,+$P(IBINS0,"^",18),0)) D SET(DFN,IBINS,IBINSM,"Plan pointer not found") Q
 | 
|---|
| 49 |  . ;
 | 
|---|
| 50 |  . ; check out 355.3 to 36
 | 
|---|
| 51 |  . I $P(IBINS0,"^")'=$P($G(^IBA(355.3,+$P(IBINS0,"^",18),0)),"^") D SET(DFN,IBINS,IBINSM,"Plan to Ins Co Mis-match")
 | 
|---|
| 52 |  ;
 | 
|---|
| 53 |  ; data all looks good
 | 
|---|
| 54 |  I '$D(^TMP("IB297",$J)) S ^TMP("IB297",$J,IBLINE,0)="Data looks good, no problems to report"
 | 
|---|
| 55 |  ;
 | 
|---|
| 56 |  ; start message
 | 
|---|
| 57 |  S IBGRP=$P($G(^IBE(350.9,1,4)),"^",4),IBGRP=$S(IBGRP:$$EXTERNAL^DILFD(350.9,4.04,"",IBGRP),1:"IB NEW INSURANCE")
 | 
|---|
| 58 |  ;
 | 
|---|
| 59 |  ; build header
 | 
|---|
| 60 |  S ^TMP("IB297",$J,1,0)="The following insurance entries have been found with errors that need to"
 | 
|---|
| 61 |  S ^TMP("IB297",$J,2,0)="be resolved.  You should use the ""Patient Insurance Info View/Edit [IBCN"
 | 
|---|
| 62 |  S ^TMP("IB297",$J,3,0)="PATIENT INSURANCE]"" option to edit the patient's insurance information"
 | 
|---|
| 63 |  S ^TMP("IB297",$J,4,0)="and correct as needed.  If you just see a NULL value in a field that"
 | 
|---|
| 64 |  S ^TMP("IB297",$J,5,0)="indicates either the pointer value in a field is invalid or missing.  You"
 | 
|---|
| 65 |  S ^TMP("IB297",$J,6,0)="may need to involve your IRM to resolve some of the issues on this report."
 | 
|---|
| 66 |  S ^TMP("IB297",$J,7,0)=""
 | 
|---|
| 67 |  ;
 | 
|---|
| 68 |  ; send away
 | 
|---|
| 69 |  S XMDUZ=$S(DUZ:DUZ,1:.5)
 | 
|---|
| 70 |  S XMSUBJ="INSURANCE FILE CLEAN UP NEEDED"
 | 
|---|
| 71 |  S XMBODY="^TMP(""IB297"",$J)"
 | 
|---|
| 72 |  S (XMTO("G.IB NEW INSURANCE"),XMTO($S(DUZ:DUZ,1:.5)))=""
 | 
|---|
| 73 |  S XMINSTR("FROM")="INTEGRATED BILLING PACKAGE"
 | 
|---|
| 74 |  D SENDMSG^XMXAPI(XMDUZ,XMSUBJ,XMBODY,.XMTO,.XMINSTR,.XMZ)
 | 
|---|
| 75 |  ;
 | 
|---|
| 76 |  ;
 | 
|---|
| 77 |  K ^TMP("IB297",$J)
 | 
|---|
| 78 |  ;
 | 
|---|
| 79 |  Q
 | 
|---|
| 80 |  ;
 | 
|---|
| 81 | SET(DFN,IBINS,IBINSM,IBERR) ;
 | 
|---|
| 82 |  N IBDFN0,IBINS0
 | 
|---|
| 83 |  ;
 | 
|---|
| 84 |  ; new ins co?
 | 
|---|
| 85 |  I IBSAVE'=IBINS S IBLINE=IBLINE+1,^TMP("IB297",$J,IBLINE,0)="",IBLINE=IBLINE+1,^TMP("IB297",$J,IBLINE,0)="     Insurance Co: "_$$EXTERNAL^DILFD(2.312,.01,"",IBINS),IBSAVE=IBINS
 | 
|---|
| 86 |  ;
 | 
|---|
| 87 |  ; get some data
 | 
|---|
| 88 |  S IBDFN0=$G(^DPT(DFN,0)),IBINS0=$G(^DPT(DFN,.312,+IBINSM,0))
 | 
|---|
| 89 |  ;
 | 
|---|
| 90 |  ; set the line
 | 
|---|
| 91 |  S IBLINE=IBLINE+1
 | 
|---|
| 92 |  S ^TMP("IB297",$J,IBLINE,0)=$$LJ^XLFSTR($P(IBDFN0,"^"),"20T")_"  "_$$LJ^XLFSTR($P(IBDFN0,"^",9),"10T")_"  "_$$LJ^XLFSTR($$EXTERNAL^DILFD(2.312,.18,"",$P(IBINS0,"^",18)),"15T")_"  "_IBERR
 | 
|---|
| 93 |  ;S ^TMP("IB297",$J,IBLINE,0)=$E($P(IBDFN0,"^"),1,20)_"  "_$P(IBDFN0,"^",9)_"  "_$E($$EXTERNAL^DILFD(2.312,.18,"",$P(IBINS0,"^",18)),1,15)_"  "_IBERR
 | 
|---|
| 94 |  ;
 | 
|---|
| 95 |  Q
 | 
|---|