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

AGEDERR3.m

Go to the documentation of this file.
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