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

AGCNVTPL.m

Go to the documentation of this file.
AGCNVTPL ; IHS/ASDS/EFG - THIRD PART LIABILITY CONVERSION ROUTINE 3/26/2004 8:10:41 AM
 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
 ;USE AS A POST INSTALL TO TRANSFER ENTRIES FROM THE AUTO/LIABILITY FILE TO
 ;THE NEW THIRD PART LIABILITY FILE
 ;
 D BMES^XPDUTL("Beginning post-install routine (AGTPLTR). "),TS
 I '$$CONFIRM D BMES^XPDUTL("New file 9000041 cannot be found transfer aborted!!") Q
 ;
 I $P($G(^AUPNTPL(0)),U,4) D BMES^XPDUTL("Entries already transferred. Aborting transfer "),TS  Q
 ;
 S RECORDS=+$P($G(^AUPNAUTO(0)),U,4)
 D BMES^XPDUTL(RECORDS_" records found in file 9000031")
 I 'RECORDS D BMES^XPDUTL("No records to transfer... transfer not done.") Q
 ;
 D READOLD  ;LOOP THROUGH OLD FILE
 Q
READOLD ;
 S PATIEN=0
 F  S PATIEN=$O(^AUPNAUTO("C",PATIEN)) Q:PATIEN=""  D
 .S RECORD=0
 .F  S RECORD=$O(^AUPNAUTO("C",PATIEN,RECORD)) Q:'RECORD  D
 ..S DATA0=$G(^AUPNAUTO(RECORD,0))
 ..S DATA1=$G(^AUPNAUTO(RECORD,1))
 ..S DATEINJ=$P(DATA0,U)       ;FILEMAN DATE 3040323
 ..S PAT=$P(DATA0,U,2)        ;PTR TO 9000001
 ..S DESCRIP=$P(DATA0,U,3)    ;FREE TEXT
 ..S INSCOMP=$P(DATA0,U,4)   ;FREE TEXT LOOK FOR IN INSURER FILE
 ..S POLNUM=$P(DATA0,U,5)    ;FREE TEXT
 ..S ATTORN=$P(DATA0,U,6)    ;FREE TEXT
 ..S RESPSSN=$P(DATA0,U,7)  ;FREE TEXT
 ..S CAUSE=$P(DATA0,U,8)    ;FREE TEXT
 ..S RESPNAM=$P(DATA1,U)    ;FREE TEXT
 ..S EFFDATE=$P(DATA1,U,2)  ;FILEMAN DATE 3040323
 ..S ENDDATE=$P(DATA1,U,3)  ;FILEMAN DATE 3040323
 ..S GRPNAME=$P(DATA1,U,4)  ;PTR TO 9999999.77
 ..S NOTES=$P(DATA1,U,5)   ;FREE TEXT
 ..I INSCOMP'="" D FINDINS(INSCOMP,RECORD)  ;FIND A MATCH FOR THE INSURER IN THE INSURER FILE
 ..D ENTERNEW  ;CREATE NEW RECORDS IN NEW FILE WITH OLD DATA
 Q
CONFIRM() ;
 Q $D(^DIC(9000041,0))
TS D MES^XPDUTL($$HTE^XLFDT($H)) Q
 ;FIND INSURER IN THE INSURER FILE
FINDINS(X,RECORD) ;
 K INSCOMPP  ;INSURANCE COMPANY POINTER
 D SEARCH(X)
 Q
 S GLO="^AUTNINS(0)"
 F  S GLO=$Q(@GLO) Q:GLO=""  Q:'(+$P($P(GLO,","),"(",2))  D  Q:$D(INSCOMPP)
 . I $P(@GLO,U)=X S FREC=$P($P(GLO,","),"(",2) S INSCOMPP=FREC D DISPLAY(GLO,FREC,1,X) Q
 . I @GLO[X S FREC=$P($P(GLO,","),"(",2) S INSCOMPP=FREC D DISPLAY(GLO,FREC,2,X) Q
 Q
DISPLAY(GLO,FREC,MSG,KEYWORD) ;
 W !!,$S(MSG=1:"Exact ",MSG=2:"Possible ",1:"Unknown msg")_" match for KEYWORD="_KEYWORD_" in record "_RECORD_" in AUTO/LIABILITY file found in INSURER file at ien "_FREC_" "_$P(@GLO,U)
 Q
 ;CREATE THE NEW RECORDS IN 'THIRD PART LIABILITY' FILE
ENTERNEW ;
 D CREATFDA  ;SET UP THE FDA ARRAY
 D UPDATE^DIE("S","AGFDA","AGIEN","AGERROR")
 Q
CREATFDA ;
 K AGFDA,AGIEN,AGERROR,AGRECORD
 I '$D(^AUPNTPL(PAT)) D NEWONE
 E  D ADDONE
 Q
NEWONE ;
 S AGIEN(1)=PAT
 S AGRECORD="+2,+1,"
 S AGFDA(9000041,"+1,",.01)=PAT
 S AGFDA(9000041.0101,AGRECORD,.01)=$G(DATEINJ)
 S AGFDA(9000041.0101,AGRECORD,.02)=$G(INSCOMPP)
 S AGFDA(9000041.0101,AGRECORD,.03)=$G(POLNUM)
 S AGFDA(9000041.0101,AGRECORD,.04)=$G(EFFDATE)
 S AGFDA(9000041.0101,AGRECORD,.05)=$G(ENDDATE)
 S AGFDA(9000041.0101,AGRECORD,.06)=$G(GRPNAME)
 S AGFDA(9000041.0101,AGRECORD,101)=$G(RESPNAM)
 S AGFDA(9000041.0101,AGRECORD,102)=$G(RESPSSN)
 S AGFDA(9000041.0101,AGRECORD,103)=$G(ATTORN)
 S AGFDA(9000041.0101,AGRECORD,104)=$G(CAUSE)
 S AGFDA(9000041.0101,AGRECORD,105)=$G(DESCRIP)
 S AGFDA(9000041.0101,AGRECORD,106)=$G(NOTES)
 Q
ADDONE ;
 S AGRECORD="+2,"_PAT_","
 S AGFDA(9000041.0101,AGRECORD,.01)=$G(DATEINJ)
 S AGFDA(9000041.0101,AGRECORD,.02)=$G(INSCOMPP)
 S AGFDA(9000041.0101,AGRECORD,.03)=$G(POLNUM)
 S AGFDA(9000041.0101,AGRECORD,.04)=$G(EFFDATE)
 S AGFDA(9000041.0101,AGRECORD,.05)=$G(ENDDATE)
 S AGFDA(9000041.0101,AGRECORD,.06)=$G(GRPNAME)
 S AGFDA(9000041.0101,AGRECORD,101)=$G(RESPNAM)
 S AGFDA(9000041.0101,AGRECORD,102)=$G(RESPSSN)
 S AGFDA(9000041.0101,AGRECORD,103)=$G(ATTORN)
 S AGFDA(9000041.0101,AGRECORD,104)=$G(CAUSE)
 S AGFDA(9000041.0101,AGRECORD,105)=$G(DESCRIP)
 S AGFDA(9000041.0101,AGRECORD,106)=$G(NOTES)
 Q