AGEDERR3 ; IHS/SD/TPF - EDIT CHECK CALLS
;;7.1;PATIENT REGISTRATION;**12**;AUG 25,2005;Build 1
;IHS/OIT/NKD AG*7.1*12 INSURER TYPE
;THIS RTN CONTAINS EDIT CHK SUBRTNS FOR USE IN THE EDIT
;CHK SYSTEM.
;EDIT CHK #20 - GRP NAME/PLAN NAME INCOMPLETE
;RETURNS TRUE IF MISSING
Q
GPNAMEMI(DFN,FINDCALL) ;EP
N X,SEQ,MISSING,AGINS
Q:DFN="" 1
;NEW SPECS REC'D 1/20/05
I $$DECEASED^AGEDERR2(DFN) Q 0
I '$$PTACTIVE^AGEDERR2(DFN) Q 0
I '$$CURRUPD^AGEDERR2(DFN,1095) Q 0
I '$$HASELIG^AGEDERR2(DFN) Q 0
;END NEW SPECS
S MISSING=0 ;ASSUME NOT MISSING
;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
;SELECTED AN INSURER FROM THE AGINS ARRAY
I $G(AGSELECT)'="" S AGINS(1)=AGSELECT
S SEL=0
I FINDCALL'="" D Q MISSING
.S FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
.D @FINDCALL
.I FINDCALL[("FINDMCD") S MISSING=$$CHKAGINS^AGEDERR(18,20,"",9)!$$CHKAGINS^AGEDERR(19,20,"",9) Q
.I FINDCALL[("FINDPVT") S MISSING=$$CHKAGINS^AGEDERR(19,20,"",9) Q
I FINDCALL="" D Q MISSING
.F FINDCALL="FINDMCD","FINDPVT" D
..S FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
..D @FINDCALL
..I FINDCALL[("FINDMCD") S MISSING=$$CHKAGINS^AGEDERR(18,20,"",9)!$$CHKAGINS^AGEDERR(19,20,"",9) Q
..I FINDCALL[("FINDPVT") S MISSING=$$CHKAGINS^AGEDERR(19,20,"",9) Q
K AGINS
Q MISSING
;EDIT CHK #21 - GRP #/PLAN # INCOMPLETE
GPNUMISS(DFN,FINDCALL) ;EP
Q:'DFN 1
;NEW SPECS REC'D 1/20/05
I $$DECEASED^AGEDERR2(DFN) Q 0
I '$$PTACTIVE^AGEDERR2(DFN) Q 0
I '$$CURRUPD^AGEDERR2(DFN,1095) Q 0
I '$$HASELIG^AGEDERR2(DFN) Q 0
;END NEW SPECS
N X,SEQ,MISSING,AGINS
;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
;SELECTED AN INSURER FROM THE AGINS ARRAY
I $G(AGSELECT)'="" S AGINS(1)=AGSELECT
E D
.;USER HAS NOT SELECTED FROM AGED4A SO CREATE OUR OWN AGINS
.;ARRAY BASED ON VALUE OF 'FINDCALL'
.I FINDCALL'="" S FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
.S SEL=0
.I FINDCALL="" D FINDALL^AGEDERR(DFN,.AGINS)
.E D @FINDCALL
S MISSING=$$CHKAGINS^AGEDERR(20,21,"",1)&$$CHKAGINS^AGEDERR(12,21,"",1)
K AGINS
Q MISSING
;EDIT CHK #22 - MISSING/INCOMPLETE INSURANCE POL #
POLNUMMI(DFN,FINDCALL) ;EP
N X,SEQ,MISSING,AGINS
Q:DFN="" 1
;NEW SPECS REC'D 1/20/05
I $$DECEASED^AGEDERR2(DFN) Q 0
I '$$PTACTIVE^AGEDERR2(DFN) Q 0
I '$$CURRUPD^AGEDERR2(DFN,1095) Q 0
I '$$HASELIG^AGEDERR2(DFN) Q 0
;END NEW SPECS
;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
;SELECTED AN INSURER FROM THE AGINS ARRAY
I $G(AGSELECT)'="" S AGINS(1)=AGSELECT
E D
.;USER HAS NOT SELECTED FROM AGED4A SO CREATE OUR OWN AGINS
.;ARRAY BASED ON VALUE OF 'FINDCALL'
.I FINDCALL'="" S FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
.S SEL=0
.I FINDCALL="" D FINDALL^AGEDERR(DFN,.AGINS)
.E D @FINDCALL
S MISSING=$$CHKAGINS^AGEDERR(9,22,"",1)
K AGINS
I $G(AGOPT("VERSION"))<7.1 Q $$POLNMMI7(DFN) ;DO PRE 7.1 CHK FOR POL # IN AUTO LIABILITY FILE ONLY
Q MISSING
;CHK POL # OF AUTO LIABILITY
POLNMMI7(DFN) ;EP
N POLNUM,ALIEN
S ALIEN="",MISSING=0
F S ALIEN=$O(^AUPNAUTO("C",DFN,ALIEN)) Q:ALIEN="" D Q:MISSING
.S MISSING=$P($G(^AUPNAUTO(ALIEN,0)),U,5)=""
Q MISSING
;EDIT CHK #23 - MISSING PH IN PRVT INS
PHMEMMS(DFN,FINDCALL) ;EP
;PER ADRIAN'S EMAIL DATED 2/3/2005 DO NOT CHECK FOR
;MISSING POLICY HOLDER IN PRVT INS
Q 0
N X,SEQ,MISSING,AGINS
Q:DFN="" 1
;NEW SPECS REC'D 1/20/05
I $$DECEASED^AGEDERR2(DFN) Q 0
I '$$PTACTIVE^AGEDERR2(DFN) Q 0
I '$$CURRUPD^AGEDERR2(DFN,1095) Q 0
I '$$HASELIG^AGEDERR2(DFN) Q 0
;END NEW SPECS
S FINDCALL="FINDPVT" ;ONLY CHK PRVT INS. AT THIS TIME.
;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
;SELECTED AN INSURER FROM THE AGINS ARRAY
I $G(AGSELECT)'="" S AGINS(1)=AGSELECT
E D
.;USER HAS NOT SELECTED FROM AGED4A SO CREATE OUR OWN AGINS
.;ARRAY BASED ON VALUE OF 'FINDCALL'
.I FINDCALL'="" S FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
.S SEL=0
.I FINDCALL="" D FINDALL^AGEDERR(DFN,.AGINS)
.E D @FINDCALL
S MISSING=$$CHKAGINS^AGEDERR(7,23,"",1)
K AGINS
Q MISSING
;EDIT CHECK #24 NAME FORMAT
NAMEFOR(DFN,FINDCALL) ;EP
N X,SEQ,MISSING,AGINS
Q:DFN="" 1
;NEW SPECS REC'D 1/20/05
I $$DECEASED^AGEDERR2(DFN) Q 0
I '$$PTACTIVE^AGEDERR2(DFN) Q 0
I '$$CURRUPD^AGEDERR2(DFN,1095) Q 0
I '$$HASELIG^AGEDERR2(DFN) Q 0
;END NEW SPECS
S FINDCALL="FINDPVT" ;ONLY CHK PRVT INS. AT THIS TIME.
;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
;SELECTED AN INSURER FROM THE AGINS ARRAY
I $G(AGSELECT)'="" S AGINS(1)=AGSELECT
E D
.;USER HAS NOT SELECTED FROM AGED4A SO CREATE OUR OWN AGINS
.;ARRAY BASED ON VALUE OF 'FINDCALL'
.I FINDCALL'="" S FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
.S SEL=0
.I FINDCALL="" D FINDALL^AGEDERR(DFN,.AGINS)
.E D @FINDCALL
S MISSING=$$CHKAGINS^AGEDERR(8,24,"D NAME^AUPNPED S X=$G(X)=""""","9,1") ;ROUTINE CALL
K AGINS
Q MISSING
;EDIT CHK #25 - INSURED'S GENDER INCOMPLETE
POLSEXIN(DFN,FINDCALL) ;EP
N X,SEQ,MISSING,AGINS,PHPTR
Q:DFN="" 1
;NEW SPECS REC'D 1/20/05
I $$DECEASED^AGEDERR2(DFN) Q 0
I '$$PTACTIVE^AGEDERR2(DFN) Q 0
I '$$CURRUPD^AGEDERR2(DFN,1095) Q 0
I '$$HASELIG^AGEDERR2(DFN) Q 0
;END NEW SPECS
S FINDCALL="FINDPVT" ;ONLY CHK PRVT INS. AT THIS TIME.
;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
;SELECTED AN INSURER FROM THE AGINS ARRAY
I $G(AGSELECT)'="" S AGINS(1)=AGSELECT
E D
.;USER HAS NOT SELECTED FROM AGED4A SO CREATE OUR OWN AGINS
.;ARRAY BASED ON VALUE OF 'FINDCALL'
.I FINDCALL'="" S FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
.S SEL=0
.I FINDCALL="" D FINDALL^AGEDERR(DFN,.AGINS)
.E D @FINDCALL
;S MISSING=$$CHKAGINS^AGEDERR(25,25,"","9,1")
;I MISSING K AGINS Q MISSING
S SEQ=0
S MISSING=0
F S SEQ=$O(AGINS(SEQ)) Q:SEQ="" D Q:MISSING
.;DO NOT CHECK FOR ERRORS ON INSURANCE THAT IS INACTIVE NEW SPECS REC'D 1/20/05
.Q:'$$ISACTIVE^AGINS($P(AGINS(SEQ),U,5),$P(AGINS(SEQ),U,6))
.;END NEW SPECS REC'D 1/20/05
.S PHPTR=$E($P(AGINS(SEQ),U,7),2,10) I PHPTR="" S MISSING=1 Q
.S MISSING=$P($G(^AUPN3PPH(PHPTR,0)),U,8)=""
K AGINS
Q MISSING
;EDIT CHECK #26 - INSURER ASSIGNED PROVIDER NUMBER UNSPECIFIED
;NO SPECS
PROVMISS(DFN,FINDCALL) ;EP
Q 0 ;ERROR NOT IMPLEMTED YET. PAMS REQUIREMNT PER E-MAIL ADRIAN 2/4/2005
N X,SEQ,MISSING,AGINS
Q:DFN="" 1
;NEW SPECS REC'D 1/20/05
I $$DECEASED^AGEDERR2(DFN) Q 0
I '$$PTACTIVE^AGEDERR2(DFN) Q 0
I '$$CURRUPD^AGEDERR2(DFN,1095) Q 0
I '$$HASELIG^AGEDERR2(DFN) Q 0
;END NEW SPECS
;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
;SELECTED AN INSURER FROM THE AGINS ARRAY
I $G(AGSELECT)'="" S AGINS(1)=AGSELECT
E D
.;USER HAS NOT SELECTED FROM AGED4A SO LETS CREATE OUR OWN AGINS
.;ARRAY BASED ON VALUE OF 'FINDCALL'
.I FINDCALL'="" S FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
.S SEL=0
.I FINDCALL="" D FINDALL^AGEDERR(DFN,.AGINS)
.E D @FINDCALL
N X
S SEQ=0,MISSING=0
F S SEQ=$O(AGINS(SEQ)) Q:SEQ="" D Q:MISSING
.;DO NOT CHECK FOR ERRORS ON INSURANCE THAT IS INACTIVE NEW SPECS REC'D 1/20/05
.Q:'$$ISACTIVE^AGINS($P(AGINS(SEQ),U,5),$P(AGINS(SEQ),U,6))
.;END NEW SPECS REC'D 1/20/05
.Q:$P(AGINS(SEQ),U,14)'=""&($P(AGINS(SEQ),U,14)'["AUTNINS")
.S INSPTR=$P(AGINS(SEQ),U,2)
.S MISSING=INSPTR="" Q:MISSING
.S X=$G(^AUTNINS(INSPTR,0))
.S MISSING=X="" Q:MISSING
.S INS=$P(X,U)
.S MISSING=$O(^AUTNINS(INSPTR,15,""))="" Q:MISSING
.S MISSING=$O(^AUTNINS(INSPTR,15,DUZ(2),""))="" Q:MISSING
.S NODE15=$G(^AUTNINS(INSPTR,15,DUZ(2),0))
.S MISSING=$P(NODE15,U,2)="" Q:MISSING
K AGINS
Q MISSING_U_$$ERRDATA^AGEDERR(26)_"|"_$G(INS)
;EDIT CHECK #27 - INSURER'S ADDRESS INCOMPLETE (#)
INSADDIC(DFN,FINDCALL) ;EP
N X,SEQ,MISSING,AGINS,INSPTR,POLNUM,INNAME,INSTYPE
Q:DFN="" 1
;NEW SPECS REC'D 1/20/05
I $$DECEASED^AGEDERR2(DFN) Q 0
I '$$PTACTIVE^AGEDERR2(DFN) Q 0
I '$$CURRUPD^AGEDERR2(DFN,1095) Q 0
I '$$HASELIG^AGEDERR2(DFN) Q 0
;END NEW SPECS
;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
;SELECTED AN INSURER FROM THE AGINS ARRAY
I $G(AGSELECT)'="" S AGINS(1)=AGSELECT
E D
.;USER HAS NOT SELECTED FROM AGED4A SO LETS CREATE OUR OWN AGINS
.;ARRAY BASED ON VALUE OF 'FINDCALL'
.I FINDCALL'="" S FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
.S SEL=0
.I FINDCALL="" D FINDALL^AGEDERR(DFN,.AGINS)
.E D @FINDCALL
S SEQ=0,MISSING=0
F S SEQ=$O(AGINS(SEQ)) Q:SEQ="" D Q:MISSING
.;DO NOT CHECK FOR ERRORS ON INSURANCE THAT IS INACTIVE NEW SPECS REC'D 1/20/05
.Q:'$$ISACTIVE^AGINS($P(AGINS(SEQ),U,5),$P(AGINS(SEQ),U,6))
.;END NEW SPECS REC'D 1/20/05
.;IF ITS GUARANTOR ADDRESS WE'RE LOOKING FOR WE HAVE TO CHECK DIFFERENTLY
.Q:AGINS(SEQ)[("[G]")
.S INSPTR=$P(AGINS(SEQ),U,2)
.S MISSING=INSPTR="" Q:MISSING
.;S INSTYPE=$P($G(^AUTNINS(INSPTR,2)),U)
.S INSTYPE=$$INSTYP^AGUTL(INSPTR) ;IHS/OIT/NKD AG*7.1*12
.I INSTYPE="D" S INSPTR=$$CAIDMISS(AGINS(SEQ))
.S POLNUM=$P(AGINS(SEQ),U,9)
.S X=$G(^AUTNINS(INSPTR,0))
.S MISSING=X="" Q:MISSING
.S MISSING=$P(X,U,2)="" Q:MISSING
.S MISSING=$P(X,U,3)="" Q:MISSING
.S MISSING=$P(X,U,4)="" Q:MISSING
.S MISSING=$P(X,U,5)="" Q:MISSING
K AGINS
Q MISSING_U_$$ERRDATA^AGEDERR(27)_"|"_$G(POLNUM)_"|"_$G(INNAME)
CAIDMISS(RECORD) ;EP - DETERMINE IF PLAN NAME IS MISSING FOR MEDICAID INSURERS
N PTR,STATEPTR,IENS,INSPTR
;PER SPECS GIVEN 7/29/2005
S INSPTR=$P(RECORD,U,2)
S PTR=$P(RECORD,U,12) ;CHECK PLAN NAME IN MEDICAID FILE ITSELF
I PTR'="" Q PTR ;IF ITS POPULATED RETURN IT
S PTR=""
S IENS=$P($P(RECORD,U,11),",")
S STATEPTR=$P($G(^AUPNMCD(IENS,0)),U,4)
S:STATEPTR'="" PTR=$P($G(^AUTNINS(3,13,STATEPTR,0)),U,2)
I PTR'="" Q PTR
Q INSPTR
AGEDERR3 ; IHS/SD/TPF - EDIT CHECK CALLS
+1 ;;7.1;PATIENT REGISTRATION;**12**;AUG 25,2005;Build 1
+2 ;IHS/OIT/NKD AG*7.1*12 INSURER TYPE
+3 ;THIS RTN CONTAINS EDIT CHK SUBRTNS FOR USE IN THE EDIT
+4 ;CHK SYSTEM.
+5 ;EDIT CHK #20 - GRP NAME/PLAN NAME INCOMPLETE
+6 ;RETURNS TRUE IF MISSING
+7 QUIT
GPNAMEMI(DFN,FINDCALL) ;EP
+1 NEW X,SEQ,MISSING,AGINS
+2 IF DFN=""
QUIT 1
+3 ;NEW SPECS REC'D 1/20/05
+4 IF $$DECEASED^AGEDERR2(DFN)
QUIT 0
+5 IF '$$PTACTIVE^AGEDERR2(DFN)
QUIT 0
+6 IF '$$CURRUPD^AGEDERR2(DFN,1095)
QUIT 0
+7 IF '$$HASELIG^AGEDERR2(DFN)
QUIT 0
+8 ;END NEW SPECS
+9 ;ASSUME NOT MISSING
SET MISSING=0
+10 ;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
+11 ;SELECTED AN INSURER FROM THE AGINS ARRAY
+12 IF $GET(AGSELECT)'=""
SET AGINS(1)=AGSELECT
+13 SET SEL=0
+14 IF FINDCALL'=""
Begin DoDot:1
+15 SET FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
+16 DO @FINDCALL
+17 IF FINDCALL[("FINDMCD")
SET MISSING=$$CHKAGINS^AGEDERR(18,20,"",9)!$$CHKAGINS^AGEDERR(19,20,"",9)
QUIT
+18 IF FINDCALL[("FINDPVT")
SET MISSING=$$CHKAGINS^AGEDERR(19,20,"",9)
QUIT
End DoDot:1
QUIT MISSING
+19 IF FINDCALL=""
Begin DoDot:1
+20 FOR FINDCALL="FINDMCD","FINDPVT"
Begin DoDot:2
+21 SET FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
+22 DO @FINDCALL
+23 IF FINDCALL[("FINDMCD")
SET MISSING=$$CHKAGINS^AGEDERR(18,20,"",9)!$$CHKAGINS^AGEDERR(19,20,"",9)
QUIT
+24 IF FINDCALL[("FINDPVT")
SET MISSING=$$CHKAGINS^AGEDERR(19,20,"",9)
QUIT
End DoDot:2
End DoDot:1
QUIT MISSING
+25 KILL AGINS
+26 QUIT MISSING
+27 ;EDIT CHK #21 - GRP #/PLAN # INCOMPLETE
GPNUMISS(DFN,FINDCALL) ;EP
+1 IF 'DFN
QUIT 1
+2 ;NEW SPECS REC'D 1/20/05
+3 IF $$DECEASED^AGEDERR2(DFN)
QUIT 0
+4 IF '$$PTACTIVE^AGEDERR2(DFN)
QUIT 0
+5 IF '$$CURRUPD^AGEDERR2(DFN,1095)
QUIT 0
+6 IF '$$HASELIG^AGEDERR2(DFN)
QUIT 0
+7 ;END NEW SPECS
+8 NEW X,SEQ,MISSING,AGINS
+9 ;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
+10 ;SELECTED AN INSURER FROM THE AGINS ARRAY
+11 IF $GET(AGSELECT)'=""
SET AGINS(1)=AGSELECT
+12 IF '$TEST
Begin DoDot:1
+13 ;USER HAS NOT SELECTED FROM AGED4A SO CREATE OUR OWN AGINS
+14 ;ARRAY BASED ON VALUE OF 'FINDCALL'
+15 IF FINDCALL'=""
SET FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
+16 SET SEL=0
+17 IF FINDCALL=""
DO FINDALL^AGEDERR(DFN,.AGINS)
+18 IF '$TEST
DO @FINDCALL
End DoDot:1
+19 SET MISSING=$$CHKAGINS^AGEDERR(20,21,"",1)&$$CHKAGINS^AGEDERR(12,21,"",1)
+20 KILL AGINS
+21 QUIT MISSING
+22 ;EDIT CHK #22 - MISSING/INCOMPLETE INSURANCE POL #
POLNUMMI(DFN,FINDCALL) ;EP
+1 NEW X,SEQ,MISSING,AGINS
+2 IF DFN=""
QUIT 1
+3 ;NEW SPECS REC'D 1/20/05
+4 IF $$DECEASED^AGEDERR2(DFN)
QUIT 0
+5 IF '$$PTACTIVE^AGEDERR2(DFN)
QUIT 0
+6 IF '$$CURRUPD^AGEDERR2(DFN,1095)
QUIT 0
+7 IF '$$HASELIG^AGEDERR2(DFN)
QUIT 0
+8 ;END NEW SPECS
+9 ;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
+10 ;SELECTED AN INSURER FROM THE AGINS ARRAY
+11 IF $GET(AGSELECT)'=""
SET AGINS(1)=AGSELECT
+12 IF '$TEST
Begin DoDot:1
+13 ;USER HAS NOT SELECTED FROM AGED4A SO CREATE OUR OWN AGINS
+14 ;ARRAY BASED ON VALUE OF 'FINDCALL'
+15 IF FINDCALL'=""
SET FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
+16 SET SEL=0
+17 IF FINDCALL=""
DO FINDALL^AGEDERR(DFN,.AGINS)
+18 IF '$TEST
DO @FINDCALL
End DoDot:1
+19 SET MISSING=$$CHKAGINS^AGEDERR(9,22,"",1)
+20 KILL AGINS
+21 ;DO PRE 7.1 CHK FOR POL # IN AUTO LIABILITY FILE ONLY
IF $GET(AGOPT("VERSION"))<7.1
QUIT $$POLNMMI7(DFN)
+22 QUIT MISSING
+23 ;CHK POL # OF AUTO LIABILITY
POLNMMI7(DFN) ;EP
+1 NEW POLNUM,ALIEN
+2 SET ALIEN=""
SET MISSING=0
+3 FOR
SET ALIEN=$ORDER(^AUPNAUTO("C",DFN,ALIEN))
IF ALIEN=""
QUIT
Begin DoDot:1
+4 SET MISSING=$PIECE($GET(^AUPNAUTO(ALIEN,0)),U,5)=""
End DoDot:1
IF MISSING
QUIT
+5 QUIT MISSING
+6 ;EDIT CHK #23 - MISSING PH IN PRVT INS
PHMEMMS(DFN,FINDCALL) ;EP
+1 ;PER ADRIAN'S EMAIL DATED 2/3/2005 DO NOT CHECK FOR
+2 ;MISSING POLICY HOLDER IN PRVT INS
+3 QUIT 0
+4 NEW X,SEQ,MISSING,AGINS
+5 IF DFN=""
QUIT 1
+6 ;NEW SPECS REC'D 1/20/05
+7 IF $$DECEASED^AGEDERR2(DFN)
QUIT 0
+8 IF '$$PTACTIVE^AGEDERR2(DFN)
QUIT 0
+9 IF '$$CURRUPD^AGEDERR2(DFN,1095)
QUIT 0
+10 IF '$$HASELIG^AGEDERR2(DFN)
QUIT 0
+11 ;END NEW SPECS
+12 ;ONLY CHK PRVT INS. AT THIS TIME.
SET FINDCALL="FINDPVT"
+13 ;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
+14 ;SELECTED AN INSURER FROM THE AGINS ARRAY
+15 IF $GET(AGSELECT)'=""
SET AGINS(1)=AGSELECT
+16 IF '$TEST
Begin DoDot:1
+17 ;USER HAS NOT SELECTED FROM AGED4A SO CREATE OUR OWN AGINS
+18 ;ARRAY BASED ON VALUE OF 'FINDCALL'
+19 IF FINDCALL'=""
SET FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
+20 SET SEL=0
+21 IF FINDCALL=""
DO FINDALL^AGEDERR(DFN,.AGINS)
+22 IF '$TEST
DO @FINDCALL
End DoDot:1
+23 SET MISSING=$$CHKAGINS^AGEDERR(7,23,"",1)
+24 KILL AGINS
+25 QUIT MISSING
+26 ;EDIT CHECK #24 NAME FORMAT
NAMEFOR(DFN,FINDCALL) ;EP
+1 NEW X,SEQ,MISSING,AGINS
+2 IF DFN=""
QUIT 1
+3 ;NEW SPECS REC'D 1/20/05
+4 IF $$DECEASED^AGEDERR2(DFN)
QUIT 0
+5 IF '$$PTACTIVE^AGEDERR2(DFN)
QUIT 0
+6 IF '$$CURRUPD^AGEDERR2(DFN,1095)
QUIT 0
+7 IF '$$HASELIG^AGEDERR2(DFN)
QUIT 0
+8 ;END NEW SPECS
+9 ;ONLY CHK PRVT INS. AT THIS TIME.
SET FINDCALL="FINDPVT"
+10 ;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
+11 ;SELECTED AN INSURER FROM THE AGINS ARRAY
+12 IF $GET(AGSELECT)'=""
SET AGINS(1)=AGSELECT
+13 IF '$TEST
Begin DoDot:1
+14 ;USER HAS NOT SELECTED FROM AGED4A SO CREATE OUR OWN AGINS
+15 ;ARRAY BASED ON VALUE OF 'FINDCALL'
+16 IF FINDCALL'=""
SET FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
+17 SET SEL=0
+18 IF FINDCALL=""
DO FINDALL^AGEDERR(DFN,.AGINS)
+19 IF '$TEST
DO @FINDCALL
End DoDot:1
+20 ;ROUTINE CALL
SET MISSING=$$CHKAGINS^AGEDERR(8,24,"D NAME^AUPNPED S X=$G(X)=""""","9,1")
+21 KILL AGINS
+22 QUIT MISSING
+23 ;EDIT CHK #25 - INSURED'S GENDER INCOMPLETE
POLSEXIN(DFN,FINDCALL) ;EP
+1 NEW X,SEQ,MISSING,AGINS,PHPTR
+2 IF DFN=""
QUIT 1
+3 ;NEW SPECS REC'D 1/20/05
+4 IF $$DECEASED^AGEDERR2(DFN)
QUIT 0
+5 IF '$$PTACTIVE^AGEDERR2(DFN)
QUIT 0
+6 IF '$$CURRUPD^AGEDERR2(DFN,1095)
QUIT 0
+7 IF '$$HASELIG^AGEDERR2(DFN)
QUIT 0
+8 ;END NEW SPECS
+9 ;ONLY CHK PRVT INS. AT THIS TIME.
SET FINDCALL="FINDPVT"
+10 ;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
+11 ;SELECTED AN INSURER FROM THE AGINS ARRAY
+12 IF $GET(AGSELECT)'=""
SET AGINS(1)=AGSELECT
+13 IF '$TEST
Begin DoDot:1
+14 ;USER HAS NOT SELECTED FROM AGED4A SO CREATE OUR OWN AGINS
+15 ;ARRAY BASED ON VALUE OF 'FINDCALL'
+16 IF FINDCALL'=""
SET FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
+17 SET SEL=0
+18 IF FINDCALL=""
DO FINDALL^AGEDERR(DFN,.AGINS)
+19 IF '$TEST
DO @FINDCALL
End DoDot:1
+20 ;S MISSING=$$CHKAGINS^AGEDERR(25,25,"","9,1")
+21 ;I MISSING K AGINS Q MISSING
+22 SET SEQ=0
+23 SET MISSING=0
+24 FOR
SET SEQ=$ORDER(AGINS(SEQ))
IF SEQ=""
QUIT
Begin DoDot:1
+25 ;DO NOT CHECK FOR ERRORS ON INSURANCE THAT IS INACTIVE NEW SPECS REC'D 1/20/05
+26 IF '$$ISACTIVE^AGINS($PIECE(AGINS(SEQ),U,5),$PIECE(AGINS(SEQ),U,6))
QUIT
+27 ;END NEW SPECS REC'D 1/20/05
+28 SET PHPTR=$EXTRACT($PIECE(AGINS(SEQ),U,7),2,10)
IF PHPTR=""
SET MISSING=1
QUIT
+29 SET MISSING=$PIECE($GET(^AUPN3PPH(PHPTR,0)),U,8)=""
End DoDot:1
IF MISSING
QUIT
+30 KILL AGINS
+31 QUIT MISSING
+32 ;EDIT CHECK #26 - INSURER ASSIGNED PROVIDER NUMBER UNSPECIFIED
+33 ;NO SPECS
PROVMISS(DFN,FINDCALL) ;EP
+1 ;ERROR NOT IMPLEMTED YET. PAMS REQUIREMNT PER E-MAIL ADRIAN 2/4/2005
QUIT 0
+2 NEW X,SEQ,MISSING,AGINS
+3 IF DFN=""
QUIT 1
+4 ;NEW SPECS REC'D 1/20/05
+5 IF $$DECEASED^AGEDERR2(DFN)
QUIT 0
+6 IF '$$PTACTIVE^AGEDERR2(DFN)
QUIT 0
+7 IF '$$CURRUPD^AGEDERR2(DFN,1095)
QUIT 0
+8 IF '$$HASELIG^AGEDERR2(DFN)
QUIT 0
+9 ;END NEW SPECS
+10 ;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
+11 ;SELECTED AN INSURER FROM THE AGINS ARRAY
+12 IF $GET(AGSELECT)'=""
SET AGINS(1)=AGSELECT
+13 IF '$TEST
Begin DoDot:1
+14 ;USER HAS NOT SELECTED FROM AGED4A SO LETS CREATE OUR OWN AGINS
+15 ;ARRAY BASED ON VALUE OF 'FINDCALL'
+16 IF FINDCALL'=""
SET FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
+17 SET SEL=0
+18 IF FINDCALL=""
DO FINDALL^AGEDERR(DFN,.AGINS)
+19 IF '$TEST
DO @FINDCALL
End DoDot:1
+20 NEW X
+21 SET SEQ=0
SET MISSING=0
+22 FOR
SET SEQ=$ORDER(AGINS(SEQ))
IF SEQ=""
QUIT
Begin DoDot:1
+23 ;DO NOT CHECK FOR ERRORS ON INSURANCE THAT IS INACTIVE NEW SPECS REC'D 1/20/05
+24 IF '$$ISACTIVE^AGINS($PIECE(AGINS(SEQ),U,5),$PIECE(AGINS(SEQ),U,6))
QUIT
+25 ;END NEW SPECS REC'D 1/20/05
+26 IF $PIECE(AGINS(SEQ),U,14)'=""&($PIECE(AGINS(SEQ),U,14)'["AUTNINS")
QUIT
+27 SET INSPTR=$PIECE(AGINS(SEQ),U,2)
+28 SET MISSING=INSPTR=""
IF MISSING
QUIT
+29 SET X=$GET(^AUTNINS(INSPTR,0))
+30 SET MISSING=X=""
IF MISSING
QUIT
+31 SET INS=$PIECE(X,U)
+32 SET MISSING=$ORDER(^AUTNINS(INSPTR,15,""))=""
IF MISSING
QUIT
+33 SET MISSING=$ORDER(^AUTNINS(INSPTR,15,DUZ(2),""))=""
IF MISSING
QUIT
+34 SET NODE15=$GET(^AUTNINS(INSPTR,15,DUZ(2),0))
+35 SET MISSING=$PIECE(NODE15,U,2)=""
IF MISSING
QUIT
End DoDot:1
IF MISSING
QUIT
+36 KILL AGINS
+37 QUIT MISSING_U_$$ERRDATA^AGEDERR(26)_"|"_$GET(INS)
+38 ;EDIT CHECK #27 - INSURER'S ADDRESS INCOMPLETE (#)
INSADDIC(DFN,FINDCALL) ;EP
+1 NEW X,SEQ,MISSING,AGINS,INSPTR,POLNUM,INNAME,INSTYPE
+2 IF DFN=""
QUIT 1
+3 ;NEW SPECS REC'D 1/20/05
+4 IF $$DECEASED^AGEDERR2(DFN)
QUIT 0
+5 IF '$$PTACTIVE^AGEDERR2(DFN)
QUIT 0
+6 IF '$$CURRUPD^AGEDERR2(DFN,1095)
QUIT 0
+7 IF '$$HASELIG^AGEDERR2(DFN)
QUIT 0
+8 ;END NEW SPECS
+9 ;IF SELECTION IS DEFINED WE'RE COMING FROM AGED4A AND THE USER HAS
+10 ;SELECTED AN INSURER FROM THE AGINS ARRAY
+11 IF $GET(AGSELECT)'=""
SET AGINS(1)=AGSELECT
+12 IF '$TEST
Begin DoDot:1
+13 ;USER HAS NOT SELECTED FROM AGED4A SO LETS CREATE OUR OWN AGINS
+14 ;ARRAY BASED ON VALUE OF 'FINDCALL'
+15 IF FINDCALL'=""
SET FINDCALL=FINDCALL_U_"AGINS("_DFN_")"
+16 SET SEL=0
+17 IF FINDCALL=""
DO FINDALL^AGEDERR(DFN,.AGINS)
+18 IF '$TEST
DO @FINDCALL
End DoDot:1
+19 SET SEQ=0
SET MISSING=0
+20 FOR
SET SEQ=$ORDER(AGINS(SEQ))
IF SEQ=""
QUIT
Begin DoDot:1
+21 ;DO NOT CHECK FOR ERRORS ON INSURANCE THAT IS INACTIVE NEW SPECS REC'D 1/20/05
+22 IF '$$ISACTIVE^AGINS($PIECE(AGINS(SEQ),U,5),$PIECE(AGINS(SEQ),U,6))
QUIT
+23 ;END NEW SPECS REC'D 1/20/05
+24 ;IF ITS GUARANTOR ADDRESS WE'RE LOOKING FOR WE HAVE TO CHECK DIFFERENTLY
+25 IF AGINS(SEQ)[("[G]")
QUIT
+26 SET INSPTR=$PIECE(AGINS(SEQ),U,2)
+27 SET MISSING=INSPTR=""
IF MISSING
QUIT
+28 ;S INSTYPE=$P($G(^AUTNINS(INSPTR,2)),U)
+29 ;IHS/OIT/NKD AG*7.1*12
SET INSTYPE=$$INSTYP^AGUTL(INSPTR)
+30 IF INSTYPE="D"
SET INSPTR=$$CAIDMISS(AGINS(SEQ))
+31 SET POLNUM=$PIECE(AGINS(SEQ),U,9)
+32 SET X=$GET(^AUTNINS(INSPTR,0))
+33 SET MISSING=X=""
IF MISSING
QUIT
+34 SET MISSING=$PIECE(X,U,2)=""
IF MISSING
QUIT
+35 SET MISSING=$PIECE(X,U,3)=""
IF MISSING
QUIT
+36 SET MISSING=$PIECE(X,U,4)=""
IF MISSING
QUIT
+37 SET MISSING=$PIECE(X,U,5)=""
IF MISSING
QUIT
End DoDot:1
IF MISSING
QUIT
+38 KILL AGINS
+39 QUIT MISSING_U_$$ERRDATA^AGEDERR(27)_"|"_$GET(POLNUM)_"|"_$GET(INNAME)
CAIDMISS(RECORD) ;EP - DETERMINE IF PLAN NAME IS MISSING FOR MEDICAID INSURERS
+1 NEW PTR,STATEPTR,IENS,INSPTR
+2 ;PER SPECS GIVEN 7/29/2005
+3 SET INSPTR=$PIECE(RECORD,U,2)
+4 ;CHECK PLAN NAME IN MEDICAID FILE ITSELF
SET PTR=$PIECE(RECORD,U,12)
+5 ;IF ITS POPULATED RETURN IT
IF PTR'=""
QUIT PTR
+6 SET PTR=""
+7 SET IENS=$PIECE($PIECE(RECORD,U,11),",")
+8 SET STATEPTR=$PIECE($GET(^AUPNMCD(IENS,0)),U,4)
+9 IF STATEPTR'=""
SET PTR=$PIECE($GET(^AUTNINS(3,13,STATEPTR,0)),U,2)
+10 IF PTR'=""
QUIT PTR
+11 QUIT INSPTR