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

ABSPICPY.m

Go to the documentation of this file.
  1. ABSPICPY ; IHS/OIT/CASSevern/Pieran ran 9/19/2011 - Copy Insurance default Profiles
  1. ;;1.0;PHARMACY POINT OF SALE;**42,46,48,49**;JUN 21, 2001;Build 38
  1. ;
  1. ; This routine will be called when creating a new ABSP INSURER so that a "sane" set of defaults can be loaded for a good chance at working without modification.
  1. ; Basically we will prompt the user as to whether it's a Medicaid, Medicare or Commercial insurer...go to the appropriate table and add the defaults stored in that table.
  1. ; We'll start out with a default table that is applicable to all of the above and then go from there.
  1. EN(ABSPINS) ;EP
  1. N OK,TYP
  1. S OK=0
  1. ;NEXT 5 LINES FOR PROMPTING USER...NO LONGER NEEDED
  1. ;F Q:OK D
  1. ;. W !,"Is this Insurer a 1.) Medicaid, 2.) Medicare or 3.) Private Insurer?"
  1. ;. R !,"Enter 1, 2, 3, or ""^"" to exit. ",INP
  1. ;. I ((+INP>0)&&(+INP<4))||(INP="^") S OK=1 ;They must enter a 1, 2, 3 or "^" otherwise prompt again.
  1. ;. ELSE W !,"That is not a valid choice, please enter ""1"", ""2"", ""3"", or ""^"""
  1. ;Instead of prompting them...we'll get the insurance type off the main insurer file
  1. ;M** and R are Medicare
  1. ;D is Medicaid
  1. ;P is private, but for the purposes of this copy program, we'll treat any value that isn't M, R or D as private
  1. ; S TYP=$P($G(^AUTNINS(ABSPINS,2)),"^")
  1. S TYP=$$INSTYP^AGUTL(ABSPINS) ; USE NEW API TO GET INSURER TYPE.
  1. S TYP=$S(TYP="D":1,TYP="M":2,TYP="R":2,TYP="MD":2,TYP="MH":2,TYP="MC":2,TYP="MMC":2,1:3) ; SET UP DEFAULTS DEPENDING ON INSURER TYPE.
  1. D PROCESS(ABSPINS,TYP)
  1. Q
  1. PROCESS(ABSPINS,TYP) ;Process the INSURER here
  1. N INS,ABSPSPEC,ABSPSPSG,ABSPSPFL,ZERR ; /IHS/OIT/RAM ; 9 JUN 17 ; ADD DBS CALL ERROR RETURN VARIABLE
  1. D DEFCOPY(ABSPINS) ;The defaults get loaded regardless of insurance type
  1. D:TYP=1 CAIDCOPY(ABSPINS)
  1. D:TYP=2 CARECOPY(ABSPINS)
  1. D:TYP=3 PRIVCOPY(ABSPINS)
  1. ; D:$D(INS(1)) UPDATE^DIE("E","INS(1)")
  1. D:$D(INS(1)) UPDATE^DIE("E","INS(1)",,"ZERR") ; /IHS/OIT/RAM ; 9 JUN 17 ; UPDATE DBS CALL TO ALLOW FOR ERROR RETURN.
  1. I $D(ZERR) D LOG^ABSPOSL2("PROCESS^ABSPICPY",.ZERR) ; /IHS/OIT/RAM ; 9 JUN 17 ; AND LOG IT IF AN ERROR OCCURS.
  1. D:$D(ABSPSPEC) POPSPEC(ABSPINS,.ABSPSPEC)
  1. D:$D(ABSPSPSG) POPSEG(ABSPINS,.ABSPSPSG)
  1. D:$D(ABSPSPFL) POPFLD(ABSPINS,.ABSPSPFL)
  1. Q
  1. DEFCOPY(ABSPINS) ;Read through the DEFTAB table and load those settings
  1. N L,LINE
  1. F L=1:1 Q:$P($T(DEFTAB+L),";",3)="***" D
  1. . S LINE=$T(DEFTAB+L)
  1. . D RDLINE(LINE,ABSPINS)
  1. Q
  1. CAIDCOPY(ABSPINS) ;Read through the CAIDTAB table and load those settings
  1. N L,LINE
  1. F L=1:1 Q:$P($T(CAIDTAB+L),";",3)="***" D
  1. . S LINE=$T(CAIDTAB+L)
  1. . D RDLINE(LINE,ABSPINS)
  1. Q
  1. CARECOPY(ABSPINS) ;Read through the CARETAB table and load those settings
  1. N L,LINE
  1. F L=1:1 Q:$P($T(CARETAB+L),";",3)="***" D
  1. . S LINE=$T(CARETAB+L)
  1. . D RDLINE(LINE,ABSPINS)
  1. Q
  1. PRIVCOPY(ABSPINS) ;Read through the PRIVTAB table and load those settings
  1. N L,LINE
  1. F L=1:1 Q:$P($T(PRIVTAB+L),";",3)="***" D
  1. . S LINE=$T(PRIVTAB+L)
  1. . D RDLINE(LINE,ABSPINS)
  1. Q
  1. RDLINE(LINE,ABSPINS) ;Go through the line and populate the array
  1. N TYPE,FLDNUM,VAL,FILE
  1. S FILE=1 I $D(^ABSPEI(ABSPINS,210))!($D(^ABSPEI(ABSPINS,221)))!($D(^ABSPEI(ABSPINS,220))) S FILE=0
  1. S TYPE=$P(LINE,";",3)
  1. S NCPDPCD=$P(LINE,";",4)
  1. S VAL=$P(LINE,";",6)
  1. I TYPE="SPEC" S ABSPSPEC(NCPDPCD)=VAL
  1. I TYPE="SEG" S ABSPSPSG(VAL)=""
  1. I TYPE="FLD" S ABSPSPFL(NCPDPCD)=""
  1. I TYPE="TOP",FILE S INS(1,9002313.4,ABSPINS_",",NCPDPCD)=VAL
  1. Q
  1. ;Tables use following setup:
  1. ;;TYPE;NCPDP FIELD #;COMMENT;VALUE
  1. ; If TYPE="SPEC" put the actual special code you want to put into the NCPDP code in "VALUE"
  1. ; I.e. ;;SPEC;302;FIELD 302;S ABSP("X")="01" (Puts the special code `S ABSP(X)=1` into NCPDP field 302
  1. ; If TYPE="SEG" put the Segment # in Value...
  1. ; I.e. ;;SEG;;CompounD Segment;10 (suppresses the compound segment....piece 5 is just to make it easier to debug)
  1. ; Segment #s are:
  1. ; 2 = Suppress Provider Segment
  1. ; 5 = Suppress COB Segment
  1. ; 6 = Suppress Workers Comp Segment
  1. ; 8 = Suppress DURR/PPS Segment
  1. ; 9 = Suppress Coupon Segment
  1. ; 10= Suppress Compound Segment
  1. ; 12= Suppress Prior Auth Segment
  1. ; 13= Suppress Clinical Segment
  1. ; 14= Suppress Additional Doc Segment
  1. ; 15= Suppress Facility Segment
  1. ; 16= Suppress Narrative Segment
  1. ; If TYPE="FLD" the correct NCPDP field number needs to be in piece 4
  1. ; I.e. ;;FLD;308;Field 308; (Suppresses field 308...Again piece 5 is not required but makes it easier to debug)
  1. ; If TYPE="TOP" put the Fileman field number in instead of NCPDP #
  1. ; I.e. ;;TOP;100.18;Medicare Part D?;Y (Put's "Y" in the field Medicare Part D?)
  1. ; Field numbers are:
  1. ; 100.18="Medicare Part D?"
  1. ; 100.19="Maximum number of RXs per claim"
  1. ; 100.2="Add Dispensing fee to ingredeant cost"
  1. ; 100.3="Contract required"
  1. ; 100.4="Total exclusive of Patient Amount"
  1. ; (Values are all either "Y" or "N" except for "Maximum number of RXs per claim")
  1. DEFTAB ;;TYPE;NCPDP FIELD #;FIELD NAME;VALUE
  1. ;;FLD;354;SUPPRESS FIELD 354;
  1. ;;FLD;357;SUPPRESS FIELD 357;
  1. ;;FLD;391;SUPPRESS FIELD 391;
  1. ;;FLD;995;SUPPRESS FIELD 995;
  1. ;;FLD;996;SUPPRESS FIELD 996;
  1. ;;FLD;420;SUPPRESS FIELD 420;
  1. ;;FLD;458;SUPPRESS FIELD 458;
  1. ;;FLD;459;SUPPRESS FIELD 459;
  1. ;;FLD;494;SUPPRESS FIELD 494;
  1. ;;FLD;495;SUPPRESS FIELD 495;
  1. ;;FLD;496;SUPPRESS FIELD 496;
  1. ;;FLD;497;SUPPRESS FIELD 497;
  1. ;;FLD;499;SUPPRESS FIELD 499;
  1. ;;FLD;524;SUPPRESS FIELD 524;
  1. ;;FLD;359;SUPPRESS FIELD 359;
  1. ;;FLD;360;SUPPRESS FIELD 360;
  1. ;;FLD;361;SUPPRESS FIELD 361;
  1. ;;FLD;997;SUPPRESS FIELD 997;
  1. ;;FLD;115;SUPPRESS FIELD 115;
  1. ;;FLD;350;SUPPRESS FIELD 350;
  1. ;;FLD;334;SUPPRESS FIELD 334;
  1. ;;FLD;498;SUPPRESS FIELD 498;
  1. ;;FLD;364;SUPPRESS FIELD 364;
  1. ;;FLD;365;SUPPRESS FIELD 365;
  1. ;;FLD;366;SUPPRESS FIELD 366;
  1. ;;FLD;367;SUPPRESS FIELD 367;
  1. ;;FLD;368;SUPPRESS FIELD 368;
  1. ;;SEG;;COB Segment;5
  1. ;;SEG;;Workers Comp Segment;6
  1. ;;SEG;;Durr/PPS Segment;8
  1. ;;SEG;;Coupon Segment;9
  1. ;;SEG;;Compound Segment;10
  1. ;;SEG;;Prior Auth Segment;12
  1. ;;SEG;;Clinical Segment;13
  1. ;;SEG;;Additional Doc Segment;14
  1. ;;SEG;;Facility Segment;15
  1. ;;SEG;;Narrative Segment;16
  1. ;;SPEC;436;PUT SPECIAL CODE IN FIELD 436;S ABSP("X")="03"
  1. ;;SPEC;455;PUT SPECIAL CODE IN FIELD 455;S ABSP("X")=1
  1. ;;TOP;100.2;Add Dispensing fee to ingredeant cost;N
  1. ;;TOP;100.3;Contract required;N
  1. ;;TOP;100.4;Total exclusive of Patient Amount;N
  1. ;;TOP;100.07;DIAL OUT TO;ENVOY DIRECT VIA T1 LINE
  1. ;;TOP;100.14;Insurer NPI Flag;BOTH
  1. ;;TOP;100.06;RX-Pricing Method;STANDARD
  1. ;;***
  1. Q
  1. CAIDTAB ;;TYPE;NCPDP FIELD #;COMMENT;VALUE
  1. ;;FLD;147;SUPPRESS FIELD 147;
  1. ;;FLD;384;SUPPRESS FIELD 384;
  1. ;;SPEC;304;PUT SPECIAL CODE IN FIELD 304;S ABSP("X")=$G(ABSP("Patient","Medicaid DOB")) S:ABSP("X")="" ABSP("X")=$G(ABSP("Patient","DOB")) S ABSP("X")=$$DTF1|ABSPECFM(ABSP("X"))
  1. ;;TOP;100.18;Medicare Part D?;N
  1. ;;TOP;100.19;Maximum RXs per claim;4
  1. ;;TOP;104.01;RX-Priority;5
  1. ;;***
  1. Q
  1. CARETAB ;;TYPE;NCPDP FIELD #;COMMENT;VALUE
  1. ;;SPEC;304;PUT SPECIAL CODE IN FIELD 304;S ABSP("X")=$G(ABSP("Patient","Medicare DOB")) S:ABSP("X")="" ABSP("X")=$G(ABSP("Patient","DOB")) S ABSP("X")=$$DTF1|ABSPECFM(ABSP("X"))
  1. ;;TOP;100.18;Medicare Part D?;Y
  1. ;;TOP;100.19;Maximum RXs per claim;1
  1. ;;TOP;104.01;RX-Prioriry;650
  1. ;;***
  1. Q
  1. PRIVTAB ;;TYPE;NCPDP FIELD #;COMMENT;VALUE
  1. ;;FLD;147;SUPPRESS FIELD 147;
  1. ;;FLD;384;SUPPRESS FIELD 384;
  1. ;;TOP;100.18;Medicare Part D?;N
  1. ;;TOP;100.19;Maximum RXs per claim;4
  1. ;;TOP;104.01;RX-Priority;20
  1. ;;***
  1. Q
  1. POPSPEC(ABSPINS,ABSPSPEC) ;Now populate the Special Code stuff
  1. ;This has already been run...don't add duplicate entries.
  1. Q:$D(^ABSPEI(ABSPINS,210))
  1. N NCPDPCD,INS,STRING,ZERR ; /IHS/OIT/RAM ; 9 JUN 17 ; ADD DBS CALL ERROR RETURN VARIABLE
  1. S NCPDPCD=""
  1. F S NCPDPCD=$O(ABSPSPEC(NCPDPCD)) Q:NCPDPCD="" D
  1. . ;These are the fields that can't be overriden
  1. . Q:(NCPDPCD=111)!(NCPDPCD=103)
  1. . S STRING=$TR(ABSPSPEC(NCPDPCD),"^","|") ;Fileman won't store this string with a ^ (caret) in it
  1. . S INS(1,9002313.42,"+1,"_ABSPINS_",",.01)=NCPDPCD
  1. . S INS(1,9002313.42,"+1,"_ABSPINS_",",.02)=STRING
  1. . ; D UPDATE^DIE("E","INS(1)")
  1. . D UPDATE^DIE("E","INS(1)",,"ZERR") ; /IHS/OIT/RAM ; 9 JUN 17 ; UPDATE DBS CALL TO ALLOW FOR ERROR RETURN.
  1. . I $D(ZERR) D LOG^ABSPOSL2("POPSPEC^ABSPICPY",.ZERR) ; /IHS/OIT/RAM ; 9 JUN 17 ; AND LOG IT IF AN ERROR OCCURS.
  1. Q
  1. POPSEG(ABSPINS,ABSPSPSG) ;Next we populate the suppressed segments
  1. ;This has already been run...don't add duplicate entries.
  1. Q:$D(^ABSPEI(ABSPINS,221))
  1. N SEGCD,INS,ZERR ; /IHS/OIT/RAM ; 9 JUN 17 ; ADD DBS CALL ERROR RETURN VARIABLE
  1. S SEGCD=""
  1. F S SEGCD=$O(ABSPSPSG(SEGCD)) Q:SEGCD="" D
  1. . S INS(1,9002313.48,"+1,"_ABSPINS_",",.01)=SEGCD
  1. . ; D UPDATE^DIE("","INS(1)") ;On this one we are using the Internal value
  1. . D UPDATE^DIE("","INS(1)",,"ZERR") ; /IHS/OIT/RAM ; 9 JUN 17 ; UPDATE DBS CALL TO ALLOW FOR ERROR RETURN.
  1. . I $D(ZERR) D LOG^ABSPOSL2("POPSEG^ABSPICPY",.ZERR) ; /IHS/OIT/RAM ; 9 JUN 17 ; AND LOG IT IF AN ERROR OCCURS.
  1. Q
  1. POPFLD(ABSPINS,ABSPSPFL) ;Next we populate the suppressed fields
  1. ;This has already been run...don't add duplicate entries.
  1. Q:$D(^ABSPEI(ABSPINS,220))
  1. N NCPDPCD,ZERR ; /IHS/OIT/RAM ; 9 JUN 17 ; ADD DBS CALL ERROR RETURN VARIABLE
  1. S NCPDPCD=""
  1. F S NCPDPCD=$O(ABSPSPFL(NCPDPCD)) Q:NCPDPCD="" D
  1. . S INS(1,9002313.46,"+1,"_ABSPINS_",",.01)=NCPDPCD
  1. . ; D UPDATE^DIE("E","INS(1)")
  1. . D UPDATE^DIE("E","INS(1)",,"ZERR") ; /IHS/OIT/RAM ; 9 JUN 17 ; UPDATE DBS CALL TO ALLOW FOR ERROR RETURN.
  1. . I $D(ZERR) D LOG^ABSPOSL2("POPFLD^ABSPICPY",.ZERR) ; /IHS/OIT/RAM ; 9 JUN 17 ; AND LOG IT IF AN ERROR OCCURS.
  1. Q