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

IBCNBCD6.m

Go to the documentation of this file.
  1. IBCNBCD6 ;ALB/AWC - MCCF FY14 Subscriber Display Screens ;25 Feb 2015
  1. ;;2.0;INTEGRATED BILLING;**528**;21-MAR-94;Build 163
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ;Input Parameters:
  1. ; See routine IBCNBCD1
  1. ;
  1. SUB(IBBUFDA,IBEXTDA,IBRIEN,IBSEL,IBTYPE,IBRESULT,DFN,IBFNAM,IBVAL,IBHOLD,IBXHOLD) ; called from routine SUB^IBCMBMI
  1. ; Move patient data(file #2) <or> income person data(408.13) into existing Patient Policy (file 2.312)
  1. ;
  1. N IBX,IBSET,IBXFILE,BUFARR,EXTARR,IBFLDS,IBLBLS,IBADDS,IBDRB,IBDRX,IBERR,IBCHNG,IBCHNGN,IBBFDA
  1. S IBBFDA=IBBUFDA_","
  1. S IBEXTDA=$G(IBEXTDA)_","_DFN_","
  1. ;
  1. I IBSEL=18 D
  1. . I IBFNAM="DPT" S IBSET="DPT" D SELF(IBSET,IBBFDA,IBRIEN,IBEXTDA,IBTYPE,.BUFARR,.EXTARR,.IBCHNG,.IBCHNGN,.IBFLDS,.IBLBLS,.IBADDS,.IBRESULT,.IBHOLD,.IBXHOLD)
  1. ;
  1. ; -- if user selected "spouse" use income person file(#408.13) to get specific data/fields
  1. I IBSEL=1 D
  1. . I IBFNAM="DGPR" S IBSET="DGPR" D SPOUSE(IBSET,IBBFDA,IBRIEN,IBEXTDA,IBTYPE,.BUFARR,.EXTARR,.IBCHNG,.IBCHNGN,.IBFLDS,.IBLBLS,.IBADDS,.IBRESULT,.IBHOLD,.IBXHOLD) Q
  1. . I IBFNAM']"" S IBSET="N" D NSPOUSE(IBSET,IBBFDA,IBRIEN,IBEXTDA,IBTYPE,.BUFARR,.EXTARR,.IBCHNG,.IBCHNGN,.IBFLDS,.IBLBLS,.IBADDS,.IBRESULT,.IBHOLD,.IBXHOLD)
  1. ;
  1. ; -- update policy fields with nulls
  1. I $D(IBCHNGN)>9 D FILE^DIE("E","IBCHNGN","IBERR") I $D(IBERR) W !,"Error... SUB-IBCNBCD6 Could not file fields with nulls" K DIR D PAUSE^VALM1 Q
  1. ; -- update policy fields with data
  1. I $D(IBCHNG)>9 D FILE^DIE("E","IBCHNG","IBERR") I $D(IBERR)>0 W !,"Error... SUB-IBCNBCD6 Could not file fields with data" K DIR D PAUSE^VALM1 Q
  1. ;
  1. ; -- update policy fields with user information
  1. D STUFF("POL",IBEXTDA,.IBRESULT)
  1. ; -- update policy with verified-by information
  1. D POLOTH(IBBFDA,IBEXTDA,.IBRESULT)
  1. Q
  1. ;
  1. SELF(IBSET,IBBUFDA,IBRIEN,IBEXTDA,IBTYPE,BUFARR,EXTARR,IBCHNG,IBCHNGN,IBFLDS,IBLBLS,IBADDS,IBRESULT,IBHOLD,IBXHOLD) ; get data for "self" relationship
  1. N IBX,IB1,IB2,IBXARY,IBFARY,IBDRB,IBDRX,IBBUFVAL,IBEXTFLD,IBEXTVAL,IBXFILE
  1. ;
  1. ; -- get corresponding fields to populate data
  1. D FIELDS(IBSET_"FLD",.IBFLDS,.IBLBLS,.IBADDS)
  1. S IBX=$P($T(@(IBSET_"DR")+1),";;",2),IBXFILE=+$P(IBX,U,1),IBDRB=$P(IBX,U,2),IBDRX=$P(IBX,U,3)
  1. ;
  1. I +$G(IBTYPE) F IBX=1:1:$L(IBDRB,";") D
  1. . ;
  1. . S IB1=$P(IBDRB,";",IBX),IB2=$P(IBDRX,";",IBX)
  1. . ;
  1. . S IBBUFVAL=$G(@IBHOLD@(2,IB1)),IBEXTVAL=$G(@IBXHOLD@(2,IB2))
  1. . ;
  1. . I IBBUFVAL=IBEXTVAL Q
  1. . I IBTYPE=1,IBEXTVAL'="" Q
  1. . I IBTYPE=2,IBBUFVAL="" Q
  1. . I IBTYPE=4,'$D(^TMP($J,"IB BUFFER SELECTED",IB1)) Q
  1. . ;
  1. . ;
  1. . S IBCHNG(IBXFILE,IBEXTDA,IB2)=IBBUFVAL
  1. . ;
  1. . ; -- for ACCEPAPI^IBCNICB do not delete the .01 field. This prevents a Data Dictionary Deletion Write message
  1. . Q:IB2=".01"!(IB2="4.03")!(IB2="6")!(IB2="7.01")
  1. . ;
  1. . S IBCHNGN(IBXFILE,IBEXTDA,IB2)=""
  1. Q
  1. ;
  1. SPOUSE(IBSET,IBBUFDA,IBRIEN,IBEXTDA,IBTYPE,BUFARR,EXTARR,IBCHNG,IBCHNGN,IBFLDS,IBLBLS,IBADDS,IBRESULT,IBHOLD,IBXHOLD) ; get data for "spouse" relationship
  1. N IBX,IBXARY,IBFARY,IBDRB,IBDRX,IBBUFVAL,IBEXTFLD,IBEXTVAL,IBXFILE
  1. ;
  1. ; -- get corresponding fields to populate data
  1. D FIELDS(IBSET_"FLD",.IBFLDS,.IBLBLS,.IBADDS)
  1. S IBX=$P($T(@(IBSET_"DR")+1),";;",2),IBXFILE=+$P(IBX,U,1),IBDRB=$P(IBX,U,2),IBDRX=$P(IBX,U,3)
  1. ;
  1. I +$G(IBTYPE) F IBX=1:1:$L(IBDRB,";") D
  1. . ;
  1. . S IB1=$P(IBDRB,";",IBX),IB2=$P(IBDRX,";",IBX)
  1. . ;
  1. . S IBBUFVAL=$G(@IBHOLD@(2,IB1)),IBEXTVAL=$G(@IBXHOLD@(2,IB2))
  1. . ;
  1. . I IBBUFVAL=IBEXTVAL Q
  1. . I IBTYPE=1,IBEXTVAL'="" Q
  1. . I IBTYPE=2,IBBUFVAL="" Q
  1. . I IBTYPE=4,'$D(^TMP($J,"IB BUFFER SELECTED",IB1)) Q
  1. . ;
  1. . S IBCHNG(IBXFILE,IBEXTDA,IB2)=IBBUFVAL
  1. . ;
  1. . ; -- for ACCEPAPI^IBCNICB do not delete the .01 field. This prevents a Data Dictionary Deletion Write message
  1. . Q:IB2=".01"!(IB2="4.03")!(IB2="6")!(IB2="7.01")
  1. . ;
  1. . S IBCHNGN(IBXFILE,IBEXTDA,IB2)=""
  1. Q
  1. ;
  1. NSPOUSE(IBSET,IBBFDA,IBRIEN,IBEXTDA,IBTYPE,BUFARR,EXTARR,IBCHNG,IBCHNGN,IBFLDS,IBLBLS,IBADDS,IBRESULT,IBHOLD,IBXHOLD) ; no spuse data
  1. N IBX,IBXARY,IBFARY,IBDRB,IBDRX,IBBUFVAL,IBEXTFLD,IBEXTVAL,IBXFILE
  1. ;
  1. ; -- left side of screen get data from income person(#408.13) fields
  1. D FIELDS(IBSET_"FLD",.IBFLDS,.IBLBLS,.IBADDS)
  1. S IBX=$P($T(@(IBSET_"DR")+1),";;",2),IBXFILE=+$P(IBX,U,1),IBDRB=$P(IBX,U,2),IBDRX=$P(IBX,U,3)
  1. ;
  1. I +$G(IBTYPE) F IBX=1:1:$L(IBDRB,";") D
  1. . ;
  1. . S IB1=$P(IBDRB,";",IBX),IB2=$P(IBDRX,";",IBX)
  1. . ;
  1. . S IBBUFVAL=$G(@IBHOLD@(2,IB1)),IBEXTVAL=$G(@IBXHOLD@(2,IB2))
  1. . ;
  1. . I IBBUFVAL=IBEXTVAL Q
  1. . I IBTYPE=1,IBEXTVAL'="" Q
  1. . I IBTYPE=2,IBBUFVAL="" Q
  1. . I IBTYPE=4,'$D(^TMP($J,"IB BUFFER SELECTED",IB1)) Q
  1. . ;
  1. . S IBCHNG(IBXFILE,IBEXTDA,IB2)=IBBUFVAL
  1. . ;
  1. . ; -- for ACCEPAPI^IBCNICB do not delete the .01 field. This prevents a Data Dictionary Deletion Write message
  1. . Q:IB2=".01"!(IB2="4.03")!(IB2="6")!(IB2="7.01")
  1. . ;
  1. . S IBCHNGN(IBXFILE,IBEXTDA,IB2)=""
  1. Q
  1. ;
  1. STUFF(IBSET,IBEXTDA,IBRESULT) ; update fields in insurance files that
  1. N IBX,IBFLDS,IBLBLS,IBADDS,EXTFILE,IBEXTFLD,IBEXTVAL,IBFDA,IBFDAX,IBERR
  1. ;
  1. D FIELDS(IBSET_"A",.IBFLDS,.IBLBLS,.IBADDS)
  1. S IBX=$P($T(@(IBSET_"DR")+1),";;",2),EXTFILE=+$P(IBX,U,1)
  1. ;
  1. S IBEXTFLD=0 F S IBEXTFLD=$O(IBFLDS(IBEXTFLD)) Q:'IBEXTFLD D
  1. . S IBEXTVAL=IBFLDS(IBEXTFLD) I IBEXTVAL="DUZ" S IBEXTVAL="`"_DUZ
  1. . S IBFDA(EXTFILE,IBEXTDA,IBEXTFLD)=IBEXTVAL
  1. . S IBFDAX(EXTFILE,IBEXTDA,IBEXTFLD)=""
  1. ;
  1. ; -- update fields with nulls (external values)
  1. D FILE^DIE("E","IBFDAX","IBERR") I $D(IBERR)>0 D EHANDLE(IBSET,.IBERR,.IBRESULT)
  1. ; -- update fields with data (external values)
  1. D FILE^DIE("E","IBFDA","IBERR") I $D(IBERR)>0 D EHANDLE(IBSET,.IBERR,.IBRESULT)
  1. Q
  1. ;
  1. POLOTH(IBBUFDA,IBEXTDA,IBRESULT) ; other special cases that can not be transferred using the generic code above, usually because of dependencies
  1. N IB0,IBFDA,IBFDAX,IBERR
  1. S IB0=$G(^IBA(355.33,+IBBUFDA,0))
  1. ;
  1. ; -- if buffer entry was verified before the accept step, then add the correct verifier info to the policy
  1. I +$P(IB0,U,10) D
  1. . S IBFDA(2.312,IBEXTDA,1.03)=$E($P(IB0,U,10),1,12),IBFDAX(2.312,IBEXTDA,1.03)=""
  1. . S IBFDA(2.312,IBEXTDA,1.04)=$P(IB0,U,11),IBFDAX(2.312,IBEXTDA,1.04)=""
  1. ;
  1. ; -- update fields with nulls (internally)
  1. I $D(IBFDAX)>9 D FILE^DIE("","IBFDAX","IBERR") I $D(IBERR)>0 D EHANDLE("POL",.IBERR,.IBRESULT)
  1. ; -- update fields data (internally)
  1. I $D(IBFDA)>9 D FILE^DIE("","IBFDA","IBERR") I $D(IBERR)>0 D EHANDLE("POL",.IBERR,.IBRESULT)
  1. Q
  1. ;
  1. FIELDS(IBSET,IBFLDS,IBLBLS,IBADDS) ; return array of corresponding fields: IBFLDS(Buffer #)=Ins #
  1. N IBI,IBLN,IBB,IBE,IBG
  1. ;
  1. F IBI=1:1 S IBLN=$P($T(@(IBSET)+IBI),";;",2) Q:IBLN="" I $E(IBLN,1)'=" " D
  1. . S IBB=$P(IBLN,U,1),IBE=$P(IBLN,U,2),IBG=$P(IBLN,U,4)
  1. . I IBB'="",IBE'="" D
  1. . . S IBFLDS(IBB)=IBE
  1. . . I IBSET["FLD" S IBLBLS(IBB)=$P(IBLN,U,3) I +IBG S IBADDS(IBB)=IBE
  1. Q
  1. ;
  1. EHANDLE(IBSET,FMERR,IBRESULT) ;
  1. ;Fileman Error Processing tracking added for ACCEPAPI^IBCNICB API.
  1. ; INPUT:
  1. ; IBSET - File where fileman error occurred
  1. ; Value = "INS" --> File 36 --> IBRESULT(1)
  1. ; Value = "GRP" --> File 355.3 --> IBRESULT(2)
  1. ; Value = "POL" --> File 2.312 --> IBRESULT(3)
  1. ; FMERR - Array that is returned by FM with error messages
  1. ; OUTPUT:
  1. ; IBRESULT - Passed array to return FM error message if there are
  1. ; errors when filing the data buffer data
  1. ;
  1. I $G(IBSET)']""!($D(FMERR)'>0) Q
  1. N SUB1,RNUM,ERRNUM,LINENUM
  1. ;
  1. ; -- numeric 1st subscript of IBRESULT array based on file being updated. File 36 = 1, 355.3 = 2, 2.312 = 3
  1. S SUB1=$S(IBSET="INS":1,IBSET="GRP":2,IBSET="POL":3,1:"") Q:SUB1']""
  1. ;
  1. S RNUM=$O(IBRESULT(SUB1,"ERR",9999999999),-1),ERRNUM=0
  1. F S ERRNUM=$O(FMERR("DIERR",ERRNUM)) Q:+ERRNUM'>0 D
  1. . S LINENUM=0
  1. . F S LINENUM=$O(FMERR("DIERR",ERRNUM,"TEXT",LINENUM)) Q:+LINENUM'>0 D
  1. . . S RNUM=RNUM+1
  1. . . S IBRESULT(SUB1,"ERR",RNUM)=FMERR("DIERR",ERRNUM,"TEXT",LINENUM)
  1. Q
  1. ;
  1. REMOVDEL(FMERR) ;
  1. ; Removed field delete errors. SET and STUFF API delete data first and
  1. ; then update with new data from Insurance Buffer file. Error Code 712
  1. ; "Deletion was attempted but not allowed" errors will be removed from
  1. ; the returned FM error array
  1. ;
  1. ; INPUT/OUTPUT:
  1. ; FMERR - Array that is returned by FM with error messages
  1. ;
  1. Q:$D(FMERR)'>0
  1. N ERRNUM
  1. S ERRNUM=0
  1. F S ERRNUM=$O(FMERR("DIERR",ERRNUM)) Q:+ERRNUM'>0 D
  1. . I FMERR("DIERR",ERRNUM)=712 K FMERR("DIERR",ERRNUM)
  1. Q
  1. ;
  1. DPTDR ; -- insurance type subfile(#2.312) ^ insurance verificaiton processor(#355.33) fields ^ insurance type subfile(#2.312) fields
  1. ;;2.312^90.03;60.05;60.14;60.15;60.16;91.01;.03;.09;.02;60.1;60.11;60.12;62.01;.111;.112;.114;.115;.116;.1173;.131^7.02;6;4.03;4.05;4.06;7.01;3.01;3.05;3.12;4.01;4.02;.2;5.01;3.06;3.07;3.08;3.09;3.1;3.13;3.11
  1. ;
  1. DPTFLD ; -- insurance verification processor(#355.33) field ^ insurance type subfile(#2.312)
  1. ;;90.03^7.02^Subscriber Id^ ; Subscriber Id
  1. ;;60.05^6^Whose Insurance^ ; Whose Insurance
  1. ;;60.14^4.03^Relationship^ ; Pt. Relationship to Insured
  1. ;;60.15^4.05^Rx Relationship^ ; Pharmacy Relationship Code
  1. ;;60.16^4.06^Rx Person Code^ ; Pharmacy Person Code
  1. ;;91.01^7.01^Subscriber Name^ ; Name of Insured
  1. ;;.03^3.01^Subscriber's DOB^ ; Insured's DOB
  1. ;;.09^3.05^Subscriber's SSN^ ; Insured's SSN
  1. ;;.02^3.12^Subscriber's Sex^ ; Insured's Sex
  1. ;;60.1^4.01^Primary Provider^ ; Primary Care Provider
  1. ;;60.11^4.02^Provider Phone^ ; Primary Care Provider Phone
  1. ;;60.12^.2^Coor of Benefits^ ; Coordination of Benefits
  1. ;;62.01^5.01^Patient Id^ ; Patient Id
  1. ;;.111^3.06^Subscr Str Ln 1^ ; Subscriber Address Line 1
  1. ;;.112^3.07^Subscr Str Ln 2^ ; Subscriber Address Line 2
  1. ;;.114^3.08^Subscr City^ ; Subscriber City
  1. ;;.115^3.09^Subscr State^ ; Subscriber State
  1. ;;.116^3.1^Subscr Zip^ ; Subscriber Zip Code
  1. ;;.1173^3.13^Subscr Country^ ; Subscriber Country Code
  1. ;;.131^3.11^Subscr Phone^ ; Subscriber Phone Number
  1. ;
  1. DGPRDR ; -- insurance type subfile(#2.312) ^ insurance verificaiton processor(#355.33) fields ^ insurance type subfile(#2.312) fields
  1. ;;2.312^90.03;60.05;60.14;60.15;60.16;.01;.03;.09;.02;60.1;60.11;60.12;62.01;1.2;1.3;1.5;1.6;1.7;1.99;1.8^7.02;6;4.03;4.05;4.06;7.01;3.01;3.05;3.12;4.01;4.02;.2;5.01;3.06;3.07;3.08;3.09;3.1;3.13;3.11
  1. ;
  1. DGPRFLD ; -- insurance verification processor(#355.33) field ^ insurance type subfile(#2.312)
  1. ;;90.03^7.02^Subscriber Id^ ; Subscriber Id
  1. ;;60.05^6^Whose Insurance^ ; Whose Insurance
  1. ;;60.14^4.03^Relationship^ ; Pt. Relationship to Insured
  1. ;;60.15^4.05^Rx Relationship^ ; Pharmacy Relationship Code
  1. ;;60.16^4.06^Rx Person Code^ ; Pharmacy Person Code
  1. ;;.01^7.01^Subscriber Name^ ; Name of Insured
  1. ;;.03^3.01^Subscriber's DOB^ ; Insured's DOB
  1. ;;.09^3.05^Subscriber's SSN^ ; Insured's SSN
  1. ;;.02^3.12^Subscriber's Sex^ ; Insured's Sex
  1. ;;60.1^4.01^Primary Provider^ ; Primary Care Provider
  1. ;;60.11^4.02^Provider Phone^ ; Primary Care Provider Phone
  1. ;;60.12^.2^Coor of Benefits^ ; Coordination of Benefits
  1. ;;62.01^5.01^Patient Id^ ; Patient Id
  1. ;;1.2^3.06^Subscr Str Ln 1^ ; Subscriber Address Line 1
  1. ;;1.3^3.07^Subscr Str Ln 2^ ; Subscriber Address Line 2
  1. ;;1.5^3.08^Subscr City^ ; Subscriber City
  1. ;;1.6^3.09^Subscr State^ ; Subscriber State
  1. ;;1.7^3.1^Subscr Zip^ ; Subscriber Zip Code
  1. ;;1.99^3.13^Subscr Country^ ; Subscriber Country Code
  1. ;;1.8^3.11^Subscr Phone^ ; Subscriber Phone Number
  1. ;
  1. NDR ; -- insurance type subfile(#2.312) ^ insurance verificaiton processor(#355.33) fields ^ insurance type subfile(#2.312) fields
  1. ;;2.312^90.03;60.05;60.14;60.15;60.16;.01;.03;.09;.02;60.1;60.11;60.12;62.01;1.2;1.3;1.5;1.6;1.7;1.99;1.8^7.02;6;4.03;4.05;4.06;7.01;3.01;3.05;3.12;4.01;4.02;.2;5.01;3.06;3.07;3.08;3.09;3.1;3.13;3.11
  1. ;
  1. NFLD ; -- insurance verification processor(#355.33) field ^ insurance type subfile(#2.312)
  1. ;;90.03^7.02^Subscriber Id^ ; Subscriber Id
  1. ;;60.05^6^Whose Insurance^ ; Whose Insurance
  1. ;;60.14^4.03^Relationship^ ; Pt. Relationship to Insured
  1. ;;60.15^4.05^Rx Relationship^ ; Pharmacy Relationship Code
  1. ;;60.16^4.06^Rx Person Code^ ; Pharmacy Person Code
  1. ;;.01^7.01^Subscriber Name^ ; Name of Insured
  1. ;;.03^3.01^Subscriber's DOB^ ; Insured's DOB
  1. ;;.09^3.05^Subscriber's SSN^ ; Insured's SSN
  1. ;;.02^3.12^Subscriber's Sex^ ; Insured's Sex
  1. ;;60.1^4.01^Primary Provider^ ; Primary Care Provider
  1. ;;60.11^4.02^Provider Phone^ ; Primary Care Provider Phone
  1. ;;60.12^.2^Coor of Benefits^ ; Coordination of Benefits
  1. ;;62.01^5.01^Patient Id^ ; Patient Id
  1. ;;1.2^3.06^Subscr Str Ln 1^ ; Subscriber Address Line 1
  1. ;;1.3^3.07^Subscr Str Ln 2^ ; Subscriber Address Line 2
  1. ;;1.5^3.08^Subscr City^ ; Subscriber City
  1. ;;1.6^3.09^Subscr State^ ; Subscriber State
  1. ;;1.7^3.1^Subscr Zip^ ; Subscriber Zip Code
  1. ;;1.99^3.13^Subscr Country^ ; Subscriber Country Code
  1. ;;1.8^3.11^Subscr Phone^ ; Subscriber Phone Number
  1. ;
  1. POLDR ;
  1. ;;2.312
  1. POLA ; auto set fields
  1. ;;1.03^NOW^ ; Date Last Verified (default is person that accepts entry)
  1. ;;1.04^DUZ^ ; Verified By (default is person that accepts entry)
  1. ;;1.05^NOW^ ; Date Last Edited
  1. ;;1.06^DUZ^ ; Last Edited By
  1. ;