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

AGINS1.m

Go to the documentation of this file.
AGINS1 ; IHS/ASDS/EFG - ROUTINE 2 TO BUILD AGINS ARRAY ;   
 ;;7.1;PATIENT REGISTRATION;**2,3,13**;AUG 25, 2005;Build 1
 ;IHS/OIT/NKD AG*7.1*13 RAILROAD DISPLAY FIX
 Q
LOAD ;EP - LOAD ARRAY AGINS WITH ELIGIBILITY DATA
 S SEL=SEL+1
 I '$D(PLANPTR) S PLANPTR=""
 S AGINS(SEL)=$G(INS)_U_$G(INSPTR)_U_$G(COVPTR)_U_$G(COV)_U_$G(EFF)_U_$G(END)_U_$G(PHPTR)_U_$G(PH)_U_$G(POLNUM)_U_$G(TYPE)_U_$G(RECPTR)_U_$G(PLANPTR)_U_$G(ISACTIVE)_U_$G(INSGLORF)_U_$G(MCDRATE)_U_$G(RELPOLHO)
 S AGINS(SEL)=AGINS(SEL)_U_$G(PCP)_U_$G(PLANNAME)_U_$G(GRPNAME)_U_$G(GRPNUMB)_U_$G(GSTREET)_U_$G(GCITY)_U_$G(GSTATE)_U_$G(GZIP)_U_$G(INSGEND)_U_$G(OPCOPAY)_U_$G(OPCOINS)_U_$G(FAMDEDUC)_U_$G(INDDEDUC)
 Q
 ;CALLED FROM AGINS
ADDSEQNM ;EP - ADD SEQ #
 N SEQ,SEQ2,EFFDT,ENDDT,OLDSEQ,MEDCR,INSPTR,MEDICARE,MEDTYP,MEDSEQ,MED2SEQ,NEWSEQ,RAILSEQ,RAIL2SEQ
 N COVTYP  ;IHS/SD/TPF 12/2/2005 AG*7.1*1
 S SEQ2=0,MEDCR=0
 S SEQ="" F  S SEQ=$O(AGINS(SEQ)) Q:SEQ=""  D
 .S EFFDT=$P(AGINS(SEQ),U,5)
 .S ENDDT=$P(AGINS(SEQ),U,6)
 .S SPECSUB=$S(ENDDT="":"O",1:"T")  ;O=OPEN ENDED , T=TERM DATE PRESENT
 .S MEDTYP=$P(AGINS(SEQ),U,4)
 .S INSPTR=$P(AGINS(SEQ),U,2)
 .S SEQ2=SEQ2+1
 .;RESORT BASED ON MOST RECENT EFF OR END DATE DEPENDING ON WHETHER TWO DATES EXIST OR NOT
 .I MEDTYP="" D
 ..I SPECSUB="O" S AGINSN1(SPECSUB,9999999-EFFDT_U_INSPTR,SEQ)=AGINS(SEQ)
 ..E  S AGINSN1(SPECSUB,9999999-ENDDT_U_INSPTR,SEQ)=AGINS(SEQ)
 .E  D
 ..I SPECSUB="O" S AGINSN1(SPECSUB,9999999-EFFDT_U_INSPTR,SEQ)=AGINS(SEQ)
 ..E  S AGINSN1(SPECSUB,9999999-ENDDT_U_INSPTR,SEQ)=AGINS(SEQ)
 ;NEW SEQ AND DISPLAY ARRAY FOR 7.1. SO MCR AND RR PART A
 ;AN B LIST TOGETHER AS ONE ITEM ON THE SUMMARY PAGE
 ;DO NOT INLCUDE MEDICARE PART D
 S MEDCARE=0
 S RAILROAD=0
 S NEWSEQ=0
 S NEWSEQR=0
 S SPECSUB=""
 F  S SPECSUB=$O(AGINSN1(SPECSUB)) Q:SPECSUB=""  D
 .S EFFDT=""
 .F  S EFFDT=$O(AGINSN1(SPECSUB,EFFDT)) Q:EFFDT=""  D
 ..S OLDSEQ=""
 ..F  S OLDSEQ=$O(AGINSN1(SPECSUB,EFFDT,OLDSEQ)) Q:OLDSEQ=""  D
 ...S MEDTYP=$P(AGINSN1(SPECSUB,EFFDT,OLDSEQ),U,2)
 ...S COVTYP=$P(AGINSN1(SPECSUB,EFFDT,OLDSEQ),U,4)  ;IHS/SD/TPF 12/2/2005 AG*7.1*1
 ...;MEDICARE
 ...I MEDTYP=2,MEDCARE,(COVTYP'="D") S MED2SEQ=MED2SEQ+1,AGINSNN(MEDSEQ,MED2SEQ)=AGINS(OLDSEQ) Q
 ...;I MEDTYP=2,'MEDCARE S MEDCARE=1 S NEWSEQ=NEWSEQ+1,MEDSEQ=NEWSEQ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