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

ABMER20A.m

Go to the documentation of this file.
  1. ABMER20A ; IHS/ASDST/DMJ - UB92 EMC RECORD 20 (Patient) cont'd ;
  1. ;;2.6;IHS 3P BILLING SYSTEM;**21**;NOV 12, 2009;Build 379
  1. ;Original;DMJ;02/07/96 12:33 PM
  1. ;
  1. ;IHS/DSD/DMJ - 7/15/1999 NOIS BXX-0799-150034 Patch 3 #3
  1. ; Modified to allow spaces in patient last name
  1. ; IHS/ASDS/DMJ - 04/20/00 - V2.4 Patch 1 - NOIS HQW-0500-100040
  1. ; Modified location code to check for satellite first. If no satellite, use parent.
  1. ; IHS/ASDS/LSL - 07/10/00 - V2.4 Path 2 - NOIS NDA-0700-180029
  1. ; Modified to strip off the leading zero of admission source and admission type.
  1. ; IHS/ASDS/LSL - 09/06/00 - V2.4 Patch 3 - NOIS CAA-0900-110008
  1. ; If nothing in admission source or type, make it null instead of 0 (zero).
  1. ; IHS/ASDS/SDH - 09/27/01 - v2.4 Patch 9 - NOIS XAA-0901-200095
  1. ; After moving Kidscare to Page 5 from Page 7 found that there are checks that are done for Medicaid that should also
  1. ; be done for Kidscare.
  1. ;
  1. ;IHS/SD/SDR - 2.6*21 - HEAT169641 - Include comma and middle initial if AO Control# is 61044
  1. ;
  1. ; *********************************************************************
  1. ;
  1. LOOP ;LOOP HERE
  1. F I=10:10:110 D
  1. .D @I
  1. .I $D(^ABMEXLM("AA",+$G(ABMP("INS")),+$G(ABMP("EXP")),20,I)) D @(^(I))
  1. .I '$G(ABMP("NOFMT")) S ABMREC(20)=$G(ABMREC(20))_ABMR(20,I)
  1. Q
  1. ;
  1. 10 ;Record type
  1. S ABMR(20,10)=20
  1. Q
  1. ;
  1. 20 ;Filler
  1. S ABMR(20,20)=""
  1. S ABMR(20,20)=$$FMT^ABMERUTL(ABMR(20,20),2)
  1. Q
  1. ;
  1. 30 ;Patient Control Number, (SOURCE: FILE=9000001.41,FIELD=.02)
  1. S ABMR(20,30)=$P(^ABMDBILL(DUZ(2),ABMP("BDFN"),0),U)
  1. I $P($G(^ABMDPARM(DUZ(2),1,2)),"^",4)'="" D
  1. .S $P(ABMR(20,30),"-",2)=$P($G(^ABMDPARM(DUZ(2),1,2)),"^",4)
  1. I $P($G(^ABMDPARM(DUZ(2),1,4)),"^",9) D
  1. .Q:ABMP("LDFN")=DUZ(2)
  1. .Q:$P($G(^ABMDPARM(ABMP("LDFN"),1,2)),"^",4)=""
  1. .S $P(ABMR(20,30),"-",2)=$P(^ABMDPARM(ABMP("LDFN"),1,2),"^",4)
  1. I $P($G(^ABMDPARM(DUZ(2),1,3)),"^",3) D
  1. .D 250^ABMER20
  1. .Q:$TR(ABMR(20,250)," ")=""
  1. .S ABMR(20,30)=ABMR(20,30)_"-"_ABMR(20,250)
  1. S ABMR(20,30)=$$FMT^ABMERUTL(ABMR(20,30),20)
  1. Q
  1. ;
  1. 40 ;Patient Last Name (SOURCE: FILE=2, FIELD=.01)
  1. ; form locator #12
  1. I '$D(ABME("PNM")) D PNM
  1. S ABMR(20,40)=$P(ABME("PNM"),",",1)
  1. I $G(ABMP("EXP"))=10 S ABMR(20,40)=$TR(ABMR(20,40),"-.,'/")
  1. S ABMR(20,40)=$$FMT^ABMERUTL(ABMR(20,40),20)
  1. Q
  1. ;
  1. 50 ;Patient First Name (SOURCE: FILE=2, FIELD=.01)
  1. ; form locator #12
  1. I '$D(ABME("PNM")) D PNM
  1. S ABMR(20,50)=$P(ABME("PNM"),",",2)
  1. D
  1. .Q:ABMR(20,50)="BABY BOY"
  1. .Q:ABMR(20,50)="BABY GIRL"
  1. .S ABMR(20,50)=$P(ABMR(20,50)," ",1)
  1. S ABMR(20,50)=$$FMT^ABMERUTL(ABMR(20,50),9)
  1. Q
  1. ;
  1. 60 ;Patient Middle Initial (SOURCE: FILE=2, FIELD=.01)
  1. ; form locator #12
  1. I '$D(ABME("PNM")) D PNM
  1. S ABMR(20,60)=$P(ABME("PNM"),",",2)
  1. I ABMR(20,60)="BABY BOY" S ABMR(20,60)=" " Q
  1. I ABMR(20,60)="BABY GIRL" S ABMR(20,60)=" " Q
  1. S ABMR(20,60)=$P(ABMR(20,60)," ",2)
  1. S ABMR(20,60)=$E(ABMR(20,60))
  1. I ($$RCID^ABMERUTL(ABMP("INS"))[61044) S ABMR(20,60)=$P(ABME("PNM"),",",3) ;abm*2.6*21 IHS/SD/SDR HEAT169641
  1. S ABMR(20,60)=$$FMT^ABMERUTL(ABMR(20,60),1)
  1. Q
  1. ;
  1. 70 ;Patient Sex Code (SOURCE: FILE=2, FIELD=.02)
  1. ; form locator #15
  1. I '$D(ABME("SEX")) D PNM
  1. S ABMR(20,70)=$S(ABME("SEX")="":"U",1:ABME("SEX"))
  1. Q
  1. ;
  1. 80 ;Patient's Birth Date (SOURCE: FILE=2, FIELD=.03)
  1. ; form locator #14
  1. I '$D(ABME("DOB")) D PNM
  1. S ABMR(20,80)=$$Y2KDT^ABMDUTL(ABME("DOB"))
  1. Q
  1. ;
  1. 90 ;Marital Status Code (SOURCE: FILE=2, FIELD=.05)
  1. ; form locator #16
  1. I '$D(ABME("MS")) D PNM
  1. S ABMR(20,90)=$S(ABME("MS")=1:"D",ABME("MS")=2:"M",ABME("MS")=4:"W",ABME("MS")=5:"X",ABME("MS")=6:"S",1:"U")
  1. Q
  1. ;
  1. 100 ;Type of Admission (SOURCE: FILE=9002274.4, FIELD=.51)
  1. ; form locator #19
  1. S ABME("FLD")=.51
  1. D DIQ1
  1. S ABMR(20,100)=+ABM(9002274.4,ABMP("BDFN"),.51,"E")
  1. ; if type of admission is "" and visit type is outpatient and
  1. ; insurance type is Medicare FI set type of admission to 1
  1. I 'ABMR(20,100),ABMP("VTYP")=131,ABMP("ITYPE")="R" S ABMR(20,100)=1
  1. S:'ABMR(20,100) ABMR(20,100)=""
  1. S ABMR(20,100)=$$FMT^ABMERUTL(ABMR(20,100),1)
  1. Q
  1. ;
  1. 110 ;Source of Admission (SOURCE: FILE=9002274.4, FIELD=.52)
  1. ; form locator #20
  1. S ABME("FLD")=.52
  1. D DIQ1
  1. S ABMR(20,110)=+ABM(9002274.4,ABMP("BDFN"),.52,"E")
  1. ; if type of admission is "" and visit type is outpatient and
  1. ; insurance type is Medicare FI set type of admission to 1
  1. I 'ABMR(20,110),ABMP("VTYP")=131,ABMP("ITYPE")="R" S ABMR(20,110)=1
  1. S:'ABMR(20,110) ABMR(20,110)=""
  1. S ABMR(20,110)=$$FMT^ABMERUTL(ABMR(20,110),1)
  1. Q
  1. ;
  1. DIQ1 ;PULL BILL DATA VIA DIQ1
  1. Q:$D(ABM(9002274.4,ABMP("BDFN"),ABME("FLD")))
  1. N I
  1. S DIQ="ABM("
  1. S DIQ(0)="EI"
  1. S DIC="^ABMDBILL(DUZ(2),"
  1. S DA=ABMP("BDFN")
  1. S DR=".01;.21;.51;.52;.53;.61;.62;.63;.64;.71;.72;.99"
  1. D EN^DIQ1
  1. K DIQ
  1. Q
  1. ;
  1. PNM ; EP
  1. ; Patient name
  1. K ABME("PNM"),ABME("DOB")
  1. ; if insurer type is Medicare FI
  1. I ABMP("ITYPE")="R" D
  1. .; if insurer name contains "MEDICARE"
  1. .I $P(^AUTNINS(ABMP("INS"),0),U)["MEDICARE" D
  1. ..; Medicare Patient name from MEDICARE ELIGIBLE
  1. ..S ABME("PNM")=$P($G(^AUPNMCR(ABMP("PDFN"),21)),U)
  1. ..S ABME("DOB")=$P($G(^AUPNMCR(ABMP("PDFN"),21)),"^",2) ; DOB
  1. .; If insurer name contains "RAILROAD"
  1. .I $P(^AUTNINS(ABMP("INS"),0),U)["RAILROAD" D
  1. ..; Railroad Patient name from RAILROAD ELIGIBLE
  1. ..S ABME("PNM")=$P($G(^AUPNRRE(ABMP("PDFN"),21)),U)
  1. ..S ABME("DOB")=$P($G(^AUPNRRE(ABMP("PDFN"),21)),"^",2) ; DOB
  1. ;
  1. ; if insurer type is Medicaid FI
  1. I ABMP("ITYPE")="D"!(ABMP("ITYPE")="K") D
  1. .Q:'$G(ABMCDNUM)
  1. .S ABME("PNM")=$P($G(^AUPNMCD(ABMCDNUM,21)),U) ; Pat name
  1. .I $P($P(ABME("PNM"),",",2)," ",2)'=""&($$RCID^ABMERUTL(ABMP("INS"))[61044) S $P(ABME("PNM"),",",2)=$P($P(ABME("PNM"),",",2)," ",1)_","_$P($P(ABME("PNM"),",",2)," ",2) ;abm*2.6*21 IHS/SD/SDR HEAT169641
  1. .S ABME("DOB")=$P($G(^AUPNMCD(ABMCDNUM,21)),"^",2) ; dob
  1. ;
  1. ; Else get from patient file
  1. S:$G(ABME("PNM"))="" ABME("PNM")=$P($G(^DPT(+ABMP("PDFN"),0)),U)
  1. S:$G(ABME("DOB"))="" ABME("DOB")=$P(^DPT(ABMP("PDFN"),0),"^",3)
  1. ; sex code & marital status
  1. S ABME("SEX")=$P(^DPT(ABMP("PDFN"),0),"^",2),ABME("MS")=$P(^(0),"^",5)
  1. Q
  1. ;
  1. EX(ABMX,ABMY) ; EP
  1. ; Extrincic function here
  1. ;
  1. ; INPUT: ABMX = data element
  1. ; Y = bill internal entry number
  1. ;
  1. ; OUTPUT: Y = bill internal entry number
  1. ;
  1. S ABMP("BDFN")=ABMY
  1. D SET^ABMERUTL
  1. I '$G(ABMP("NOFMT")) S ABMP("FMT")=0
  1. D @ABMX
  1. S Y=ABMR(20,ABMX)
  1. K ABMR(20,ABMX),ABMX,ABMY
  1. I $D(ABMP("FMT")) S ABMP("FMT")=1
  1. Q Y