Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package gosi.business.socialinsurance.occupationalhazards.injury.session;
- // Import Statements
- import gosi.core.util.ServiceLocator;
- import gosi.core.util.GOSIDebug;
- import javax.ejb.SessionBean;
- import javax.ejb.SessionContext;
- import javax.ejb.EJBException;
- import java.rmi.RemoteException;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.util.HashMap;
- import java.util.ArrayList;
- import java.util.Calendar;
- import javax.naming.Context;
- import javax.rmi.PortableRemoteObject;
- import gosi.core.util.GOSIInstrumentationLog;
- import gosi.core.util.GOSIConstants;
- import gosi.core.util.GOSIErrorMessages;
- import gosi.core.util.GOSIException;
- import gosi.core.util.GOSIUtilities;
- import gosi.core.util.beans.AuditBean;
- import gosi.core.workflow.beans.WorkflowParamBean;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.TransferOHHelperBean;
- import gosi.business.socialinsurance.occupationalhazards.common.beans.OHConstants;
- import gosi.business.socialinsurance.occupationalhazards.common.beans.OHServices;
- import gosi.business.socialinsurance.common.beans.SITables;
- import java.sql.Timestamp;
- import gosi.core.util.GOSIDateUtilities;
- import gosi.business.socialinsurance.common.beans.SIUtilities;
- import gosi.core.dms.beans.DMSRequestHeaderBean;
- import gosi.core.dms.beans.DMSConstants;
- import gosi.core.dms.util.DMSUtilities;
- import gosi.core.util.CommonTransactions;
- import gosi.core.util.beans.NotificationLetterBean;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.OHQueryInjury;
- import gosi.business.socialinsurance.registration.engagement.beans.EngagementDetailsBean;
- import gosi.business.socialinsurance.registration.engagement.beans.EngagementBean;
- import gosi.business.socialinsurance.registration.engagement.beans.EngagementOccupationBean;
- import gosi.business.socialinsurance.registration.engagement.beans.WageChangeCoverageBean;
- import gosi.business.socialinsurance.common.beans.PersonBean;
- import gosi.business.socialinsurance.registration.establishment.beans.EstablishmentBean;
- import gosi.business.socialinsurance.registration.establishment.beans.EstablishmentUtility;
- import gosi.business.socialinsurance.registration.establishment.beans.EstablishmentBean;
- import gosi.business.socialinsurance.common.beans.PersonBean;
- import gosi.business.socialinsurance.common.beans.PersonUtilities;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.InjuryDocReqEntity;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.InjuryDocReqEntityHome;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.InjuryEntity;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.InjuryEntityHome;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.PMREntity;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.PMREntityHome;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.PreexistingDeformitiesEntity;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.PreexistingDeformitiesEntityHome;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.BodyPartsEntity;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.BodyPartsEntityHome;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.TransferOHEntity;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.TransferOHEntityHome;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.TreatmentEntity;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.TreatmentEntityHome;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.BodyPartsListBean;
- import gosi.business.socialinsurance.registration.engagement.beans.ContributorBean;
- import gosi.business.socialinsurance.registration.engagement.beans.ContributorUtilities;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.InjuryDiagnosisEntity;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.InjuryDiagnosisEntityHome;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.ResumeTreatmentEntity;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.ResumeTreatmentEntityHome;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.ChangeRegNoBean;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.OHestChangesEntityHome;
- import gosi.database.socialinsurance.occupationalhazards.injury.entity.OHestChangesEntity;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.InjuryDocReqListBean;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.InjuryDocReqSearchBean;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.OHPopSearchListBean;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.InjuryBean;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.PMRHelperBean;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.ResumeBean;
- import gosi.business.socialinsurance.occupationalhazards.injury.beans.TreatmentPeriodBean;
- import gosi.core.util.beans.IndividualContactBean;
- import gosi.business.socialinsurance.occupationalhazards.common.beans.OHUtilities;
- import gosi.business.socialinsurance.common.beans.ContactDetailsUtility;
- import gosi.business.socialinsurance.registration.common.beans.RegistrationConstants;
- import gosi.business.socialinsurance.registration.engagement.beans.EngagementUtilities;
- import gosi.common.letters.beans.LetterHeaderBean;
- import gosi.common.letters.util.LetterUtilities;
- import gosi.common.reports.beans.ReportConstants;
- import java.util.TreeMap;
- import gosi.core.security.common.beans.SecurityAndWorkflowConstants;
- /**
- * @CLASS NAME : MaintainInjurySessionEJB
- * @TYPE : SessionEJB
- * @AUTHOR : TCS
- * @VERSION : 1
- * @EXTENDS : Nil
- * @INFORMATION : Session EJB object is used to Maintain Injury Component.
- * @IMPLEMENTS : SessionBean
- * @TABLES REFERRED : T_injury,T_accident,T_injurysource,T_injurynature,T_contributor,T_conpreexistingdeformities,T_establishment
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- * @stereotype SessionBean
- * @homeInterface gosi.business.socialinsurance.occupationalhazards.injury.session.MaintainInjurySessionHome
- * @remoteInterface gosi.business.socialinsurance.occupationalhazards.injury.session.MaintainInjurySession
- */
- public class MaintainInjurySessionEJB implements SessionBean
- {
- private Connection conn=null;
- private SessionContext sesCtx = null;
- /**
- * @METHOD NAME : MaintainInjurySessionEJB
- * @INFORMATION : This method is the constructor
- * @PARAM : class java.lang.String
- * @RETURN : class java.lang.Class
- * @EXCEPTION :
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public MaintainInjurySessionEJB()
- {
- }
- /**
- * @METHOD NAME : ejbCreate
- * @INFORMATION : This method is to ejb Create
- * @PARAM :
- * @RETURN : void
- * @EXCEPTION :
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public void ejbCreate ()
- {
- }
- /**
- * @METHOD NAME : ejbRemove
- * @INFORMATION : This method is to ejb Remove
- * @PARAM :
- * @RETURN : void
- * @EXCEPTION :
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public void ejbRemove ()
- {
- }
- /**
- * @METHOD NAME : ejbActivate
- * @INFORMATION : This method is to ejb Activate
- * @PARAM :
- * @RETURN : void
- * @EXCEPTION :
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public void ejbActivate ()
- {
- }
- /**
- * @METHOD NAME : ejbPassivate
- * @INFORMATION : This method is to ejb Passivate
- * @PARAM :
- * @RETURN : void
- * @EXCEPTION :
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public void ejbPassivate ()
- {
- }
- /**
- * @METHOD NAME : setSessionContext
- * @INFORMATION : This method is to set Session Context
- * @PARAM : interface javax.ejb.SessionContext
- * @RETURN : void
- * @EXCEPTION : class javax.ejb.EJBException,
- class java.rmi.RemoteException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public void setSessionContext(SessionContext sesCtx)
- throws EJBException,RemoteException
- {
- this.sesCtx=sesCtx;
- }
- /**
- * @METHOD NAME : isValidSocInsNumber
- * @INFORMATION : This method is to Validate the Social Insurance Number entered
- * @PARAM : class java.lang.Long
- * @RETURN : boolean
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public boolean isValidSocInsNumber(Long socInsNumber) throws GOSIException
- {
- boolean isSocInsNumber=false;
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- String sqlQuery="";
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- try
- {
- conn =GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- StringBuffer queryBuffer =new StringBuffer();
- //Query to get contributor details from contributor table
- queryBuffer.append(OHQueryInjury.OhQry_QRY_00056 );
- queryBuffer.append(" FROM ");
- queryBuffer.append(SITables.T_CONTRIBUTOR);
- queryBuffer.append(" WHERE SOCIALINSURANCENUMBER=?");
- sqlQuery = queryBuffer.toString();
- GOSIDebug.debugMessages(""+sqlQuery);
- ps=conn.prepareStatement(sqlQuery);
- ps.setLong(1,socInsNumber.longValue());
- rsCommon=ps.executeQuery();
- GOSIDebug.debugMessages(""+sqlQuery);
- if(rsCommon.next())
- {
- if (rsCommon.getInt("con") >0)
- {
- isSocInsNumber=true;
- }
- }
- // if contributor details found flag set to true
- // else set to false
- if(isSocInsNumber == false)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "isValidSocInsNumber()",
- new GOSIException(),
- "SOI_ERR_1012"
- );
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "isValidSocInsNumber()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "isValidSocInsNumber()",
- e,
- "CMN_ERR_1000"
- );
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- return isSocInsNumber;
- }
- /**
- * @METHOD NAME : searchIndividualContactList
- * @INFORMATION : This method is to get the Individual Contact details of the contributor
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList searchIndividualContactList
- (AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- Long contactId=null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- ArrayList contactArrayList=null;
- startTime = System.currentTimeMillis();
- try
- {
- // the contact details of the contributor is fetched using
- // the ContactDetailsUtility and using the contact id
- // stored in the disease bean
- contactId=injuryBean.getContactId();
- if(contactId!=null)
- {
- contactArrayList=ContactDetailsUtility.
- getIndividualContactList
- (contactId,GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- GOSIDebug.debugMessages("After coming out of utilities:"+
- contactArrayList);
- }
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "searchIndividualContactList()",
- e,
- "CMN_ERR_1000"
- );
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "searchIndividualContactList()",
- elapsedTime);
- return contactArrayList;
- }
- /**
- * @METHOD NAME : getContactIdList
- * @INFORMATION : This method is to check whether the contact details exist for this contributor or not.
- * @PARAM : class java.lang.Long
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList getContactIdList(Long socInsNumber)
- throws GOSIException
- {
- String sqlQuery="";
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- StringBuffer queryBuffer = new StringBuffer();
- // query to get the contact details of the contributor
- queryBuffer.append(OHQueryInjury.OhQry_QRY_00057 );
- queryBuffer.append(" FROM ");
- queryBuffer.append(SITables.T_CONTRIBUTOR);
- queryBuffer.append(" WHERE SOCIALINSURANCENUMBER=?");
- sqlQuery = queryBuffer.toString();
- ArrayList contactDetExists=new ArrayList();
- contactDetExists.clear();
- try
- {
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setLong(1,socInsNumber.longValue());
- rsCommon=ps.executeQuery();
- GOSIDebug.debugMessages(""+sqlQuery);
- AddInjuryHelperBean injuryBean =null;
- // if contact details exists the contact id is added to the
- // disease bean and added to the array list and returned
- while(rsCommon.next())
- {
- injuryBean =
- new AddInjuryHelperBean();
- injuryBean.
- setContactId(new Long
- (rsCommon.getLong("CONTACTID")));
- if(!rsCommon.wasNull())
- {
- GOSIDebug.debugMessages("setContactId:"+
- injuryBean.getContactId());
- contactDetExists.add(injuryBean);
- GOSIDebug.debugMessages("size of list in sesBean:"+
- contactDetExists.size());
- }
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "getContactIdList()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "getContactId()",
- e,
- "CMN_ERR_1000"
- );
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- return contactDetExists;
- }
- /**
- * @METHOD NAME : addInjury
- * @INFORMATION : This method is to add an injury
- (save it into the T_INJURY table and the child
- tables T_BODYPARTS,T_CONPREEXISTINGDEFORMITIES,
- T_INJURYDIAGNOSIS)
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean,
- class gosi.core.workflow.beans.WorkflowParamBean,
- class java.lang.String,
- class java.util.ArrayList,
- class gosi.core.util.beans.AuditBean,
- class java.util.ArrayList,
- class java.util.ArrayList,
- int,
- class gosi.core.dms.beans.DMSRequestHeaderBean
- * @RETURN : class java.util.HashMap
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public HashMap addInjury(AddInjuryHelperBean injuryBean,
- WorkflowParamBean workflowParamBean,
- String contact,
- ArrayList contactList,
- AuditBean contactAuditBean,
- ArrayList injuryBodyParts,
- ArrayList icdList,int noOfYears,
- DMSRequestHeaderBean headerBean)
- throws GOSIException
- {
- Long injuryNumber;
- String userName="";
- GOSIDebug.debugMessages("getPreExistDeformitiesId().............."+
- injuryBean.getPreExistDeformitiesId());
- Long contactID;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- HashMap injuryMap = null;
- try
- {
- // this method is used to add the injury details into the
- // T_INJURY table , along with injury , other tables such
- // as T_Induvidualcontactdetails ,T_conprexistingdeformities
- // T_injurredbodyparts and T_icd details are modifed
- conn = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- injuryBean.setInjuryId(
- GOSIUtilities.getPrimaryKey("T_INJURY",
- injuryBean.getCreatedBy()));
- injuryBean.setInjuryNumber(
- GOSIUtilities.getPrimaryKey("INJURYNUMBER",
- injuryBean.getCreatedBy()));
- injuryNumber=injuryBean.getInjuryNumber();
- if(contact!=null) {
- contactAuditBean.setModuleId(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- contactAuditBean.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
- contactAuditBean.setLastModifiedTimestamp(new Timestamp(System.currentTimeMillis()));
- GOSIDebug.debugMessages("ContactList inside sesBean:"+contactList.size());
- }
- // updating contact details if present.
- // logic checks if atleast one contact details record is present
- // for the contributor else it throws error
- if((contact!=null) && contactList.size()>0)
- {
- int count=0;
- for(int i=0; i<contactList.size();i++)
- {
- IndividualContactBean contactBean =
- (IndividualContactBean)contactList.get(i);
- contactBean.setModuleId
- (GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- String contMode =""+contactAuditBean.DELETE_MODE;
- String entMode =""+contactBean.getMode();
- if(!entMode.equals(contMode))
- {
- count=count+1;
- }
- }
- if(count==0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "addInjury()",
- new GOSIException(),
- "SOI_ERR_4467");
- }
- }
- if((contact!=null) && contact.equals("Add"))
- {
- if(contactList.size()==0)
- {
- GOSIDebug.debugMessages("Inside count==null");
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "addInjury()",
- new GOSIException(),
- "SOI_ERR_4467");
- }
- }
- GOSIDebug.debugMessages("contact in session bean:"+contact);
- if((contact!=null) && (!("").equals(contact)))
- {
- if("Add".equals(contact))
- {
- contactID=GOSIUtilities.
- createIndividualContactDetails(contactList,
- contactAuditBean);
- GOSIDebug.debugMessages("Inside SessionBean ContactId is:"+
- contactID);
- injuryBean.setContactId(contactID);
- }
- else if("Modify".equals(contact))
- {
- GOSIUtilities.
- modifyIndividualContactDetails(contactList,
- contactAuditBean);
- }
- }
- // converting String dates entered by user to Timestamp for storage
- if( injuryBean.getInjuryDate()!= null)
- {
- injuryBean.setInjuryDate(SIUtilities.getDateTimestamp
- (injuryBean.getInjuryDateStr(),
- injuryBean.getInjuryDateEntFmt()));
- }
- if( injuryBean.getWorkDisabilityDate()!= null)
- {
- injuryBean.setWorkDisabilityDate(SIUtilities.getDateTimestamp
- (injuryBean.getWorkDisabilityDateStr(),
- injuryBean.getWorkDisabilityDateEntFmt()));
- }
- if( injuryBean.getEmpNotifyDate()!= null)
- {
- injuryBean.setEmpNotifyDate(SIUtilities.getDateTimestamp
- (injuryBean.getEmpNotifyDateStr(),
- injuryBean.getEmpNotifyDateEntFmt()));
- }
- if( injuryBean.getWorkerIntimateDate()!= null)
- {
- injuryBean.setWorkerIntimateDate(SIUtilities.getDateTimestamp
- (injuryBean.getWorkerIntDateStr(),
- injuryBean.getWorkerIntDateEntFmt()));
- }
- if( injuryBean.getWageStoppingDate()!= null)
- {
- injuryBean.setWageStoppingDate(SIUtilities.getDateTimestamp
- (injuryBean.getWageStoppingDateStr(),
- injuryBean.getWageStoppingDateEntFmt()));
- }
- if( injuryBean.getDateComplication()!= null)
- {
- injuryBean.setDateComplication(SIUtilities.getDateTimestamp
- (injuryBean.getComplicationDateStr(),
- injuryBean.getDateComplicationEntFmt()));
- }
- GOSIDebug.debugMessages("injurydate format in ses bean:"+
- injuryBean.getInjuryDateStr());
- // setting audit information
- injuryBean.
- setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
- injuryBean.setLastModifiedTimestamp
- (new Timestamp(System.currentTimeMillis()));
- // setting workflow status
- if(workflowParamBean != null && GOSIConstants.COMPLETED.equals(workflowParamBean.getRoutingCriterion()))
- {
- injuryBean.setWorkFlowStatus(OHConstants.WFS_INJ_ENTERED);
- }
- else
- {
- injuryBean.
- setWorkFlowStatus(OHConstants.WFS_INJ_PENDING_DATA_ENTRY);
- }
- // validating the injury
- // checks for valid coverage, engagement,etc
- injuryMap = isValidInjury(injuryBean);
- // validating the injury
- boolean isValidInjury =
- ((Boolean)injuryMap.get("isValidInjury")).booleanValue();
- if(!isValidInjury)
- {
- Short rejectionCode = (Short)injuryMap.get("rejectionCode");
- String message = (String)injuryMap.get("message");
- injuryBean.setInjuryStatus(OHConstants.INJ_STS_REJECTED);
- injuryBean.setRejectionCode(rejectionCode);
- injuryBean.setWorkFlowStatus(OHConstants.
- WFS_INJ_REJECTED);
- // letter generated if injury is not a valid one
- generateLetter(injuryBean);
- }else
- {
- //The implementation moved to the isValidInjuryMethod
- }
- injuryMap.put("injuryNumber",injuryNumber);
- // calling injury entity
- InjuryEntityHome home=getInjuryHome();
- InjuryEntity oInjuryEntity = (InjuryEntity)home.create(injuryBean);
- GOSIDebug.debugMessages("header bean"+ headerBean);
- // the DMS key values are set and the dms interface called
- if(headerBean != null)
- {
- headerBean.setSourceRecordId("" + injuryBean.getInjuryId());
- GOSIDebug.debugMessages("headerbean-SourceRecordId: "+ injuryBean.getInjuryId());
- headerBean.setSourceTable(SITables.T_INJURY);
- GOSIDebug.debugMessages("headerbean-SourceTable: "+ SITables.T_INJURY);
- headerBean.setCreatedBy(injuryBean.getCreatedBy()); //new Long (injuryBean.getCreatedBy())
- headerBean.setKeyList(DMSConstants.SI_NUMBER,
- "" + injuryBean.getSocInsNumber());
- GOSIDebug.debugMessages("headerbean-KeyList: "+ injuryBean.getSocInsNumber());
- headerBean.setKeyList(DMSConstants.REGISTRATION_NUMBER,
- "" + injuryBean.getRegNumber());
- GOSIDebug.debugMessages("headerbean-KeyList: "+ injuryBean.getRegNumber());
- headerBean.setKeyList(DMSConstants.INJURY_NUMBER,
- "" + injuryBean.getInjuryNumber());
- GOSIDebug.debugMessages("headerbean-KeyList: "+ injuryBean.getInjuryNumber());
- DMSUtilities.startDMS(headerBean);
- }
- // calling workflow interface and returning the next user name
- if(isValidInjury)
- {
- if(workflowParamBean != null && GOSIConstants.COMPLETED.equals(workflowParamBean.getRoutingCriterion()))
- {
- workflowParamBean.setrecordDescription(
- workflowParamBean.getrecordDescription()+"-"+
- injuryBean.getSocInsNumber());
- workflowParamBean.
- setPrimaryKeyOfTherecord
- (injuryBean.getInjuryId().toString());
- WorkflowParamBean initialWorkflow = new WorkflowParamBean ();
- initialWorkflow.setUserId(workflowParamBean.getUserId());
- initialWorkflow.setUserLocationId(workflowParamBean.getUserLocationId());
- initialWorkflow.setRoleId(workflowParamBean.getRoleId());
- initialWorkflow.setStepShortName ("ADD_OH_INJURY_INITIAL_STEP");
- initialWorkflow.setModuleId(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- initialWorkflow.setrecordDescription(GOSIErrorMessages.getErrorDesc("SOI_ERR_5641")+"-"+injuryBean.getSocInsNumber());
- initialWorkflow.setRoutingCriterion(GOSIConstants.COMPLETED);
- initialWorkflow.setComments(null);
- initialWorkflow.setTransactionEntityMap(workflowParamBean.getTransactionEntityMap());
- initialWorkflow.setPrimaryKeyOfTherecord(workflowParamBean.getPrimaryKeyOfTherecord());
- initialWorkflow.setTargetUserId(workflowParamBean.getUserId());
- GOSIUtilities.startWorkflow(initialWorkflow);
- userName=GOSIUtilities.
- startWorkflow(workflowParamBean);
- injuryMap.put("userName",userName);
- }
- }
- // To insert bodyparts
- if (injuryBodyParts != null)
- {
- insertBodyParts(injuryBean.getInjuryId(),injuryBodyParts,injuryBean);
- }
- // To insert ICDList
- if (icdList != null)
- {
- insertICDDiagnosis(injuryBean.getInjuryId(),icdList,injuryBean);
- }
- // To insert/update Preexisting deformities
- if(injuryBean.getPreviousNonOH()!=null)
- {
- PreexistingDeformitiesEntityHome preexistDeformitiesHome =
- getPreExistDeformitiesHome();
- if(injuryBean.getPreExistDeformitiesId()==null)
- {
- // creating record if preexisting deformities for
- // contributor does not exists
- injuryBean.setPreExistDeformitiesId(
- GOSIUtilities.getPrimaryKey("T_CONPREEXISTINGDEFORMITIES",
- injuryBean.getCreatedBy()));
- PreexistingDeformitiesEntity oPreexistDeformitiesEntity =
- (PreexistingDeformitiesEntity)preexistDeformitiesHome.
- create(injuryBean);
- }
- else
- {
- // updating the contributor preexisting deformities information
- PreexistingDeformitiesEntity oPreexistDeformitiesEntity =
- (PreexistingDeformitiesEntity)preexistDeformitiesHome.
- findByPrimaryKey(injuryBean.getPreExistDeformitiesId());
- oPreexistDeformitiesEntity.
- updatePreexistDeformities(injuryBean);
- }
- }
- GOSIDebug.debugMessages("contributorId:"+injuryBean.getContributorId());
- GOSIDebug.debugMessages("getContactId:"+injuryBean.getContactId());
- // To Update Contributor table with contact id
- if(injuryBean.getContactId()!=null)
- {
- ContributorBean oContributorBean=
- new ContributorBean();
- oContributorBean=ContributorUtilities.
- displayContributor(injuryBean.getContributorId());
- oContributorBean.setContactId(injuryBean.getContactId());
- oContributorBean.
- setLastModifiedTimestamp
- (new Timestamp(System.currentTimeMillis()));
- oContributorBean.setLastModifiedBy
- (injuryBean.getLastModifiedBy());
- ContributorUtilities.updateContributor
- (oContributorBean,false);
- }
- if(injuryBean.getIsEngagementProactive() && injuryBean.getEngagementApprovalDate() == null)
- {
- // Activate proactive registartion
- ContributorUtilities.completingNonSaudiProactiveRegistration(injuryBean.getIqamaNumber(), injuryBean.getBoarderNumber(), injuryBean.getRegNumber(), RegistrationConstants.OH_MODE);
- }
- }
- catch (GOSIException ge)
- {
- sesCtx.setRollbackOnly();
- throw ge;
- }
- catch(Exception e)
- {
- e.printStackTrace();
- sesCtx.setRollbackOnly();
- GOSIDebug.debugMessages("Exception inside the Session save:"+e);
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "addInjury()",
- e,
- "CMN_ERR_1000"
- );
- }
- finally
- {
- GOSIUtilities.cleanUp (conn);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "addInjury()",elapsedTime);
- return injuryMap;
- // returning the hashmap with the next users name
- }
- /**
- * @METHOD NAME : addInjuryCompln
- * @INFORMATION : This method is to add a complication of an injury
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean,
- class gosi.core.workflow.beans.WorkflowParamBean,
- class java.lang.String,
- class java.util.ArrayList,
- class gosi.core.util.beans.AuditBean,
- class java.util.ArrayList,
- class gosi.core.dms.beans.DMSRequestHeaderBean
- * @RETURN : String
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public String addInjuryCompln(AddInjuryHelperBean injuryBean,
- WorkflowParamBean workflowParamBean,
- String contact,
- ArrayList contactList,
- AuditBean contactAuditBean,
- ArrayList bodyPartsList,
- DMSRequestHeaderBean headerBean)
- throws GOSIException
- {
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- String message = "";
- try
- {
- // this method is used to insert the complication for an injury
- // T_injury , and its child tables will be updates
- // method similar to add injury.
- // no validation required because complications are allways
- // for the approved injury
- injuryBean.setInjuryId(
- GOSIUtilities.getPrimaryKey("T_INJURY",injuryBean.getCreatedBy()));
- Long contactID;
- if(contact!=null) {
- contactAuditBean.setModuleId(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- contactAuditBean.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
- contactAuditBean.setLastModifiedTimestamp(new Timestamp(System.currentTimeMillis()));
- }
- // adding contact details if present
- // logic checks if atleast one contact details record is present
- // for the contributor else it throws error
- if((contact!=null) && contactList.size()>0)
- {
- int count=0;
- for(int i=0; i<contactList.size();i++)
- {
- IndividualContactBean contactBean =
- (IndividualContactBean)contactList.get(i);
- contactBean.setModuleId
- (GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- GOSIDebug.debugMessages("ModuleId inside sesBean:"+
- contactBean.getModuleId());
- GOSIDebug.debugMessages("2343432"+contactBean.getMode());
- String contMode =""+contactAuditBean.DELETE_MODE;
- String entMode =""+contactBean.getMode();
- if(!entMode.equals(contMode))
- {
- count=count+1;
- }
- }
- if(count==0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "addInjury()",
- new GOSIException(),
- "SOI_ERR_4467");
- }
- }
- if((contact!=null) && contact.equals("Add"))
- {
- if(contactList.size()==0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "addInjury()",
- new GOSIException(),
- "SOI_ERR_4467");
- }
- }
- if((contact!=null) && (!("").equals(contact)))
- {
- if("Add".equals(contact))
- {
- contactID=GOSIUtilities.
- createIndividualContactDetails(contactList,
- contactAuditBean);
- injuryBean.setContactId(contactID);
- }
- else if("Modify".equals(contact))
- {
- GOSIUtilities.
- modifyIndividualContactDetails(contactList,
- contactAuditBean);
- }
- }
- GOSIDebug.debugMessages("InjuryNumber inside the ses bean:"+
- injuryBean.getInjuryNumber());
- Short parentInjuryStatus = getParentInjuryStatus(injuryBean.getInjuryNumber());
- // setting audit information
- injuryBean.setCreationTimestamp
- (new Timestamp(System.currentTimeMillis()));
- injuryBean.setLastModifiedTimestamp
- (new Timestamp(System.currentTimeMillis()));
- // setting workflow status
- if(workflowParamBean != null && GOSIConstants.COMPLETED.equals(workflowParamBean.getRoutingCriterion()))
- {
- injuryBean.setWorkFlowStatus(OHConstants.WFS_INJ_ENTERED);
- }
- else
- {
- injuryBean.
- setWorkFlowStatus(OHConstants.WFS_INJ_PENDING_DATA_ENTRY);
- }
- // converting String dates entered by user to Timestamp for storage
- if( injuryBean.getInjuryDate()!= null)
- {
- injuryBean.setInjuryDate(SIUtilities.getDateTimestamp
- (injuryBean.getInjuryDateStr(),
- injuryBean.getInjuryDateEntFmt()));
- }
- if( injuryBean.getWorkDisabilityDate()!= null)
- {
- injuryBean.setWorkDisabilityDate(SIUtilities.getDateTimestamp
- (injuryBean.getWorkDisabilityDateStr(),
- injuryBean.getWorkDisabilityDateEntFmt()));
- }
- if( injuryBean.getEmpNotifyDate()!= null)
- {
- injuryBean.setEmpNotifyDate(SIUtilities.getDateTimestamp
- (injuryBean.getEmpNotifyDateStr(),
- injuryBean.getEmpNotifyDateEntFmt()));
- }
- if( injuryBean.getWorkerIntimateDate()!= null)
- {
- injuryBean.setWorkerIntimateDate(SIUtilities.getDateTimestamp
- (injuryBean.getWorkerIntDateStr(),
- injuryBean.getWorkerIntDateEntFmt()));
- }
- if( injuryBean.getWageStoppingDate()!= null)
- {
- injuryBean.setWageStoppingDate(SIUtilities.getDateTimestamp
- (injuryBean.getWageStoppingDateStr(),
- injuryBean.getWageStoppingDateEntFmt()));
- }
- if( injuryBean.getDateComplication()!= null)
- {
- injuryBean.setDateComplication(SIUtilities.getDateTimestamp
- (injuryBean.getComplicationDateStr(),
- injuryBean.getDateComplicationEntFmt()));
- }
- if(OHConstants.INJ_STS_REJECTED.equals(parentInjuryStatus))
- {
- injuryBean.setInjuryStatus(OHConstants.INJ_STS_REJECTED);
- injuryBean.setRejectionCode(new Short("1044"));
- injuryBean.setWorkFlowStatus(OHConstants.WFS_INJ_REJECTED);
- message = GOSIErrorMessages.getErrorDesc("SOI_ERR_5556");
- }
- // calling injury home and inserting injury record
- InjuryEntityHome home=getInjuryHome();
- InjuryEntity oInjuryEntity =
- (InjuryEntity)home.create(injuryBean);
- // Calling workflow interface
- if(!OHConstants.INJ_STS_REJECTED.equals(parentInjuryStatus))
- {
- if(workflowParamBean != null && GOSIConstants.COMPLETED.equals(workflowParamBean.getRoutingCriterion()))
- {
- workflowParamBean.setrecordDescription(
- workflowParamBean.getrecordDescription()+"-"+
- injuryBean.getSocInsNumber());
- workflowParamBean.setPrimaryKeyOfTherecord
- (injuryBean.getInjuryId().toString());
- WorkflowParamBean initialWorkflow = new WorkflowParamBean ();
- initialWorkflow.setUserId(workflowParamBean.getUserId());
- initialWorkflow.setUserLocationId(workflowParamBean.getUserLocationId());
- initialWorkflow.setRoleId(workflowParamBean.getRoleId());
- initialWorkflow.setStepShortName ("COMPLICATION_INJURY_INITIAL_STEP");
- initialWorkflow.setModuleId(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- initialWorkflow.setrecordDescription(GOSIErrorMessages.getErrorDesc("SOI_ERR_5642")+"-"+injuryBean.getSocInsNumber());
- initialWorkflow.setRoutingCriterion(GOSIConstants.COMPLETED);
- initialWorkflow.setComments(null);
- initialWorkflow.setTransactionEntityMap(workflowParamBean.getTransactionEntityMap());
- initialWorkflow.setPrimaryKeyOfTherecord(workflowParamBean.getPrimaryKeyOfTherecord());
- initialWorkflow.setTargetUserId(workflowParamBean.getUserId());
- GOSIUtilities.startWorkflow(initialWorkflow);
- String userName=GOSIUtilities.startWorkflow(workflowParamBean);
- message = GOSIErrorMessages.getErrorDesc("SOI_ERR_5402")
- + " : "+ userName;
- }else
- {
- message = GOSIErrorMessages.getErrorDesc("SOI_ERR_4609");
- }
- }
- GOSIDebug.debugMessages("header bean"+ headerBean);
- // the DMS key values are set and the dms interface called
- if(headerBean != null)
- {
- headerBean.setSourceRecordId
- ("" + injuryBean.getInjuryId());
- headerBean.
- setSourceTable(SITables.T_INJURY);
- headerBean.setCreatedBy
- (new Long (workflowParamBean.getUserId()));
- headerBean.setKeyList(DMSConstants.SI_NUMBER,
- "" + injuryBean.getSocInsNumber());
- headerBean.setKeyList(DMSConstants.REGISTRATION_NUMBER,
- "" + injuryBean.getRegNumber());
- headerBean.setKeyList(DMSConstants.INJURY_NUMBER,
- "" + injuryBean.getInjuryNumber());
- DMSUtilities.startDMS(headerBean);
- }
- // inseting body parts in complication reenter
- if (bodyPartsList != null)
- {
- insertBodyPartsComplnEnter(injuryBean.getInjuryId(),bodyPartsList,injuryBean);
- }
- // To insert/update Preexisting deformities
- if(injuryBean.getPreviousNonOH()!=null)
- {
- PreexistingDeformitiesEntityHome preexistDeformitiesHome =
- getPreExistDeformitiesHome();
- // if its already present it will be modifed else entered
- if(injuryBean.getPreExistDeformitiesId()==null)
- {
- // creating record if preexisting deformities for
- // contributor does not exists
- injuryBean.setPreExistDeformitiesId(
- GOSIUtilities.getPrimaryKey("T_CONPREEXISTINGDEFORMITIES",
- injuryBean.getCreatedBy()));
- PreexistingDeformitiesEntity oPreexistDeformitiesEntity =
- (PreexistingDeformitiesEntity)preexistDeformitiesHome.
- create(injuryBean);
- }
- else
- {
- // updating the contributor preexisting deformities information
- PreexistingDeformitiesEntity oPreexistDeformitiesEntity =
- (PreexistingDeformitiesEntity)preexistDeformitiesHome.
- findByPrimaryKey(injuryBean.getPreExistDeformitiesId());
- oPreexistDeformitiesEntity.
- updatePreexistDeformities(injuryBean);
- }
- }
- // To update contact id in Contributor table
- if(injuryBean.getContactId()!=null)
- {
- ContributorBean oContributorBean=
- new ContributorBean();
- oContributorBean=ContributorUtilities.
- displayContributor(injuryBean.getContributorId());
- oContributorBean.setContactId(injuryBean.getContactId());
- oContributorBean.
- setLastModifiedTimestamp
- (new Timestamp(System.currentTimeMillis()));
- oContributorBean.setLastModifiedBy
- (injuryBean.getLastModifiedBy());
- ContributorUtilities.
- updateContributor(oContributorBean,false);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),"addInjuryCompln()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- sesCtx.setRollbackOnly();
- throw ge;
- }
- catch(Exception e)
- {
- sesCtx.setRollbackOnly();
- GOSIDebug.debugMessages("Exception inside the Session save:"+e);
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "addInjuryCompln()", e, "CMN_ERR_1000" );
- }
- return message;
- }
- /**
- * @METHOD NAME : injModifyReenter
- * @INFORMATION : This method is to update Injury details in Reenter/enter mode
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean,
- class gosi.core.workflow.beans.WorkflowParamBean,
- class java.lang.String,
- class java.util.ArrayList,
- class gosi.core.util.beans.AuditBean,
- class java.util.ArrayList,
- class java.util.ArrayList,
- class gosi.core.dms.beans.DMSRequestHeaderBean,
- class java.util.ArrayList
- * @RETURN : class java.lang.String
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public String injModifyReenter(AddInjuryHelperBean injuryBean,
- WorkflowParamBean workflowParamBean,
- String contact,
- ArrayList contactList,
- AuditBean contactAuditBean,
- ArrayList bodyPartsList,
- ArrayList icdList,
- DMSRequestHeaderBean headerBean,
- ArrayList injuryDocReqList)
- throws GOSIException
- {
- Long contactID;
- String userName="";
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- try
- {
- conn = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- // this method is used to update the injury in reneter mode
- // T_injury , and its child tables will be updated
- if(contact!=null) {
- contactAuditBean.setModuleId(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- contactAuditBean.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
- contactAuditBean.setLastModifiedTimestamp(new Timestamp(System.currentTimeMillis()));
- }
- // adding contact details if present
- // logic checks if atleast one contact details record is present
- // for the contributor else it throws error
- if((contact!=null) && contactList.size()>0)
- {
- int count=0;
- for(int i=0; i<contactList.size();i++)
- {
- IndividualContactBean contactBean =
- (IndividualContactBean)contactList.get(i);
- contactBean.setModuleId
- (GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- GOSIDebug.debugMessages("ModuleId inside sesBean:"+
- contactBean.getModuleId());
- GOSIDebug.debugMessages("2343432"+contactBean.getMode());
- String contMode =""+contactAuditBean.DELETE_MODE;
- String entMode =""+contactBean.getMode();
- if(!entMode.equals(contMode))
- {
- count=count+1;
- }
- }
- if(count==0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "injModifyReenter()",
- new GOSIException(),"SOI_ERR_4467");
- }
- }
- if((contact!=null) && contact.equals("Add"))
- {
- if(contactList.size()==0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "injModifyReenter()",
- new GOSIException(),"SOI_ERR_4467");
- }
- }
- GOSIDebug.debugMessages("contact in session bean:"+contact);
- if((contact!=null) && (!("").equals(contact)))
- {
- if("Add".equals(contact))
- {
- contactID=GOSIUtilities.
- createIndividualContactDetails(contactList,
- contactAuditBean);
- GOSIDebug.debugMessages("Inside SessionBean ContactId is:"+
- contactID);
- injuryBean.setContactId(contactID);
- }
- else if("Modify".equals(contact))
- {
- GOSIDebug.debugMessages("Inside update contact ");
- GOSIUtilities.
- modifyIndividualContactDetails(contactList,
- contactAuditBean);
- }
- }
- // converting String dates entered by user to Timestamp for storage
- if( injuryBean.getInjuryDate()!= null)
- {
- injuryBean.setInjuryDate(SIUtilities.getDateTimestamp
- (injuryBean.getInjuryDateStr(),
- injuryBean.getInjuryDateEntFmt()));
- }
- if( injuryBean.getWorkDisabilityDate()!= null)
- {
- injuryBean.setWorkDisabilityDate(SIUtilities.getDateTimestamp
- (injuryBean.getWorkDisabilityDateStr(),
- injuryBean.getWorkDisabilityDateEntFmt()));
- }
- if(injuryBean.getEmpNotifyDate()!= null)
- {
- injuryBean.setEmpNotifyDate(SIUtilities.getDateTimestamp
- (injuryBean.getEmpNotifyDateStr(),
- injuryBean.getEmpNotifyDateEntFmt()));
- }
- if(injuryBean.getWorkerIntimateDate()!= null)
- {
- injuryBean.setWorkerIntimateDate(SIUtilities.getDateTimestamp
- (injuryBean.getWorkerIntDateStr(),
- injuryBean.getWorkerIntDateEntFmt()));
- }
- if( injuryBean.getWageStoppingDate()!= null)
- {
- injuryBean.setWageStoppingDate(SIUtilities.getDateTimestamp
- (injuryBean.getWageStoppingDateStr(),
- injuryBean.getWageStoppingDateEntFmt()));
- }
- if( injuryBean.getDateComplication()!= null)
- {
- injuryBean.setDateComplication(SIUtilities.getDateTimestamp
- (injuryBean.getComplicationDateStr(),
- injuryBean.getDateComplicationEntFmt()));
- }
- //setting audit information for injury bean
- injuryBean.
- setLastModifiedTimestamp
- (new Timestamp(System.currentTimeMillis()));
- GOSIDebug.debugMessages("Inside LAST MODIFIED:"+
- injuryBean.getLastModifiedTimestamp());
- // calling injury entity home
- InjuryEntityHome home=getInjuryHome();
- InjuryEntity oInjuryEntity =(InjuryEntity)home.findByPrimaryKey
- (injuryBean.getInjuryId());
- // added for validating if wage stop date is modified
- InjuryBean storedInjuryBean = oInjuryEntity.getInjury();
- if(storedInjuryBean.getInjuryStatus().equals(OHConstants.INJ_STS_APPROVED))
- {
- // checking if the wage stop date can be changed or not
- if(storedInjuryBean.getWageStopDateGreg()== null &&
- injuryBean.getWageStoppingDate() == null)
- {
- //canChangeWageStopDate(injuryBean.getInjuryId());
- //if its null dont check
- }else
- if(storedInjuryBean.getWageStopDateGreg()!=null &&
- injuryBean.getWageStoppingDate() == null)
- {
- canChangeWageStopDate(injuryBean.getInjuryId());
- }else
- if(storedInjuryBean.getWageStopDateGreg()==null &&
- injuryBean.getWageStoppingDate() != null)
- {
- canChangeWageStopDate(injuryBean.getInjuryId());
- }else
- if(!storedInjuryBean.getWageStopDateGreg().equals(
- injuryBean.getWageStoppingDate()))
- {
- canChangeWageStopDate(injuryBean.getInjuryId());
- }
- /* PRD00067443 Abdulrazaq Alabdulrazaq 12/01/2015 */
- // if the date of injury has been changed
- if(!storedInjuryBean.getInjuryDateGreg().equals(
- injuryBean.getInjuryDate()))
- {
- // check if there is duplicate injury with same date of new date
- isInjuryAlreadyEntered(injuryBean.getSocInsNumber(),injuryBean.getInjuryDate());
- // Check if Injury has another Injury for the same contributor is taking In Patient Treatment in the same date
- checkTreatmentInpatientforAnotherInjury(injuryBean.getSocInsNumber(),injuryBean.getInjuryId(),injuryBean.getInjuryDate());
- /* if the date of injury has been changed and the new date after the old date
- * that might exist OH benefit still not recovered or Treatment Service not Recovered
- */
- if(storedInjuryBean.getInjuryDateGreg().before(
- injuryBean.getInjuryDate()))
- {
- Timestamp oldDate=storedInjuryBean.getInjuryDateGreg();
- Timestamp NewDate=injuryBean.getInjuryDate();
- Timestamp tempDate=oldDate;
- while (!tempDate.equals(NewDate))
- {
- // check if there OH benefit not Covered on period between Old injury date until New injury date
- checkInjuryHasOHBenefit(injuryBean.getInjuryId(), tempDate);
- // check if there is Treatment service not covered period between Old injury date until New injury date
- checkInjuryHasTreatmentService(injuryBean.getInjuryId(), tempDate);
- // get next day
- tempDate=GOSIUtilities.getNextDate(tempDate);
- }
- //check if there treatment period that on period between Old injury date until New injury date
- checkInjuryHasTreatmentOrTransfer(injuryBean);
- // check if the fisrt visit date on the T_PMR need to be update (may be it will before the New date !!)
- updateFirstVisitDate(injuryBean);
- // check if the start treatment date on the T_INJURY need to be update (may be it will before the New date !!)
- if(storedInjuryBean.getTreatmentStDateGreg()!=null
- && storedInjuryBean.getTreatmentStDateGreg().before(injuryBean.getInjuryDate()))
- {
- storedInjuryBean.setTreatmentStDateGreg(injuryBean.getInjuryDate());
- oInjuryEntity.modifyInjury(storedInjuryBean);
- }
- }
- // check if have Complication of these injury (that have same injuryNumber ) we will update the Complication Details also
- /* to be added on modifying Complication
- ArrayList<Long> complicationList= checkInjuryHasComplicationList(injuryBean);
- for (Long comloicationInjuryId : complicationList )
- {
- InjuryEntity oComplicationEntity =(InjuryEntity)home.findByPrimaryKey
- (comloicationInjuryId);
- oComplicationEntity.updateInjuryDetailsOfComplication(injuryBean);
- }
- /* if the date of injury has been changed and the New date before the old date
- * that means not need to any check
- */
- }
- }
- // updating injury & calling workflow interface
- oInjuryEntity.updateInjury(injuryBean);
- if((OHConstants.VERIFIED).
- equals(workflowParamBean.getRoutingCriterion())||
- (OHConstants.APPROVED).
- equals(workflowParamBean.getRoutingCriterion())||
- (GOSIConstants.REJECTED).
- equals(workflowParamBean.getRoutingCriterion())||
- (GOSIConstants.COMPLETED).
- equals(workflowParamBean.getRoutingCriterion())||
- (GOSIConstants.CANCELLED).
- equals(workflowParamBean.getRoutingCriterion()))
- {
- workflowParamBean.setrecordDescription(
- workflowParamBean.getrecordDescription()+"-"+
- injuryBean.getSocInsNumber());
- workflowParamBean.
- setPrimaryKeyOfTherecord(injuryBean.getInjuryId().toString());
- userName=GOSIUtilities.startWorkflow(workflowParamBean);
- }
- else
- {
- injuryBean.
- setWorkFlowStatus(OHConstants.WFS_INJ_PENDING_DATA_ENTRY);
- }
- if(injuryDocReqList!=null)
- {
- InjuryDocReqEntityHome ReqDocHome = getInjuryReqDocHome();
- for (int i=0; i<injuryDocReqList.size();i++)
- {
- InjuryDocReqListBean injuryDocReqListBean=(InjuryDocReqListBean)injuryDocReqList.get(i);
- InjuryDocReqEntity injuryDocReqEntity =(InjuryDocReqEntity)ReqDocHome.findByPrimaryKey(injuryDocReqListBean.getInjuryDocReqId());
- injuryDocReqEntity.updateInjuryDocReq(injuryBean.getLastModifiedBy(),new Timestamp(System.currentTimeMillis()));
- }
- }
- // the DMS key values are set and the dms interface called
- GOSIDebug.debugMessages("header bean"+ headerBean);
- if(headerBean != null)
- {
- GOSIDebug.debugMessages("inside header");
- headerBean.setSourceRecordId
- ("" + injuryBean.getInjuryId());
- headerBean.
- setSourceTable(SITables.T_INJURY);
- headerBean.setCreatedBy
- (new Long (workflowParamBean.getUserId()));
- headerBean.setKeyList(DMSConstants.SI_NUMBER,
- "" + injuryBean.getSocInsNumber());
- headerBean.setKeyList(DMSConstants.REGISTRATION_NUMBER,
- "" + injuryBean.getRegNumber());
- headerBean.setKeyList(DMSConstants.INJURY_NUMBER,
- "" + injuryBean.getInjuryNumber());
- DMSUtilities.startDMS(headerBean);
- }
- // To insert bodyparts
- if(bodyPartsList != null) {
- insertBodyParts(injuryBean.getInjuryId(),bodyPartsList,injuryBean);
- }
- // To insert ICDList
- if(icdList != null) {
- insertICDDiagnosis(injuryBean.getInjuryId(),icdList,injuryBean);
- }
- if(injuryBean.getPreviousNonOH()!=null)
- {
- PreexistingDeformitiesEntityHome preexistDeformitiesHome =
- getPreExistDeformitiesHome();
- // if its already present it will be modifed else entered
- if(injuryBean.getPreExistDeformitiesId()==null)
- {
- // creating record if preexisting deformities for
- // contributor does not exists
- injuryBean.setPreExistDeformitiesId(GOSIUtilities.getPrimaryKey
- ("T_CONPREEXISTINGDEFORMITIES",injuryBean.getCreatedBy()));
- PreexistingDeformitiesEntity oPreexistDeformitiesEntity =
- (PreexistingDeformitiesEntity)preexistDeformitiesHome.
- create(injuryBean);
- }
- else
- {
- // updating the contributor preexisting deformities information
- PreexistingDeformitiesEntity oPreexistDeformitiesEntity =
- (PreexistingDeformitiesEntity)preexistDeformitiesHome.
- findByPrimaryKey(injuryBean.getPreExistDeformitiesId());
- oPreexistDeformitiesEntity.updatePreexistDeformities(injuryBean);
- }
- }
- // Updating contact details.
- GOSIDebug.debugMessages("contributorId:"+injuryBean.getContributorId());
- GOSIDebug.debugMessages("getContactId:"+injuryBean.getContactId());
- // To update contact id in Contributor table
- if(injuryBean.getContactId()!=null)
- {
- ContributorBean oContributorBean=
- new ContributorBean();
- oContributorBean=ContributorUtilities.
- displayContributor(injuryBean.getContributorId());
- oContributorBean.setContactId(injuryBean.getContactId());
- oContributorBean.
- setLastModifiedTimestamp
- (new Timestamp(System.currentTimeMillis()));
- oContributorBean.setLastModifiedBy
- (injuryBean.getLastModifiedBy());
- ContributorUtilities.updateContributor(oContributorBean,false);
- }
- // letter to be generated if injury is rejected
- if(OHConstants.INJ_STS_REJECTED.equals(injuryBean.getInjuryStatus()))
- {
- generateLetter(injuryBean);
- }
- }
- catch (GOSIException ge)
- {
- sesCtx.setRollbackOnly();
- throw ge;
- }
- catch(Exception e)
- {
- sesCtx.setRollbackOnly();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "injModifyReenter()", e, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp (conn);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "injModifyReenter()",elapsedTime);
- return userName;
- }
- /**
- * @METHOD NAME : modifyInjuryDetails
- * @INFORMATION : This method is to update Injury details in the database for the workflow
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean,
- class gosi.core.workflow.beans.WorkflowParamBean,
- class java.util.ArrayList,
- class java.util.ArrayList,
- class gosi.core.dms.beans.DMSRequestHeaderBean
- * @RETURN : class java.lang.String
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public String modifyInjuryDetails(AddInjuryHelperBean injuryBean,
- WorkflowParamBean workflowParamBean,
- ArrayList injuryBodyParts,
- ArrayList icdList,
- DMSRequestHeaderBean headerBean,InjuryDocReqSearchBean injuryDocReq)
- throws GOSIException
- {
- Long contactID;
- String userName="";
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- try
- {
- GOSIDebug.debugMessages("--------------modifyInjuryDetails-------------------");
- conn = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- // converting String dates entered by user to Timestamp for storage
- if( injuryBean.getInjuryDate()!= null)
- {
- if(OHConstants.HIJRAH.
- equals(injuryBean.getInjuryDateEntFmt()))
- {
- injuryBean.setInjuryDate(GOSIUtilities.getTimestamp
- (GOSIDateUtilities.convertToGregorian(
- injuryBean.getInjuryDateStr())));
- }
- else
- {
- injuryBean.setInjuryDate(GOSIUtilities.getTimestamp
- (injuryBean.getInjuryDateStr()));
- }
- }
- if( injuryBean.getWorkDisabilityDate()!= null)
- {
- injuryBean.setWorkDisabilityDate(SIUtilities.getDateTimestamp
- (injuryBean.getWorkDisabilityDateStr(),
- injuryBean.getWorkDisabilityDateEntFmt()));
- }
- if( injuryBean.getEmpNotifyDate()!= null)
- {
- injuryBean.setEmpNotifyDate(SIUtilities.getDateTimestamp
- (injuryBean.getEmpNotifyDateStr(),
- injuryBean.getEmpNotifyDateEntFmt()));
- }
- if( injuryBean.getWorkerIntimateDate()!= null)
- {
- injuryBean.setWorkerIntimateDate(SIUtilities.getDateTimestamp
- (injuryBean.getWorkerIntDateStr(),
- injuryBean.getWorkerIntDateEntFmt()));
- }
- if( injuryBean.getWageStoppingDate()!= null)
- {
- injuryBean.setWageStoppingDate(SIUtilities.getDateTimestamp
- (injuryBean.getWageStoppingDateStr(),
- injuryBean.getWageStoppingDateEntFmt()));
- }
- if( injuryBean.getDateComplication()!= null)
- {
- injuryBean.setDateComplication(SIUtilities.getDateTimestamp
- (injuryBean.getComplicationDateStr(),
- injuryBean.getDateComplicationEntFmt()));
- }
- // setting audit information
- injuryBean.setLastModifiedTimestamp
- (new Timestamp(System.currentTimeMillis()));
- injuryBean.setCreationTimestamp
- (new Timestamp(System.currentTimeMillis()));
- // getting injury entity home
- InjuryEntityHome home=getInjuryHome();
- GOSIDebug.debugMessages("Injury Id value:"+injuryBean.getInjuryId());
- InjuryEntity oInjuryEntity =(InjuryEntity)home.
- findByPrimaryKey(injuryBean.getInjuryId());
- InjuryBean storedInjuryBean = oInjuryEntity.getInjury();
- // checking if wage stop dates can be changed or not
- if(storedInjuryBean.getInjuryStatus().equals(OHConstants.INJ_STS_APPROVED))
- {
- if(storedInjuryBean.getWageStopDateGreg()== null &&
- injuryBean.getWageStoppingDate() == null)
- {
- //canChangeWageStopDate(injuryBean.getInjuryId());
- // if the dates are null do not check .
- }else
- if(storedInjuryBean.getWageStopDateGreg()!=null &&
- injuryBean.getWageStoppingDate() == null)
- {
- canChangeWageStopDate(injuryBean.getInjuryId());
- }else
- if(storedInjuryBean.getWageStopDateGreg()==null &&
- injuryBean.getWageStoppingDate() != null)
- {
- canChangeWageStopDate(injuryBean.getInjuryId());
- }else
- if(!storedInjuryBean.getWageStopDateGreg().equals(
- injuryBean.getWageStoppingDate()))
- {
- canChangeWageStopDate(injuryBean.getInjuryId());
- }
- }
- // updating the injury record
- oInjuryEntity.updateInjury(injuryBean);
- GOSIDebug.debugMessages("getInjuryStatus:"+injuryBean.getInjuryStatus());
- // calling the workflow interface
- if((OHConstants.VERIFIED).
- equals(workflowParamBean.getRoutingCriterion())||
- (OHConstants.APPROVED).
- equals(workflowParamBean.getRoutingCriterion())||
- (GOSIConstants.REJECTED).
- equals(workflowParamBean.getRoutingCriterion())||
- (GOSIConstants.COMPLETED).
- equals(workflowParamBean.getRoutingCriterion())||
- (GOSIConstants.CANCELLED).
- equals(workflowParamBean.getRoutingCriterion()))
- {
- workflowParamBean.setrecordDescription(
- workflowParamBean.getrecordDescription()+"-"+
- injuryBean.getSocInsNumber());
- workflowParamBean.
- setPrimaryKeyOfTherecord(injuryBean.getInjuryId().toString());
- userName=GOSIUtilities.startWorkflow(workflowParamBean);
- GOSIDebug.debugMessages("userName inside the ses bean:"+userName);
- }else if(OHConstants.INJ_STS_APPROVED.equals(injuryBean.getInjuryStatus()))
- {
- GOSIDebug.debugMessages("getInjuryStatus:"+injuryBean.getInjuryStatus());
- }
- else
- {
- injuryBean.
- setWorkFlowStatus(OHConstants.WFS_INJ_PENDING_DATA_ENTRY);
- }
- // the DMS key values are set and the dms interface called
- GOSIDebug.debugMessages("header bean"+ headerBean);
- if(headerBean != null)
- {
- GOSIDebug.debugMessages("inside header");
- headerBean.setSourceRecordId
- ("" + injuryBean.getInjuryId());
- headerBean.
- setSourceTable(SITables.T_INJURY);
- headerBean.setCreatedBy
- (new Long (workflowParamBean.getUserId()));
- headerBean.setKeyList(DMSConstants.SI_NUMBER,
- "" + injuryBean.getSocInsNumber());
- headerBean.setKeyList(DMSConstants.REGISTRATION_NUMBER,
- "" + injuryBean.getRegNumber());
- headerBean.setKeyList(DMSConstants.INJURY_NUMBER,
- "" + injuryBean.getInjuryNumber());
- DMSUtilities.startDMS(headerBean);
- }
- // To insert Request Doucument form Establishment
- if(injuryDocReq!=null)
- {
- InjuryDocReqEntityHome ReqDocHome = getInjuryReqDocHome();
- ArrayList list =injuryDocReq.getDocReq();
- InjuryDocReqListBean injuryDocReqListBean= null;
- for (int i=0; i<list.size();i++){
- injuryDocReqListBean= new InjuryDocReqListBean ();
- injuryDocReqListBean.setInjuryDocReqId(GOSIUtilities.getPrimaryKey("T_injuryDocReq",injuryDocReq.getCreatedBy()));
- injuryDocReqListBean.setInjuryId(injuryDocReq.getInjuryId());
- injuryDocReqListBean.setDocReq(new Long((String)list.get(i)));
- injuryDocReqListBean.setCreatedBy(injuryDocReq.getCreatedBy());
- injuryDocReqListBean.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
- InjuryDocReqEntity injuryDocReqEntity =ReqDocHome.create(injuryDocReqListBean);
- }
- }
- // To insert bodyparts
- insertBodyParts(injuryBean.getInjuryId(),injuryBodyParts,injuryBean);
- // To insert ICDList
- insertICDDiagnosis(injuryBean.getInjuryId(),icdList,injuryBean);
- // updating pre existing deformities.
- if(injuryBean.getPreviousNonOH()!=null)
- {
- PreexistingDeformitiesEntityHome preexistDeformitiesHome =
- getPreExistDeformitiesHome();
- // if its already present it will be modifed else entered
- if(injuryBean.getPreExistDeformitiesId()==null)
- {
- // creating record if preexisting deformities for
- // contributor does not exists
- injuryBean.setPreExistDeformitiesId(
- GOSIUtilities.getPrimaryKey("T_CONPREEXISTINGDEFORMITIES",
- injuryBean.getCreatedBy()));
- PreexistingDeformitiesEntity oPreexistDeformitiesEntity =
- (PreexistingDeformitiesEntity)preexistDeformitiesHome.
- create(injuryBean);
- }
- else
- {
- // updating the contributor preexisting deformities information
- PreexistingDeformitiesEntity oPreexistDeformitiesEntity =
- (PreexistingDeformitiesEntity)preexistDeformitiesHome.
- findByPrimaryKey(injuryBean.getPreExistDeformitiesId());
- oPreexistDeformitiesEntity.
- updatePreexistDeformities(injuryBean);
- }
- }
- // Letter to be generated if injury is rejected
- if(OHConstants.INJ_STS_REJECTED.equals(injuryBean.getInjuryStatus()))
- {
- generateLetter(injuryBean);
- }
- GOSIDebug.debugMessages("--------------modifyInjuryDetails*-------------------");
- }
- catch (GOSIException ge)
- {
- sesCtx.setRollbackOnly();
- throw ge;
- }
- catch(Exception e)
- {
- sesCtx.setRollbackOnly();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "modifyInjuryDetails()",e, "CMN_ERR_1000"
- );
- }
- finally
- {
- GOSIUtilities.cleanUp (conn);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "modifyInjuryDetails()",
- elapsedTime);
- return userName;
- }
- /**
- * @METHOD NAME : reenterCompln
- * @INFORMATION : This method is to update Complication Injury details in the Reenter mode
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean,
- class gosi.core.workflow.beans.WorkflowParamBean,
- class java.lang.String,
- class java.util.ArrayList,
- class gosi.core.util.beans.AuditBean,
- class java.util.ArrayList,
- class gosi.core.dms.beans.DMSRequestHeaderBean,
- class java.util.ArrayList
- * @RETURN : class java.lang.String
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public String reenterCompln(AddInjuryHelperBean injuryBean,
- WorkflowParamBean workflowParamBean,
- String contact,
- ArrayList contactList,
- AuditBean contactAuditBean,
- ArrayList injuryBodyParts,
- DMSRequestHeaderBean headerBean,
- ArrayList injuryDocReqList)
- throws GOSIException
- {
- Long contactID;
- String userName="";
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- try
- {
- conn = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- // this method is called to update the complication details
- // in the reenter mode, T_injury and the realted child tables
- // are modified in this method
- if(contact!=null) {
- contactAuditBean.setModuleId(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- contactAuditBean.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
- contactAuditBean.setLastModifiedTimestamp(new Timestamp(System.currentTimeMillis()));
- GOSIDebug.debugMessages("ContactList inside sesBean:" + contactList.size());
- }
- // adding contact details if present
- // logic checks if atleast one contact details record is present
- // for the contributor else it throws error
- if((contact!=null) && contactList.size()>0)
- {
- int count=0;
- for(int i=0; i<contactList.size();i++)
- {
- IndividualContactBean contactBean =
- (IndividualContactBean)contactList.get(i);
- contactBean.setModuleId
- (GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- GOSIDebug.debugMessages("ModuleId inside sesBean:"+
- contactBean.getModuleId());
- String contMode =""+contactAuditBean.DELETE_MODE;
- String entMode =""+contactBean.getMode();
- if(!entMode.equals(contMode))
- {
- count=count+1;
- }
- }
- if(count==0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "reenterCompln()",
- new GOSIException(),"SOI_ERR_4467");
- }
- }
- if((contact!=null) && contact.equals("Add"))
- {
- if(contactList.size()==0)
- {
- GOSIDebug.debugMessages("Inside count==null");
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "reenterCompln()",new GOSIException(),
- "SOI_ERR_4467");
- }
- }
- GOSIDebug.debugMessages("contact in session bean:"+contact);
- if(contact!=null && !("").equals(contact))
- {
- if("Add".equals(contact))
- {
- contactID=GOSIUtilities.
- createIndividualContactDetails(contactList,
- contactAuditBean);
- injuryBean.setContactId(contactID);
- }
- else if("Modify".equals(contact))
- {
- GOSIUtilities.
- modifyIndividualContactDetails(contactList,
- contactAuditBean);
- }
- }
- GOSIDebug.debugMessages("Inside try of modify in ses bean:"+
- injuryBean.getInjuryId());
- // converting String dates entered by user to Timestamp for storage
- if( injuryBean.getInjuryDate()!= null)
- {
- injuryBean.setInjuryDate(SIUtilities.getDateTimestamp
- (injuryBean.getInjuryDateStr(),
- injuryBean.getInjuryDateEntFmt()));
- }
- if( injuryBean.getWorkDisabilityDate()!= null)
- {
- injuryBean.setWorkDisabilityDate(SIUtilities.getDateTimestamp
- (injuryBean.getWorkDisabilityDateStr(),
- injuryBean.getWorkDisabilityDateEntFmt()));
- }
- if( injuryBean.getEmpNotifyDate()!= null)
- {
- injuryBean.setEmpNotifyDate(SIUtilities.getDateTimestamp
- (injuryBean.getEmpNotifyDateStr(),
- injuryBean.getEmpNotifyDateEntFmt()));
- }
- if( injuryBean.getWorkerIntimateDate()!= null)
- {
- injuryBean.setWorkerIntimateDate(SIUtilities.getDateTimestamp
- (injuryBean.getWorkerIntDateStr(),
- injuryBean.getWorkerIntDateEntFmt()));
- }
- if( injuryBean.getWageStoppingDate()!= null)
- {
- injuryBean.setWageStoppingDate(SIUtilities.getDateTimestamp
- (injuryBean.getWageStoppingDateStr(),
- injuryBean.getWageStoppingDateEntFmt()));
- }
- if( injuryBean.getDateComplication()!= null)
- {
- injuryBean.setDateComplication(SIUtilities.getDateTimestamp
- (injuryBean.getComplicationDateStr(),
- injuryBean.getDateComplicationEntFmt()));
- }
- // setting audit information
- injuryBean.setLastModifiedTimestamp(new Timestamp
- (System.currentTimeMillis()));
- // calling injury entity home
- InjuryEntityHome home=getInjuryHome();
- InjuryEntity oInjuryEntity =(InjuryEntity)home.findByPrimaryKey
- (injuryBean.getInjuryId());
- oInjuryEntity.updateInjury(injuryBean);
- // updating injury
- // calling workflow interface
- if(OHConstants.WFS_INJ_PENDING_DATA_ENTRY.equals(injuryBean.getWorkFlowStatus())||
- OHConstants.INJ_STS_APPROVED.equals(injuryBean.getInjuryStatus()))
- {
- //No work flow
- }else
- {
- workflowParamBean.setrecordDescription(
- workflowParamBean.getrecordDescription()+"-"+
- injuryBean.getSocInsNumber());
- workflowParamBean.
- setPrimaryKeyOfTherecord(injuryBean.getInjuryId().toString());
- userName=GOSIUtilities.startWorkflow(workflowParamBean);
- }
- if(injuryDocReqList!=null)
- {
- InjuryDocReqEntityHome ReqDocHome = getInjuryReqDocHome();
- for (int i=0; i<injuryDocReqList.size();i++)
- {
- InjuryDocReqListBean injuryDocReqListBean=(InjuryDocReqListBean)injuryDocReqList.get(i);
- InjuryDocReqEntity injuryDocReqEntity =(InjuryDocReqEntity)ReqDocHome.findByPrimaryKey(injuryDocReqListBean.getInjuryDocReqId());
- injuryDocReqEntity.updateInjuryDocReq(injuryBean.getLastModifiedBy(),new Timestamp(System.currentTimeMillis()));
- }
- }
- // the DMS key values are set and the dms interface called
- GOSIDebug.debugMessages("header bean"+ headerBean);
- if(headerBean != null)
- {
- GOSIDebug.debugMessages("inside header");
- headerBean.setSourceRecordId
- ("" + injuryBean.getInjuryId());
- headerBean.setSourceTable(SITables.T_INJURY);
- headerBean.setCreatedBy
- (new Long (workflowParamBean.getUserId()));
- headerBean.setKeyList(DMSConstants.SI_NUMBER,
- "" + injuryBean.getSocInsNumber());
- headerBean.setKeyList(DMSConstants.REGISTRATION_NUMBER,
- "" + injuryBean.getRegNumber());
- headerBean.setKeyList(DMSConstants.INJURY_NUMBER,
- "" + injuryBean.getInjuryNumber());
- DMSUtilities.startDMS(headerBean);
- }
- // To insert bodyparts
- if(injuryBodyParts != null) {
- insertBodyParts(injuryBean.getInjuryId(),injuryBodyParts,injuryBean);
- }
- // updating preexisting deformities
- if(injuryBean.getPreviousNonOH()!=null)
- {
- PreexistingDeformitiesEntityHome preexistDeformitiesHome =
- getPreExistDeformitiesHome();
- // if its already present it will be modifed else entered
- if(injuryBean.getPreExistDeformitiesId()==null)
- {
- // creating record if preexisting deformities for
- // contributor does not exists
- injuryBean.setPreExistDeformitiesId(
- GOSIUtilities.getPrimaryKey("T_CONPREEXISTINGDEFORMITIES",
- injuryBean.getCreatedBy()));
- PreexistingDeformitiesEntity oPreexistDeformitiesEntity =
- (PreexistingDeformitiesEntity)preexistDeformitiesHome.
- create(injuryBean);
- }
- else
- {
- // updating the contributor preexisting deformities information
- PreexistingDeformitiesEntity oPreexistDeformitiesEntity =
- (PreexistingDeformitiesEntity)preexistDeformitiesHome.
- findByPrimaryKey(injuryBean.getPreExistDeformitiesId());
- oPreexistDeformitiesEntity.
- updatePreexistDeformities(injuryBean);
- }
- }
- // To update contact id in Contributor table
- if(injuryBean.getContactId()!=null)
- {
- ContributorBean oContributorBean=
- new ContributorBean();
- oContributorBean=ContributorUtilities.
- displayContributor(injuryBean.getContributorId());
- oContributorBean.setContactId(injuryBean.getContactId());
- oContributorBean.
- setLastModifiedTimestamp
- (new Timestamp(System.currentTimeMillis()));
- oContributorBean.setLastModifiedBy
- (injuryBean.getLastModifiedBy());
- ContributorUtilities.
- updateContributor(oContributorBean,false);
- }
- // generating letter if injury is rejected
- if(OHConstants.INJ_STS_REJECTED.equals(injuryBean.getInjuryStatus()))
- {
- generateLetter(injuryBean);
- }
- }
- catch (GOSIException ge)
- {
- sesCtx.setRollbackOnly();
- throw ge;
- }
- catch(Exception e)
- {
- sesCtx.setRollbackOnly();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,this.getClass().toString(),
- "reenterCompln()", e, "CMN_ERR_1000" );
- }
- finally
- {
- GOSIUtilities.cleanUp (conn);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "reenterCompln()", elapsedTime);
- return userName;
- }
- /**
- * @METHOD NAME : searchInjModifyList
- * @INFORMATION : This method is to search the Injury/Complication details
- from the database for the workflow
- * @PARAM : class java.lang.Long,
- class java.lang.String
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList searchInjModifyList(Long injuryId,String mode)
- throws GOSIException
- {
- String sqlQuery="";
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- ArrayList injuryArrayList = new ArrayList();
- injuryArrayList.clear();
- ArrayList finalInjuryArrayList = new ArrayList();
- finalInjuryArrayList.clear();
- try
- {
- // Query to fetch the injury details in modify list
- // injury id is used to fetch the record
- // the injury bean is added in an array list and returned
- sqlQuery=OHQueryInjury.OhQry_QRY_00058 ;
- conn = GOSIUtilities.getConnection
- (GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setLong(1,injuryId.longValue());
- GOSIDebug.debugMessages("sqlQuery:"+sqlQuery);
- GOSIDebug.debugMessages("MaintainInjurySessionEjb:InjuryId:"+injuryId);
- rsCommon=ps.executeQuery();
- AddInjuryHelperBean injuryListBean =null;
- if(rsCommon.next())
- {
- GOSIDebug.debugMessages("In the while loop of searchInjuryDetails:");
- injuryListBean =
- new AddInjuryHelperBean();
- injuryListBean.
- setInjuryId(new Long(rsCommon.getLong("INJURYID")));
- injuryListBean.
- setContributorId(new Long(rsCommon.getLong("CONTRIBUTORID")));
- injuryListBean.
- setEstablishmentId(new Long
- (rsCommon.getLong("ESTABLISHMENTID")));
- injuryListBean.
- setSocInsNumber(new Long(rsCommon.getLong("SOCINSNUMBER")));
- injuryListBean.
- setContactId(new Long(rsCommon.getLong("CONTACTID")));
- injuryListBean.
- setRegNumber(new Long(rsCommon.getLong("REGISTRATIONNUMBER")));
- injuryListBean.
- setInjuryDate(rsCommon.getTimestamp("INJURYDATE"));
- GOSIDebug.debugMessages("Injury Date:"+
- injuryListBean.getInjuryDate());
- injuryListBean.
- setInjuryDateEntFmt(rsCommon.getString("INJURYDATEENTFMT"));
- GOSIDebug.debugMessages("Injury Date:entfmt"+
- injuryListBean.getInjuryDateEntFmt());
- if (injuryListBean.getInjuryDateEntFmt()!= null)
- {
- injuryListBean.
- setInjuryDateStr(SIUtilities.getDateString(
- injuryListBean.getInjuryDate(),
- injuryListBean.getInjuryDateEntFmt()));
- GOSIDebug.debugMessages("injuryDateStr:"+
- injuryListBean.getInjuryDateStr());
- }
- injuryListBean.setWorkDisabilityDate(
- rsCommon.getTimestamp("WORKDISABILITYDATE"));
- GOSIDebug.debugMessages("workDisabilitydate in ses:"+
- injuryListBean.getWorkDisabilityDate());
- injuryListBean.setWorkDisabilityDateEntFmt(
- rsCommon.getString("WORKDISABILITYDATEENTFMT"));
- GOSIDebug.debugMessages("entfmt :::"+injuryListBean.
- getWorkDisabilityDateEntFmt());
- if (injuryListBean.getWorkDisabilityDateEntFmt()!= null)
- {
- injuryListBean.setWorkDisabilityDateStr
- (SIUtilities.getDateString(
- injuryListBean.getWorkDisabilityDate(),
- injuryListBean.getWorkDisabilityDateEntFmt()));
- GOSIDebug.debugMessages("WorkDisabilityDateStr in G"+
- injuryListBean.getWorkDisabilityDateStr());
- }
- injuryListBean.
- setReceiveWageFromEmp(new Byte(
- rsCommon.getByte("RECEIVINGWAGEFROMEMP")));
- injuryListBean.
- setInjuryNumber(new Long(rsCommon.getLong("INJURYNUMBER")));
- injuryListBean.
- setInjuryDescription(rsCommon.getString("DESCRIPTION"));
- injuryListBean.
- setDateComplication(
- rsCommon.getTimestamp("DATECOMPLICATION"));
- injuryListBean.
- setDateComplicationEntFmt(
- rsCommon.getString("DATECOMPLICATIONENTFMT"));
- if (injuryListBean.getDateComplicationEntFmt()!= null)
- {
- injuryListBean.setComplicationDateStr
- (SIUtilities.getDateString(
- injuryListBean.getDateComplication(),
- injuryListBean.getDateComplicationEntFmt()));
- }
- injuryListBean.setFieldOfficeCode(new Short(
- rsCommon.getShort("FIELDOFFICECODE")));
- if(rsCommon.getObject("ENTEREDBY")!=null) {
- injuryListBean.setEnteredBy(new Short(rsCommon.getShort("ENTEREDBY")));
- }
- if(rsCommon.getObject("INITIATEDBY")!=null) {
- injuryListBean.setInitiatedBy(new Short(rsCommon.getShort("INITIATEDBY")));
- }
- if(rsCommon.getObject("CREATEDBY")!=null) {
- injuryListBean.setCreatedBy(new Long(rsCommon.getLong("CREATEDBY")));
- }
- injuryListBean.setCreationTimestamp(rsCommon.getTimestamp("CREATIONTIMESTAMP"));
- if(rsCommon.getObject("GOVERNMENTSECTOR")!=null) {
- injuryListBean.setGovernmentSector(new Short(rsCommon.getShort("GOVERNMENTSECTOR")));
- }
- if(rsCommon.getObject("DELAYREASON")!=null) {
- injuryListBean.setDelayReason(rsCommon.getString("DELAYREASON"));
- }
- String firstName="";
- String secondName="";
- String thirdName="";
- String surName="";
- String finalName="";
- if(rsCommon.getString("FIRSTNAME")!=null)
- {
- firstName=""+rsCommon.getString("FIRSTNAME");
- }
- if(rsCommon.getString("SECONDNAME")!=null)
- {
- secondName=""+rsCommon.getString("SECONDNAME");
- }
- if(rsCommon.getString("THIRDNAME")!=null)
- {
- thirdName=""+rsCommon.getString("THIRDNAME");
- }
- if(rsCommon.getString("SURNAME")!=null)
- {
- surName=""+rsCommon.getString("SURNAME");
- }
- finalName=firstName+" "+secondName+" "+thirdName+" "+surName;
- injuryListBean.setName(finalName);
- injuryListBean.
- setInjuryTimeHrs(rsCommon.getString("INJURYTIMEHR"));
- injuryListBean.
- setInjuryTimeMins(rsCommon.getString("INJURYTIMEMIN"));
- injuryListBean.
- setInjuryTimeAmPm(
- new Byte(rsCommon.getByte("INJURYTIMEAMPM")));
- injuryListBean.
- setEmpNotifyDate(rsCommon.getTimestamp
- ("EMPLOYERNOTIFYDATE"));
- injuryListBean.
- setEmpNotifyDateEntFmt(
- rsCommon.getString("EMPLOYERNOTIFYDATEENTFMT"));
- if (injuryListBean.getEmpNotifyDateEntFmt()!= null)
- {
- injuryListBean.setEmpNotifyDateStr
- (SIUtilities.getDateString(
- injuryListBean.getEmpNotifyDate(),
- injuryListBean.getEmpNotifyDateEntFmt()));
- }
- injuryListBean.
- setWorkerIntimateDate(rsCommon.getTimestamp
- ("WORKERINTIMATIONDATE"));
- injuryListBean.
- setWorkerIntDateEntFmt(
- rsCommon.getString("WORKERINTIMATIONDATEENTFMT"));
- if (injuryListBean.getWorkerIntDateEntFmt()!= null)
- {
- injuryListBean.setWorkerIntDateStr
- (SIUtilities.getDateString(
- injuryListBean.getWorkerIntimateDate(),
- injuryListBean.getWorkerIntDateEntFmt()));
- }
- injuryListBean.
- setPlaceOfInjury(rsCommon.getString("PLACEINJURY"));
- injuryListBean.
- setActivityAtTimeInjury(
- rsCommon.getString("ACTIVITYATTIMEINJURY"));
- injuryListBean.
- setWageStoppingDate(rsCommon.getTimestamp("WAGESTOPDATE"));
- injuryListBean.
- setWageStoppingDateEntFmt(
- rsCommon.getString("WAGESTOPDATEENTFMT"));
- if (injuryListBean.getWageStoppingDateEntFmt()!= null)
- {
- injuryListBean.setWageStoppingDateStr
- (SIUtilities.getDateString(
- injuryListBean.getWageStoppingDate(),
- injuryListBean.getWageStoppingDateEntFmt()));
- }
- injuryListBean.
- setNationalityCode(
- new Short(rsCommon.getShort("NATIONALITYCODE")));
- injuryListBean.
- setInjuryStatus(
- new Short(rsCommon.getShort("INJURYSTATUS")));
- injuryListBean.
- setEstablishmentName(
- rsCommon.getString("ESTABLISHMENTNAMEENG"));
- injuryListBean.
- setEstablishmentNameArb(
- rsCommon.getString("ESTABLISHMENTNAMEARB"));
- GOSIDebug.debugMessages("EstablishmentNameArb:"+
- injuryListBean.
- getEstablishmentNameArb());
- if(rsCommon.getObject("RESPONSIBLEFOROHPAYMENT")!=null)
- {
- injuryListBean.setResponsibleForOHPayment
- (new Byte(rsCommon.getByte("RESPONSIBLEFOROHPAYMENT")));
- }
- if(rsCommon.getObject("ACCIDENTCODE")!=null)
- {
- injuryListBean.setAccidentCode(
- new Short(rsCommon.getShort("ACCIDENTCODE")));
- }
- if(rsCommon.getObject("ACCIDENTOTHER")!=null)
- {
- injuryListBean.setAccidentOther(
- rsCommon.getString("ACCIDENTOTHER"));
- }
- if(rsCommon.getObject("INJURYSOURCECODE") != null)
- {
- injuryListBean.
- setInjurySourceCode(
- new Short(rsCommon.getShort("INJURYSOURCECODE")));
- }
- if(rsCommon.getObject("INJURYSOURCEOTHER") != null)
- {
- injuryListBean.
- setInjurySourceOther(rsCommon.getString("INJURYSOURCEOTHER"));
- }
- injuryListBean.
- setInjuryNatureCode(
- new Short(rsCommon.getShort("INJURYNATURECODE")));
- if(rsCommon.getObject("INJURYNATUREOTHER") != null)
- {
- injuryListBean.
- setInjuryNatureOther(rsCommon.getString("INJURYNATUREOTHER"));
- }
- injuryListBean.
- setHospitalCode(
- new Long(rsCommon.getLong("HOSPITALCODE")));
- injuryListBean.
- setWorkFlowStatus(
- new Short(rsCommon.getShort("WORKFLOWSTATUS")));
- injuryListBean.
- setOHEligibilityStatus(new Byte(
- rsCommon.getByte("OHELIGIBILITYSTATUS")));
- if(rsCommon.getObject("REJECTIONCODE")!=null)
- {
- injuryListBean.setRejectionCode(new Short(
- rsCommon.getShort("REJECTIONCODE")));
- }
- injuryListBean.setLastModifiedTimestamp(
- rsCommon.getTimestamp("LASTMODIFIEDTIMESTAMP"));
- if(rsCommon.getString("RoutingFlag")!=null)
- {
- injuryListBean.setRoutingFlag(new Byte(
- rsCommon.getByte("ROUTINGFLAG")));
- }
- GOSIDebug.debugMessages("routing flag:"+
- injuryListBean.getRoutingFlag());
- injuryArrayList.add(injuryListBean);
- }
- // getting details for the varios codes stored in injury table
- if(injuryArrayList.size()!=0)
- {
- AddInjuryHelperBean injuryHelpBean = null;
- for(int i=0;i<injuryArrayList.size();i++)
- {
- injuryHelpBean = new AddInjuryHelperBean();
- injuryHelpBean=(AddInjuryHelperBean)injuryArrayList.get(i);
- // getting accident details
- if(injuryHelpBean.getAccidentCode()!=null)
- {
- String strQuery="";
- StringBuffer queryBuffer = new StringBuffer();
- queryBuffer.append(" select ACCIDENTCODE, ACCIDENTNAMEARB, " );
- queryBuffer.append(" ACCIDENTNAMEENG FROM ");
- queryBuffer.append(SITables.T_ACCIDENT);
- queryBuffer.append(" WHERE ");
- queryBuffer.append(" ACCIDENTCODE=? ");
- strQuery = queryBuffer.toString();
- ps=conn.prepareStatement(strQuery);
- ps.setInt(1,injuryHelpBean.getAccidentCode().shortValue());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryHelpBean.setAccidentType
- (rsCommon.getString("ACCIDENTNAMEENG"));
- injuryHelpBean.setAccidentTypeArb
- (rsCommon.getString("ACCIDENTNAMEARB"));
- }
- }// getting injury source details
- if(injuryHelpBean.getInjurySourceCode()!=null)
- {
- String strQuery="";
- StringBuffer queryBuffer = new StringBuffer();
- queryBuffer.append(OHQueryInjury.OhQry_QRY_00059 );
- queryBuffer.append("g.INJURYSOURCEARB FROM ");
- queryBuffer.append(SITables.T_INJURYSOURCE);
- queryBuffer.append(" g ");
- queryBuffer.append("WHERE ");
- queryBuffer.append("g.INJURYSOURCECODE=?");
- strQuery = queryBuffer.toString();
- ps=conn.prepareStatement(strQuery);
- ps.setInt(1,injuryHelpBean.getInjurySourceCode().
- shortValue());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryHelpBean.
- setInjurySource
- (rsCommon.getString("INJURYSOURCEENG"));
- injuryHelpBean.setInjurySourceArb(
- rsCommon.getString("INJURYSOURCEARB"));
- }
- }// getting injury nature details
- if(injuryHelpBean.getInjuryNatureCode()!=null)
- {
- String strQuery="";
- StringBuffer queryBuffer = new StringBuffer();
- queryBuffer.append(OHQueryInjury.OhQry_QRY_00060 );
- queryBuffer.append("h.INJURYNATUREARB FROM ");
- queryBuffer.append(SITables.T_INJURYNATURE);
- queryBuffer.append(" h ");
- queryBuffer.append("WHERE h.INJURYNATURECODE=?");
- strQuery=queryBuffer.toString();
- GOSIDebug.debugMessages(""+strQuery);
- ps=conn.prepareStatement(strQuery);
- ps.setInt(1,injuryHelpBean.getInjuryNatureCode().
- shortValue());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryHelpBean.setInjuryNature(
- rsCommon.getString("INJURYNATUREENG"));
- injuryHelpBean.setInjuryNatureArb(
- rsCommon.getString("INJURYNATUREARB"));
- }
- }// getting hospital details
- if(injuryHelpBean.getHospitalCode()!=null)
- {
- String strQuery="";
- StringBuffer queryBuffer = new StringBuffer();
- queryBuffer.append(OHQueryInjury.OhQry_QRY_00061 );
- queryBuffer.append("i.HOSPITALNAMEARB FROM ");
- queryBuffer.append(SITables.T_HOSPITAL);
- queryBuffer.append(" i ");
- queryBuffer.append("WHERE i.HOSPITALCODE=?");
- strQuery = queryBuffer.toString();
- GOSIDebug.debugMessages("Inside the for loop::3:Query");
- GOSIDebug.debugMessages(""+strQuery);
- ps=conn.prepareStatement(strQuery);
- ps.setLong
- (1,injuryHelpBean.getHospitalCode().intValue());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryHelpBean.setHospitalName(
- rsCommon.getString("HOSPITALNAMEENG"));
- injuryHelpBean.setHospitalNameArb(
- rsCommon.getString("HOSPITALNAMEARB"));
- }
- }// getting contributor preexisting details
- if(injuryHelpBean.getContributorId()!=null)
- {
- String strQuery="";
- StringBuffer queryBuffer = new StringBuffer();
- queryBuffer.append
- (OHQueryInjury.OhQry_QRY_00062 );
- queryBuffer.append(" PRE.PREEXISTINGDEFORMITIES ");
- queryBuffer.append
- (" FROM "+SITables.T_CONPREEXISTINGDEFORMITIES);
- queryBuffer.append(" PRE,");
- queryBuffer.append(SITables.T_CONTRIBUTOR);
- queryBuffer.append(" CON ");
- queryBuffer.append
- (" WHERE PRE.CONTRIBUTORID=CON.CONTRIBUTORID ");
- queryBuffer.append(" AND CON.CONTRIBUTORID=? ");
- strQuery=queryBuffer.toString();
- ps=conn.prepareStatement(strQuery);
- ps.setLong(1,injuryHelpBean.
- getContributorId().longValue());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryHelpBean.
- setPreExistDeformitiesId(new Long(
- rsCommon.getLong("PREEXISTINGDEFORMITIESID")));
- injuryHelpBean.setPreviousNonOH(
- rsCommon.getString("PREEXISTINGDEFORMITIES"));
- }
- }
- GOSIDebug.debugMessages("ContributorId:"+
- injuryHelpBean.getContributorId());
- GOSIDebug.debugMessages("establishmentId:"+
- injuryHelpBean.getEstablishmentId());
- // getting occupation and engagement details
- if(injuryHelpBean.getContributorId()!=null)
- {
- String strQuery="";
- StringBuffer queryBuffer = new StringBuffer();
- queryBuffer.append(
- OHQueryInjury.OhQry_QRY_00063 );
- queryBuffer.append(" ENG.JOININGMONTHLYMOVEMENTID, ");
- queryBuffer.append(" ENG.JOININGDATE,");
- queryBuffer.append(" ENG.JOININGDATEENTFMT, ");
- queryBuffer.append(" ENG.LEAVINGDATE,");
- queryBuffer.append(" ENG.LEAVINGDATEENTFMT, ");
- queryBuffer.append(" ENG.ENGAGEMENTSTATUS,");
- queryBuffer.append(" OCC.OCCUPATIONNAMEENG, ");
- queryBuffer.append(" OCC.OCCUPATIONNAMEARB ");
- queryBuffer.append(" FROM ");
- queryBuffer.append(SITables.T_ENGAGEMENT);
- queryBuffer.append(" ENG,");
- queryBuffer.append(SITables.T_OCCUPATION);
- queryBuffer.append(" OCC, ");
- queryBuffer.append(SITables.T_ENGAGEMENTOCCUPATION);
- queryBuffer.append(" ENGOCC ");
- queryBuffer.append
- (" WHERE ENG.ENGAGEMENTID=ENGOCC.ENGAGEMENTID ");
- queryBuffer.append
- (" AND OCC.OCCUPATIONCODE=ENGOCC.OCCUPATIONCODE ");
- queryBuffer.append(" AND ENG.CONTRIBUTORID=? ");
- queryBuffer.append(" AND ENG.ESTABLISHMENTID=? ");
- queryBuffer.append(" AND ENG.JOININGDATE <= ? and NVL(ENG.LEAVINGDATE,?)>= ?");
- strQuery = queryBuffer.toString();
- GOSIDebug.debugMessages(""+strQuery);
- ps=conn.prepareStatement(strQuery);
- ps.setLong(1,injuryHelpBean.
- getContributorId().longValue());
- ps.setLong(2,injuryHelpBean.
- getEstablishmentId().longValue());
- ps.setTimestamp(3,injuryHelpBean.getInjuryDate());
- ps.setTimestamp(4,new Timestamp(System.currentTimeMillis()));
- ps.setTimestamp(5,injuryHelpBean.getInjuryDate());
- rsCommon=ps.executeQuery();
- while(rsCommon.next())
- {
- injuryHelpBean.
- setEngagementId(new Long(
- rsCommon.getLong("ENGAGEMENTID")));
- injuryHelpBean.setMonthlyMovementId
- (new Long(rsCommon.
- getLong("JOININGMONTHLYMOVEMENTID")));
- injuryHelpBean.setOccupation
- (rsCommon.getString("OCCUPATIONNAMEENG"));
- injuryHelpBean.setOccupationArb
- (rsCommon.getString("OCCUPATIONNAMEARB"));
- injuryHelpBean.
- setEngagementStatus(
- rsCommon.getShort("ENGAGEMENTSTATUS"));
- injuryHelpBean.
- setJoiningDate(
- rsCommon.getTimestamp("JOININGDATE"));
- injuryHelpBean.
- setJoiningDateEntFmt
- (rsCommon.getString("JOININGDATEENTFMT"));
- if(injuryHelpBean.getJoiningDateEntFmt()!= null)
- {
- injuryHelpBean.setJoiningDateStr
- (SIUtilities.getDateString(
- injuryHelpBean.getJoiningDate(),
- injuryHelpBean.getJoiningDateEntFmt()));
- }
- injuryHelpBean.setLeavingDate(rsCommon.
- getTimestamp("LEAVINGDATE"));
- injuryHelpBean.setLeavingDateEntFmt
- (rsCommon.getString("LEAVINGDATEENTFMT"));
- if(injuryHelpBean.getLeavingDateEntFmt()!= null)
- {
- injuryHelpBean.setLeavingDateStr
- (SIUtilities.getDateString(
- injuryHelpBean.getLeavingDate(),
- injuryHelpBean.getLeavingDateEntFmt()));
- }
- }
- }
- GOSIDebug.debugMessages("EstablishmentId:"+
- injuryHelpBean.getEstablishmentId());
- // getting form submission date
- if(injuryHelpBean.getEstablishmentId()!=null &&
- injuryHelpBean.getMonthlyMovementId()!=null)
- {
- String strQuery="";
- StringBuffer queryBuffer = new StringBuffer();
- queryBuffer.append(
- OHQueryInjury.OhQry_QRY_00064 );
- queryBuffer.append
- (" FROM T_MONTHLYMOVEMENTSUMMARY ");
- queryBuffer.append
- (" WHERE MONTHLYMOVEMENTSUMMARYID=? ");
- queryBuffer.append(" AND ESTABLISHMENTID=? ");
- strQuery = queryBuffer.toString();
- ps=conn.prepareStatement(strQuery);
- ps.setLong(1,injuryHelpBean.
- getMonthlyMovementId().longValue());
- ps.setLong(2,injuryHelpBean.
- getEstablishmentId().longValue());
- GOSIDebug.debugMessages(""+strQuery);
- rsCommon=ps.executeQuery();
- while(rsCommon.next())
- {
- injuryHelpBean.
- setFormSubmissionDate(
- rsCommon.getTimestamp("FORMSUBMISSIONDATE"));
- GOSIDebug.debugMessages("FormSubmissionDate:"+
- injuryHelpBean.getFormSubmissionDate());
- injuryHelpBean.
- setFormSubmissionDateEntFmt(
- injuryHelpBean.getInjuryDateEntFmt());
- GOSIDebug.debugMessages("FormSubmissionEntFmt:"+
- injuryHelpBean.getFormSubmissionDateEntFmt());
- if (injuryHelpBean.
- getFormSubmissionDateEntFmt()!= null)
- {
- injuryHelpBean.setFormSubmissionDateStr
- (SIUtilities.getDateString(
- injuryHelpBean.getFormSubmissionDate(),
- injuryHelpBean.getFormSubmissionDateEntFmt()));
- }
- }
- }
- // getting coverage details
- if(injuryHelpBean.getEngagementId()!=null)
- {
- String strQuery ="";
- strQuery=
- OHQueryInjury.OhQry_QRY_00065 ;
- GOSIDebug.debugMessages("eng id:"+
- injuryHelpBean.getEngagementId());
- GOSIDebug.debugMessages(""+strQuery);
- ps=conn.prepareStatement(strQuery);
- ps.setLong(1,injuryHelpBean.
- getEngagementId().longValue());
- ps.setShort(2,RegistrationConstants.VALID);
- ps.setShort(3,RegistrationConstants.
- DATA_FINALLY_APPROVED.shortValue());
- //ps.setByte(4,RegistrationConstants.ACTIVE_WORKER.byteValue());
- ps.setLong(4,injuryHelpBean.
- getEngagementId().longValue());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryHelpBean.setCoverage(new Short(
- rsCommon.getShort("COVERAGE")));
- GOSIDebug.debugMessages("setCoverage::"+
- injuryHelpBean.getCoverage());
- }
- }
- finalInjuryArrayList.add(injuryHelpBean);
- }
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "searchInjModifyList()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- ge.printStackTrace();
- throw ge;
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "searchInjModifyList()", e, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- return finalInjuryArrayList;
- // returning injury details in an array list
- }
- /**
- * @METHOD NAME : searchInjuryDetailsList
- * @INFORMATION : This method will search for the Injury Details
- in the popup if the record is already exists
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList searchInjuryDetailsList
- (AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- String sqlQuery="";
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- ArrayList injuryArrayList = new ArrayList();
- ArrayList finalInjuryArrayList=new ArrayList();
- // Query to fetch the injury details in modify mode
- // sin and injury date is used to fetch the record
- // the injury bean is added in an array list and returned
- sqlQuery=OHQueryInjury.OhQry_QRY_00066 ;
- try
- {
- GOSIDebug.debugMessages(""+sqlQuery);
- GOSIDebug.debugMessages("injurydate"+injuryBean.getInjuryDate());
- GOSIDebug.debugMessages("socinsnumber"+injuryBean.getSocInsNumber());
- GOSIDebug.debugMessages("OHConstants.INJ_STS_APPROVED"+
- OHConstants.INJ_STS_APPROVED);
- GOSIDebug.debugMessages("OHConstants.WFS_INJ_PENDING_DATA_ENTRY"+
- OHConstants.WFS_INJ_PENDING_DATA_ENTRY);
- GOSIDebug.debugMessages("Injury Type:"+OHConstants.INJ_TYPE_INJURY);
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setByte(1,OHConstants.INJ_TYPE_INJURY.byteValue());
- ps.setShort(2,OHConstants.INJ_STS_APPROVED.shortValue());
- ps.setShort(3,OHConstants.
- WFS_INJ_PENDING_DATA_ENTRY.shortValue());
- ps.setLong(4,injuryBean.getSocInsNumber().longValue());
- ps.setTimestamp(5,injuryBean.getInjuryDate());
- rsCommon=ps.executeQuery();
- AddInjuryHelperBean injuryListBean =null;
- while(rsCommon.next())
- {
- injuryListBean = new AddInjuryHelperBean();
- injuryListBean.
- setInjuryId(
- new Long(rsCommon.getLong("INJURYID")));
- injuryListBean.
- setSocInsNumber(
- new Long(rsCommon.getLong("SOCINSNUMBER")));
- injuryListBean.
- setRegNumber(new Long
- (rsCommon.getLong("REGISTRATIONNUMBER")));
- injuryListBean.
- setEstablishmentId(new Long
- (rsCommon.getLong("ESTABLISHMENTID")));
- injuryListBean.
- setInjuryDate(rsCommon.getTimestamp("INJURYDATE"));
- injuryListBean.
- setInjuryDateEntFmt(
- rsCommon.getString("INJURYDATEENTFMT"));
- if (injuryListBean.getInjuryDateEntFmt()!= null)
- {
- injuryListBean.setInjuryDateStr
- (SIUtilities.getDateString(
- injuryListBean.getInjuryDate(),
- injuryListBean.getInjuryDateEntFmt()));
- }
- injuryListBean.setWorkDisabilityDate(
- rsCommon.getTimestamp("WORKDISABILITYDATE"));
- injuryListBean.setWorkDisabilityDateEntFmt(
- rsCommon.getString("WORKDISABILITYDATEENTFMT"));
- if (injuryListBean.getWorkDisabilityDateEntFmt()!= null)
- {
- injuryListBean.setWorkDisabilityDateStr
- (SIUtilities.getDateString(
- injuryListBean.getWorkDisabilityDate(),
- injuryListBean.getWorkDisabilityDateEntFmt()));
- }
- injuryListBean.
- setReceiveWageFromEmp(new Byte(
- rsCommon.getByte("RECEIVINGWAGEFROMEMP")));
- injuryListBean.setContributorId(new Long(
- rsCommon.getLong("CONTRIBUTORID")));
- injuryListBean.setInjuryNumber(
- new Long(rsCommon.getLong("INJURYNUMBER")));
- injuryListBean.setInjuryDescription(
- rsCommon.getString("DESCRIPTION"));
- String firstName="";
- String secondName="";
- String thirdName="";
- String surName="";
- String finalName="";
- if(rsCommon.getString("FIRSTNAME")!=null)
- {
- firstName=""+rsCommon.getString("FIRSTNAME");
- }
- if(rsCommon.getString("SECONDNAME")!=null)
- {
- secondName=""+rsCommon.getString("SECONDNAME");
- }
- if(rsCommon.getString("THIRDNAME")!=null)
- {
- thirdName=""+rsCommon.getString("THIRDNAME");
- }
- if(rsCommon.getString("SURNAME")!=null)
- {
- surName=""+rsCommon.getString("SURNAME");
- }
- finalName=firstName+" "+secondName+" "+thirdName+" "+surName;
- injuryListBean.setName(finalName);
- injuryListBean.
- setInjuryTimeHrs(
- rsCommon.getString("INJURYTIMEHR"));
- injuryListBean.
- setInjuryTimeMins(rsCommon.getString("INJURYTIMEMIN"));
- injuryListBean.setInjuryTimeAmPm(
- new Byte(rsCommon.getByte("INJURYTIMEAMPM")));
- injuryListBean.
- setEmpNotifyDate(rsCommon.getTimestamp
- ("EMPLOYERNOTIFYDATE"));
- injuryListBean.setEmpNotifyDateEntFmt(
- rsCommon.getString("EMPLOYERNOTIFYDATEENTFMT"));
- if (injuryListBean.getEmpNotifyDateEntFmt()!= null)
- {
- injuryListBean.setEmpNotifyDateStr
- (SIUtilities.getDateString(
- injuryListBean.getEmpNotifyDate(),
- injuryListBean.getEmpNotifyDateEntFmt()));
- }
- injuryListBean.
- setWorkerIntimateDate(rsCommon.getTimestamp
- ("WORKERINTIMATIONDATE"));
- injuryListBean.setWorkerIntDateEntFmt(
- rsCommon.getString("WORKERINTIMATIONDATEENTFMT"));
- if (injuryListBean.getWorkerIntDateEntFmt()!= null)
- {
- injuryListBean.setWorkerIntDateStr
- (SIUtilities.getDateString(
- injuryListBean.getWorkerIntimateDate(),
- injuryListBean.getWorkerIntDateEntFmt()));
- }
- injuryListBean.
- setPlaceOfInjury(
- rsCommon.getString("PLACEINJURY"));
- injuryListBean.
- setActivityAtTimeInjury(
- rsCommon.getString("ACTIVITYATTIMEINJURY"));
- injuryListBean.
- setLastModifiedTimestamp(
- rsCommon.getTimestamp("LASTMODIFIEDTIMESTAMP"));
- GOSIDebug.debugMessages("last modified timestamp:"+
- injuryListBean.getLastModifiedTimestamp());
- injuryListBean.
- setWageStoppingDate(
- rsCommon.getTimestamp("WAGESTOPDATE"));
- injuryListBean.
- setWageStoppingDateEntFmt(
- rsCommon.getString("WAGESTOPDATEENTFMT"));
- if (injuryListBean.getWageStoppingDateEntFmt()!= null)
- {
- injuryListBean.setWageStoppingDateStr
- (SIUtilities.getDateString(
- injuryListBean.getWageStoppingDate(),
- injuryListBean.getWageStoppingDateEntFmt()));
- }
- injuryListBean.
- setNationalityCode(
- new Short(rsCommon.getShort("NATIONALITYCODE")));
- injuryListBean.
- setEstablishmentName(
- rsCommon.getString("ESTABLISHMENTNAMEENG"));
- injuryListBean.
- setEstablishmentNameArb(
- rsCommon.getString("ESTABLISHMENTNAMEARB"));
- if(rsCommon.getObject("ACCIDENTCODE")!= null)
- {
- injuryListBean.setAccidentCode
- (new Short(rsCommon.getShort("ACCIDENTCODE")));
- }
- if(rsCommon.getObject("INJURYSOURCECODE") != null)
- {
- injuryListBean.
- setInjurySourceCode(
- new Short(rsCommon.getShort("INJURYSOURCECODE")));
- }
- if(rsCommon.getObject("INJURYNATURECODE")!= null)
- {
- injuryListBean.setInjuryNatureCode(
- new Short(rsCommon.getShort("INJURYNATURECODE")));
- }
- if(rsCommon.getObject("ACCIDENTOTHER")!= null)
- {
- injuryListBean.setAccidentOther(rsCommon.getString("ACCIDENTOTHER"));
- }
- if(rsCommon.getObject("DELAYREASON")!=null) {
- injuryListBean.setDelayReason(rsCommon.getString("DELAYREASON"));
- }
- if(rsCommon.getObject("INJURYSOURCEOTHER") != null)
- {
- injuryListBean.
- setInjurySourceOther(rsCommon.getString("INJURYSOURCEOTHER"));
- }
- if(rsCommon.getObject("INJURYNATUREOTHER")!= null)
- {
- injuryListBean.setInjuryNatureOther(rsCommon.getString("INJURYNATUREOTHER"));
- }
- injuryListBean.
- setHospitalCode(new Long(rsCommon.getLong("HOSPITALCODE")));
- injuryListBean.
- setInjuryStatus(new Short(rsCommon.getShort("INJURYSTATUS")));
- injuryListBean.setWorkFlowStatus(
- new Short(rsCommon.getShort("WORKFLOWSTATUS")));
- injuryListBean.setFieldOfficeCode(
- new Short(rsCommon.getShort("FIELDOFFICECODE")));
- injuryListBean.setInjuryType(
- new Byte(rsCommon.getByte("INJURYTYPE")));
- injuryListBean.
- setContactId(new Long(rsCommon.getLong("CONTACTID")));
- if(rsCommon.wasNull())
- {
- injuryListBean.setContactId(null);
- }
- injuryArrayList.add(injuryListBean);
- }
- // if the query fetches more than one record
- // each bean is itrated through this loop to set the details
- if(injuryArrayList.size()!=0)
- {
- AddInjuryHelperBean injuryHelpBean = null;
- // itrating the list
- for(int i=0;i<injuryArrayList.size();i++)
- {
- injuryHelpBean =
- new AddInjuryHelperBean();
- injuryHelpBean=
- (AddInjuryHelperBean)injuryArrayList.get(i);
- GOSIDebug.debugMessages(".......socinsnumber........"+
- injuryHelpBean.getInjuryId());
- //getting accident details
- if(injuryHelpBean.getAccidentCode()!=null)
- {
- String strQuery="";
- strQuery=OHQueryInjury.OhQry_QRY_00137 ;
- GOSIDebug.debugMessages(""+strQuery);
- ps=conn.prepareStatement(strQuery);
- ps.setInt(1,injuryHelpBean.
- getAccidentCode().intValue());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryHelpBean.setAccidentType(rsCommon.
- getString("ACCIDENTNAMEENG"));
- injuryHelpBean.setAccidentTypeArb(rsCommon.
- getString("ACCIDENTNAMEARB"));
- }
- }
- //getting injury source details
- if(injuryHelpBean.getInjurySourceCode()!=null)
- {
- String strQuery="";
- strQuery=
- OHQueryInjury.OhQry_QRY_00067 ;
- ps=conn.prepareStatement(strQuery);
- ps.setInt(1,injuryHelpBean.
- getInjurySourceCode().intValue());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryHelpBean.setInjurySource(
- rsCommon.getString("INJURYSOURCEENG"));
- injuryHelpBean.setInjurySourceArb(
- rsCommon.getString("INJURYSOURCEARB"));
- }
- }
- //getting injury nature details
- if(injuryHelpBean.getInjuryNatureCode()!=null)
- {
- String strQuery="";
- strQuery=
- OHQueryInjury.OhQry_QRY_00068 ;
- ps=conn.prepareStatement(strQuery);
- ps.setInt(1,injuryHelpBean.
- getInjuryNatureCode().intValue());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryHelpBean.setInjuryNature(
- rsCommon.getString("INJURYNATUREENG"));
- injuryHelpBean.setInjuryNatureArb(
- rsCommon.getString("INJURYNATUREARB"));
- }
- }//getting hospital details
- if(injuryHelpBean.getHospitalCode()!=null)
- {
- String strQuery="";
- strQuery=
- OHQueryInjury.OhQry_QRY_00069 ;
- ps=conn.prepareStatement(strQuery);
- ps.setLong(1,injuryHelpBean.
- getHospitalCode().longValue());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryHelpBean.setHospitalName(
- rsCommon.getString("HOSPITALNAMEENG"));
- injuryHelpBean.setHospitalNameArb(
- rsCommon.getString("HOSPITALNAMEARB"));
- }
- }// getting contributor preexisting deformities details
- if(injuryHelpBean.getContributorId()!=null)
- {
- String strQuery="";
- strQuery=
- OHQueryInjury.OhQry_QRY_00070 ;
- ps=conn.prepareStatement(strQuery);
- ps.setLong(1,injuryHelpBean.
- getContributorId().longValue());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryHelpBean.
- setPreExistDeformitiesId(new Long(
- rsCommon.getLong("PREEXISTINGDEFORMITIESID")));
- injuryHelpBean.
- setPreviousNonOH(
- rsCommon.getString("PREEXISTINGDEFORMITIES"));
- }
- }
- GOSIDebug.debugMessages("monthlymovementid:"+
- injuryHelpBean.getMonthlyMovementId());
- GOSIDebug.debugMessages("establishmentId:"+
- injuryHelpBean.getEstablishmentId());
- // getting occupation details of contributor
- if(injuryHelpBean.getContributorId()!=null)
- {
- String strQuery="";
- strQuery=
- OHQueryInjury.OhQry_QRY_00071 ;
- GOSIDebug.debugMessages(""+strQuery);
- ps=conn.prepareStatement(strQuery);
- ps.setLong(1,injuryHelpBean.
- getContributorId().longValue());
- rsCommon=ps.executeQuery();
- GOSIDebug.debugMessages("Inside engage method b4 while:");
- while(rsCommon.next())
- {
- injuryHelpBean.setEngagementId(new Long(
- rsCommon.getLong("ENGAGEMENTID")));
- injuryHelpBean.setMonthlyMovementId
- (new Long(rsCommon.
- getLong("JOININGMONTHLYMOVEMENTID")));
- injuryHelpBean.setOccupation
- (rsCommon.getString("OCCUPATIONNAMEENG"));
- injuryHelpBean.setOccupationArb
- (rsCommon.getString("OCCUPATIONNAMEARB"));
- }
- }// getting from submission date
- if(injuryHelpBean.getEstablishmentId()!=null &&
- injuryHelpBean.getMonthlyMovementId()!= null)
- {
- String strQuery="";
- strQuery=
- OHQueryInjury.OhQry_QRY_00072 ;
- ps=conn.prepareStatement(strQuery);
- ps.setLong(1,injuryHelpBean.
- getMonthlyMovementId().longValue());
- ps.setLong(2,injuryHelpBean.
- getEstablishmentId().longValue());
- GOSIDebug.debugMessages(""+strQuery);
- rsCommon=ps.executeQuery();
- while(rsCommon.next())
- {
- injuryHelpBean.
- setFormSubmissionDate(
- rsCommon.getTimestamp("FORMSUBMISSIONDATE"));
- GOSIDebug.debugMessages("FormSubmissionDate:"+
- injuryHelpBean.getFormSubmissionDate());
- injuryHelpBean.setFormSubmissionDateEntFmt(
- injuryHelpBean.getInjuryDateEntFmt());
- GOSIDebug.debugMessages("FormSubmissionEntFmt:"+
- injuryHelpBean.getFormSubmissionDateEntFmt());
- if (injuryHelpBean.
- getFormSubmissionDateEntFmt()!= null)
- {
- injuryHelpBean.setFormSubmissionDateStr
- (SIUtilities.getDateString(
- injuryHelpBean.getFormSubmissionDate(),
- injuryHelpBean.getFormSubmissionDateEntFmt()));
- }
- }
- }
- finalInjuryArrayList.add(injuryHelpBean);
- }
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "searchInjuryDetailsList()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "searchInjuryDetailsList()", e, "CMN_ERR_1000" );
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- return finalInjuryArrayList;
- // returning the result
- }
- /**
- * @METHOD NAME : searchPersonDetailsList
- * @INFORMATION : This method is to search Person Details during
- add injury if contributor is present and has a
- valid engagement it will return the details
- * @PARAM : class java.lang.Long,
- class java.sql.Timestamp
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList searchPersonDetailsList (Long socInsNumber, Timestamp injuryDate) throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- ArrayList personArrayList=new ArrayList();
- ArrayList personDetailsList=new ArrayList();
- String sqlQuery="";
- String query="";
- int vicValid=-1;
- int engVIC=-1;
- Short totalInjury=null;
- try
- {
- //Query to check if the contributor is a VIC or not
- query=OHQueryInjury.OhQry_QRY_00073 ;
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- GOSIDebug.debugMessages("Inside the for loop1:::Query");
- GOSIDebug.debugMessages(""+query);
- ps=conn.prepareStatement(query);
- ps.setLong(1,socInsNumber.longValue());
- rsCommon=ps.executeQuery();
- while(rsCommon.next())
- {
- engVIC=rsCommon.getInt("num");
- GOSIDebug.debugMessages("engVIC:"+engVIC);
- }
- //Query to get engagment details in at the time of injury
- sqlQuery=OHQueryInjury.OhQry_QRY_00074 ;
- GOSIDebug.debugMessages(""+sqlQuery);
- ps=conn.prepareStatement(sqlQuery);
- GOSIDebug.debugMessages("socinsnumber:"+socInsNumber);
- GOSIDebug.debugMessages("injuryDate:"+injuryDate);
- ps.setLong(1,socInsNumber.longValue());
- ps.setTimestamp(2,injuryDate);
- ps.setTimestamp(3,injuryDate);
- rsCommon=ps.executeQuery();
- while(rsCommon.next())
- {
- vicValid=rsCommon.getInt("num");
- GOSIDebug.debugMessages("vicValid:"+vicValid);
- }
- // Total of Injury occured This Year except compliaction.
- totalInjury = getTotalOfInjuryThisYear(socInsNumber);
- // throw exception if the contributor is vic
- if(!((vicValid == 0) && (engVIC > 0)))
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "searchPersonDetailsList()",
- new GOSIException(), "SOI_ERR_5249" );
- }
- // getting all engagement for contributor
- ArrayList engagementFullList = EngagementUtilities.displayAllEngagementForSINIncludingProactive (socInsNumber, injuryDate);
- // if no engagements throw exception
- if(engagementFullList == null ||engagementFullList.size()==0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "searchPersonDetailsList()",
- new GOSIException(), "SOI_ERR_4257" );
- }
- // if the person has engagements set person details into bean
- if(engagementFullList.size()>0)
- {
- EngagementDetailsBean engagementBean =
- (EngagementDetailsBean)engagementFullList.get(0);
- WageChangeCoverageBean wageBean =
- engagementBean.getWageChangeCoverageBean();
- EstablishmentBean establishmentBean =
- engagementBean.getEstablishmentBean();
- ContributorBean contributorBean = engagementBean.getContributorBean();
- PersonBean personBean = engagementBean.getPersonBean();
- AddInjuryHelperBean injuryListBean =new AddInjuryHelperBean();
- String finalName=personBean.getFirstName();
- if(personBean.getSecondName()!= null &&
- !"".equals(personBean.getSecondName()))
- {
- finalName = finalName+ " "+personBean.getSecondName();
- }
- if(personBean.getThirdName()!= null &&
- !"".equals(personBean.getThirdName()))
- {
- finalName = finalName+ " "+personBean.getThirdName();
- }
- if(personBean.getSurName()!= null &&
- !"".equals(personBean.getSurName()))
- {
- finalName = finalName+ " "+personBean.getSurName();
- }
- injuryListBean.setName(finalName);
- injuryListBean.setNationalityCode(personBean.getNationalityCode());
- injuryListBean.setContactId(contributorBean.getContactId());
- injuryListBean.setContributorId(contributorBean.getContributorId());
- // Additional parameters related to MOL proactive registartion project
- if(injuryListBean.getNationalityCode().equals(OHConstants.NATIONALITY_CODE_SAUDI))
- {
- injuryListBean.setIsEngagementProactive(Boolean.FALSE);
- }
- else if(engagementBean.getEngagementBean().getIsProactive().equals(RegistrationConstants.PROACTIVE_YES))
- {
- injuryListBean.setIsEngagementProactive(Boolean.TRUE);
- injuryListBean.setEngagementApprovalDate(engagementBean.getEngagementBean().getApprovalDate());
- }
- else
- {
- injuryListBean.setIsEngagementProactive(Boolean.FALSE);
- }
- personArrayList.add(injuryListBean);
- }
- // if the person has atleast one engagement
- if(personArrayList.size() >0)
- {
- int personArrayListSize = personArrayList.size();
- AddInjuryHelperBean injuryHelpBean =
- new AddInjuryHelperBean();
- injuryHelpBean=
- (AddInjuryHelperBean)personArrayList.get(0);
- // query to get contributor preexisting deformities
- String strQuery=OHQueryInjury.OhQry_QRY_00077 ;
- ps=conn.prepareStatement(strQuery);
- ps.setLong(1,injuryHelpBean.
- getContributorId().longValue());
- rsCommon=ps.executeQuery();
- GOSIDebug.debugMessages(""+strQuery);
- if(rsCommon.next())
- {
- injuryHelpBean.setPreExistDeformitiesId(new Long(
- rsCommon.getLong("PREEXISTINGDEFORMITIESID")));
- injuryHelpBean.setPreviousNonOH(
- rsCommon.getString("PREEXISTINGDEFORMITIES"));
- }
- //setting the number of engagements
- injuryHelpBean.setNoOfEngagements
- (new Integer(engagementFullList.size()));
- // setting engagement /coverage/occupation details for contributor
- if(engagementFullList.size()==1)
- {
- EngagementDetailsBean engagementDetailsBean =
- (EngagementDetailsBean)engagementFullList.get(0);
- EngagementBean engagementBean =
- engagementDetailsBean.getEngagementBean();
- WageChangeCoverageBean wageBean =
- engagementDetailsBean.getWageChangeCoverageBean();
- EstablishmentBean establishmentBean =
- engagementDetailsBean.getEstablishmentBean();
- EngagementOccupationBean engagementOccupationBean =
- engagementDetailsBean.getEngagementOccupationBean();
- injuryHelpBean.setEngagementId(engagementBean.getEngagementId());
- injuryHelpBean.setEstablishmentId
- (establishmentBean.getEstablishmentId());
- injuryHelpBean.setEngagementStatus(engagementBean.getEngagementStatus());
- injuryHelpBean.setJoiningDate(engagementBean.getJoiningDate());
- injuryHelpBean.setJoiningDateEntFmt(engagementBean.getJoiningDateEntFmt());
- injuryHelpBean.setJoiningDateStr(engagementBean.getJoiningDateStr());
- injuryHelpBean.setLeavingDate(engagementBean.getLeavingDate());
- injuryHelpBean.setLeavingDateEntFmt(engagementBean.getLeavingDateEntFmt());
- injuryHelpBean.setLeavingDateStr(engagementBean.getLeavingDateStr());
- //injuryHelpBean.setMonthlyMovementId
- injuryHelpBean.setFormSubmissionDate(engagementDetailsBean.getFormSubmissionDate());
- //injuryHelpBean.setFormSubmissionDateEntFmt(engagementDetailsBean.getFormSubmissionEntFmt());
- injuryHelpBean.setFormSubmissionDateStr(engagementDetailsBean.getFormSubmissionDateStr());
- injuryHelpBean.setRegNumber(establishmentBean.getRegistrationNumber());
- injuryHelpBean.setEstablishmentName(establishmentBean.getEstablishmentNameEng());
- injuryHelpBean.setEstablishmentNameArb(establishmentBean.getEstablishmentNameArb());
- injuryHelpBean.setEstablishmentCalendarType(establishmentBean.getCalendarType());
- injuryHelpBean.setOHEligibilityStatus(establishmentBean.getOHEligibilityStatus());
- injuryHelpBean.setResponsibleForOHPayment(establishmentBean.getResponsibleForOHPayment());
- if(!injuryHelpBean.getIsEngagementProactive()) {
- injuryHelpBean.setOccupation(engagementOccupationBean.getOccupationDescEng());
- injuryHelpBean.setOccupationArb(engagementOccupationBean.getOccupationDescArb());
- injuryHelpBean.setCoverage(wageBean.getCoverage());
- GOSIDebug.debugMessages("setCoverage::"+injuryHelpBean.getCoverage());
- injuryHelpBean.setInlandAbroad(wageBean.getInlandAbroadIndicator());
- GOSIDebug.debugMessages("inlandabroad"+injuryHelpBean.getInlandAbroad());
- if (injuryHelpBean.getOccupation() == null || injuryHelpBean.getEstablishmentName()== null)
- {
- injuryHelpBean.setOccupation (engagementOccupationBean.getOccupationDescArb());
- }
- }
- injuryHelpBean.setNumberOfInjuryThisYear(totalInjury);
- GOSIDebug.debugMessages("inlandabroad"+injuryHelpBean.getInlandAbroad());
- if (injuryHelpBean.getEstablishmentName() == null || injuryHelpBean.getEstablishmentName() == null)
- {
- injuryHelpBean.setEstablishmentName (establishmentBean.getEstablishmentNameArb());
- }
- if (injuryHelpBean.getEstablishmentCalendarType() == null || injuryHelpBean.getEstablishmentCalendarType()== null)
- {
- injuryHelpBean.setEstablishmentCalendarType (OHConstants.GREGORIAN);
- }
- }
- personDetailsList.add(injuryHelpBean);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "searchPersonDetailsList()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- GOSIDebug.debugMessages("searchPersonDetailsList:ge:"+ge);
- throw ge;
- }
- catch(Exception e)
- {
- GOSIDebug.debugMessages("searchPersonDetailsList:e:"+e);
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "searchPersonDetailsList()", e,
- "CMN_ERR_1000" );
- }
- finally
- {
- GOSIUtilities.cleanUp(conn,ps,rsCommon);
- }
- return personDetailsList;
- }
- /**
- * @METHOD NAME : searchPersonDetailsListTerminatedWorker
- * @INFORMATION : This method is to search Person Details for
- a terminated worker it will get his details of
- his last engagement.
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList searchPersonDetailsListTerminatedWorker
- (AddInjuryHelperBean injuryBean) throws GOSIException
- {
- ArrayList personDetailsList=new ArrayList();
- try
- {
- ContributorBean contributorBean = ContributorUtilities.
- displayContributorForSIN(injuryBean.getSocInsNumber());
- // getting the last terminated engagement
- EngagementBean engagementBean = EngagementUtilities.
- getLastTerminatedEngagement(contributorBean.getContributorId());
- if(engagementBean != null)
- {
- Timestamp leavingDate = engagementBean.getLeavingDate();
- Timestamp injuryDate = injuryBean.getInjuryDate();
- //leaving date is set as injury date bcos it will
- //use this date to fetch the engagement on this day
- injuryBean.setInjuryDate(leavingDate);
- personDetailsList = searchPersonDetailsList(injuryBean.getSocInsNumber(), injuryBean.getInjuryDate());
- // if still he doesnt have any enagements
- if(personDetailsList != null && personDetailsList.size()>0)
- {
- for(int i=0;i<personDetailsList.size();i++)
- {
- ((AddInjuryHelperBean)personDetailsList.get(i)).setInjuryDate(injuryDate);
- }
- }else
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "searchPersonDetailsList()",
- new GOSIException(), "SOI_ERR_4257" );
- }
- }
- else
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "searchPersonDetailsList()",
- new GOSIException(), "SOI_ERR_4257" );
- }
- }
- catch (GOSIException ge)
- {
- GOSIDebug.debugMessages("searchPersonDetailsListTerminatedWorker:ge:"+ge);
- throw ge;
- }
- catch(Exception e)
- {
- GOSIDebug.debugMessages("searchPersonDetailsListTerminatedWorker:e:"+e);
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "searchPersonDetailsListTerminatedWorker()", e,
- "CMN_ERR_1000" );
- }
- return personDetailsList;
- }
- /**
- * @METHOD NAME : setSearchRegNumberList
- * @INFORMATION : This method is to Search engagement and
- establishment details of the worker
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList setSearchRegNumberList
- (AddInjuryHelperBean injuryBean) throws GOSIException
- {
- String sqlQuery="";
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- Timestamp compDate=null;
- startTime = System.currentTimeMillis();
- ArrayList multipleEmpList=new ArrayList();
- try
- {
- if(injuryBean.getDateComplication()!=null)
- {
- compDate=injuryBean.getDateComplication();
- }
- else
- {
- compDate=injuryBean.getInjuryDate();
- }
- GOSIDebug.debugMessages("compDate : :::::::"+compDate);
- // getting all engagements for contributor
- ArrayList engagementFullList = EngagementUtilities.
- displayAllEngagementForSIN
- (injuryBean.getSocInsNumber(),compDate);
- if(engagementFullList == null ||engagementFullList.size()==0)
- {
- return multipleEmpList;
- }
- // setting engagement /coverage/occupation details for contributor
- for (int i=0;i<engagementFullList.size() ;i++ )
- {
- EngagementDetailsBean engagementDetailsBean =
- (EngagementDetailsBean)engagementFullList.get(i);
- EngagementBean engagementBean =
- engagementDetailsBean.getEngagementBean();
- WageChangeCoverageBean wageBean =
- engagementDetailsBean.getWageChangeCoverageBean();
- EstablishmentBean establishmentBean =
- engagementDetailsBean.getEstablishmentBean();
- EngagementOccupationBean engagementOccupationBean =
- engagementDetailsBean.getEngagementOccupationBean();
- if (injuryBean.getEstablishmentId()==null || !injuryBean.getEstablishmentId().equals(establishmentBean.getEstablishmentId()))
- {
- AddInjuryHelperBean injuryHelpBean=new AddInjuryHelperBean();
- injuryHelpBean.setSocInsNumber(injuryBean.getSocInsNumber());
- injuryHelpBean.setEngagementId(engagementBean.getEngagementId());
- injuryHelpBean.setEstablishmentId
- (establishmentBean.getEstablishmentId());
- injuryHelpBean.setEngagementStatus(engagementBean.getEngagementStatus());
- injuryHelpBean.setJoiningDate(engagementBean.getJoiningDate());
- injuryHelpBean.setJoiningDateEntFmt(engagementBean.getJoiningDateEntFmt());
- injuryHelpBean.setJoiningDateStr(engagementBean.getJoiningDateStr());
- injuryHelpBean.setLeavingDate(engagementBean.getLeavingDate());
- injuryHelpBean.setLeavingDateEntFmt(engagementBean.getLeavingDateEntFmt());
- injuryHelpBean.setLeavingDateStr(engagementBean.getLeavingDateStr());
- //injuryHelpBean.setMonthlyMovementId
- injuryHelpBean.setFormSubmissionDate(engagementDetailsBean.getFormSubmissionDate());
- //injuryHelpBean.setFormSubmissionDateEntFmt(engagementDetailsBean.getFormSubmissionEntFmt());
- injuryHelpBean.setFormSubmissionDateStr(engagementDetailsBean .getFormSubmissionDateStr());
- injuryHelpBean.setRegNumber(establishmentBean.getRegistrationNumber());
- injuryHelpBean.setEstablishmentName(establishmentBean.getEstablishmentNameEng());
- injuryHelpBean.setEstablishmentNameArb(establishmentBean.getEstablishmentNameArb());
- injuryHelpBean.setOHEligibilityStatus(establishmentBean.getOHEligibilityStatus());
- injuryHelpBean.setOccupation(engagementOccupationBean.getOccupationDescArb());
- injuryHelpBean.setOccupationArb(engagementOccupationBean.getOccupationDescArb());
- injuryHelpBean.setCoverage(wageBean.getCoverage());
- GOSIDebug.debugMessages("setCoverage::"+injuryHelpBean.getCoverage());
- injuryHelpBean.setInlandAbroad(wageBean.getInlandAbroadIndicator());
- GOSIDebug.debugMessages("inlandabroad"+injuryHelpBean.getInlandAbroad());
- multipleEmpList.add(injuryHelpBean);
- }
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "setSearchRegNumberList()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "setSearchRegNumberList()",
- e, "CMN_ERR_1000" );
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- return multipleEmpList;
- }
- /**
- * @METHOD NAME : getAccidentCodeResultList
- * @INFORMATION : This method is to search for the Accident Type from the database
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList getAccidentCodeResultList(AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- Short accidentCode=null;
- String sqlQuery="";
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- accidentCode=injuryBean.getAccidentCode();
- ArrayList popAccidentArrayList=new ArrayList();
- popAccidentArrayList.clear();
- // Query to get accident details using accident code from T_accident table
- sqlQuery=OHQueryInjury.OhQry_QRY_00087 ;
- try
- {
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setLong(1,accidentCode.intValue());
- rsCommon=ps.executeQuery();
- GOSIDebug.debugMessages(""+sqlQuery);
- if(rsCommon.next())
- {
- injuryBean.
- setAccidentType(rsCommon.getString("ACCIDENTNAMEENG"));
- injuryBean.
- setAccidentTypeArb(rsCommon.getString("ACCIDENTNAMEARB"));
- popAccidentArrayList.add(injuryBean);
- }
- if(popAccidentArrayList.size()==0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "getAccidentCodeResultList()",
- new GOSIException(), "SOI_ERR_4030" );
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "getAccidentCodeResultList()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(), "getAccidentCodeResultList()",
- e, "CMN_ERR_1000" );
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- return popAccidentArrayList;
- }
- /**
- * @METHOD NAME : getInjurySourceCodeResultList
- * @INFORMATION : This method is to search for the Injury Source from the database
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList getInjurySourceCodeResultList
- (AddInjuryHelperBean injuryBean) throws GOSIException
- {
- Short injurySourceCode=null;
- String sqlQuery="";
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- injurySourceCode=injuryBean.getInjurySourceCode();
- ArrayList popInjSourceArrayList=new ArrayList();
- popInjSourceArrayList.clear();
- // Query to get Injury Source details using InjurySource code from T_INJURYSOURCE table
- sqlQuery=OHQueryInjury.OhQry_QRY_00088 ;
- try
- {
- GOSIDebug.debugMessages(""+sqlQuery);
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setLong(1,injurySourceCode.intValue());
- GOSIDebug.debugMessages(""+sqlQuery);
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- injuryBean.
- setInjurySource(rsCommon.getString("INJURYSOURCEENG"));
- injuryBean.
- setInjurySourceArb(rsCommon.getString("INJURYSOURCEARB"));
- popInjSourceArrayList.add(injuryBean);
- }
- if(popInjSourceArrayList.size()==0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "getInjurySourceCodeResultList()",
- new GOSIException(), "SOI_ERR_4031" );
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "getInjurySourceCodeResultList()", elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "getInjurySourceCodeResultList()", e, "CMN_ERR_1000" );
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- return popInjSourceArrayList;
- }
- /**
- * @METHOD NAME : getInjuryNatureCodeResultList
- * @INFORMATION : This method is to search for the Injury Nature from the database
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList getInjuryNatureCodeResultList
- (AddInjuryHelperBean injuryBean) throws GOSIException
- {
- Short injuryNatureCode=null;
- String sqlQuery="";
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- injuryNatureCode=injuryBean.getInjuryNatureCode();
- ArrayList popInjNatureArrayList=new ArrayList();
- popInjNatureArrayList.clear();
- // Query to get Injury nature details using Injurynature code from T_INJURYNATURE table
- sqlQuery=OHQueryInjury.OhQry_QRY_00089 ;
- try
- {
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setLong(1,injuryNatureCode.intValue());
- rsCommon=ps.executeQuery();
- GOSIDebug.debugMessages(""+sqlQuery);
- if(rsCommon.next())
- {
- injuryBean.setInjuryNature
- (rsCommon.getString("INJURYNATUREENG"));
- injuryBean.setInjuryNatureArb
- (rsCommon.getString("INJURYNATUREARB"));
- popInjNatureArrayList.add(injuryBean);
- }
- if(popInjNatureArrayList.size()==0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "getInjuryNatureCodeResultList()",
- new GOSIException(), "SOI_ERR_4032" );
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "getInjuryNatureCodeResultList()", elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "getInjuryNatureCodeResultList()", e, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- return popInjNatureArrayList;
- }
- /**
- * @METHOD NAME : getHospitalCodeResultList
- * @INFORMATION : This method is to search the Hospital Name from the database
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList getHospitalCodeResultList
- (AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- Long hospitalCode=null;
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- hospitalCode=injuryBean.getHospitalCode();
- // getting hospital type and hospital name for injury
- ArrayList popHospitalArrayList=new ArrayList();
- popHospitalArrayList.clear();
- StringBuffer sbQuery = new StringBuffer();
- Timestamp minInjuryDate = null;
- Timestamp maxInjuryDate = null;
- GOSIDebug.debugMessages("Before the injurydate str:::"+
- injuryBean.getInjuryDateStr());
- if(injuryBean.getInjuryDateStr() != null)
- {
- minInjuryDate = (OHUtilities.getGregDate
- (injuryBean.getInjuryDateStr(),
- injuryBean.getInjuryDateEntFmt()));
- maxInjuryDate = (OHUtilities.getGregDate
- (injuryBean.getInjuryDateStr(),
- injuryBean.getInjuryDateEntFmt()));
- }
- else
- {
- minInjuryDate = OHUtilities.getGregDate
- (OHConstants.MIN_INJURY_DATE,OHConstants.GREGORIAN);
- maxInjuryDate = OHUtilities.getGregDate
- (OHConstants.MAX_INJURY_DATE,OHConstants.GREGORIAN);
- }
- GOSIDebug.debugMessages("min inj date " +minInjuryDate);
- GOSIDebug.debugMessages("max inj date " + maxInjuryDate);
- GOSIDebug.debugMessages("Inside the hospitalcode:");
- try
- {
- // query to get hospital details based on hospital code
- // and disease code to check the contract date in case
- // of registered hospital
- sbQuery.append(OHQueryInjury.OhQry_QRY_00090 );
- sbQuery.append(" HOSPITALNAMEARB, ");
- sbQuery.append(" HOSPITALNAMEENG FROM ");
- sbQuery.append( SITables.T_HOSPITAL );
- sbQuery.append(" WHERE HOSPITALTYPE <> ? ");
- sbQuery.append(" AND FIELDOFFICECODE = ? " );
- sbQuery.append(" AND HOSPITALCODE = ? " );
- sbQuery.append(" UNION " );
- sbQuery.append(OHQueryInjury.OhQry_QRY_00091 );
- sbQuery.append(" HOSP.HOSPITALNAMEARB, ");
- sbQuery.append(" HOSP.HOSPITALNAMEENG FROM ");
- sbQuery.append( SITables.T_HOSPITAL + " HOSP, " );
- sbQuery.append( SITables.T_HOSPITALCONTRACT );
- sbQuery.append(" CON WHERE ");
- sbQuery.append(" CON.CONTRSTDATE <= ? AND " );
- sbQuery.append(" NVL(CON.CONTRENDDATE,SYSDATE) ");
- sbQuery.append(" >= ? ");
- sbQuery.append(" AND HOSP.HOSPITALCODE = ");
- sbQuery.append(" CON.HOSPITALCODE ");
- sbQuery.append(" AND HOSP.HOSPITALTYPE = ? ");
- sbQuery.append(" AND HOSP.FIELDOFFICECODE = ? " );
- sbQuery.append(" AND HOSP.HOSPITALCODE = ? " );
- GOSIDebug.debugMessages("Before tthe conn:::::");
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- GOSIDebug.debugMessages("conn value:"+conn);
- ps=conn.prepareStatement(sbQuery.toString());
- GOSIDebug.debugMessages("unreg_hosp"+OHConstants.UNREG_HOSPITAL);
- GOSIDebug.debugMessages("injuryBean.getFieldOfficeCode()"+
- injuryBean.getFieldOfficeCode());
- GOSIDebug.debugMessages("injuryBean.getHospitalCode()"+
- injuryBean.getHospitalCode());
- GOSIDebug.debugMessages("maxInjuryDate"+maxInjuryDate);
- ps.setShort
- (1,OHConstants.REG_HOSPITAL.shortValue());
- ps.setShort
- (2,injuryBean.getFieldOfficeCode().shortValue());
- ps.setLong(3,injuryBean.getHospitalCode().longValue());
- ps.setTimestamp(4,maxInjuryDate);
- ps.setTimestamp(5,minInjuryDate);
- ps.setShort
- (6,OHConstants.REG_HOSPITAL.shortValue());
- ps.setShort
- (7,injuryBean.getFieldOfficeCode().shortValue());
- ps.setLong(8,injuryBean.getHospitalCode().longValue());
- GOSIDebug.debugMessages(""+sbQuery.toString());
- rsCommon=ps.executeQuery();
- if(rsCommon.next())
- {
- GOSIDebug.debugMessages("Inside the while:::::");
- injuryBean.
- setHospitalName(
- rsCommon.getString("HOSPITALNAMEENG"));
- injuryBean.
- setHospitalNameArb(rsCommon.getString("HOSPITALNAMEARB"));
- popHospitalArrayList.add(injuryBean);
- }
- GOSIDebug.debugMessages("Hospital list in the ses bean:"+
- popHospitalArrayList);
- if(popHospitalArrayList.size()==0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "getHospitalCodeResultList()",
- new GOSIException(), "SOI_ERR_4033" );
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "getHospitalCodeResultList()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "getHospitalCodeResultList()", e, "CMN_ERR_1000" );
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- return popHospitalArrayList;
- }
- /**
- * @METHOD NAME : checkNumberOfDays
- * @INFORMATION : This method is to get the Number of days difference
- between Complication date and Worker Intimation Date
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : int
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public int checkNumberOfDays(AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- GOSIDebug.debugMessages("CheckNumberOfDays:");
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- int dateValid=0;
- Timestamp complicationDate=injuryBean.getDateComplication();
- Timestamp workerIntimationDate=
- injuryBean.getWorkerIntimateDate();
- try
- {
- // method to get the number of days between two days
- int x=(1000*24*60*60);
- GOSIDebug.debugMessages("x value is:"+x);
- dateValid=(int)
- ((workerIntimationDate.
- getTime()-complicationDate.getTime())/x)+1;
- dateValid=dateValid-1;
- GOSIDebug.debugMessages(" Inside the date validate :::"+dateValid);
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkNumberOfDays()", e, "CMN_ERR_1000" );
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "checkNumberOfDays()", elapsedTime);
- return dateValid;
- }
- /**
- * @METHOD NAME : checkNumberOfDaysWorker
- * @INFORMATION : This method is to get the Number of days difference
- between Injury date and Worker Intimation date
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : int
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public int checkNumberOfDaysWorker(AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- int dateValid=0;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- Timestamp injuryDate=injuryBean.getInjuryDate();
- Timestamp workerIntimateDate=injuryBean.getWorkerIntimateDate();
- try
- {
- // method to get the number of days between workerIntimateDate and injuryDate
- int x=(1000*24*60*60);
- dateValid=(int)
- ((workerIntimateDate.getTime()-injuryDate.getTime())/x)+1;
- GOSIDebug.debugMessages(" before //\\the date validate :::"+dateValid);
- dateValid=dateValid-1;
- GOSIDebug.debugMessages(" Inside the date validate :::"+dateValid);
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkNumberOfDaysWorker()", e, "CMN_ERR_1000");
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "checkNumberOfDaysWorker()", elapsedTime);
- return dateValid;
- }
- /**
- * @METHOD NAME : checkNumberOfDaysEmployer
- * @INFORMATION : This method is to get the Number of days difference
- between Worker Intimation date and Employer Notification date
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : int
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public int checkNumberOfDaysEmployer(AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- int noOfDaysEmployer=0;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- Timestamp workerIntimationDate=injuryBean.getWorkerIntimateDate();
- Timestamp empNotifyDate=injuryBean.getEmpNotifyDate();
- try
- {
- // method to get the number of days between workerIntimateDate and empNotifyDate
- int x=(1000*24*60*60);
- noOfDaysEmployer=(int)
- ((empNotifyDate.getTime()-workerIntimationDate.
- getTime())/x)+1;
- noOfDaysEmployer=noOfDaysEmployer-1;
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkNumberOfDaysEmployer()", e, "CMN_ERR_1000");
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "checkNumberOfDaysEmployer()",
- elapsedTime);
- return noOfDaysEmployer;
- }
- /**
- * @METHOD NAME : checkNumberOfDaysHospital
- * @INFORMATION : This method is to get the Number of days difference
- between injury notification date and hospital PMR entry date
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : int
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public int checkNumberOfDaysHospital(AddInjuryHelperBean injuryBean) throws GOSIException
- {
- PreparedStatement ps = null;
- ResultSet rs = null;
- int noOfDaysHospital = 0;
- Timestamp injuryNotificationDate = injuryBean.getCreationTimestamp();
- try
- {
- /* Get the PMR entry date if this injury has been entered via GOSI On-Line */
- conn = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps = conn.prepareStatement("SELECT creationtimestamp FROM t_pmr WHERE injuryid = ? ");
- ps.setLong(1, injuryBean.getInjuryId());
- rs = ps.executeQuery();
- if(rs.next())
- {
- Timestamp pmrEntryDate = rs.getTimestamp("CREATIONTIMESTAMP");
- // method to get the number of days between injury notification date and PMR entry date
- int x=(1000*24*60*60);
- noOfDaysHospital=(int)
- ((pmrEntryDate.getTime()-injuryNotificationDate.
- getTime())/x)+1;
- noOfDaysHospital=noOfDaysHospital-1;
- }
- }
- catch(Exception e)
- {
- throw new GOSIException (GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkNumberOfDaysHospital()",
- e,
- "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rs);
- }
- return noOfDaysHospital;
- }
- /**
- * @METHOD NAME : checkNoOfDaysComplnDiff
- * @INFORMATION : This method is to get the Number of days difference between
- treatment end date and complication date
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean,
- class java.util.ArrayList
- * @RETURN : int
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public int checkNoOfDaysComplnDiff(AddInjuryHelperBean injuryBean,
- ArrayList trmtList)
- throws GOSIException
- {
- GOSIDebug.debugMessages("inside checkNoOfDaysCompln........sesbean");
- int noOfDaysComplnDiff=0;
- Timestamp trmtEndDate=null;
- String trmtEndDateStr="";
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- AddInjuryHelperBean injuryListBean=new AddInjuryHelperBean();
- Timestamp complicationDate=injuryBean.getDateComplication();
- try
- {
- // method to get the number of days between trmtEndDate and complicationDate
- for(int i=0;i<trmtList.size();i++)
- {
- injuryListBean=(AddInjuryHelperBean)trmtList.get(i);
- trmtEndDateStr=injuryListBean.getTrmtEndDateStr();
- }
- trmtEndDate=GOSIUtilities.getTimestamp(trmtEndDateStr);
- int x=(1000*24*60*60);
- noOfDaysComplnDiff=(int)
- ((complicationDate.getTime()-trmtEndDate.
- getTime())/x)+1;
- noOfDaysComplnDiff=noOfDaysComplnDiff-1;
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkNoOfDaysComplnDiff()", e,"CMN_ERR_1000" );
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "checkNoOfDaysComplnDiff()", elapsedTime);
- return noOfDaysComplnDiff;
- }
- /**
- * @METHOD NAME : insertBodyParts
- * @INFORMATION : This method is to insert Body Parts
- * @PARAM : class java.lang.Long,
- class java.util.ArrayList,
- class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private void insertBodyParts(Long injuryID,
- ArrayList injuredBodyPartsList,
- AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- try
- {
- //calling body parts entity
- BodyPartsEntityHome home=(BodyPartsEntityHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.BODY_PARTS_ENTITY_JNDI,
- BodyPartsEntityHome.class);
- // if body parts selected
- if(injuredBodyPartsList!=null)
- {
- for(int i=0;i<injuredBodyPartsList.size();i++)
- {
- // inserting body parts based on mode
- // M for modify
- // D for delete
- BodyPartsListBean bodyPartsBean = (BodyPartsListBean)
- injuredBodyPartsList.get(i);
- bodyPartsBean.setCreatedBy(injuryBean.getCreatedBy());
- bodyPartsBean.setCreationTimestamp(
- new Timestamp(System.currentTimeMillis()));
- if(!(("D").equals(""+bodyPartsBean.getMode())))
- {
- if(!("M".equals(""+bodyPartsBean.getMode())))
- {
- // insert into t_bodyparts table
- Long primary=GOSIUtilities.
- getPrimaryKey("T_BODYPARTS",
- bodyPartsBean.getCreatedBy());
- bodyPartsBean.setInjuryBodyPartsId(primary);
- bodyPartsBean.setInjuryId(injuryID);
- BodyPartsEntity remote=(BodyPartsEntity)home.
- create(bodyPartsBean);
- }
- }// deleting the entered body parts
- if(("D").equals(""+bodyPartsBean.getMode()))
- {
- GOSIDebug.debugMessages("Inside else bodyParts:");
- GOSIDebug.debugMessages("findByPrimaryKey:"+
- bodyPartsBean.getInjuryBodyPartsId());
- if(bodyPartsBean.getInjuryBodyPartsId()!=null)
- {
- BodyPartsEntity remote=(BodyPartsEntity)home.
- findByPrimaryKey(bodyPartsBean.
- getInjuryBodyPartsId());
- remote.remove();
- }
- }
- }
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "insertBodyParts()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "insertBodyParts()", e, "CMN_ERR_1000" );
- }
- finally
- {
- }
- }
- /**
- * @METHOD NAME : insertBodyPartsComplnEnter
- * @INFORMATION : This method is to insert Body Parts during complication injury Entry
- * @PARAM : class java.lang.Long,
- class java.util.ArrayList,
- class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private void insertBodyPartsComplnEnter(Long injuryID,
- ArrayList injuredBodyPartsList,
- AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- try
- {
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- // inserting body parts for complication
- BodyPartsEntityHome home=(BodyPartsEntityHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.BODY_PARTS_ENTITY_JNDI,
- BodyPartsEntityHome.class);
- GOSIDebug.debugMessages("Inside Insert body parts:");
- // if body parts entered
- if(injuredBodyPartsList!=null)
- {
- for(int i=0;i<injuredBodyPartsList.size();i++)
- {
- // setting audit information
- BodyPartsListBean bodyPartsBean = (BodyPartsListBean)
- injuredBodyPartsList.get(i);
- bodyPartsBean.setCreatedBy(injuryBean.getCreatedBy());
- bodyPartsBean.setCreationTimestamp(
- new Timestamp(System.currentTimeMillis()));
- Long primary=GOSIUtilities.getPrimaryKey("T_BODYPARTS",
- bodyPartsBean.getCreatedBy());
- bodyPartsBean.setInjuryBodyPartsId(primary);
- bodyPartsBean.setInjuryId(injuryID);
- // inserting body parts into the db
- BodyPartsEntity remote=(BodyPartsEntity)home.
- create(bodyPartsBean);
- }
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "insertBodyPartsComplnEnter()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "insertBodyPartsComplnEnter()", e, "CMN_ERR_1000" );
- }
- finally
- {
- }
- }
- /**
- * @METHOD NAME : insertICDDiagnosis
- * @INFORMATION : This method is to insert ICD Diagnosis Details
- * @PARAM : class java.lang.Long,
- class java.util.ArrayList,
- class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private void insertICDDiagnosis(Long injuryID,
- ArrayList icdList,
- AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- GOSIDebug.debugMessages("Inside insert ICDDiagnosis:");
- try
- {
- // method to add the selected icd details to the injury or
- // complication , records inserted if icd list is not null
- InjuryDiagnosisEntityHome home=(InjuryDiagnosisEntityHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.INJURY_DIAGNOSIS_ENTITY_JNDI,
- InjuryDiagnosisEntityHome.class);
- GOSIDebug.debugMessages("ICD LIST SIZE IN SES"+icdList.size());
- if(icdList!=null)
- {
- for(int i=0;i<icdList.size();i++)
- {
- OHPopSearchListBean icdListBean = (OHPopSearchListBean)
- icdList.get(i);
- icdListBean.setCreatedBy(injuryBean.getCreatedBy());
- // setting audit information
- icdListBean.setCreationTimestamp(
- new Timestamp(System.currentTimeMillis()));
- if(!(("D").equals(""+icdListBean.getMode())))
- {
- // if mode is new record is inserted
- GOSIDebug.debugMessages("Inside !D..Create");
- if(!("M".equals(""+icdListBean.getMode())))
- {
- GOSIDebug.debugMessages("Inside M..Create");
- Long injuryDiagnosisId=GOSIUtilities.getPrimaryKey
- ("T_INJURYDIAGNOSIS",
- icdListBean.getCreatedBy());
- icdListBean.setInjuryDiagnosisId(injuryDiagnosisId);
- icdListBean.setInjuryId(injuryID);
- InjuryDiagnosisEntity oInjuryDiagnosisEntity=
- (InjuryDiagnosisEntity)home.
- create(icdListBean);
- }
- }// id mode is D record is deleted
- if(("D").equals(""+icdListBean.getMode()))
- {
- GOSIDebug.debugMessages("Inside else bodyParts:");
- GOSIDebug.debugMessages("findByPrimaryKey:"+
- icdListBean.getInjuryDiagnosisId());
- if(icdListBean.getInjuryDiagnosisId()!=null)
- {
- InjuryDiagnosisEntity remote=
- (InjuryDiagnosisEntity)home.
- findByPrimaryKey(icdListBean.
- getInjuryDiagnosisId());
- remote.remove();
- }
- }
- }
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "insertICDDiagnosis()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "insertICDDiagnosis()", e, "CMN_ERR_1000" );
- }
- finally
- {
- }
- }
- /**
- * @METHOD NAME : subPartsList
- * @INFORMATION : This method is to search for the SubBodyParts from the database
- * @PARAM :
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList subPartsList() throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- ArrayList subPartsList = new ArrayList();
- try
- {
- // query to get the sub body parts list
- String sysDate=GOSIUtilities.getDateFullString(new Timestamp
- (System.currentTimeMillis()));
- String query=OHQueryInjury.OhQry_QRY_00092
- +SITables.T_BODYPARTS;
- GOSIDebug.debugMessages(""+query);
- conn=GOSIUtilities.getConnection
- (GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(query,
- ResultSet.TYPE_SCROLL_INSENSITIVE,
- ResultSet.CONCUR_READ_ONLY);
- rsCommon = ps.executeQuery();
- String searchValue=null;
- BodyPartsListBean subParts =null;
- while(rsCommon.next())
- {
- subParts = new BodyPartsListBean();
- searchValue=rsCommon.getString("BODYPARTSCODE");
- if(searchValue!=null)
- {
- subParts.setBodyPartCode(new Long(searchValue));
- }
- searchValue=rsCommon.getString("BODYPARTNAMEENG");
- if(searchValue!=null)
- {
- subParts.setBodyPartNameEng(searchValue);
- }
- searchValue=rsCommon.getString("BODYPARTNAMEARB");
- if(searchValue!=null)
- {
- subParts.setBodyPartNameArb(searchValue);
- }
- searchValue=rsCommon.getString("MAINBODYPARTCODE");
- if(searchValue!=null)
- {
- subParts.setMainBodyPart(new Long(searchValue));
- }
- subPartsList.add(subParts);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "subPartsList()",
- elapsedTime);
- return subPartsList;
- }
- catch(GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "subPartsList()", e, "CMN_ERR_1000" );
- }
- finally
- {
- try
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "finally of subPartsList",
- e, "CMN_ERR_1000");
- }
- }
- }
- /**
- * @METHOD NAME : mainPartsList
- * @INFORMATION : This method is to search for the main Body Parts
- from the database
- * @PARAM :
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList mainPartsList() throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- ArrayList mainPartsList = new ArrayList();
- try
- {
- // query to get the body parts list
- String sysDate=GOSIUtilities.getDateFullString(new Timestamp
- (System.currentTimeMillis()));
- String query=OHQueryInjury.OhQry_QRY_00093 ;
- GOSIDebug.debugMessages(""+query);
- conn=GOSIUtilities.getConnection
- (GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(query,
- ResultSet.TYPE_SCROLL_INSENSITIVE,
- ResultSet.CONCUR_READ_ONLY);
- rsCommon = ps.executeQuery();
- String searchValue=null;
- BodyPartsListBean mainParts =null;
- while(rsCommon.next())
- {
- mainParts = new BodyPartsListBean();
- searchValue=rsCommon.getString("BODYPARTSCODE");
- if(searchValue!=null)
- {
- mainParts.setMainBodyPart(new Long(searchValue));
- }
- searchValue=rsCommon.getString("BODYPARTNAMEENG");
- if(searchValue!=null)
- {
- mainParts.setBodyPartNameEng(searchValue);
- }
- searchValue=rsCommon.getString("BODYPARTNAMEARB");
- if(searchValue!=null)
- {
- mainParts.setBodyPartNameArb(searchValue);
- }
- mainPartsList.add(mainParts);
- }
- return mainPartsList;
- }
- catch(GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "mainPartsList()",
- e, "CMN_ERR_1000");
- }
- finally
- {
- try{
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "finally of mainPartsList",
- e,"CMN_ERR_1000");
- }
- }
- }
- /**
- * @METHOD NAME : srchBodyPartsList
- * @INFORMATION : This method is to search for the Body parts in the
- database for theworkflow
- * @PARAM : class java.lang.Long
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList srchBodyPartsList(Long injuryId) throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- String sqlQuery="";
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- try
- { // query to get the injured body parts for the injury
- // using injuryid
- sqlQuery=OHQueryInjury.OhQry_QRY_00094 ;
- GOSIDebug.debugMessages("INJURY ID IS :"+injuryId);
- GOSIDebug.debugMessages(""+sqlQuery);
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setLong(1,injuryId.longValue());
- rsCommon=ps.executeQuery();
- ArrayList bodyListArray = new ArrayList();
- BodyPartsListBean injuredPartsBean =null;
- while(rsCommon.next())
- {
- injuredPartsBean = new BodyPartsListBean();
- String searchValue=rsCommon.getString("INJUREDBODYPARTSID");
- if(searchValue!=null)
- {
- injuredPartsBean.setInjuryBodyPartsId
- (new Long(searchValue));
- }
- searchValue=rsCommon.getString("BODYPARTSCODE");
- if(searchValue!=null)
- {
- injuredPartsBean.setBodyPartCode(new Long(searchValue));
- }
- searchValue=rsCommon.getString("INJURYID");
- if(searchValue!=null)
- {
- injuredPartsBean.setMainBodyPart(new Long(searchValue));
- }
- injuredPartsBean.setBodyPartNameArb(rsCommon.getString(
- "BODYPARTNAMEARB"));
- injuredPartsBean.setBodyPartNameEng(rsCommon.getString(
- "BODYPARTNAMEENG"));
- bodyListArray.add(injuredPartsBean);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "srchBodyPartsList()",
- elapsedTime);
- return bodyListArray;
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "srchBodyPartsList()", e,
- "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- }
- /**
- * @METHOD NAME : searchPreviousInjuryId
- * @INFORMATION : This method is to search previous Injury Id for ICD Diagnosis list
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : class java.lang.Long
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public Long searchPreviousInjuryId
- (AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- Long previousInjuryId=null;
- String sqlQuery="";
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- GOSIDebug.debugMessages("Inside search ICD Diagnosis List");
- try
- {
- //Query to get the injury id for the parent injury
- // called during adding the complication for the injury
- sqlQuery=OHQueryInjury.OhQry_QRY_00095 ;
- GOSIDebug.debugMessages(""+sqlQuery);
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setLong(1,injuryBean.getInjuryNumber().longValue());
- ps.setTimestamp(2,injuryBean.getInjuryDate());
- rsCommon=ps.executeQuery();
- GOSIDebug.debugMessages("b4 while");
- while(rsCommon.next())
- {
- previousInjuryId=new Long(rsCommon.getLong("INJURYID"));
- GOSIDebug.debugMessages("PreviousInjuryId:"+previousInjuryId);
- }
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "searchPreviousInjuryId()",
- e, "CMN_ERR_1000" );
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "searchPreviousInjuryId()",
- elapsedTime);
- return previousInjuryId;
- }
- /**
- * @METHOD NAME : getTrmtEndDate
- * @INFORMATION : This method is to get Trmtment End Date
- * @PARAM : class java.lang.Long
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList getTrmtEndDate
- (Long injuryNumber)
- throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- java.sql.Timestamp treatmentDate=null;
- String sqlQuery="";
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- GOSIDebug.debugMessages("Inside search ICD Diagnosis List");
- // this method is used to get the treatment enddate in the injury table
- // using injury number as parameter
- ArrayList trmtDateList=new ArrayList();
- trmtDateList.clear();
- try
- {
- sqlQuery=OHQueryInjury.OhQry_QRY_00096 ;
- // query to get treatment end date
- GOSIDebug.debugMessages(""+sqlQuery);
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setLong(1,injuryNumber.longValue());
- ps.setLong(2,injuryNumber.longValue());
- rsCommon=ps.executeQuery();
- GOSIDebug.debugMessages("b4 while");
- AddInjuryHelperBean injuryListBean=null;
- while(rsCommon.next())
- {
- injuryListBean=new AddInjuryHelperBean();
- injuryListBean.setTmtEndDate
- (rsCommon.getTimestamp("TREATMENTENDDATE"));
- injuryListBean.setTmtEndDateEntFmt
- (rsCommon.getString("TREATMENTENDDATEENTFMT"));
- GOSIDebug.debugMessages("TrmtEndDateEntFmt:::"+
- injuryListBean.getTmtEndDateEntFmt());
- GOSIDebug.debugMessages("TrmtEndDate:::"+
- injuryListBean.getTmtEndDate());
- if (injuryListBean.getTmtEndDate()!= null &&
- injuryListBean.getTmtEndDateEntFmt()!= null)
- {
- GOSIDebug.debugMessages("inside if trmtenddate:");
- if (OHConstants.HIJRAH.equals
- (injuryListBean.getTmtEndDateEntFmt()))
- {
- injuryListBean.setTrmtEndDateStr(
- GOSIDateUtilities.convertToHijra(
- GOSIUtilities.getDateFullString
- (injuryListBean.getTmtEndDate())));
- }
- else
- {
- injuryListBean.setTrmtEndDateStr
- (GOSIUtilities.getDateFullString(
- injuryListBean.getTmtEndDate()));
- }
- }
- trmtDateList.add(injuryListBean);
- }
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "getTrmtEndDate()",
- e, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(), "getTrmtEndDate()", elapsedTime);
- return trmtDateList;
- }
- /**
- * @METHOD NAME : searchICDDiagnosisList
- * @INFORMATION : This method is to search for the ICD Codes in the
- database for the workflow
- * @PARAM : class java.lang.Long
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList searchICDDiagnosisList(Long injuryId)
- throws GOSIException
- {
- GOSIDebug.debugMessages("Inside search ICD Diagnosis List");
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- String sqlQuery="";
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- ArrayList icdList = new ArrayList();
- icdList.clear();
- try
- {
- //query to get the ICD diagnosis code entered for the disease
- // using injury id
- sqlQuery=OHQueryInjury.OhQry_QRY_00097 ;
- GOSIDebug.debugMessages("INJURY ID IS :"+injuryId);
- GOSIDebug.debugMessages(""+sqlQuery);
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setLong(1,injuryId.longValue());
- rsCommon=ps.executeQuery();
- OHPopSearchListBean icdListBean=null;
- while(rsCommon.next())
- {
- icdListBean = new OHPopSearchListBean();
- GOSIDebug.debugMessages("Inside while:");
- icdListBean.setInjuryDiagnosisId(new Long(
- rsCommon.getLong("INJURYDIAGNOSISID")));
- icdListBean.setICDDiagnosisId(new Long(rsCommon.getLong(
- "ICDDIAGNOSISID")));
- icdListBean.setICDCode(rsCommon.getString("ICD10CODE"));
- icdListBean.setDiagnosisArb(rsCommon.getString(
- "ICDDIAGNOSISARB"));
- icdListBean.setDiagnosisEng(rsCommon.getString(
- "ICDDIAGNOSISENG"));
- icdList.add(icdListBean);
- }
- }
- catch(Exception e)
- {
- e.printStackTrace();
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "searchICDDiagnosisList()",
- e, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rsCommon);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "searchICDDiagnosisList()", elapsedTime);
- return icdList;
- }
- /**
- * @METHOD NAME : getInjuryHome
- * @INFORMATION : This method is to call Injury Entity
- * @PARAM :
- * @RETURN : interface gosi.database.socialinsurance.occupationalhazards.injury.entity.InjuryEntityHome
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private InjuryEntityHome getInjuryHome() throws GOSIException
- {
- try
- {
- return (InjuryEntityHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.INJURY_ENTITY_JNDI,
- InjuryEntityHome.class);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getInjuryHome()", e, "CMN_ERR_1000"
- );
- }
- finally
- {
- }
- }
- /**
- * @METHOD NAME : getInjuryReqDocHome
- * @INFORMATION : This method is to call Injury Entity
- * @PARAM :
- * @RETURN : interface gosi.database.socialinsurance.occupationalhazards.injury.entity.InjuryReqDocHome
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private InjuryDocReqEntityHome getInjuryReqDocHome() throws GOSIException
- {
- try
- {
- return (InjuryDocReqEntityHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.INJURY_DOC_REQ_ENTITY_JNDI,
- InjuryDocReqEntityHome.class);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getInjuryReqDocHome()", e, "CMN_ERR_1000"
- );
- }
- finally
- {
- }
- }
- /**
- * @METHOD NAME : getPreExistDeformitiesHome
- * @INFORMATION : This method is to call PreexistingDeformitiesEntity
- * @PARAM :
- * @RETURN : interface gosi.database.socialinsurance.occupationalhazards.injury.entity.PreexistingDeformitiesEntityHome
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private PreexistingDeformitiesEntityHome getPreExistDeformitiesHome()
- throws GOSIException
- {
- try
- {
- return (PreexistingDeformitiesEntityHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.PREEXIST_DEFORMITIES_ENTITY_JNDI,
- PreexistingDeformitiesEntityHome.class);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(), "getPreexistingDeformitiesHome()",
- e, "CMN_ERR_1000"
- );
- }
- finally
- {
- }
- }
- /**
- * @METHOD NAME : isValidInjury
- * @INFORMATION : This method is to is Validate Injury
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : class java.util.HashMap
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private HashMap isValidInjury(AddInjuryHelperBean injuryBean)throws GOSIException
- {
- try
- {
- // the valiadation of the method is implimented in the
- // MaintainNotifyInjuryInternetSessionEJB refer that file to
- // know validation details
- MaintainNotifyInjuryInternetSessionHome home = (MaintainNotifyInjuryInternetSessionHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.MAINTAIN_NOTIFY_INJURY_INTERNET_SESSION_JNDI,
- MaintainNotifyInjuryInternetSessionHome.class);
- MaintainNotifyInjuryInternetSession remote = home.create();
- return remote.isValidInjury(injuryBean,null);
- }
- catch(GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "isValidInjury()", e, "CMN_ERR_1000");
- }
- }
- /**
- * @METHOD NAME : checkFormSubmissionDate
- * @INFORMATION : This method is to check Form Submission Date
- * @PARAM : class java.lang.Long,
- class java.sql.Timestamp
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public void checkFormSubmissionDate (Long socInsNumber, Timestamp injuryDate) throws GOSIException
- {
- PreparedStatement ps = null;
- ResultSet rs = null;
- try
- {
- String sqlQuery = "SELECT NVL(A.FORMSUBMISSIONDATE,B.JOININGDATE) as FORMSUBMISSIONDATE " +
- " FROM " + SITables.T_MONTHLYMOVEMENTSUMMARY + " a, " + SITables.T_ENGAGEMENT + " b " +
- " WHERE a.monthlymovementsummaryid(+) = b.joiningmonthlymovementid " +
- " AND b.joiningdate <= ? " +
- " AND (b.leavingdate >= ? OR b.leavingdate IS NULL) " +
- " AND b.contributorid IN ( " +
- " SELECT contributorid " +
- " FROM t_contributor " +
- " WHERE socialinsurancenumber = ?) " +
- " AND b.approvalstatus <> ? " +
- " AND b.engagementstatus NOT IN (?, ?) ";
- conn = GOSIUtilities.getConnection (GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps = conn.prepareStatement (sqlQuery);
- ps.setTimestamp (1, injuryDate);
- ps.setTimestamp (2, injuryDate);
- ps.setLong (3, socInsNumber);
- ps.setShort (4, RegistrationConstants.DATA_FINALLY_CANCELLED);
- ps.setShort (5, RegistrationConstants.ENG_CANCEL_IN_PROGRESS);
- ps.setShort (6, RegistrationConstants.ENG_CANCELLED);
- rs = ps.executeQuery ();
- if (! rs.next())
- {
- throw new GOSIException (GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkFormSubmissionDate()",
- null,
- "SOI_ERR_5782");
- }
- else if (rs.getObject ("FORMSUBMISSIONDATE") == null || ! injuryDate.after(rs.getTimestamp("FORMSUBMISSIONDATE")))
- {
- throw new GOSIException (GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkFormSubmissionDate()",
- null,
- GOSIUtilities.getDateDifference(injuryDate, rs.getTimestamp("FORMSUBMISSIONDATE")) == 0 ? "SOI_ERR_5789" : "SOI_ERR_5782");
- }
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch (Exception e)
- {
- throw new GOSIException (GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkFormSubmissionDate()",
- e,
- "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp (conn, ps, rs);
- }
- }
- /**
- * @METHOD NAME : checkTreatmentInpatient
- * @INFORMATION : This method is to check Treatment on Inpatient
- it will check whether the injury date is on inpatient period
- * @PARAM : class java.lang.Long,
- class java.sql.Timestamp
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public void checkTreatmentInpatient(Long siNumber, Timestamp injuryDate)
- throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rs =null;
- StringBuilder sqlQuery=new StringBuilder();
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- try
- {
- // this method is to check if the injury date is on an inpatient
- // period for the contributor
- sqlQuery.append(" SELECT COUNT(*) CNT ");
- sqlQuery.append(" FROM "+SITables.T_TREATMENT +" a, ");
- sqlQuery.append(SITables.T_INJURY+" b ");
- sqlQuery.append(" where a.INJURYID=b.INJURYID ");
- sqlQuery.append(" and b.SOCINSNUMBER=? ");
- sqlQuery.append(" and ( b.INJURYSTATUS != ? and b.INJURYSTATUS != ?) ");
- sqlQuery.append(" AND a.STARTDATE <= ? AND a.ENDDATE >= ? ");
- sqlQuery.append(" AND a.TREATMENTTYPE=? ");
- sqlQuery.append(" AND a.TREATMENTSTATUS <> ? ");
- GOSIDebug.debugMessages("checkTreatmentInpatient:sqlQuery:"+sqlQuery.toString());
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery.toString());
- ps.setLong(1,siNumber.longValue());
- ps.setShort(2,OHConstants.INJ_STS_CANCELLED.shortValue());
- ps.setShort(3,OHConstants.INJ_STS_REJECTED.shortValue());
- ps.setTimestamp(4,injuryDate);
- ps.setTimestamp(5,injuryDate);
- ps.setShort(6,OHConstants.TRMT_TYPE_INPATIENT.shortValue());
- ps.setShort(7,OHConstants.TRMT_STS_CANCELLED.shortValue());
- rs=ps.executeQuery();
- if(rs.next())
- {
- //Injury cannot be booked when another Injury for the same
- //contributor is taking In Patient Treatment
- if(rs.getInt("CNT")>0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkTreatmentInpatient()",
- new GOSIException(),
- "SOI_ERR_5388");
- }
- GOSIDebug.debugMessages("rs.getInt(CNT)==="+rs.getInt("CNT"));
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "checkTreatmentInpatient()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException(GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "viewUnregHospitalInvoice()",
- e,"CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rs);
- }
- }
- /**
- * @METHOD NAME : isAnyOpenInjury
- * @INFORMATION : This method is to check Any Open Injury is present
- for the contributor
- * @PARAM : class java.lang.Long
- * @RETURN : boolean
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public boolean isAnyOpenInjury(Long siNumber,Timestamp injuryDate)
- throws GOSIException
- {
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- PreparedStatement ps =null;
- ResultSet rs =null;
- String sqlQuery="";
- boolean isAnyOpenInjury = false;
- try
- {
- // Query to check whether the contributor has any open injuries
- // or not
- sqlQuery=" SELECT COUNT(1) CNT "+
- " FROM "+SITables.T_INJURY +
- " where SOCINSNUMBER=? "+
- " and (INJURYSTATUS =? or INJURYSTATUS = ? or INJURYSTATUS = ?) "+
- " and INJURYDATE != ? ";
- GOSIDebug.debugMessages("isAnyOpenInjury:sqlQuery:"+sqlQuery);
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setLong(1,siNumber.longValue());
- ps.setShort(2,OHConstants.INJ_STS_APPROVED.shortValue());
- ps.setShort(3,OHConstants.INJ_STS_NOTIFIED.shortValue());
- ps.setShort(4,OHConstants.INJ_STS_FIRST_NOTIFIED.shortValue());
- ps.setTimestamp(5,injuryDate);
- rs=ps.executeQuery();
- int count = 0;
- if(rs.next())
- {
- if(rs.getInt("CNT")>0)
- {
- // set to true if there is an open injury
- isAnyOpenInjury = true;
- count = rs.getInt("CNT");
- }
- GOSIDebug.debugMessages("rs.getInt(CNT)==="+count);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "isAnyOpenInjury()",
- elapsedTime);
- return isAnyOpenInjury;
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException(GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "isAnyOpenInjury()",
- e,"CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rs);
- }
- }
- /**
- * @METHOD NAME : generateLetter
- * @INFORMATION : This method is to generate Letter when injury is rejected
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private void generateLetter(AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- LetterHeaderBean letterHeader = null;
- HashMap letterMap=null;
- TreeMap parameterList = null;
- long printSerialNumber = 0;
- Long contactId = null;
- String injuryDateStr = "";
- Short partialDisablity = OHConstants.INJ_STS_CURED_WITH_DISABILITY;
- Long userId= null;
- try
- {
- // method to generate letter during rejection of injury
- GOSIDebug.debugMessages("-----------GENERATE LTTER--------------------");
- GOSIDebug.debugMessages("Social Insurance Number:"+injuryBean.getSocInsNumber());
- GOSIDebug.debugMessages("EstablishmentId:"+injuryBean.getEstablishmentId());
- if(null != injuryBean.getHospitalCode() && isRegisteredHospital(injuryBean.getHospitalCode()))
- {
- generateLetterHospital(injuryBean);
- }
- Timestamp injuryDate = null;
- if(injuryBean.getDateComplication()!=null)
- {
- injuryDate = injuryBean.getDateComplication();
- }else
- {
- injuryDate = injuryBean.getInjuryDate();
- }
- injuryDateStr = OHUtilities.getDateStr(injuryDate,OHConstants.GREGORIAN);
- EstablishmentBean estBean = EstablishmentUtility.
- getEstablishmentDetails(injuryBean.getEstablishmentId().longValue(),
- false,true);
- contactId = estBean.getEstablishmentContactId();
- ContributorBean conBean = ContributorUtilities.displayContributorForSIN
- (injuryBean.getSocInsNumber());
- PersonBean personBean = PersonUtilities.displayPerson(conBean.getPersonId());
- String name = personBean.getFirstName();
- if(personBean.getSecondName()!= null)
- {
- name = name + " " + personBean.getSecondName();
- }
- if(personBean.getThirdName()!= null)
- {
- name = name + " " + personBean.getThirdName();
- }
- if(personBean.getSurName()!= null)
- {
- name = name + " " + personBean.getSurName();
- }
- String reasonCode = "";
- if(injuryBean.getRejectionCode()!=null)
- {
- reasonCode = GOSIUtilities.getDomainDesc("OH Rejection Code",
- injuryBean.getRejectionCode().shortValue(),true);
- }
- if(injuryBean.getLastModifiedBy()!=null)
- {
- userId = injuryBean.getLastModifiedBy();
- }else
- {
- userId = injuryBean.getCreatedBy();
- }
- letterHeader = new LetterHeaderBean();
- letterHeader.setRequestedBy(userId);
- letterHeader.setReportId("16_02_0013");
- letterHeader.setLetterStatusFlag(new Short("5"));
- letterHeader.setRecordId(""+injuryBean.getInjuryId());
- letterHeader.setFieldOfficeCode(
- injuryBean.getFieldOfficeCode());
- letterMap = new HashMap();
- letterHeader.setStakeHolders(new Short(
- ReportConstants.STAKE_HOLDER_REG_ESTABLISHMENT),
- contactId,
- estBean.getRegistrationNumber().toString());
- letterMap.put("ESTABLISHMENTNAMEARB", ""+estBean.getEstablishmentNameArb());
- letterMap.put("REGNUM",""+estBean.getRegistrationNumber());
- letterMap.put("SINUM", ""+ injuryBean.getSocInsNumber());
- letterMap.put("CONTRIBUTORNAME",""+name);
- letterMap.put("DATEOFINJURY", "" + injuryDateStr);
- letterMap.put("REASONCODE", ""+reasonCode);
- // These S.O.P is tp Test Dynamic Field Values for Master Data
- GOSIDebug.debugMessages("Field ESTABLISHMENTNAMEARB : "+ letterMap.get("ESTABLISHMENTNAMEARB"));
- GOSIDebug.debugMessages("Field REGNUM : "+ letterMap.get("REGNUM"));
- GOSIDebug.debugMessages("Field SINUM : " + letterMap.get("SINUM"));
- GOSIDebug.debugMessages("Field CONTRIBUTORNAME : "+ letterMap.get("CONTRIBUTORNAME"));
- GOSIDebug.debugMessages("Field DATEOFINJURY : "+ letterMap.get("DATEOFINJURY"));
- GOSIDebug.debugMessages("Field REASONCODE : "+ letterMap.get("REASONCODE"));
- parameterList = new TreeMap();
- parameterList.put("1", letterMap);
- printSerialNumber = LetterUtilities.createSingleLetter(
- parameterList, letterHeader);
- GOSIDebug.debugMessages(" PRINT SERIAL NUMBER :"
- + printSerialNumber);
- /*START of Notification Letter*/
- //Establishment:
- String longName = CommonTransactions.getTransactionLongName(GOSIConstants.OCCUPATIONAL_HAZARDS_ID, "MNT_INJURY");
- Long transactionId = CommonTransactions.getTransactionId(GOSIConstants.OCCUPATIONAL_HAZARDS_ID, "MNT_INJURY");
- ArrayList identifiers = new ArrayList();
- identifiers.add(estBean.getRegistrationNumber());
- identifiers.add(SecurityAndWorkflowConstants.ESTABLISHMENT_ADMIN);
- identifiers.add(SecurityAndWorkflowConstants.OH_EMPLOYEE);
- NotificationLetterBean objNotificationLetterBean = new NotificationLetterBean();
- objNotificationLetterBean.setPrintSerialNumber(printSerialNumber);
- objNotificationLetterBean.setNotificationTitle(GOSIErrorMessages.getErrorDesc("SOI_ERR_5757")+" "+injuryBean.getSocInsNumber());
- objNotificationLetterBean.setTransactionName(longName);
- objNotificationLetterBean.setTransactionID(transactionId);
- objNotificationLetterBean.setTargetUsers(GOSIConstants.GOL_GIVEN_REG_NUM_AND_ROLES.shortValue());
- objNotificationLetterBean.setIdentifiers(identifiers);
- objNotificationLetterBean.setCreatedBy(userId);
- objNotificationLetterBean.setIssuingFieldOffice(injuryBean.getFieldOfficeCode());
- objNotificationLetterBean.setReportID(letterHeader.getReportId());
- GOSIUtilities.sendNotificationLetter(GOSIConstants.OCCUPATIONAL_HAZARDS_ID, objNotificationLetterBean);
- /*END*/
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception se)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "generateLetter()", se, "CMN_ERR_1000");
- }
- }
- /**
- * @METHOD NAME : canChangeWageStopDate
- * @INFORMATION : This method is to check whether WageStopDate can be
- changed , will throw an exception if the benefit is already paid
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private void canChangeWageStopDate(Long injuryId)throws GOSIException
- {
- PreparedStatement ps = null;
- ResultSet rs = null;
- boolean canChangeWageStopDate = false;
- try
- {
- // Query to check if oh benefit has been calculated or not
- // if oh benefit is calculated the wage stop date shd
- // not be modified
- String sqlQuery = " select OHBENID from "+
- SITables.T_OHBENEFIT +
- " where INJURYID = ? "+
- " and BENSTATUS != ? ";
- conn = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps = conn.prepareStatement(sqlQuery);
- ps.setLong(1,injuryId.longValue());
- ps.setShort(2,OHConstants.OH_BNFT_STS_CANCELLED.shortValue());
- rs = ps.executeQuery();
- if(rs.next())
- {
- canChangeWageStopDate = true;
- }
- if(canChangeWageStopDate)
- {
- //Cannot modify the wage stop date as oh benefit has been calculated
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "canChangeWageStopDate()",null,"SOI_ERR_5524");
- }
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception se)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "canChangeWageStopDate()", se, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn,ps,rs);
- }
- }
- /**
- * @METHOD NAME : searchPersonDetailsListTerminatedWorker
- * @INFORMATION : This method is to check wheather an injury has been booked for this person on this day
- * @PARAM : class java.lang.Long,
- class java.sql.Timestamp
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public void isInjuryAlreadyEntered(Long socInsNumber, Timestamp injuryDate)
- throws GOSIException
- {
- PreparedStatement ps = null;
- ResultSet rs = null;
- try
- {
- // this method checks whether an injury has already been entered
- // or not checks for any injury with same sin and injury date
- String sqlQuery = " select INJURYID from "+
- SITables.T_INJURY + " where INJURYSTATUS != ? "+
- " and SOCINSNUMBER = ? and INJURYDATE = ? ";
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setShort(1,OHConstants.INJ_STS_CANCELLED.shortValue());
- ps.setLong(2,socInsNumber.longValue());
- ps.setTimestamp(3,injuryDate);
- rs = ps.executeQuery();
- if(rs.next())
- {
- //SOI_ERR_5018
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "isInjuryAlreadyEntered()", null,"SOI_ERR_5018");
- }
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception se)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "isInjuryAlreadyEntered()", se, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn,ps,rs);
- }
- }
- /**
- * @METHOD NAME : isComplicationAlreadyEntered
- * @INFORMATION : This method is to check if the complication is already entered or not
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public void isComplicationAlreadyEntered(AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- PreparedStatement ps = null;
- ResultSet rs = null;
- try
- {
- // this method checks whether an injury has already been entered
- // or not checks for any injury with same sin and complication date
- String sqlQuery = " select INJURYID from "+
- SITables.T_INJURY + " where INJURYSTATUS != ? "+
- " and SOCINSNUMBER = ? and INJURYDATE = ? and DATECOMPLICATION = ? ";
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery);
- ps.setShort(1,OHConstants.INJ_STS_CANCELLED.shortValue());
- ps.setLong(2,injuryBean.getSocInsNumber().longValue());
- ps.setTimestamp(3,injuryBean.getInjuryDate());
- ps.setTimestamp(4,injuryBean.getDateComplication());
- rs = ps.executeQuery();
- if(rs.next())
- {
- //SOI_ERR_5018
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "isInjuryAlreadyEntered()", null,"SOI_ERR_5018");
- }
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception se)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "isInjuryAlreadyEntered()", se, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn,ps,rs);
- }
- }
- /**
- * @METHOD NAME : getParentInjuryStatus
- * @INFORMATION : This method is to get the injurystatus of the parent injury for which the complication is being entered
- * @PARAM : class java.lang.Long
- * @RETURN : class java.lang.Short
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private Short getParentInjuryStatus(Long injuryNumber) throws GOSIException
- {
- PreparedStatement ps = null;
- ResultSet rs = null;
- Short injuryStatus = null;
- try
- {
- String sqlQuery = "select INJURYSTATUS from "
- + SITables.T_INJURY
- + " where INJURYNUMBER = ? "
- + " and DATECOMPLICATION is null ";
- conn = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps = conn.prepareStatement(sqlQuery);
- ps.setLong(1,injuryNumber.longValue());
- rs = ps.executeQuery();
- if(rs.next())
- {
- injuryStatus = new Short (rs.getShort("INJURYSTATUS"));
- }
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception se)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getParentInjuryStatus()", se, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn,ps,rs);
- }
- return injuryStatus;
- }
- /**
- * @METHOD NAME : generateLetterHospital
- * @INFORMATION : This method is to generate Letter to hospital when injury is rejected
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private void generateLetterHospital(AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- LetterHeaderBean letterHeader = null;
- HashMap letterMap=null;
- TreeMap parameterList = null;
- long printSerialNumber = 0;
- Long contactId = null;
- String injuryDateStr = "";
- Short partialDisablity = OHConstants.INJ_STS_CURED_WITH_DISABILITY;
- Long userId= null;
- String patientNumber = "";
- try
- {
- // method to generate letter during rejection of injury
- GOSIDebug.debugMessages("-----------GENERATE LTTER--------------------");
- GOSIDebug.debugMessages("Social Insurance Number:"+injuryBean.getSocInsNumber());
- GOSIDebug.debugMessages("EstablishmentId:"+injuryBean.getEstablishmentId());
- Timestamp injuryDate = null;
- if(injuryBean.getDateComplication()!=null)
- {
- injuryDate = injuryBean.getDateComplication();
- }else
- {
- injuryDate = injuryBean.getInjuryDate();
- }
- injuryDateStr = OHUtilities.getDateStr(injuryDate,OHConstants.GREGORIAN);
- EstablishmentBean estBean = EstablishmentUtility.
- getEstablishmentDetails(injuryBean.getEstablishmentId().longValue(),
- false,true);
- EstablishmentBean hospitalBean = EstablishmentUtility.
- getEstablishmentDetails(injuryBean.getHospitalCode().longValue(),
- true,false);
- contactId = hospitalBean.getEstablishmentContactId();
- ContributorBean conBean = ContributorUtilities.displayContributorForSIN
- (injuryBean.getSocInsNumber());
- PersonBean personBean = PersonUtilities.displayPerson(conBean.getPersonId());
- String name = personBean.getFirstName();
- if(personBean.getSecondName()!= null)
- {
- name = name + " " + personBean.getSecondName();
- }
- if(personBean.getThirdName()!= null)
- {
- name = name + " " + personBean.getThirdName();
- }
- if(personBean.getSurName()!= null)
- {
- name = name + " " + personBean.getSurName();
- }
- String reasonCode = "";
- if(injuryBean.getRejectionCode()!=null)
- {
- reasonCode = GOSIUtilities.getDomainDesc("OH Rejection Code",
- injuryBean.getRejectionCode().shortValue(),true);
- }
- patientNumber = getPatientNumber(injuryBean.getInjuryId());
- if(injuryBean.getLastModifiedBy()!=null)
- {
- userId = injuryBean.getLastModifiedBy();
- }else
- {
- userId = injuryBean.getCreatedBy();
- }
- letterHeader = new LetterHeaderBean();
- letterHeader.setRequestedBy(userId);
- letterHeader.setReportId("16_02_0021");
- letterHeader.setLetterStatusFlag(new Short("5"));
- letterHeader.setRecordId(""+injuryBean.getInjuryId());
- letterHeader.setFieldOfficeCode(
- injuryBean.getFieldOfficeCode());
- letterMap = new HashMap();
- letterHeader.setStakeHolders(new Short(
- ReportConstants.STAKE_HOLDER_REG_HOSPITAL),
- contactId,
- injuryBean.getSocInsNumber().toString());
- letterMap.put("HOSPITALNAME", ""+hospitalBean.getEstablishmentNameArb());
- letterMap.put("ESTABLISHMENTNAMEARB", ""+estBean.getEstablishmentNameArb());
- letterMap.put("REGNUM",""+estBean.getRegistrationNumber());
- letterMap.put("SINUM", ""+ injuryBean.getSocInsNumber());
- letterMap.put("CONTRIBUTORNAME",""+name);
- letterMap.put("DATEOFINJURY", "" + injuryDateStr);
- letterMap.put("REASONCODE", ""+reasonCode);
- letterMap.put("PATIENTNUMBER", ""+patientNumber);
- // These S.O.P is tp Test Dynamic Field Values for Master Data
- GOSIDebug.debugMessages("Field ESTABLISHMENTNAMEARB : "+ letterMap.get("ESTABLISHMENTNAMEARB"));
- GOSIDebug.debugMessages("Field REGNUM : "+ letterMap.get("REGNUM"));
- GOSIDebug.debugMessages("Field SINUM : " + letterMap.get("SINUM"));
- GOSIDebug.debugMessages("Field CONTRIBUTORNAME : "+ letterMap.get("CONTRIBUTORNAME"));
- GOSIDebug.debugMessages("Field DATEOFINJURY : "+ letterMap.get("DATEOFINJURY"));
- GOSIDebug.debugMessages("Field REASONCODE : "+ letterMap.get("REASONCODE"));
- GOSIDebug.debugMessages("Field PATIENTNUMBER : "+ letterMap.get("PATIENTNUMBER"));
- parameterList = new TreeMap();
- parameterList.put("1", letterMap);
- printSerialNumber = LetterUtilities.createSingleLetter(
- parameterList, letterHeader);
- GOSIDebug.debugMessages(" PRINT SERIAL NUMBER :"
- + printSerialNumber);
- /*Start Notification Letter*/
- String longName = CommonTransactions.getTransactionLongName(GOSIConstants.OCCUPATIONAL_HAZARDS_ID, "MNT_INJURY");
- Long transactionId = CommonTransactions.getTransactionId(GOSIConstants.OCCUPATIONAL_HAZARDS_ID, "MNT_INJURY");
- ArrayList identifiers = new ArrayList();
- identifiers.add( injuryBean.getHospitalCode());
- identifiers.add(SecurityAndWorkflowConstants.HOSPITAL_EMPLOYEE);
- identifiers.add(SecurityAndWorkflowConstants.HOSPITAL_ADMIN);
- //Hospital:
- NotificationLetterBean objNotificationLetterBean2 = new NotificationLetterBean();
- objNotificationLetterBean2.setPrintSerialNumber(printSerialNumber);
- objNotificationLetterBean2.setNotificationTitle(GOSIErrorMessages.getErrorDesc("SOI_ERR_5757")+" "+injuryBean.getSocInsNumber());
- objNotificationLetterBean2.setTransactionName(longName);
- objNotificationLetterBean2.setTransactionID(transactionId);
- objNotificationLetterBean2.setTargetUsers(GOSIConstants.GOL_GIVEN_REG_NUM_AND_ROLES.shortValue());
- objNotificationLetterBean2.setIdentifiers(identifiers);
- objNotificationLetterBean2.setCreatedBy(userId);
- objNotificationLetterBean2.setIssuingFieldOffice(injuryBean.getFieldOfficeCode());
- objNotificationLetterBean2.setReportID(letterHeader.getReportId());
- GOSIUtilities.sendNotificationLetter(GOSIConstants.OCCUPATIONAL_HAZARDS_ID, objNotificationLetterBean2);
- /*End*/
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception se)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "generateLetterHospital()", se, "CMN_ERR_1000");
- }
- }
- /**
- * @METHOD NAME : getPatientNumber
- * @INFORMATION : This method is to get Patient Number
- * @PARAM : class java.lang.Long
- * @RETURN : class java.lang.String
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private String getPatientNumber(Long injuryID)throws GOSIException
- {
- PreparedStatement ps = null;
- ResultSet rs = null;
- String patientNumber = "";
- String sqlQuery="";
- try
- {
- sqlQuery=" SELECT PATIENTNUMBER FROM T_TREATMENT WHERE INJURYID =?";
- GOSIDebug.debugMessages("SQLQuery:" + sqlQuery + ":");
- GOSIDebug.debugMessages("\t\t Param 1 :" +injuryID+ ":");
- ps = conn.prepareStatement(sqlQuery);
- ps.setLong(1,injuryID.longValue());
- rs = ps.executeQuery();
- if(rs.next())
- {
- patientNumber=rs.getString("PATIENTNUMBER");
- }
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "getPatientNumber()",
- e,"CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(ps,rs);
- }
- return patientNumber;
- }
- /**
- * @METHOD NAME : getContributorDetails
- * @INFORMATION : This method is to get Contributor details
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public ArrayList getContributorDetails (AddInjuryHelperBean injuryListBean)
- throws GOSIException
- {
- ArrayList personArrayList = new ArrayList();
- PreparedStatement ps = null;
- ResultSet rsCommon = null;
- try
- {
- ContributorBean contributorBean = ContributorUtilities.
- displayContributorForSIN(injuryListBean.getSocInsNumber());
- PersonBean personBean = PersonUtilities.
- displayPerson(contributorBean.getPersonId());
- //injuryListBean =new AddInjuryHelperBean();
- String finalName=personBean.getFirstName();
- if(personBean.getSecondName()!= null &&
- !"".equals(personBean.getSecondName()))
- {
- finalName = finalName+ " "+personBean.getSecondName();
- }
- if(personBean.getThirdName()!= null &&
- !"".equals(personBean.getThirdName()))
- {
- finalName = finalName+ " "+personBean.getThirdName();
- }
- if(personBean.getSurName()!= null &&
- !"".equals(personBean.getSurName()))
- {
- finalName = finalName+ " "+personBean.getSurName();
- }
- injuryListBean.setName(finalName);
- injuryListBean.setNationalityCode(personBean.getNationalityCode());
- injuryListBean.setContactId(contributorBean.getContactId());
- injuryListBean.setContributorId(contributorBean.getContributorId());
- //
- if(injuryListBean != null)
- {
- // query to get contributor preexisting deformities
- String strQuery=OHQueryInjury.OhQry_QRY_00077 ;
- conn = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(strQuery);
- ps.setLong(1,injuryListBean.getContributorId().longValue());
- rsCommon=ps.executeQuery();
- GOSIDebug.debugMessages(""+strQuery);
- if(rsCommon.next())
- {
- injuryListBean.setPreExistDeformitiesId(new Long(
- rsCommon.getLong("PREEXISTINGDEFORMITIESID")));
- injuryListBean.setPreviousNonOH(
- rsCommon.getString("PREEXISTINGDEFORMITIES"));
- }
- }
- personArrayList.add(injuryListBean);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch (Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getContributorDetails()", e, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn,ps,rsCommon);
- }
- return personArrayList;
- }
- private boolean isRegisteredHospital(Long hospitalCode)
- throws GOSIException
- {
- boolean isRegistered = false;
- Connection con = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- String sqlQuery = null;
- sqlQuery = " SELECT HOSPITALTYPE ";
- sqlQuery += " FROM " + SITables.T_HOSPITAL;
- sqlQuery += " WHERE HOSPITALCODE = ? " ;
- try
- {
- GOSIDebug.debugMessages("SQLQuery:" + sqlQuery + ":");
- GOSIDebug.debugMessages("\t\t Param 1 :" + hospitalCode.longValue() + ":");
- con = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps = con.prepareStatement(sqlQuery);
- ps.setLong(1,hospitalCode.longValue());
- rs = ps.executeQuery();
- if(rs.next())
- {
- if(OHConstants.REG_HOSPITAL.equals(new Short(rs.getShort("HOSPITALTYPE"))))
- {
- isRegistered = true;
- }
- }
- GOSIDebug.debugMessages("isRegisteredHospital:" + isRegistered + ":");
- return isRegistered;
- }
- catch (Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "isRegisteredHospital()",e,"CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(con,ps,rs);
- }
- }
- /**
- * @METHOD NAME : getTotalOfInjuryThisYear
- * @INFORMATION : his method is to get Total of Injury occured This Year except compliaction.
- * @PARAM : class java.lang.Long
- * @RETURN : class java.lang.Short
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private Short getTotalOfInjuryThisYear(Long socialInsuranceNumber) throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rsCommon =null;
- Calendar rightNow = Calendar.getInstance();
- String countQuery="";
- Short totalInjury=null;
- //Query to get number of injury occured from begining of the current year
- countQuery = " SELECT COUNT(*) TOTALINJURY FROM T_INJURY "
- +" WHERE SOCINSNUMBER=? AND INJURYDATE>=? AND DATECOMPLICATION IS NULL";
- try
- {
- conn = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- GOSIDebug.debugMessages(""+countQuery);
- ps=conn.prepareStatement(countQuery);
- GOSIDebug.debugMessages("socinsnumber:"+socialInsuranceNumber);
- GOSIDebug.debugMessages("Current Year :"+rightNow.get(Calendar.YEAR));
- ps.setLong(1,socialInsuranceNumber.longValue());
- ps.setTimestamp(2,new Timestamp (rightNow.get(Calendar.YEAR)-1900,0,1,0,0,0,0));
- rsCommon=ps.executeQuery();
- while(rsCommon.next())
- {
- totalInjury = new Short (rsCommon.getShort("TOTALINJURY"));
- }
- return totalInjury;
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception se)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getTotalInjuryThisYear()", se, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(ps,rsCommon);
- }
- }
- /**
- * @METHOD NAME : resumeTreatmetRequest
- * @INFORMATION : This method is to insert resume treatment request for closed injury
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.ResumeBean
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- public void resumeTreatmetRequest(ResumeBean resumeBean)
- throws GOSIException
- {
- try
- {
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- // inserting resume treatment request for closed injury
- ResumeTreatmentEntityHome home=(ResumeTreatmentEntityHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.RESUMETREATMET_ENTITY_JNDI,
- ResumeTreatmentEntityHome.class);
- GOSIDebug.debugMessages("Inside Resume treatment request:");
- if(resumeBean !=null)
- {
- resumeBean.setResumeId(
- GOSIUtilities.getPrimaryKey("T_RESUMETREATMENT",
- resumeBean.getCreatedBy()));
- resumeBean.setCreationTimestamp(
- new Timestamp(System.currentTimeMillis()));
- // inserting resume treatment request for closed injury into the db
- ResumeTreatmentEntity remote=(ResumeTreatmentEntity)home.
- create(resumeBean);
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "resumeTreatmetRequest()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "resumeTreatmetRequest()", e, "CMN_ERR_1000" );
- }
- }
- /**
- * @METHOD NAME : changeRegNo
- * @INFORMATION : This method is to change the regestiration number for contributor
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.ChangeRegNoBean
- * class gosi.core.workflow.beans.WorkflowParamBean
- * @RETURN : class gosi.business.socialinsurance.occupationalhazards.injury.beans.ChangeRegNoBean
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : PRD00008536
- * @LAST MODIFIED DATE :
- **/
- public ChangeRegNoBean changeRegNo (ChangeRegNoBean selectedRegBean,WorkflowParamBean workflowParamBean)
- throws GOSIException
- {
- Connection con = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- String sqlQuery="";
- String message="";
- ChangeRegNoBean regBean= selectedRegBean;
- try
- {
- con = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- // check the record is participating in workflow. Throw error if there is a workitem for the same injury
- sqlQuery = "SELECT * FROM T_OHESTCHANGES WHERE INJURYID = ?";
- ps = con.prepareStatement(sqlQuery);
- ps.setLong(1,regBean.getInjuryId().longValue());
- rs = ps.executeQuery();
- if(rs.next()){
- //The Establishment change cannot occur because it's already done
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "changeRegNo()",null,"SOI_ERR_5605");
- }
- // check the record is participating in workflow. Throw error if there is a workitem for the same injury
- sqlQuery = "SELECT * FROM T_OHBENEFIT WHERE INJURYID = ? AND BENSTATUS =? ";
- ps = con.prepareStatement(sqlQuery);
- ps.setLong(1,regBean.getInjuryId().longValue());
- ps.setShort(2,OHConstants.OH_BNFT_STS_ENTERED.shortValue());
- rs = ps.executeQuery();
- if(rs.next()){
- //There are benefits in workflow for this injury
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "changeRegNo()",null,"SOI_ERR_5607");
- }
- //clear resultset and preparestatement
- GOSIUtilities.cleanUp(ps,rs);
- regBean.setEstChangeId(GOSIUtilities.getPrimaryKey("T_ohestchanges",regBean.getCreatedBy()));
- GOSIDebug.debugMessages("\t\t Param 1 InjuryId:" + regBean.getInjuryId().longValue() + ":");
- GOSIDebug.debugMessages("\t\t Param 2 EstChangeId:" + regBean.getEstChangeId().longValue() + ":");
- sqlQuery = "SELECT CONTRIBUTORID,ESTABLISHMENTID,INJURYNUMBER,SOCINSNUMBER " ;
- sqlQuery += " FROM "+ SITables.T_INJURY;
- sqlQuery += " WHERE injuryid = ? ";
- GOSIDebug.debugMessages("SQLQuery:" + sqlQuery + ":");
- GOSIDebug.debugMessages("\t\t Param 1 :" + regBean.getInjuryId().longValue() + ":");
- ps = con.prepareStatement(sqlQuery);
- ps.setLong(1,regBean.getInjuryId().longValue());
- rs = ps.executeQuery();
- if(rs.next())
- {
- regBean.setOldEstablishmentId(new Long(rs.getLong("ESTABLISHMENTID")));
- regBean.setSocInsNumber(new Long(rs.getLong("SOCINSNUMBER")));
- regBean.setInjuryNumber(new Long(rs.getLong("INJURYNUMBER")));
- regBean.setContributorId(new Long(rs.getLong("CONTRIBUTORID")));
- }
- String stepShortName =workflowParamBean.getStepShortName();
- String routingCriterion =workflowParamBean.getRoutingCriterion();
- if (stepShortName.equals("ADD_CHANGE_REG_NUMBER"))
- {
- if(OHConstants.COMPLETED.equals(routingCriterion))
- {
- regBean.setStatus(OHConstants.REG_NUMBER_CHANGE_ENTERED);
- regBean.setWorkflowStatus(OHConstants.WFS_REG_NUMBER_CHANGE_ENTERED_BY_SUPERVISOR);
- }
- }
- regBean.setCreationTimestamp(new Timestamp(System.currentTimeMillis()));
- EstablishmentBean oldEstBean = EstablishmentUtility.
- getEstablishmentDetails(regBean.getOldEstablishmentId().longValue(),
- false,true);
- EstablishmentBean newEstBean = EstablishmentUtility.
- getEstablishmentDetails(regBean.getNewEstablishmentId().longValue(),
- false,true);
- ContributorBean contributorBean = ContributorUtilities.
- displayContributorForSIN(regBean.getSocInsNumber());
- PersonBean personBean = PersonUtilities.
- displayPerson(contributorBean.getPersonId());
- String finalName=personBean.getFullName();
- regBean.setName(finalName);
- GOSIDebug.debugMessages("Old Establishmentid==============>:" + oldEstBean.getEstablishmentNameArb() + ":");
- GOSIDebug.debugMessages("New Establishmentid==============>:" + newEstBean.getEstablishmentNameArb() + ":");
- OHestChangesEntityHome home=getOHestChangesHome();
- OHestChangesEntity oOHestChangesEntity = (OHestChangesEntity)home.create(regBean);
- regBean.setOldEstablishmentName(oldEstBean.getEstablishmentNameArb() );
- regBean.setOldEstablishmentNumber(oldEstBean.getRegistrationNumber() );
- regBean.setNewEstablishmentName(newEstBean.getEstablishmentNameArb() );
- regBean.setNewEstablishmentNumber(newEstBean.getRegistrationNumber() );
- GOSIDebug.debugMessages("Old Establishmentid After Sitting in the Bean==============>:" + regBean.getOldEstablishmentName () + ":");
- GOSIDebug.debugMessages("New Establishmentid After Sitting in the Bean==============>:" + regBean.getNewEstablishmentName () + ":");
- GOSIDebug.debugMessages("InjuryNumber After Sitting in the Bean=====================>:" + regBean.getInjuryNumber() + ":");
- workflowParamBean.setPrimaryKeyOfTherecord(regBean.getEstChangeId().toString());
- String userName=GOSIUtilities.startWorkflow(workflowParamBean);
- message = GOSIErrorMessages.getErrorDesc("SOI_ERR_5615")+""+userName ;
- }
- catch (GOSIException ge)
- {
- GOSIDebug.debugMessages("SESSION:changeRegNo:ge:"+ge);
- sesCtx.setRollbackOnly();
- throw ge;
- }
- catch (Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "changeRegNo()",e, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(con,ps,rs);
- }
- return regBean;
- }
- /**
- * @METHOD NAME : getModifiedEstablishmentDetails
- * @INFORMATION : This method is to get details about modified establishment
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.ChangeRegNoBean
- * @RETURN : class gosi.business.socialinsurance.occupationalhazards.injury.beans.ChangeRegNoBean
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : PRD00008536
- * @LAST MODIFIED DATE :
- **/
- public ChangeRegNoBean getModifiedEstablishmentDetails (ChangeRegNoBean selectedRegBean)
- throws GOSIException
- {
- ChangeRegNoBean regBean= selectedRegBean;
- Connection con = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- String sqlQuery="";
- try
- {
- GOSIDebug.debugMessages("\t\t Param 2 EstChangeId:" + regBean.getEstChangeId().longValue() + ":");
- sqlQuery = " SELECT A.INJURYID,A.OLDESTABLISHMENTID,A.NEWESTABLISHMENTID,A.STATUS,A.WORKFLOWSTATUS,";
- sqlQuery += " B.SOCINSNUMBER,B.INJURYNUMBER,B.CONTRIBUTORID" ;
- sqlQuery += " FROM "+ SITables.T_OHESTCHANGES+" A,"+SITables.T_INJURY+" B ";
- sqlQuery += " WHERE A.INJURYID = B.INJURYID ";
- sqlQuery += " AND A.ESTCHANGESID = ? ";
- GOSIDebug.debugMessages("SQLQuery:" + sqlQuery + ":");
- GOSIDebug.debugMessages("\t\t Param 1 :" + regBean.getEstChangeId().longValue() + ":");
- con = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps = con.prepareStatement(sqlQuery);
- ps.setLong(1,regBean.getEstChangeId().longValue());
- rs = ps.executeQuery();
- if(rs.next())
- {
- regBean.setInjuryId(new Long(rs.getLong("INJURYID")));
- regBean.setOldEstablishmentId(new Long(rs.getLong("OLDESTABLISHMENTID")));
- regBean.setNewEstablishmentId(new Long(rs.getLong("NEWESTABLISHMENTID")));
- regBean.setStatus(new Short(rs.getShort("STATUS")));
- regBean.setWorkflowStatus(new Short(rs.getShort("WORKFLOWSTATUS")));
- regBean.setSocInsNumber(new Long(rs.getLong("SOCINSNUMBER")));
- regBean.setInjuryNumber(new Long(rs.getLong("INJURYNUMBER")));
- regBean.setContributorId(new Long(rs.getLong("CONTRIBUTORID")));
- }
- EstablishmentBean oldEstBean = EstablishmentUtility.
- getEstablishmentDetails(regBean.getOldEstablishmentId().longValue(),
- false,true);
- EstablishmentBean newEstBean = EstablishmentUtility.
- getEstablishmentDetails(regBean.getNewEstablishmentId().longValue(),
- false,true);
- ContributorBean contributorBean = ContributorUtilities.
- displayContributorForSIN(regBean.getSocInsNumber());
- PersonBean personBean = PersonUtilities.
- displayPerson(contributorBean.getPersonId());
- String finalName=personBean.getFullName();
- regBean.setName(finalName);
- regBean.setOldEstablishmentName(oldEstBean.getEstablishmentNameArb() );
- regBean.setOldEstablishmentNumber(oldEstBean.getRegistrationNumber() );
- regBean.setNewEstablishmentName(newEstBean.getEstablishmentNameArb() );
- regBean.setNewEstablishmentNumber(newEstBean.getRegistrationNumber() );
- GOSIDebug.debugMessages("Old Establishmentid After Sitting in the Bean==============>:" + regBean.getOldEstablishmentName () + ":");
- GOSIDebug.debugMessages("New Establishmentid After Sitting in the Bean==============>:" + regBean.getNewEstablishmentName () + ":");
- GOSIDebug.debugMessages("InjuryNumber After Sitting in the Bean=====================>:" + regBean.getInjuryNumber() + ":");
- GOSIDebug.debugMessages("Old Establishmentid==============>:" + oldEstBean.getEstablishmentNameArb() + ":");
- GOSIDebug.debugMessages("New Establishmentid==============>:" + newEstBean.getEstablishmentNameArb() + ":");
- }
- catch (GOSIException ge)
- {
- GOSIDebug.debugMessages("SESSION:getModifiedEstablishmentDetails:ge:"+ge);
- sesCtx.setRollbackOnly();
- throw ge;
- }
- catch (Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getModifiedEstablishmentDetails()",e, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(con,ps,rs);
- }
- return regBean;
- }
- /**
- * @METHOD NAME : saveChangeRegNo
- * @INFORMATION : This method is to change the registration number for contributor
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.ChangeRegNoBean
- * class gosi.core.workflow.beans.WorkflowParamBean
- * @RETURN : class java.lang.String
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : PRD00008536
- * @LAST MODIFIED DATE :
- **/
- public String saveChangeRegNo (ChangeRegNoBean selectedRegBean,WorkflowParamBean workflowParamBean)
- throws GOSIException
- {
- Connection con = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- String sqlQuery="";
- DMSRequestHeaderBean headerBean = new DMSRequestHeaderBean();
- String message="";
- try
- {
- ChangeRegNoBean regBean= selectedRegBean;
- GOSIDebug.debugMessages("\t\t Param 2 EstChangeId:" + regBean.getEstChangeId().longValue() + ":");
- sqlQuery = "SELECT o.INJURYID, o.OLDESTABLISHMENTID,o.NEWESTABLISHMENTID,o.STATUS,o.WORKFLOWSTATUS, ";
- sqlQuery += "e.REGISTRATIONNUMBER,a.INJURYNUMBER,a.SOCINSNUMBER" ;
- sqlQuery += " FROM "+ SITables.T_OHESTCHANGES +" o,"+ SITables.T_ESTABLISHMENT +" e,"+ SITables.T_INJURY +" a";
- sqlQuery += " WHERE o.ESTCHANGESID = ? AND e.ESTABLISHMENTID = o.NEWESTABLISHMENTID AND a.INJURYID = o.INJURYID ";
- GOSIDebug.debugMessages("SQLQuery:" + sqlQuery + ":");
- GOSIDebug.debugMessages("\t\t Param 1 :" + regBean.getEstChangeId().longValue() + ":");
- con = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps = con.prepareStatement(sqlQuery);
- ps.setLong(1,regBean.getEstChangeId().longValue());
- rs = ps.executeQuery();
- if(rs.next())
- {
- regBean.setInjuryId(new Long(rs.getLong("INJURYID")));
- regBean.setOldEstablishmentId(new Long(rs.getLong("OLDESTABLISHMENTID")));
- regBean.setNewEstablishmentId(new Long(rs.getLong("NEWESTABLISHMENTID")));
- regBean.setNewRegistrationNumber(new Long(rs.getLong("REGISTRATIONNUMBER")));
- regBean.setStatus(new Short(rs.getShort("STATUS")));
- regBean.setWorkflowStatus(new Short(rs.getShort("WORKFLOWSTATUS")));
- regBean.setInjuryNumber(new Long(rs.getLong("INJURYNUMBER")));
- regBean.setSocInsNumber(new Long(rs.getLong("SOCINSNUMBER")));
- }
- GOSIDebug.debugMessages("OldEstablishmentId:" + regBean.getOldEstablishmentId() + ":");
- AddInjuryHelperBean injuryBean =null;
- injuryBean = new AddInjuryHelperBean();
- injuryBean.setInjuryId(regBean.getInjuryId());
- injuryBean.setEstablishmentId(regBean.getNewEstablishmentId());
- injuryBean.setLastModifiedBy((regBean.getLastModifiedBy()));
- injuryBean.setLastModifiedTimestamp(new Timestamp(System.currentTimeMillis()));
- GOSIDebug.debugMessages("NewEstablishmentId:" + injuryBean.getEstablishmentId() + ":");
- GOSIDebug.debugMessages("LastModifiedBy:" + injuryBean.getLastModifiedBy() + ":");
- GOSIDebug.debugMessages("LastModifiedTimestamp:" + injuryBean.getLastModifiedTimestamp() + ":");
- String stepShortName = workflowParamBean.getStepShortName();
- String routingCriterion = workflowParamBean.getRoutingCriterion();
- if (stepShortName.equals("VER_CHANGE_REG_NUMBER_OH_HEAD"))
- {
- if(OHConstants.COMPLETED.equals(routingCriterion))
- {
- regBean.setStatus(OHConstants.REG_NUMBER_CHANGE_APPROVED);
- regBean.setWorkflowStatus(OHConstants.WFS_REG_NUMBER_CHANGE_APPROVED_BY_OH_HEAD);
- OHestChangesEntityHome home=getOHestChangesHome();
- OHestChangesEntity oOHestChangesEntity =(OHestChangesEntity)home.findByPrimaryKey (regBean.getEstChangeId());
- oOHestChangesEntity.updateStatusAndWorkflowStatus(regBean);
- InjuryEntityHome injuryhome=getInjuryHome();
- InjuryEntity oInjuryEntity =(InjuryEntity)injuryhome.findByPrimaryKey
- (injuryBean.getInjuryId());
- oInjuryEntity.updateEstablishmentId(injuryBean);
- workflowParamBean.setPrimaryKeyOfTherecord(regBean.getEstChangeId().toString());
- headerBean.setTransactionStepName("ADD_OH_INJURY_MENU");
- headerBean.setSourceRecordId("" + regBean.getInjuryId());
- headerBean.setKeyList(DMSConstants.SI_NUMBER,"" + regBean.getSocInsNumber());
- headerBean.setKeyList(DMSConstants.REGISTRATION_NUMBER,"" + regBean.getNewRegistrationNumber());
- headerBean.setKeyList(DMSConstants.INJURY_NUMBER,"" + regBean.getInjuryNumber());
- headerBean.setModuleId(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- GOSIUtilities.updateScanReqDetails(headerBean);
- GOSIUtilities.startWorkflow(workflowParamBean);
- message = GOSIErrorMessages.getErrorDesc("SOI_ERR_5400");
- }
- else if(OHConstants.REJECTED.equals(routingCriterion))
- {
- regBean.setStatus(OHConstants.REG_NUMBER_CHANGE_REJECTED);
- regBean.setWorkflowStatus(OHConstants.WFS_REG_NUMBER_CHANGE_REJECTED_BY_OH_HEAD);
- OHestChangesEntityHome home=getOHestChangesHome();
- OHestChangesEntity oOHestChangesEntity =(OHestChangesEntity)home.findByPrimaryKey (regBean.getEstChangeId());
- oOHestChangesEntity.updateStatusAndWorkflowStatus(regBean);
- workflowParamBean.setPrimaryKeyOfTherecord(regBean.getEstChangeId().toString());
- String userName=GOSIUtilities.startWorkflow(workflowParamBean);
- message = GOSIErrorMessages.getErrorDesc("SOI_ERR_5401")+""+userName;
- }
- }
- if (stepShortName.equals("REENTER_CHANGE_REG_NUMBER"))
- {
- if(OHConstants.COMPLETED.equals(routingCriterion))
- {
- regBean.setStatus(OHConstants.REG_NUMBER_CHANGE_ENTERED);
- regBean.setWorkflowStatus(OHConstants.WFS_REG_NUMBER_CHANGE_RENTERED_BY_SUPERVISOR);
- OHestChangesEntityHome home=getOHestChangesHome();
- OHestChangesEntity oOHestChangesEntity =(OHestChangesEntity)home.findByPrimaryKey (regBean.getEstChangeId());
- oOHestChangesEntity.updateStatusAndWorkflowStatus(regBean);
- workflowParamBean.setPrimaryKeyOfTherecord(regBean.getEstChangeId().toString());
- String userName=GOSIUtilities.startWorkflow(workflowParamBean);
- message = GOSIErrorMessages.getErrorDesc("SOI_ERR_5402")+""+userName;;
- }
- if(OHConstants.REJECTED.equals(routingCriterion))
- {
- regBean.setStatus(OHConstants.REG_NUMBER_CHANGE_CANCELLED);
- regBean.setWorkflowStatus(OHConstants.WFS_REG_NUMBER_CHANGE_CANCELLED_BY_OH_SUPERVISOR);
- OHestChangesEntityHome home=getOHestChangesHome();
- OHestChangesEntity oOHestChangesEntity =(OHestChangesEntity)home.findByPrimaryKey (regBean.getEstChangeId());
- oOHestChangesEntity.updateStatusAndWorkflowStatus(regBean);
- workflowParamBean.setPrimaryKeyOfTherecord(regBean.getEstChangeId().toString());
- GOSIUtilities.startWorkflow(workflowParamBean);
- message = GOSIErrorMessages.getErrorDesc("SOI_ERR_5608");
- }
- }
- }
- catch (GOSIException ge)
- {
- GOSIDebug.debugMessages("SESSION:saveChangeRegNo:ge:"+ge);
- sesCtx.setRollbackOnly();
- throw ge;
- }
- catch (Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "saveChangeRegNo()",e, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(con,ps,rs);
- }
- return message;
- }
- /**
- * @METHOD NAME : getInjuryDetials
- * @INFORMATION : This method is to get injury details
- * @PARAM : class java.lang.Long
- * @RETURN : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean,
- * @EXCEPTION : class java.rmi.RemoteException,
- class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : PRD00008536
- * @LAST MODIFIED DATE :
- **/
- public AddInjuryHelperBean getInjuryDetails (Long estChangeId)
- throws GOSIException
- {
- Connection con = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- String sqlQuery="";
- AddInjuryHelperBean injuryBean =null;
- try
- {
- injuryBean = new AddInjuryHelperBean();
- sqlQuery = " SELECT B.INJURYDATE,B.SOCINSNUMBER,B.INJURYNUMBER,B.CONTRIBUTORID,B.ESTABLISHMENTID" ;
- sqlQuery += " FROM "+ SITables.T_OHESTCHANGES+" A,"+SITables.T_INJURY+" B ";
- sqlQuery += " WHERE A.INJURYID = B.INJURYID ";
- sqlQuery += " AND A.ESTCHANGESID = ? ";
- GOSIDebug.debugMessages("SQLQuery:" + sqlQuery + ":");
- GOSIDebug.debugMessages("\t\t Param 1 :" + estChangeId+ ":");
- con = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps = con.prepareStatement(sqlQuery);
- ps.setLong(1,estChangeId.longValue());
- rs = ps.executeQuery();
- if(rs.next())
- {
- injuryBean.setInjuryDate(rs.getTimestamp("INJURYDATE"));
- injuryBean.setSocInsNumber(new Long(rs.getLong("SOCINSNUMBER")));
- injuryBean.setInjuryNumber(new Long(rs.getLong("INJURYNUMBER")));
- injuryBean.setContributorId(new Long(rs.getLong("CONTRIBUTORID")));
- injuryBean.setEstablishmentId(new Long(rs.getLong("ESTABLISHMENTID")));
- }
- GOSIDebug.debugMessages("SocInsNumber After Sitting in the Bean==============>:" + injuryBean.getSocInsNumber () + ":");
- GOSIDebug.debugMessages("SocInsNumber After Sitting in the Bean==============>:" + injuryBean.getInjuryDate() + ":");
- GOSIDebug.debugMessages("InjuryNumber After Sitting in the Bean=====================>:" + injuryBean.getInjuryNumber() + ":");
- GOSIDebug.debugMessages("ContributorId After Sitting in the Bean=====================>:" + injuryBean.getContributorId() + ":");
- }
- catch (GOSIException ge)
- {
- GOSIDebug.debugMessages("SESSION:getInjuryDetials:ge:"+ge);
- sesCtx.setRollbackOnly();
- throw ge;
- }
- catch (Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getInjuryDetials()",e, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(con,ps,rs);
- }
- return injuryBean;
- }
- /**
- * @METHOD NAME : getinjuryBean
- * @INFORMATION : This method is to get injurydate or complication date
- * @PARAM : class gosi.business.socialinsurance.occupationalhazards.injury.beans.AddInjuryHelperBean
- * @RETURN : class java.util.ArrayList
- * @EXCEPTION : class java.rmi.RemoteException,
- class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : PRD00008536
- * @LAST MODIFIED DATE :
- **/
- public ArrayList getinjuryBean (AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- ArrayList resultRegList = new ArrayList();
- Connection con = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- String sqlQuery="";
- Long injuryId =null;
- try
- {
- injuryId = injuryBean.getInjuryId();
- if (!(injuryId==null))
- {
- sqlQuery = "SELECT INJURYDATE,DATECOMPLICATION,ESTABLISHMENTID" ;
- sqlQuery += " FROM "+ SITables.T_INJURY;
- sqlQuery += " WHERE INJURYID = ? ";
- GOSIDebug.debugMessages("SQLQuery:" + sqlQuery + ":");
- GOSIDebug.debugMessages("\t\t Param 1 :" +injuryBean.getInjuryId().longValue()+ ":");
- con = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps = con.prepareStatement(sqlQuery);
- ps.setLong(1,injuryBean.getInjuryId().longValue());
- rs = ps.executeQuery();
- if(rs.next())
- {
- injuryBean.setInjuryDate(rs.getTimestamp("INJURYDATE"));
- injuryBean.setDateComplication(rs.getTimestamp("DATECOMPLICATION"));
- injuryBean.setEstablishmentId(rs.getLong("ESTABLISHMENTID"));
- }
- }
- else
- {
- sqlQuery = "SELECT INJURYDATE,DATECOMPLICATION,ESTABLISHMENTID" ;
- sqlQuery += " FROM "+ SITables.T_INJURY;
- sqlQuery += " WHERE SOCINSNUMBER = ? ";
- GOSIDebug.debugMessages("SQLQuery:" + sqlQuery + ":");
- GOSIDebug.debugMessages("\t\t Param 1 :" +injuryBean.getSocInsNumber().longValue()+ ":");
- con = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps = con.prepareStatement(sqlQuery);
- ps.setLong(1,injuryBean.getSocInsNumber().longValue());
- rs = ps.executeQuery();
- if(rs.next())
- {
- injuryBean.setInjuryDate(rs.getTimestamp("INJURYDATE"));
- injuryBean.setDateComplication(rs.getTimestamp("DATECOMPLICATION"));
- injuryBean.setEstablishmentId(rs.getLong("ESTABLISHMENTID"));
- }
- }
- resultRegList=setSearchRegNumberList(injuryBean);
- }
- catch (GOSIException ge)
- {
- GOSIDebug.debugMessages("SESSION:insertRecordList:ge:"+ge);
- sesCtx.setRollbackOnly();
- throw ge;
- }
- catch (Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getinjuryBean()",e, "CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(con,ps,rs);
- }
- return resultRegList;
- }
- /**
- * @METHOD NAME : getOHestChangesHome
- * @INFORMATION : This method is to call Injury Entity
- * @PARAM :
- * @RETURN : interface gosi.database.socialinsurance.occupationalhazards.injury.entity.OHestChangesEntity
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : PRD00008536
- * @LAST MODIFIED DATE :
- **/
- private OHestChangesEntityHome getOHestChangesHome() throws GOSIException
- {
- try
- {
- return (OHestChangesEntityHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.OHESTCHANGES_ENTITY_JNDI,
- OHestChangesEntityHome.class);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getOHestChangesHome()", e, "CMN_ERR_1000"
- );
- }
- }
- /**
- * @METHOD NAME : getInjuryDocReqList
- * @INFORMATION : This method is to call Injury Entity
- * @PARAM :
- * @RETURN : interface gosi.database.socialinsurance.occupationalhazards.injury.entity.InjuryDocReqSearchBean
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : PRD00008536
- * @LAST MODIFIED DATE :
- **/
- public HashMap getInjuryDocReqList
- (Long injuryid) throws GOSIException
- {
- ArrayList injuryDocReqListBean =new ArrayList();
- ArrayList docReq =new ArrayList();
- HashMap result=new HashMap();
- InjuryDocReqSearchBean injuryDocReqSearch=new InjuryDocReqSearchBean();
- injuryDocReqSearch.setInjuryId(injuryid);
- InjuryDocReqListBean injuryDocReq =null;
- Connection con = null;
- PreparedStatement ps = null;
- ResultSet rs = null;
- String sqlQuery="";
- try
- {
- sqlQuery = "SELECT INJURYDOCREQID,DOCREQ,CREATIONTIMESTAMP" ;
- sqlQuery += " FROM "+ SITables.T_INJURYDOCREQ;
- sqlQuery += " WHERE INJURYID = ? AND LASTMODIFIEDBY is null order by DOCREQ Asc";
- GOSIDebug.debugMessages("SQLQuery:" + sqlQuery + ":");
- GOSIDebug.debugMessages("\t\t Param 1 :" +injuryid.longValue()+ ":");
- con = GOSIUtilities.getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps = con.prepareStatement(sqlQuery);
- ps.setLong(1,injuryid.longValue());
- rs = ps.executeQuery();
- while(rs.next())
- {
- injuryDocReq =new InjuryDocReqListBean();
- injuryDocReq.setInjuryDocReqId(rs.getLong("INJURYDOCREQID"));
- injuryDocReq.setInjuryId(injuryid);
- injuryDocReq.setDocReq(rs.getLong("DOCREQ"));
- injuryDocReq.setCreationTimestamp(rs.getTimestamp("CREATIONTIMESTAMP"));
- docReq.add(injuryDocReq.getDocReq().toString());
- injuryDocReqListBean.add(injuryDocReq);
- }
- if(injuryDocReqListBean.size()==0){
- sqlQuery = "SELECT INJURYDOCREQID,DOCREQ,CREATIONTIMESTAMP" ;
- sqlQuery += " FROM "+ SITables.T_INJURYDOCREQ;
- sqlQuery += " WHERE INJURYID = ? AND LASTMODIFIEDTIMESTAMP > to_date ((SELECT to_date(max (CREATIONTIMESTAMP))"
- +" FROM T_INJURYDOCREQ WHERE INJURYID = ? ))order by DOCREQ Asc";
- ps = con.prepareStatement(sqlQuery);
- ps.setLong(1,injuryid.longValue());
- ps.setLong(2,injuryid.longValue());
- rs = ps.executeQuery();
- while(rs.next())
- {
- injuryDocReq =new InjuryDocReqListBean();
- injuryDocReq.setInjuryDocReqId(rs.getLong("INJURYDOCREQID"));
- injuryDocReq.setInjuryId(injuryid);
- injuryDocReq.setDocReq(rs.getLong("DOCREQ"));
- injuryDocReq.setCreationTimestamp(rs.getTimestamp("CREATIONTIMESTAMP"));
- docReq.add(injuryDocReq.getDocReq().toString());
- injuryDocReqListBean.add(injuryDocReq);
- }
- }
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getOHestChangesHome()", e, "CMN_ERR_1000"
- );
- }
- finally{
- if(docReq.size()>0){
- injuryDocReqSearch.setDocReq(docReq);
- result.put("injuryDocReq", injuryDocReqSearch);
- result.put("injuryDocReqList", injuryDocReqListBean);
- }
- GOSIUtilities.cleanUp(con,ps,rs);
- return result;
- }
- }
- /**
- * @METHOD NAME : checkInjuryHasTreatmentOrTransfer
- * @INFORMATION : This method is to check if Injury Have Treatment on injury date
- * @PARAM : class java.lang.Long,
- class java.sql.Timestamp
- * @RETURN : Boolean
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : Abdulrazaq Alabdulrazaq
- * @LAST MODIFIED DATE : 12/01/2015
- **/
- private void checkInjuryHasTreatmentOrTransfer(AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rs =null;
- StringBuilder sqlQuery=new StringBuilder();
- Boolean isInjuryHasTreatment=false;
- TreatmentPeriodBean trmtBean =null;
- TransferOHHelperBean transferBean =null;
- try
- {
- // this method is to check if Injury Have Treatment on injury date
- sqlQuery.append(" SELECT a.TREATMENTID , a.STARTDATE , a.ENDDATE , a.TREATMENTSTATUS , a.WORKFLOWID ");
- sqlQuery.append(" FROM "+SITables.T_TREATMENT +" a ");
- sqlQuery.append(" where a.INJURYID=? ");
- sqlQuery.append(" AND a.STARTDATE <= ? AND a.ENDDATE >= ? ");
- sqlQuery.append(" AND a.TREATMENTSTATUS <> ? ");
- sqlQuery.append(" ORDER BY a.STARTDATE ASC ");
- GOSIDebug.debugMessages("checkInjuryHasTreatment:sqlQuery:"+sqlQuery.toString());
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery.toString());
- ps.setLong(1,injuryBean.getInjuryId().longValue());
- ps.setTimestamp(2,injuryBean.getInjuryDate());
- ps.setTimestamp(3,injuryBean.getInjuryDate());
- ps.setShort(4,OHConstants.TRMT_STS_CANCELLED.shortValue());
- rs=ps.executeQuery();
- while(rs.next())
- {
- trmtBean =new TreatmentPeriodBean();
- trmtBean.setTreatmentId(rs.getLong("TREATMENTID"));
- trmtBean.setStartDateGreg(rs.getTimestamp("STARTDATE"));
- trmtBean.setEndDateGreg(rs.getTimestamp("ENDDATE"));
- trmtBean.setTreatmentStatus(rs.getShort("TREATMENTSTATUS"));
- trmtBean.setWorkflowId(rs.getLong("WORKFLOWID"));
- trmtBean.setLastModifiedBy(injuryBean.getLastModifiedBy());
- trmtBean.setLastModifiedTimestamp(injuryBean.getLastModifiedTimestamp());
- if (OHConstants.TRMT_STS_ENTERED.equals(trmtBean.getTreatmentStatus())
- && trmtBean.getWorkflowStatus()!=null )
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkInjuryHasTreatmentOrTransfer()",
- new GOSIException(),
- "SOI_ERR_5905");
- }
- TreatmentEntity oTreatment=getTreatmentHome().findByPrimaryKey(trmtBean.getTreatmentId());
- // if the treatment period before the injury date
- if(trmtBean.getEndDateGreg().before(injuryBean.getInjuryDate()))
- {
- trmtBean.setTreatmentStatus(OHConstants.TRMT_STS_CANCELLED);
- trmtBean.setWorkflowStatus(OHConstants.WFS_TRMT_CANCELLED);
- oTreatment.UpdateTreatmentStatus(trmtBean);
- }
- // if the treatment period overlapped with injury date
- else if(trmtBean.getStartDateGreg().before(injuryBean.getInjuryDate()))
- {
- trmtBean.setStartDateGreg(injuryBean.getInjuryDate());
- oTreatment.UpdateTreatmentPeriodDate(trmtBean);
- }
- }
- GOSIUtilities.cleanUp(ps, rs);
- sqlQuery=new StringBuilder("");
- sqlQuery.append(" SELECT a.TRANSFEROHID, a.TRANSFERDATE, a.STATUS ");
- sqlQuery.append(" FROM "+SITables.T_TRANSFEROH +" a ");
- sqlQuery.append(" where a.INJURYID = ? ");
- sqlQuery.append(" AND a.TRANSFERDATE < ? ");
- sqlQuery.append(" AND a.STATUS <> ? ");
- sqlQuery.append(" ORDER BY a.TRANSFERDATE ASC ");
- GOSIDebug.debugMessages("checkInjuryHasTransfer:sqlQuery:"+sqlQuery.toString());
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery.toString());
- ps.setLong(1,injuryBean.getSocInsNumber().longValue());
- ps.setTimestamp(2,injuryBean.getInjuryDate());
- ps.setShort(3,OHConstants.TRANSFER_STS_CANCELLED.shortValue());
- rs=ps.executeQuery();
- while(rs.next())
- {
- transferBean =new TransferOHHelperBean();
- transferBean.setTransferOHId(rs.getLong("TRANSFEROHID"));
- transferBean.setTransferDate(rs.getTimestamp("TRANSFERDATE"));
- transferBean.setTransferStatus(rs.getShort("STATUS"));
- transferBean.setLastModifiedBy(injuryBean.getLastModifiedBy());
- transferBean.setLastModifiedTimestamp(injuryBean.getLastModifiedTimestamp());
- if (OHConstants.TRANSFER_STS_NOTIFIED.equals(trmtBean.getTreatmentStatus()))
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkInjuryHasTreatmentOrTransfer()",
- new GOSIException(),
- "SOI_ERR_5631");
- }
- TransferOHEntity oTransfer=getTransferOHHome().findByPrimaryKey(transferBean.getTransferOHId());
- // if the trnasfer date before the injury date will be cancelled
- if(transferBean.getTransferDate().before(injuryBean.getInjuryDate()))
- {
- transferBean.setTransferStatus(OHConstants.TRANSFER_STS_CANCELLED);
- transferBean.setWorkFlowStatus(OHConstants.WFS_TRANS_OH_CANCELLED);
- oTransfer.updateTransferOHStatus(transferBean);
- }
- }
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException(GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkInjuryHasTreatmentOrTransfer()",
- e,"CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rs);
- }
- }
- /**
- * @METHOD NAME : checkInjuryHasOHBenefit
- * @INFORMATION : This method is to check if Injury Have OH Benefit not Recovered on injury date
- * @PARAM : class java.lang.Long,
- class java.sql.Timestamp
- * @RETURN : Boolean
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : Abdulrazaq Alabdulrazaq
- * @LAST MODIFIED DATE : 12/01/2015
- **/
- private void checkInjuryHasOHBenefit(Long injuryId, Timestamp injuryDate)
- throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rs =null;
- StringBuilder sqlQuery=new StringBuilder();
- try
- {
- // this method is to check if Injury Have OH Benefit not Recovered on injury date
- sqlQuery.append(" SELECT COUNT(*) CNT ");
- sqlQuery.append(" FROM "+SITables.T_OHBENEFIT +" a, ");
- sqlQuery.append(SITables.T_INJURY+" b, "+SITables.T_RECFROMCONTRIBUTOR+" c, "+SITables.T_RECFROMEMP+" d ");
- sqlQuery.append(" where a.INJURYID=b.INJURYID AND C.OHBENID(+)=A.OHBENID AND D.OHBENID(+) = A.OHBENID ");
- sqlQuery.append(" AND b.INJURYID= ? ");
- sqlQuery.append(" AND a.BENSTDATE <= ? AND a.BENSTDATE >= ? ");
- sqlQuery.append(" AND A.BENSTATUS NOT IN ( ? , ? ) ");
- sqlQuery.append(" AND D.DEBNOTEID IS NULL AND C.DEBITNOTEID IS NULL ");
- GOSIDebug.debugMessages("checkInjuryHasOHBenefit:sqlQuery:"+sqlQuery.toString());
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery.toString());
- ps.setLong(1,injuryId.longValue());
- ps.setTimestamp(2,injuryDate);
- ps.setTimestamp(3,injuryDate);
- ps.setShort(4,OHConstants.OH_BNFT_STS_RECOVERED);
- ps.setShort(5,OHConstants.OH_BNFT_STS_CANCELLED);
- rs=ps.executeQuery();
- if(rs.next())
- {
- GOSIDebug.debugMessages("rs.getInt(CNT)==="+rs.getInt("CNT"));
- if(rs.getInt("CNT")>0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkInjuryHasOHBenefit()",
- new GOSIException(),
- "SOI_ERR_7252");
- }
- }
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException(GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkInjuryHasOHBenefit()",
- e,"CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rs);
- }
- }
- /**
- * @METHOD NAME : checkInjuryHasTreatmentService
- * @INFORMATION : This method is to check if Injury Has Treatment Service Not Recovered on injury date
- * @PARAM : class java.lang.Long,
- class java.sql.Timestamp
- * @RETURN : Boolean
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : Abdulrazaq Alabdulrazaq
- * @LAST MODIFIED DATE : 12/01/2015
- **/
- private void checkInjuryHasTreatmentService(Long injuryId, Timestamp injuryDate)
- throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rs =null;
- StringBuilder sqlQuery=new StringBuilder();
- try
- {
- // this method is to check if Injury Has Treatment Service Not Recovered on injury date
- sqlQuery.append(" SELECT COUNT(*) CNT ");
- sqlQuery.append(" FROM "+SITables.T_REGHOSPINVOICEDET +" a, ");
- sqlQuery.append(SITables.T_INJURY+" b ,"+SITables.T_RECFROMEMP+" d ");
- sqlQuery.append(" where a.INJURYID=b.INJURYID AND D.INJURYID(+) = A.INJURYID ");
- sqlQuery.append(" AND b.INJURYID=? ");
- sqlQuery.append(" AND ( b.INJURYSTATUS != ? and b.INJURYSTATUS != ?) ");
- sqlQuery.append(" AND a.TRMTSTARTDATE <= ? AND a.TRMTSTARTDATE >= ? ");
- sqlQuery.append(" AND A.STATUS <> ? ");
- sqlQuery.append(" AND (D.DEBNOTEID IS NULL OR ( D.DEBNOTEID IS NOT NULL AND D.CREDITNOTEID IS NOT NULL)) ");
- GOSIDebug.debugMessages("checkInjuryHasTreatmentService:sqlQuery:"+sqlQuery.toString());
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery.toString());
- ps.setLong(1,injuryId.longValue());
- ps.setShort(2,OHConstants.INJ_STS_CANCELLED.shortValue());
- ps.setShort(3,OHConstants.INJ_STS_REJECTED.shortValue());
- ps.setTimestamp(4,injuryDate);
- ps.setTimestamp(5,injuryDate);
- ps.setShort(6,OHConstants.REG_HOSP_INVC_DETAILS_CANCELLED);
- rs=ps.executeQuery();
- if(rs.next())
- {
- GOSIDebug.debugMessages("rs.getInt(CNT)==="+rs.getInt("CNT"));
- if(rs.getInt("CNT")>0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkInjuryHasTreatmentService()",
- new GOSIException(),
- "SOI_ERR_7253");
- }
- }
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException(GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkInjuryHasTreatmentService()",
- e,"CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rs);
- }
- }
- /**
- * @METHOD NAME : checkInjuryHasComplicationList
- * @INFORMATION : This method is to check if Injury Has Treatment Service Not Recovered on injury date
- * @PARAM : class java.lang.Long,
- class java.sql.Timestamp
- * @RETURN : Long
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : Abdulrazaq Alabdulrazaq
- * @LAST MODIFIED DATE : 12/01/2015
- **/
- private ArrayList checkInjuryHasComplicationList(AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rs =null;
- StringBuilder sqlQuery=new StringBuilder();
- ArrayList<Long> complicationList= new ArrayList<Long> ();
- try
- {
- // this method is to check if Injury Has Treatment Service Not Recovered on injury date
- sqlQuery.append(" SELECT INJURYID ");
- sqlQuery.append(" FROM "+SITables.T_INJURY+" a ");
- sqlQuery.append(" where a.SOCINSNUMBER=? AND a.INJURYNUMBER= ? AND a.INJURYID <> ? ");
- sqlQuery.append(" AND ( a.INJURYSTATUS != ? and a.INJURYSTATUS != ?) ");
- sqlQuery.append(" AND a.DATECOMPLICATION IS NOT NULL ");
- GOSIDebug.debugMessages("checkInjuryHasComplicationList:sqlQuery:"+sqlQuery.toString());
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery.toString());
- ps.setLong(1,injuryBean.getSocInsNumber().longValue());
- ps.setLong(2,injuryBean.getInjuryNumber().longValue());
- ps.setLong(3,injuryBean.getInjuryId().longValue());
- ps.setShort(4,OHConstants.INJ_STS_CANCELLED.shortValue());
- ps.setShort(5,OHConstants.INJ_STS_REJECTED.shortValue());
- rs=ps.executeQuery();
- while(rs.next())
- {
- GOSIDebug.debugMessages("rs.getLong(INJURYID)==="+rs.getLong("INJURYID"));
- if(rs.getObject("INJURYID")!=null)
- {
- complicationList.add(rs.getLong("INJURYID"));
- }
- }
- return complicationList;
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException(GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkInjuryHasComplicationList()",
- e,"CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rs);
- }
- }
- /**
- * @METHOD NAME : updateFirstVisitDate
- * @INFORMATION : This method is to update First Visit Date if it before the injury date
- * @PARAM : class java.lang.Long,
- class java.sql.Timestamp
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : Abdulrazaq Alabdulrazaq
- * @LAST MODIFIED DATE : 12/01/2015
- **/
- private void updateFirstVisitDate(AddInjuryHelperBean injuryBean)
- throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rs =null;
- StringBuilder sqlQuery=new StringBuilder();
- Long pmrId=null;
- Timestamp firstVisitDate=null;
- try
- {
- // this method is to check if Injury Have Treatment on injury date
- sqlQuery.append(" SELECT PMRID , FIRSTVISITDATE ");
- sqlQuery.append(" FROM "+SITables.T_PMR+" a ");
- sqlQuery.append(" where a.INJURYID= ? ");
- GOSIDebug.debugMessages("updateFirstVisitDate:sqlQuery:"+sqlQuery.toString());
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery.toString());
- ps.setLong(1,injuryBean.getInjuryId().longValue());
- rs=ps.executeQuery();
- if(rs.next())
- {
- pmrId=rs.getLong("PMRID");
- firstVisitDate=rs.getTimestamp("FIRSTVISITDATE");
- // check if the fisrt visit date on the T_PMR need to be update (may be it will before the New date !!)
- if(firstVisitDate.before(injuryBean.getInjuryDate()))
- {
- PMREntity injuryPMR=getPMRHome().findByPrimaryKey(pmrId);
- PMRHelperBean pmrBean =new PMRHelperBean();
- pmrBean.setPmrId(pmrId);
- pmrBean.setFirstVisitDate(injuryBean.getInjuryDate());
- pmrBean.setLastModifiedBy(injuryBean.getLastModifiedBy());
- pmrBean.setLastModifiedTimestamp(injuryBean.getLastModifiedTimestamp());
- injuryPMR.updateFirstVisitDate(pmrBean);
- }
- }
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException(GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "updateFirstVisitDate()",
- e,"CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rs);
- }
- }
- /**
- * @METHOD NAME : getPMRHome
- * @INFORMATION : This method is to call PMR Entity
- * @PARAM :
- * @RETURN : interface gosi.database.socialinsurance.occupationalhazards.injury.entity.PMREntityHome
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private PMREntityHome getPMRHome() throws GOSIException
- {
- try
- {
- return (PMREntityHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.PMR_ENTITY_JNDI,
- PMREntityHome.class);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getPMRHome()", e, "CMN_ERR_1000"
- );
- }
- finally
- {
- }
- }
- /**
- * @METHOD NAME : getTreatmentHome
- * @INFORMATION : This method is to call Treatment Entity
- * @PARAM :
- * @RETURN : interface gosi.database.socialinsurance.occupationalhazards.injury.entity.PMREntityHome
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private TreatmentEntityHome getTreatmentHome() throws GOSIException
- {
- try
- {
- return (TreatmentEntityHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.TRMT_PRD_ENTITY_JNDI,
- TreatmentEntityHome.class);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getTreatmentHome()", e, "CMN_ERR_1000"
- );
- }
- finally
- {
- }
- }
- /**
- * @METHOD NAME : getTransferOHHome
- * @INFORMATION : This method is to call TransferOH Entity
- * @PARAM :
- * @RETURN : interface gosi.database.socialinsurance.occupationalhazards.injury.entity.PMREntityHome
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY :
- * @LAST MODIFIED DATE :
- **/
- private TransferOHEntityHome getTransferOHHome() throws GOSIException
- {
- try
- {
- return (TransferOHEntityHome)
- ServiceLocator.getInstance().getRemoteHome(
- OHConstants.TRANSFER_OH_ENTITY_JNDI,
- TransferOHEntityHome.class);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE, this.getClass().toString(),
- "getTransferOHHome()", e, "CMN_ERR_1000"
- );
- }
- finally
- {
- }
- }
- /**
- * @METHOD NAME : checkTreatmentInpatientforAnotherInjury
- * @INFORMATION : This method is to check Treatment on Inpatient for another Injury
- it will check whether the injury date is on inpatient period
- * @PARAM : class java.lang.Long,
- class java.sql.Timestamp
- * @RETURN : void
- * @EXCEPTION : class gosi.core.util.GOSIException
- * @LAST MODIFIED BY : Abdulrazaq Alabdulrazaq
- * @LAST MODIFIED DATE : 12/01/2015
- **/
- private void checkTreatmentInpatientforAnotherInjury(Long siNumber, Long injuryId, Timestamp injuryDate)
- throws GOSIException
- {
- PreparedStatement ps =null;
- ResultSet rs =null;
- StringBuilder sqlQuery=new StringBuilder();
- long startTime = 0;
- long endTime = 0;
- long elapsedTime = 0;
- startTime = System.currentTimeMillis();
- try
- {
- // this method is to check if the injury date is on an inpatient
- // period for the contributor
- sqlQuery.append(" SELECT COUNT(*) CNT ");
- sqlQuery.append(" FROM "+SITables.T_TREATMENT +" a, ");
- sqlQuery.append(SITables.T_INJURY+" b ");
- sqlQuery.append(" where a.INJURYID=b.INJURYID ");
- sqlQuery.append(" and b.SOCINSNUMBER=? AND b.INJURYID <> ? ");
- sqlQuery.append(" and ( b.INJURYSTATUS != ? and b.INJURYSTATUS != ?) ");
- sqlQuery.append(" AND a.STARTDATE <= ? AND a.ENDDATE >= ? ");
- sqlQuery.append(" AND a.TREATMENTTYPE=? ");
- sqlQuery.append(" AND a.TREATMENTSTATUS <> ? ");
- GOSIDebug.debugMessages("checkTreatmentInpatientforAnotherInjury:sqlQuery:"+sqlQuery.toString());
- conn = GOSIUtilities.
- getConnection(GOSIConstants.OCCUPATIONAL_HAZARDS_ID);
- ps=conn.prepareStatement(sqlQuery.toString());
- ps.setLong(1,siNumber.longValue());
- ps.setLong(2,injuryId.longValue());
- ps.setShort(3,OHConstants.INJ_STS_CANCELLED.shortValue());
- ps.setShort(4,OHConstants.INJ_STS_REJECTED.shortValue());
- ps.setTimestamp(5,injuryDate);
- ps.setTimestamp(6,injuryDate);
- ps.setShort(7,OHConstants.TRMT_TYPE_INPATIENT.shortValue());
- ps.setShort(8,OHConstants.TRMT_STS_CANCELLED.shortValue());
- rs=ps.executeQuery();
- if(rs.next())
- {
- //Injury cannot be booked when another Injury for the same
- //contributor is taking In Patient Treatment
- if(rs.getInt("CNT")>0)
- {
- throw new GOSIException( GOSIConstants.SEVERITY_THREE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkTreatmentInpatient()",
- new GOSIException(),
- "SOI_ERR_5388");
- }
- GOSIDebug.debugMessages("rs.getInt(CNT)==="+rs.getInt("CNT"));
- }
- endTime = System.currentTimeMillis();
- elapsedTime = endTime - startTime;
- GOSIInstrumentationLog.writeInstrumentationToLog(
- this.getClass().toString(),
- "checkTreatmentInpatientforAnotherInjury()",
- elapsedTime);
- }
- catch (GOSIException ge)
- {
- throw ge;
- }
- catch(Exception e)
- {
- throw new GOSIException(GOSIConstants.SEVERITY_ONE,
- GOSIConstants.SOCIAL_INSURANCE,
- this.getClass().toString(),
- "checkTreatmentInpatientforAnotherInjury()",
- e,"CMN_ERR_1000");
- }
- finally
- {
- GOSIUtilities.cleanUp(conn, ps, rs);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement