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

AGCNVWC.m

Go to the documentation of this file.
AGCNVWC ; IHS/ASDS/EFG - WORKMAN'S COMP CONVERSION ROUTINE ;  
 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
 ;
 D BMES^XPDUTL("Do not run from root tag! ")
 Q
START ;EP -
 S RECORDS=+$P($G(^AUPNWRKC(0)),U,4)
 D BMES^XPDUTL(RECORDS_" records found in file 9000032")
 I 'RECORDS D BMES^XPDUTL("No records to transfer... transfer not done.") Q
 ;
 I $P($G(^AUPNWC(0)),U,4) D BMES^XPDUTL("Entries already transferred. Aborting transfer "),TS  Q
 ;
 D READOLD  ;LOOP THROUGH OLD FILE
 Q
READOLD ;
 S PATIEN=0
 F  S PATIEN=$O(^AUPNWRKC("C",PATIEN)) Q:PATIEN=""  D
 .S RECORD=0
 .F  S RECORD=$O(^AUPNWRKC("C",PATIEN,RECORD)) Q:'RECORD  D
 ..S DATA0=$G(^AUPNWRKC(RECORD,0))
 ..S DATA1=$G(^AUPNWRKC(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 CLAIM=$P(DATA0,U,4)   ;SET CATEGORY
 ..S CLAIMNUM=$P(DATA0,U,5)    ;FREE TEXT
 ..S ATTORN=$P(DATA0,U,6)    ;FREE TEXT
 ..S EMPLOYER=$P(DATA0,U,7)  ;PTR TO 9999999.75
 ..S DTCLOSE=$P(DATA0,U,8)    ;DATE CLOSED
 ..S TYPEACC=$P(DATA0,U,9)    ;FREE TEXT
 ..S CLMSTAT=$P(DATA0,U,10)  ;SET CATEGORY
 ..S ENTITY=$P(DATA0,U,11)  ;PTR TO 9999999.18
 ..S GRPNAME=$P(DATA0,U,12)  ;PTR TO 9999999.77
 ..S EFFDATE=$P(DATA0,U,13)  ;FILEMAN DATE
 ..S ENDDATE=$P(DATA0,U,14)
 ..S NOTES=$P(DATA1,U)   ;FREE TEXT
 ..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
FINDINS(X,RECORD) ;FIND INSURER IN THE INSURER FILE
 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
ENTERNEW ;CREATE THE NEW RECORDS IN 'THIRD PART LIABILITY' FILE
 D CREATFDA  ;SET UP THE FDA ARRAY
 D UPDATE^DIE("S","AGFDA","AGIEN","AGERROR")
 Q
CREATFDA ;
 K AGFDA,AGIEN,AGERROR,AGRECORD
 I '$D(^AUPNWC(PAT)) D NEWONE
 E  D ADDONE
 Q
NEWONE ;
 S AGIEN(1)=PAT
 S AGRECORD="+2,+1,"
 S AGFDA(9000042,"+1,",.01)=PAT
 S AGFDA(9000042.11,AGRECORD,.01)=$G(DATEINJ)
 S AGFDA(9000042.11,AGRECORD,.02)=$G(DESCRIP)
 S AGFDA(9000042.11,AGRECORD,.03)=$G(CLAIM)
 S AGFDA(9000042.11,AGRECORD,.04)=$G(CLAIMNUM)
 S AGFDA(9000042.11,AGRECORD,.05)=$G(ATTORN)
 S AGFDA(9000042.11,AGRECORD,.06)=$G(EMPLOYER)
 S AGFDA(9000042.11,AGRECORD,.07)=$G(DTCLOSE)
 S AGFDA(9000042.11,AGRECORD,.08)=$G(TYPEACC)
 S AGFDA(9000042.11,AGRECORD,.09)=$G(CLMSTAT)
 S AGFDA(9000042.11,AGRECORD,.11)=$G(ENTITY)
 S AGFDA(9000042.11,AGRECORD,.12)=$G(GRPNAME)
 S AGFDA(9000042.11,AGRECORD,.13)=$G(EFFDATE)
 S AGFDA(9000042.11,AGRECORD,.14)=$G(ENDDATE)
 S AGFDA(9000042.11,AGRECORD,.15)=$G(NOTES)
 Q
ADDONE ;
 S AGRECORD="+2,"_PAT_","
 S AGFDA(9000042.11,AGRECORD,.01)=$G(DATEINJ)
 S AGFDA(9000042.11,AGRECORD,.02)=$G(DESCRIP)
 S AGFDA(9000042.11,AGRECORD,.03)=$G(CLAIM)
 S AGFDA(9000042.11,AGRECORD,.04)=$G(CLAIMNUM)
 S AGFDA(9000042.11,AGRECORD,.05)=$G(ATTORN)
 S AGFDA(9000042.11,AGRECORD,.06)=$G(EMPLOYER)
 S AGFDA(9000042.11,AGRECORD,.07)=$G(DTCLOSE)
 S AGFDA(9000042.11,AGRECORD,.08)=$G(TYPEACC)
 S AGFDA(9000042.11,AGRECORD,.09)=$G(CLMSTAT)
 S AGFDA(9000042.11,AGRECORD,.11)=$G(ENTITY)
 S AGFDA(9000042.11,AGRECORD,.12)=$G(GRPNAME)
 S AGFDA(9000042.11,AGRECORD,.13)=$G(EFFDATE)
 S AGFDA(9000042.11,AGRECORD,.14)=$G(ENDDATE)
 S AGFDA(9000042.11,AGRECORD,.15)=$G(NOTES)
 Q