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

AG71A.m

Go to the documentation of this file.
AG71A ;IHS/SD/EFG - Patient Registration 7.1 POST INSTALL ;   
 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
 ;
PRE ;EP - From KIDS.
 ;FILE 9009061.5 IS DINUMED AND HAS IDENTIFIERS. KIDS WILL NOT TRANSFER
 ;NEW DTAT FOR THOSE FIELDS WIHTOUT FIRST KILLING THE GLOBAL DTAT FIRST.
 S IEN="" F  S IEN=$O(^AGEDERRS(IEN)) Q:IEN=""  K ^AGEDERRS(IEN)
 Q
POST ;EP - From KIDS.
 D BMES^XPDUTL("Beginning post-install routine (POST^AG71A)."),TS
 ;
 D AGFAC
 ;
 D BMES^XPDUTL("Fixing private eligibility with missing .01 field."),TS
 D PRVT
 ;
 D BMES^XPDUTL("Fixing Railroad Eligibility file with erroneous ""B"" cross reference"),TS
 D RRE
 ;
 D BMES^XPDUTL("Fixing Medicaid eligibility with missing .01 field."),TS
 D MCD
 ;
 D BMES^XPDUTL("Fixing Medicare eligibility B cross references."),TS
 D MCR
 ;
 D BMES^XPDUTL("Fixing Medicaid sub file node counts."),TS
 D ^AGMCDCNT
 ;
 D BMES^XPDUTL("Converting AUPNPAT field 3401 to a POINTER."),TS
 D ^AGCNVMOD  ;CONVERT AUPNPAT FIELD 3401 TO A POINTER
 ;
 ;
 ;CONVERT ENTRIES FROM .09 FIELD IN AUPNPAT TO
 ;NEW 1201 MULTIPLE FIELD IN AUPNPAT
 D BMES^XPDUTL("Converting AUPNPAT field .09 to new multiple field 1201."),TS
 D ^AGCNVIMP
 ;
 ;CONVERT ENTRIES FROM OLD 'AUTO/LIABILITY' FILE
 ;TO NEW 'THIRD PARTY LIABILITY' FILE
 D BMES^XPDUTL("Converting AUTO/LIABILITY entries to new file."),TS
 D ^AGCNVTPL
 ;
 ;CONVERT ENTRIES FROM OLD WORKMAN'S COMP FILE TO NEW WORKMAN'S
 ;COMPENSATION FILE
 D BMES^XPDUTL("Converting WORKMAN'S COMP entries to new file."),TS
 D START^AGCNVWC
 ;
 ;CONVERT ENTRIES FROM FIELD 3301 IN AUPNPAT TO NEW
 ;FILE AUPNBENR
 D BMES^XPDUTL("Converting entries from AUPNPAT field 3301 to new file."),TS
 D ^AGCNVBEN
 ;
 ;CONVERT ENTRIES IN .17 AND .18 IN AUPNPAT TO
 ;NEW MULTIPLE FIELD 7101 IN AUPNPAT
 D BMES^XPDUTL("Converting AUPNPAT fields .17 and .18 to new multiple field 7101."),TS
 D ^AGCNVAOB
 ;
 ;POPULATE NEW 'MANDATORY FIELDS (SITE)' IN REGISTRATION PARAMETER
 ;FILE
 D BMES^XPDUTL("Populating mandatory site fields..."),TS
 D ^AG71POST
 ;
 I $$INSTALLD^AG71ENV("AG*7.1") D
 . D TS,BMES^XPDUTL("Delivering AG*7.1 install message to select users ...")
 . D MAIL
 . D BMES^XPDUTL("Post-install routine is complete."),TS
 ;
 Q:$$INSTALLD^AG71ENV("AG*7.1")
 ;
 D TS,OPTRES("AGMENU")
 ;
 D TS,BMES^XPDUTL("Delivering AG*7.1 install message to select users...")
 ;
 D MAIL
 ;
 D BMES^XPDUTL("Post-install routine is complete."),TS
 Q
MAIL ;Send install mail message.
 N DIFROM,XMSUB,XMDUZ,XMTEXT,XMY
 K ^TMP("AG71MS",$J)
 S ^TMP("AG71MS",$J,1)=" --- AG v 7.1 has been installed into this uci ---"
 S ^TMP("AG71MS",$J,2)=" "
 S ^TMP("AG71MS",$J,3)="UNPOPULATED STATE FIELDS IN MEDICAID ELIGIBILITY FILE"
 S ^TMP("AG71MS",$J,4)="YOU WILL HAVE TO USE FILEMAN TO ENTER THE PROPER STATE INTO THIS FIELD"
 S CNT=5
 D STATEMSG(.AGERRLST,.CNT)
 K AGERRLST
 S %=0
 F  S %=$O(^XTMP("XPDI",XPDA,"BLD",XPDBLD,1,%)) Q:'%   S ^TMP("AG71MS",$J,(%+CNT))=" "_^(%,0)
 S XMSUB=$P($P($T(+1),";",2)," ",3,99),XMDUZ=$S($G(DUZ):DUZ,1:.5),XMTEXT="^TMP(""AG71MS"",$J,",XMY(1)="",XMY(DUZ)=""
 F %="AGZMENU","XUMGR","XUPROG","XUPROGMODE" D SINGLE(%)
 D ^XMD
 K ^TMP("AG71MS",$J)
 Q
SINGLE(K) ;EP - Get holders of a single key K.
 N Y
 S Y=0
 Q:'$D(^XUSEC(K))
 F  S Y=$O(^XUSEC(K,Y)) Q:'Y  S XMY(Y)=""
 Q
 ;
OPTRES(AGM) ;
 D BMES^XPDUTL("Restoring '"_AGM_"' option to PRE-install configuration...")
 NEW AG,AGI
 I '$D(^XTMP("AG71",7.2,"OPTSAV",AGM)) D BMES^XPDUTL("FAILED.  Option '"_AGM_"' was not previously saved.") Q
 S AG=0
 F  S AG=$O(^XTMP("AG71",7.2,"OPTSAV",AGM,AG)) Q:'AG  S AGI=^(AG) I '$$ADD^XPDMENU(AGM,$P(AGI,U),$P(AGI,U,2),$P(AGI,U,3)) D BMES^XPDUTL("....FAILED to re-attach "_$P(AGI,U)_" to "_AGM_".")
 ;D BMES^XPDUTL("Attaching ""RHI1"" option to the Registration Reports menu ""RPT"".")
 ;I $$ADD^XPDMENU("AGREPORTS","AGRHI1","RHI1",20) D BMES^XPDUTL("....successfully atch'd.") I 1
 ;E  D BMES^XPDUTL("....Attachment *FAILED*.")
 Q
TS D MES^XPDUTL($$HTE^XLFDT($H)) Q
AGFAC ;POPULATE NEW REGISTRATION PARAMETERS IF BLANK
 S AGFAC=0
 F  S AGFAC=$O(^AGFAC("B",AGFAC)) Q:'AGFAC  D
 . S AGFACPTR=0
 . F  S AGFACPTR=$O(^AGFAC("B",AGFAC,AGFACPTR)) Q:'AGFACPTR  D
 .. I $P($G(^AGFAC(AGFACPTR,0)),U,22)="" S $P(^AGFAC(AGFACPTR,0),U,22)=0
 .. I $P($G(^AGFAC(AGFACPTR,0)),U,23)="" S $P(^AGFAC(AGFACPTR,0),U,23)="N"
 .. I $P($G(^AGFAC(AGFACPTR,0)),U,24)="" S $P(^AGFAC(AGFACPTR,0),U,24)="N"
 .. I $P($G(^AGFAC(AGFACPTR,0)),U,25)="" S $P(^AGFAC(AGFACPTR,0),U,25)="N"
 .. S AGVAL("TMP",1)="I CERTIFY THAT THE ABOVE INFORMATION IS ACCURATE TO THE BEST OF MY KNOWLEDGE."
 .. S AGVAL("TMP",2)=" "
 .. S AGVAL("TMP",3)="SIGNED: _____________________________________________  DATE: ______________"
 .. S AGVAL("TMP",4)="        PATIENT/GUARDIAN/AUTHORIZED REPRESENTATIVE"
 .. I '$D(^AGFAC(AGFACPTR,4,0)) D
 ... D WP^DIE(9009061,AGFACPTR_",",40,,"AGVAL(""TMP"")")
 K AGFAC,AGFACPTR,AGVAL
 Q
PRVT ;CLEAR ANY PRIVATE ELIG RECORDS MISSING INSURER POINTER
 ;MUST DO DIRECT KILL BECAUSE X-REF NOT THERE. BOMBS ON USE OF ^DIK
 S RECNO=0
 F  S RECNO=$O(^AUPNPRVT(RECNO)) Q:'RECNO  D
 .S D1=0
 .F  S D1=$O(^AUPNPRVT(RECNO,11,D1)) Q:'D1  D
 ..I $P($G(^AUPNPRVT(RECNO,11,D1,0)),U)="" K ^AUPNPRVT(RECNO,11,D1) Q
 ..I $P($G(^AUPNPRVT(RECNO,11,D1,0)),U,8)="" S DA=D1,DA(1)=RECNO,DIK="^AUPNPRVT("_DA(1)_",11," D ^DIK
 ..I $O(^AUPNPRVT(RECNO,11,0)) Q
 ..S DA=RECNO,DIK="^AUPNPRVT(" D ^DIK
 S RECNO=0 F  S RECNO=$O(^AUPNPRVT("B",RECNO)) Q:RECNO=""  D
 .S IEN=0 F  S IEN=$O(^AUPNPRVT("B",RECNO,IEN)) Q:'IEN  D
 ..I $P($G(^AUPNPRVT(IEN,0)),U)="" K ^AUPNPRVT(IEN),^AUPNPRVT("B",RECNO,IEN)
 Q
MCD ;CLEAR MCD RECORDS MISSING .01 FIELD
 ;MUST DO DIRECT KILL BECAUSE X-REF NOT THERE. BOMBS ON USE OF ^DIK
 K AGERRLST
 N HRN,DFN,ST,MCDNUM
 S RECNO=0
 F  S RECNO=$O(^AUPNMCD(RECNO)) Q:'RECNO  D
 .I $P($G(^AUPNMCD(RECNO,0)),U)="" K ^AUPNMCD(RECNO) Q  ;GET RID OF WHOLE THING INCLUDING SUBFILE
 .;IF THE INS. PTR IS MISSING LETS FIX IT SO TPB CLAIMS GENERATOR DOESN'T BLOW UP
 .I $P($G(^AUPNMCD(RECNO,0)),U,2)="" S DA=RECNO,DIE="^AUPNMCD(",DR=".02///3" D ^DIE
 .I $P($G(^AUPNMCD(RECNO,0)),U,4)="" S DFN=$P($G(^AUPNMCD(RECNO,0)),U),AGERRLST(RECNO)=$P($G(^DPT(DFN,0)),U)_U_$P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,2)
 .S D1=0
 .F  S D1=$O(^AUPNMCD(RECNO,11,D1)) Q:'D1  D
 ..I $P($G(^AUPNMCD(RECNO,11,D1,0)),U)="" K ^AUPNMCD(RECNO,11,D1)
 ;NOTE: MCD ELIGIBILITY HEADER FIXED IN ^AGMCDCNT
 S DFN=""
 F  S DFN=$O(^AUPNMCD("AB",DFN)) Q:DFN=""  D
 .S ST="" F  S ST=$O(^AUPNMCD("AB",DFN,ST)) Q:ST=""  D
 ..S MCDNUM="" F  S MCDNUM=$O(^AUPNMCD("AB",DFN,ST,MCDNUM)) Q:MCDNUM=""  D
 ...S RECNO="" F  S RECNO=$O(^AUPNMCD("AB",DFN,ST,MCDNUM,RECNO)) Q:RECNO=""  D
 ....I $P($G(^AUPNMCD(RECNO,0)),U)="" K ^AUPNMCD(RECNO),^AUPNMCD("AB",DFN,ST,MCDNUM,RECNO)
 Q
RRE ;FIX "B" X-REF ENTRIES WITH NO ZERO RECORD
 ;MUST DO DIRECT KILL BECAUSE RECORD NOT THERE. BOMBS ON USE OF ^DIK DOESN'T WORK
 S RECNO=""
 F  S RECNO=$O(^AUPNRRE("B",RECNO)) Q:'RECNO  D
 .I $P($G(^AUPNRRE(RECNO,0)),U)="" K ^AUPNRRE(RECNO),^AUPNRRE("B",RECNO)
 S RECNO=0
 F  S RECNO=$O(^AUPNRRE(RECNO)) Q:'RECNO  D
 .I $P($G(^AUPNRRE(RECNO,0)),U)="" K ^AUPNRRE(RECNO),^AUPNRRE("B",RECNO)
 Q
MCR ;
 S RECNO=""
 F  S RECNO=$O(^AUPNMCR("B",RECNO)) Q:'RECNO  D
 .I $P($G(^AUPNMCR(RECNO,0)),U)="" K ^AUPNMCR(RECNO),^AUPNMCR("B",RECNO)
 S RECNO=0
 F  S RECNO=$O(^AUPNMCR(RECNO)) Q:'RECNO  D
 .I $P($G(^AUPNMCR(RECNO,0)),U)="" K ^AUPNMCR(RECNO),^AUPNMCR("B",RECNO)
 Q
STATEMSG(ARRAY,LN) ;EP - SEND MSG ABOUT MEDICAID ENTRIES MISSING STATE FIELD
 N IEN
 S IEN=""
 F LN=LN:1 S IEN=$O(ARRAY(IEN)) Q:IEN=""  D
 .S ^TMP("AG71MS",$J,LN)="HRN # "_$P(ARRAY(IEN),U,2)_" IS MISSIING THE STATE FIELD IN MEDICAID ELIGIBILITY ENTRY "_IEN
 Q