Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: IVMLINS

IVMLINS.m

Go to the documentation of this file.
  1. IVMLINS ;ALB/KCL,PHH - IVM INSURANCE UPLOAD ; 14-JAN-94
  1. ;;2.0;INCOME VERIFICATION MATCH;**14,94**; 21-OCT-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;
  1. ;
  1. EN ; - main entry point for IVM INSURANCE UPLOAD
  1. D BLD
  1. ;
  1. ; - if no patients in ASEG x-ref goto EXIT
  1. I IVMCTR=0 G EXIT
  1. ;
  1. S IVMINSUP=1
  1. ;
  1. ; - call list manager
  1. D EN^VALM("IVM INSURANCE UPLOAD")
  1. ;
  1. K IVMINSUP
  1. Q
  1. ;
  1. ;
  1. BLD ; - build an array of patients with uploadable insurance data
  1. K ^TMP("IVMIUPL",$J)
  1. W !,"Building patient list for display..."
  1. ;
  1. ; - change (HLFS) if HL7 segment sep ever changes!
  1. S IVMCTR=0,HLFS="^"
  1. ;
  1. ; - get records from ASEG x-ref
  1. S IVMI=0 F S IVMI=$O(^IVM(301.5,"ASEG","IN1",IVMI)) Q:'IVMI D
  1. .S IVMJ=0 F S IVMJ=$O(^IVM(301.5,"ASEG","IN1",IVMI,IVMJ)) Q:'IVMJ D
  1. ..;
  1. ..S IVMCTR=IVMCTR+1 W:'(IVMCTR#15) "."
  1. ..;
  1. ..; - get node from IVM Patient (#301.5) file
  1. ..S IVM0NOD=$G(^IVM(301.5,IVMI,0)) I IVM0NOD']"" Q
  1. ..S DFN=+IVM0NOD
  1. ..;
  1. ..; - get HL7 segment string from (#301.511) sub-file
  1. ..S IVMSEG=$G(^IVM(301.5,IVMI,"IN",IVMJ,"ST")) I IVMSEG']"" Q
  1. ..S:$D(^IVM(301.5,IVMI,"IN",IVMJ,"ST1")) IVMSEG=IVMSEG_$G(^IVM(301.5,IVMI,"IN",IVMJ,"ST1"))
  1. ..;
  1. ..; - check for zeroth node Patient (#2) file
  1. ..I $G(^DPT(+DFN,0))']"" Q
  1. ..;
  1. ..; - get patient name and ssn
  1. ..S IVMNAME=$P($$PT^IVMUFNC4(DFN),"^"),IVMSSN=$P($$PT^IVMUFNC4(DFN),"^",2)
  1. ..;
  1. ..; - check for date of death from IVM
  1. ..S IVMDOD=$S($P($P($G(^IVM(301.5,IVMI,"IN",IVMJ,0)),"^",7),"/",2)]"":$P($P($G(^IVM(301.5,IVMI,"IN",IVMJ,0)),"^",7),"/",2),1:"")
  1. ..;
  1. ..; - check if patient has active insurance
  1. ..S IVMINS=$$INSUR^IBBAPI(DFN,DT),IVMINS=$S(IVMINS=1:"YES",1:"NO")
  1. ..;
  1. ..; - build line for list manager display
  1. ..D BLDLINE
  1. ;
  1. I IVMCTR=0 W !!,"There is no IVM insurance data to be uploaded at this time.",!,*7
  1. ;
  1. BLDQ ; - clean up variables
  1. K DFN,IVM0NOD,IVMDOD,IVMINS,IVMNAME,IVMREC,IVMSEG,IVMSSN
  1. Q
  1. ;
  1. ;
  1. BLDLINE ; - build storage array with data for list manager (called from BLD)
  1. S ^TMP("IVMIUPL",$J,IVMNAME,IVMI,IVMJ)=DFN_"^"_IVMSSN_"^"_IVMINS_"^"_$P(IVMSEG,HLFS,4)_"^"_$P(IVMSEG,HLFS,36)_"^"_IVMDOD
  1. ;
  1. ; ^tmp("ivmiupl",$j,pat name, ivm ien, ivm sub ien)=dfn^ssn^active insurance^ins company^subscriber id^ivm date of death
  1. Q
  1. ;
  1. ;
  1. HDR ; - header code for list manager display
  1. S VALMHDR(1)="HEC has identified insurance for the following patients:"
  1. S VALMHDR(2)=" (*) - Indicates Death Reported Act"
  1. Q
  1. ;
  1. ;
  1. INIT ; - init variables and list array
  1. K ^TMP("IVMLST",$J)
  1. ;
  1. ; - set up blank line for padding display fields and init counter
  1. S IVMBL="",$P(IVMBL," ",40)="",IVMCTR=0
  1. ;
  1. S IVMNAME="" F S IVMNAME=$O(^TMP("IVMIUPL",$J,IVMNAME)) Q:IVMNAME']"" S IVMI1="" D
  1. .F S IVMI1=$O(^TMP("IVMIUPL",$J,IVMNAME,IVMI1)) Q:'IVMI1 S IVMJ1="" D
  1. ..F S IVMJ1=$O(^TMP("IVMIUPL",$J,IVMNAME,IVMI1,IVMJ1)) Q:'IVMJ1 D
  1. ...;
  1. ...; - node from the data storage array
  1. ...S IVMLN=$G(^TMP("IVMIUPL",$J,IVMNAME,IVMI1,IVMJ1))
  1. ...;
  1. ...S IVMSTAR=$S($P(IVMLN,"^",6)]"":"*",$P($G(^DPT(+$P(IVMLN,"^"),.35)),"^")]"":"*",1:" ")
  1. ...;
  1. ...; - line for display
  1. ...S DFN=$P(IVMLN,"^"),IVMLN=$E(IVMNAME,1,25)_"^"_$P(IVMLN,"^",2,99)
  1. ...;
  1. ...; - increment counter and write line
  1. ...S IVMCTR=IVMCTR+1 D WRLN(IVMLN,IVMCTR)
  1. ...;
  1. ...; - create index array for look up
  1. ...S ^TMP("IVMLST",$J,"IDX",IVMCTR,IVMCTR)=IVMNAME_"^"_$P(IVMLN,"^",2)_"^"_IVMI1_"^"_IVMJ1
  1. ...; ^tmp("ivmlst",$j,"idx",counter,counter)=pat name^pat ssn^ien (#301.5) file^ien (#301.501) sub file
  1. ;
  1. ; - VALMCNT as the number of lines in the list
  1. S VALMCNT=IVMCTR
  1. ;
  1. INTQ ; - clean up variables
  1. K DFN,IVMBL,IVMCTR,IVMI,IVMI1,IVMJ,IVMJ1,IVMLN,IVMNAME,IVMSSN,IVMSTAR,LINE,NUMBER
  1. Q
  1. ;
  1. ;
  1. WRLN(LINE,NUMBER) ; - write line out for list manager display
  1. ;
  1. ; Input: LINE -- as pat name^pat ssn^active ins^ins carrier^subscriber id
  1. ; NUMBER -- as line number
  1. ;
  1. ; Output: None
  1. ;
  1. N IVMLN
  1. S IVMLN=$E(IVMSTAR_$P(LINE,"^",1)_IVMBL,1,16)_" "_$E($P(LINE,"^",2)_IVMBL,1,11)_" "_$E($P(LINE,"^",3)_IVMBL,1,3)_" "_$E($P(LINE,"^",4)_IVMBL,1,24)_" "_$P(LINE,"^",5)
  1. S @VALMAR@(NUMBER,0)=$E(NUMBER_" ",1,4)_IVMLN
  1. Q
  1. ;
  1. ;
  1. HELP ; - help code
  1. S X="?" D DISP^XQORM1 W !!
  1. Q
  1. ;
  1. ;
  1. EXIT ; - exit code
  1. K ^TMP("IVMLST",$J),^TMP("IVMIUPL",$J)
  1. Q