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

AGEDWC.m

Go to the documentation of this file.
AGEDWC ; IHS/ASDS/EFG - WORKMAN'S COMP PAGE ;    
 ;;7.1;PATIENT REGISTRATION;**1,2,9**;AUG 25, 2005
 ;
 ;AG*7.1*9 - Reworked routine to add new Claim related fields
EN(WD0,WD1,NEWENTRY,AGSELECT) ;EP -
 ;IF ITS A NEW ENTRY THEN DISP THE SCREEN, DISP MESSAGE, AUTO-
 ;MATICALLY ENTER A NEW PATIENT RECORD THEN ASK FOR THE DATE OF WC
 ;INJURY
 I NEWENTRY D  Q:EXIT
 .S EXIT=0
 .;D DRAW,WMSG,NEWENTRY I +$G(Y)<0 D CLEANZER(WD0) W !,"New entry not made" H 3 D END S EXIT=1 Q
 .;D DRAW,WMSG,NEWENTRY I +$G(Y)<0 D CLEANZER(WD0) W !,"New entry not made" H 3 D END S EXIT=1 Q
 .D DRAW,WMSG,NEWENTRY I +$G(Y)<0 D:$G(WD0)'="" CLEANZER(WD0) W !,"New entry not made" H 3 D END S EXIT=1 Q  ;IM20157 AG*7.1*1
 .;AG*7.1*9 - Modified order/added new fields
 .D ADTWC I +$G(Y)<0 D CLEANZER(WD0) W !,"New entry not made" H 3 D END S EXIT=1 Q
 .D TYPEACC
 .D DESCWI
 .D EMPL
 .D WPATATTY
 .D GROUP
 .D EFF
 .D EXP
 .D CLMFIL
 .D CLMSTAT
 .D CLMNO
 .D DTLWRK
 .D DSSTDT
 .D DSENDT
 .D DTAWRK
 .D CONT
 .D NOTES
 .S COMPIEN=WD0_",11,"_WD1
 .;S AGSELECT=$$UPDTSEL^AGUTILS("FINDWC",.AGINS,COMPIEN)
 .S AGSELECT=$$UPDTSEL^AGUTILS(.AGINS,WD0_","_WD1,AGELP("INS"))  ;AG*7.1*1 IM18549 ERROR IN ERROR MSG UPDATE
 .S NEWENTRY=0
 S COMPIEN=WD0_",11,"_WD1
VAR D DRAW
 Q:$D(AGSEENLY)
 W !,AGLINE("EQ")
 K DIR
 S DIR("A")="CHANGE which item? (1-"_AG("N")_") NONE// "
 D READ^AGED1
 ;CHECK TO SEE IF THERE ARE ANY DATE ENTRIES LEFT. IF NOT CLEAR THE
 ;REMAINING TOP LEVEL RECORD SINCE NOTHING REALLY EXISTS FOR THIS
 ;PATIENT ANYMORE
 I Y="",'$O(^AUPNWC(WD0,11,0)) D CLEAN(WD0),END Q
 I $D(MYERRS("C","E")),(Y'?1N.N),(Y'=AGOPT("ESCAPE")) W !,"ERRORS ON THIS PAGE. PLEASE FIX BEFORE EXITING!!" H 3 G VAR
 Q:Y=AGOPT("ESCAPE")
 G:$D(AG("ED"))&'$D(AGXTERN) @("^AGED"_AG("ED"))
 G END:$D(DLOUT)!(Y["N")!$D(DUOUT),VAR:$D(AG("ERR"))
 Q:$D(DFOUT)!$D(DTOUT)
 I $D(DQOUT)!(+Y<1)!(+Y>AG("N")) W !!,"You must enter a number from 1 to ",AG("N") H 2 G VAR
 ;AG*7.1*9 - Reordered, added fields
 S AG("C")="DTWC,TYPEACC,DESCWI,EMPL,WPATATTY,ENTITY,GROUP,EFF,EXP,CLMFIL,CLMSTAT,CLMNO,DTLWRK,DSSTDT,DSENDT,DTAWRK,CONT,NOTES"
 S AGY=Y
 F AGI=1:1 S AG("SEL")=+$P(AGY,",",AGI) Q:AG("SEL")<1!(AG("SEL")>AG("N"))  D @($P(AG("C"),",",AG("SEL")))
 Q:$G(EXIT)=1
 ;I '$G(NEWENTRY) S AGSELECT=$$UPDTSEL^AGUTILS("FINDWC",.AGINS,COMPIEN)
 I '$G(NEWENTRY) S AGSELECT=$$UPDTSEL^AGUTILS(.AGINS,WD0_","_WD1,$P(AGSELECT,U,2))  ;AG*7.1*1 IM18549 ERROR IN ERROR MSG UPDATE 
 D UPDATE1^AGED(DUZ(2),DFN,3,"")
 K AGI,AGY
 G VAR
CLEAN(WD0) ;CLEAN EMPTY RECORD. IF NO GUARANTOR HAS BEEN ENTERED THEN
 ;THE RECORD IS MEANINGLESS
 ;CHECK HERE TO SEE IF ENTRIES HAVE ACTUALLY BEEN ENTERED. IF NOT
 ;CLEAR THE REMAINING TOP LEVEL RECORD SINCE NOTHING REALLY EXISTS
 ;IN THIS RECORD
 I '$O(^AUPNWC(WD0,11,0)) D
 .W !,"There are is no injury date for this patient's workman's compensation entry.",!,"This record is being deleted." H 3
 .D CLEANZER(WD0)
 Q
CLEANZER(WD0) ;EP - CLEAN ZERO NODE WITH NO DATES
 K DIK,DA
 S DIK="^AUPNWC(",DA=WD0 D ^DIK
 Q
END K DLOUT,DTOUT,DFOUT,DQOUT,DA,DIC,DR,AGSCRN,Y,ADA,WDA,ADT,WDT,ADFN,WDFN,REC,ROUTID
 Q
DRAW ;EP
 S AG("PG")="4WCA"
 S ROUTID=$P($T(+1)," ")
 D ^AGED
 K ^UTILITY("DIQ1",$J)
 W ?30,"WORKMAN'S COMPENSATION"
 W !,AGLINE("-")
 D GETAW
 Q
GETAW ;DISPLAY
 F AG=1:1 D  Q:$G(AGSCRN)[("*END*")
 . S AGSCRN=$P($T(@1+AG),";;",2,15)
 . Q:AGSCRN[("*END*")
 . I AG=4 W !,"EMPLOYER DATA"_$E(AGLINE("-"),1,66)
 . I AG=5 W !,"ATTORNEY DATA"_$E(AGLINE("-"),1,66)
 . I AG=6 W !,"INSURANCE COVERAGE"_$E(AGLINE("-"),1,61)
 . I AG=10 W !,"CLAIM INFORMATION"_$E(AGLINE("-"),1,63)
 . I AG=18 W !,$G(AGLINE("-"))
 . S CAPTION=$P(AGSCRN,U)
 . S DIC=$P(AGSCRN,U,3)
 . S DR=$P(AGSCRN,U,4)
 . S NEWLINE=$P(AGSCRN,U,5)
 . S CAPDENT=$P(AGSCRN,U,2)
 . W @NEWLINE,AG,".",@CAPDENT,$S($G(CAPTION)'="":CAPTION,1:$P($G(^DD(DIC,DR,0)),U)),": "
 .;IF EDITING, DISP DATA ONLY
 .;E DISP ONLY THE CAPS
 .I 'NEWENTRY D
 .. S D0=WD0
 .. I DIC'["." S D0=D0_","
 .. E  S D0=WD1_","_D0_","
 .. W $$GET1^DIQ(DIC,D0,DR)
 .. I AG=7 W ?50,"GROUP NUMBER: ",$S($$GET1^DIQ(DIC,D0,DR,"I"):$P($G(^AUTNEGRP($$GET1^DIQ(DIC,D0,DR,"I"),0)),U,2),1:"")
 S AG("N")=AG-1
 W !,$G(AGLINE("-"))
 K MYERRS,MYVARS
 D FETCHERR^AGEDERR(AG("PG"),.MYERRS)
 S MYVARS("DFN")=DFN,MYVARS("FINDCALL")="FINDWC",MYVARS("SELECTION")=$G(AGSELECT),MYVARS("SITE")=DUZ(2)
 I '$G(NEWENTRY) D EDITCHEK^AGEDERR(.MYERRS,.MYVARS,1)
 W !,$G(AGLINE("-"))
 D VERIF^AGUTILS
 I $D(AGSEENLY) S DIR("A")="Press return: ",DIR(0)="FO" D ^DIR Q
 Q
WMSG ;DISP THIS MSG IF THERE IS NO ENTRY IN THE WORKMAN'S
 ;COMP GLOBAL
 W !,"You must first enter the DATE OF WC INJURY"
 Q
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; WORKMAN'S COMP INJURY FLDS
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
NEWENTRY ;NEW ENTRY
 W !!
 K DIC,DIE,DR,DA
 S DIC="^AUPNWC("
 S DIC(0)="L"
 S X="`"_DFN
 K DD,DO
 D ^DIC
 Q:+Y'>0
 S WD0=+Y
 S NEWENTRY=0
 Q
ADTWC ;ADD NEW DT RECORD
 K DIC,DIE,DA,DR
 S DA(1)=WD0
 S DIC="^AUPNWC("_WD0_",11,"
 S DIC(0)="AEL"
 S DIC("P")=$P($G(^DD(9000042,1101,0)),U,2)
 S DIC("DR")=".01;.11////^S X=$G(AGELP(""INS""))"
 K DD,DO
 D ^DIC
 Q:+Y<1
 S WD1=+Y
 K DIC,DIE,DA,DR
 Q
DTWC ;WORKMAN'S COMP INJURY DATE
 K DIC,DIE,DR
 S DA(1)=WD0
 S DA=WD1
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".01"
 D ^DIE
 S:'$D(DA) EXIT=1
 K DIC,DR,DIE
 Q
DESCWI ;DESCRIPTION OF INJURY
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".02"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
CLMFIL ;WAS CLAIM FILED
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".03"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
CLMNO ;CLAIM #
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".04"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
WPATATTY ;NAME OF PATIENT'S ATTORNEY FOR WORKMAN'S COMP
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".05"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
EMPL ;PATIENT'S EMPLOYER
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".06"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
DTCLOSE ;DATE CASE CLOSED
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".07"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
TYPEACC ;TYPE OF ACCIDENT
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".08"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
CLMSTAT ;CLAIM STATUS
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".09"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
ENTITY ;WORKMAN'S COMP ENTITY
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".11"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
GROUP ;GROUP NAME
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".12"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
EFF ;EFF COV DATE
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".13"
 D ^DIE
 K DIC,DR,DIE,DA
 ;COMPARE EFF AND EXP DATES
 I '$$GOODDT(WD0,WD1) G EFF
 Q
EXP ;EXPIRE DATE
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".14"
 D ^DIE
 K DIC,DR,DIE,DA
 ;COMPARE EFF AND EXP DATES
 I '$$GOODDT(WD0,WD1) G EXP
 Q
 ;
DTLWRK ;DATE LAST WORKED - AG*7.1*9
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR="201"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
 ;
DSSTDT ;DISABILITY START DATE - AG*7.1*9
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR="202"
 D ^DIE
 K DIC,DR,DIE,DA
 ;COMPARE START AND END DATES
 I '$$GDDDT(WD0,WD1) G DSSTDT
 Q
 ;
DSENDT ;DISABILITY END DATE - AG*7.1*9
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR="203"
 D ^DIE
 K DIC,DR,DIE,DA
 ;COMPARE START AND END DATES
 I '$$GDDDT(WD0,WD1) G DSENDT
 Q
 ;
DTAWRK ;DATE AUTHORIZED RETURN TO WORK - AG*7.1*9
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR="204"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
 ;
CONT ;CONTACT INFO - AG*7.1*9
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR="205"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
 ;
GDDDT(AD0,AD1) ;CHECK DISABILITY START/END DATES - AG*7.1*9
 N BDT,EDT
 S BDT=$$GET1^DIQ(9000042.11,AD1_","_AD0_",",202,"I")  ;$P($G(^AUPNWC(WD0,1,WD1,0)),U,12)
 S EDT=$$GET1^DIQ(9000042.11,AD1_","_AD0_",",203,"I")  ;$P($G(^AUPNWC(WD0,1,WD1,0)),U,13)
 I EDT,'BDT W !,"CANNOT HAVE AN ENDING DATE WITHOUT A BEGINNING DATE! TRY AGAIN" Q 0
 I EDT<BDT&(+EDT'=0) W !,"DISABILITY ENDING DATE IS LESS THAN THE EFFECTIVE DATE! TRY AGAIN" Q 0
 I BDT>EDT&(+EDT'=0) W !,"DISABILITY START DATE IS GREATER THAN THE ENDING DATE! TRY AGAIN" Q 0
 Q 1
GOODDT(AD0,AD1) ;EP
 N BDT,EDT
 S BDT=$P($G(^AUPNWC(WD0,1,WD1,0)),U,12)
 S EDT=$P($G(^AUPNWC(WD0,1,WD1,0)),U,13)
 I EDT,'BDT W !,"CANNOT HAVE AN ENDING DATE WITHOUT A BEGINNING DATE! TRY AGAIN" Q 0
 I EDT<BDT&(+EDT'=0) W !,"ENDING DATE IS LESS THAN THE EFFECTIVE DATE! TRY AGAIN" Q 0
 I BDT>EDT&(+EDT'=0) W !,"EFFECTIVE DATE IS GREATER THAN THE ENDING DATE! TRY AGAIN" Q 0
 Q 1
NOTES ;NOTES
 W !
 K DIC,DR,DIE,DA,DD,DO
 S DA=WD1
 S DA(1)=WD0
 S DIE="^AUPNWC("_DA(1)_",11,"
 S DR=".15"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
 ;AG*7.1*9 - Added fields, reordered others
 ; ****************************************************************
 ; ON LINES BELOW:
 ; PIECE 1= FLD LBL
 ; PIECE 2= POSITION ON LINE TO DISP FLD LBL
 ; PIECE 3= FILE #
 ; PIECE 4= FLD #
 ; PIECE 5= NEW LINE OR NOT
1 ;
 ;;WC INJURY DATE^?3^9000042.11^.01^!
 ;;TYPE OF ACCIDENT^?41^9000042.11^.08^?42
 ;;DESCRIPTION OF INJURY^?3^9000042.11^.02^!
 ;;EMPLOYER^?3^9000042.11^.06^!
 ;;NAME OF PATIENT'S ATTORNEY^?3^9000042.11^.05^!
 ;;WORKMAN'S COMP ENTITY^?3^9000042.11^.11^!
 ;;GROUP NAME^?3^9000042.11^.12^!
 ;;EFFECTIVE COVERAGE DATE^?3^9000042.11^.13^!
 ;;EXPIRATION DATE^?40^9000042.11^.14^?44
 ;;CLAIM FILED^?4^9000042.11^.03^!
 ;;CLAIM STATUS^?52^9000042.11^.09^?48
 ;;CLAIM NUMBER^?4^9000042.11^.04^!
 ;;DATE LAST WORKED^?47^9000042.11^201^?43
 ;;DISABILITY START DATE^?4^9000042.11^202^!
 ;;DISABILITY END DATE^?47^9000042.11^203^?43
 ;;DATE AUTHORIZED RETURN TO WORK^?4^9000042.11^204^!
 ;;CONTACT INFO^?4^9000042.11^205^!
 ;;NOTES^?4^9000042.11^.15^!
 ;;*END*