Ejemplo n.º 1
0
  private void isRecordEditable() {
    boolean isEditable = false;
    ClinicalContactShortVo voSelectedClinicalContact =
        form.getGlobalContext().Core.getCurrentClinicalContact();

    if (voSelectedClinicalContact != null) {
      if (form.recbrMassage().getValue() instanceof ClinicalContactShortVo) {
        ClinicalContactShortVo voContact = (ClinicalContactShortVo) form.recbrMassage().getValue();
        if (voContact
            .getID_ClinicalContact()
            .equals(voSelectedClinicalContact.getID_ClinicalContact())) isEditable = true;
      }
    }

    form.btnNew().setVisible(isEditable);
    form.btnUpdate().setVisible(isEditable);

    if (isEditable) {
      if (form.getLocalContext().getCurrentMassageVoIsNotNull()) {
        form.btnNew().setVisible(false);
        form.btnUpdate().setEnabled(true);
      } else {
        form.btnNew().setEnabled(true);
        form.btnUpdate().setVisible(false);
      }
    }
  }
Ejemplo n.º 2
0
 private void loadCurrentClinicalContact(ClinicalContactShortVo voCurrentClinicalContact) {
   form.recbrMassage()
       .newRow(
           voCurrentClinicalContact,
           "\t\t\t\tClinical Contact: "
               + voCurrentClinicalContact.getStartDateTime().toString()
               + " - "
               + voCurrentClinicalContact.getSeenBy().toString(),
           Color.Green);
   form.recbrMassage().setValue(voCurrentClinicalContact);
 }
Ejemplo n.º 3
0
  private void isRecordCurrent() {
    ClinicalContactShortVo voCurrent = null;
    if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull())
      voCurrent = form.getGlobalContext().Core.getCurrentClinicalContact();

    for (int i = 0; i < form.gridGait().getRows().size(); i++) {
      GaitReEducationVo voGait = form.gridGait().getRows().get(i).getValue();
      if (voCurrent != null && voGait.getClinicalContact() != null) {
        if (voGait
            .getClinicalContact()
            .getID_ClinicalContact()
            .equals(voCurrent.getID_ClinicalContact())) {
          form.getLocalContext().setUpdateCurrentRecord(new Boolean(true));
          // set colour of current record + set it expanded
          GenForm.gridGaitRow currentRow = form.gridGait().getRows().get(i);
          currentRow.setBackColor(Color.Beige);
          currentRow.setExpanded(true);
          form.gridGait().setValue(voGait);
        }
      }
      populateControls(voGait);
    }
  }
Ejemplo n.º 4
0
  /** get gait */
  public ims.therapies.vo.GaitVo getGait(ims.core.vo.ClinicalContactShortVo voClinicalContact) {
    if (voClinicalContact == null)
      throw new RuntimeException("Cannot get GaitVo for null ClinicalContactShortVo");

    StringBuffer hql =
        new StringBuffer(
            "from Gait as g1_1 where g1_1.clinicalContact.id = :CCID and g1_1.isRIE is null");

    List list =
        getDomainFactory().find(hql.toString(), "CCID", voClinicalContact.getID_ClinicalContact());

    if (list == null || list.size() == 0) return null;
    else if (list.size() > 1)
      throw new RuntimeException(
          "More than one Gait Treatment found for the current Clinical Contact");

    GaitVoCollection voColl = GaitVoAssembler.createGaitVoCollectionFromGait(list);
    if (voColl.size() > 0) return voColl.get(0);

    return null;
  }
Ejemplo n.º 5
0
  private void fillRecordBrowser() {
    MassageShortVoCollection voMassageShortVoColl =
        domain.listMassageByCareContext(form.getGlobalContext().Core.getCurrentCareContext());

    loadCurrentCareContext();
    boolean currentClinicalContactFound = false;
    if (voMassageShortVoColl != null) {
      if (engine.isRIEMode()) {
        for (int i = 0; i < voMassageShortVoColl.size(); i++) {
          MassageShortVo voMassageShort = voMassageShortVoColl.get(i);
          if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()
              && form.getGlobalContext()
                  .Core
                  .getCurrentClinicalContact()
                  .getID_ClinicalContact()
                  .equals(voMassageShort.getClinicalContact().getID_ClinicalContact()))
            form.recbrMassage()
                .newRow(
                    voMassageShort,
                    "\t\t\t\tClinical Contact: "
                        + voMassageShort.getClinicalContact().getStartDateTime().toString()
                        + " - "
                        + voMassageShort.getClinicalContact().getSeenBy().toString(),
                    Color.Green);
          else
            form.recbrMassage()
                .newRow(
                    voMassageShort,
                    "\t\t\t\tClinical Contact: "
                        + voMassageShort.getClinicalContact().getStartDateTime().toString()
                        + " - "
                        + voMassageShort.getClinicalContact().getSeenBy().toString());
        }
        if (voMassageShortVoColl.size() > 0)
          form.recbrMassage().setValue(voMassageShortVoColl.get(voMassageShortVoColl.size() - 1));
      } else {
        for (int i = 0; i < voMassageShortVoColl.size(); i++) {
          ClinicalContactShortVo voClinicalContact =
              voMassageShortVoColl.get(i).getClinicalContact();
          if (form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()
              && form.getGlobalContext()
                  .Core
                  .getCurrentClinicalContact()
                  .getID_ClinicalContact()
                  .equals(voClinicalContact.getID_ClinicalContact())) {
            currentClinicalContactFound = true;
            loadCurrentClinicalContact(voClinicalContact);
          } else
            form.recbrMassage()
                .newRow(
                    voClinicalContact,
                    "\t\t\t\tClinical Contact: "
                        + voClinicalContact.getStartDateTime().toString()
                        + " - "
                        + voClinicalContact.getSeenBy().toString());
        }
      }
    }

    if (!currentClinicalContactFound
        && form.getGlobalContext().Core.getCurrentClinicalContactIsNotNull()
        && !engine.isRIEMode())
      loadCurrentClinicalContact(form.getGlobalContext().Core.getCurrentClinicalContact());

    browseRecored();
  }
  private ims.generalmedical.vo.AdmisSummary getAdmissionSummary(
      CareContextShortVo careContext, ClinicalContactShortVo clinicalContact) {
    // Get the Medical Contact, everything else can be retrieved from there.
    DomainFactory factory = getDomainFactory();

    AdmisSummary summaryVo = new AdmisSummary();

    InjuryDetailsVoCollection voCollInjuryDetails = new InjuryDetailsVoCollection();

    String hql = " from InjuryDetails injuryDetails ";
    StringBuffer condStr = new StringBuffer();
    String andStr = " ";

    ArrayList markers = new ArrayList();
    ArrayList values = new ArrayList();

    condStr.append(andStr + " injuryDetails.clinicalContact.contactType = :contactType");
    markers.add("contactType");
    values.add(getDomLookup(ContactType.SPINALMEDICALADMISSION));
    andStr = " and ";

    if (careContext != null) {
      condStr.append(andStr + " injuryDetails.clinicalContact.careContext.id = :id_CareContext");
      markers.add("id_CareContext");
      values.add(careContext.getID_CareContext());
      andStr = " and ";
    } else if (clinicalContact != null) {
      condStr.append(andStr + " injuryDetails.clinicalContact.id = :id_ClinicalContact");
      markers.add("id_ClinicalContact");
      values.add(clinicalContact.getID_ClinicalContact());
      andStr = " and ";
    }

    if (andStr.equals(" and ")) hql += " where ";

    hql += condStr.toString();
    voCollInjuryDetails =
        InjuryDetailsVoAssembler.createInjuryDetailsVoCollectionFromInjuryDetails(
            factory.find(hql, markers, values));

    if (voCollInjuryDetails != null && voCollInjuryDetails.size() > 0) {
      InjuryDetails injury =
          InjuryDetailsVoAssembler.extractInjuryDetails(factory, voCollInjuryDetails.get(0));
      if (injury != null) {
        // 1000 - seconds, 60 - minutes, 60 - hours, 24 - days
        long dayDiff =
            ((((new java.util.Date().getTime()
                                - (injury.getInjuryDate() != null
                                    ? injury.getInjuryDate().getTime()
                                    : 0))
                            / 1000)
                        / 60)
                    / 60)
                / 24;

        if (injury.getInjuryDate() != null)
          summaryVo.setDateOfInjury(new ims.framework.utils.Date(injury.getInjuryDate()));
        summaryVo.setDurationSinceInjury(String.valueOf(dayDiff));

        if (injury.getCauseOfInjury() != null)
          summaryVo.setCauseOfInjury(injury.getCauseOfInjury().getText());
        if (injury.getModeOfInjury() != null)
          summaryVo.setModeOfInjury(injury.getModeOfInjury().getText());
        if (injury.getMechanismOfInjury() != null)
          summaryVo.setMechanismOfInjury(injury.getMechanismOfInjury().getText());
      }
    }

    /*NeuroMotorFindingsVoCollection collNeuroMotorFindings = new NeuroMotorFindingsVoCollection();
    hql = " from NeuExamMotor neuExamMotor";
    condStr = new StringBuffer();
    andStr = " ";

    markers.clear();
    values.clear();

    if(careContext!=null)
    {
    	condStr.append(andStr + " neuExamMotor.careContext.id = :id_CareContext");
    	markers.add("id_CareContext");
    	values.add(careContext.getID_CareContext());
    	andStr = " and ";
    }
    else if(clinicalContact!=null)
    {
    	condStr.append(andStr + " neuExamMotor.clinicalContact.id = :id_ClinicalContact");
    	markers.add("id_ClinicalContact");
    	values.add(clinicalContact.getID_ClinicalContact());
    	andStr = " and ";
    }

    if (andStr.equals(" and "))
    	hql += " where ";

    hql += condStr.toString();
    collNeuroMotorFindings = NeuroMotorFindingsVoAssembler.createNeuroMotorFindingsVoCollectionFromNeuExamMotor(factory.find(hql, markers, values));

    if(collNeuroMotorFindings.size()>0)
    {
    	NeuExamMotor motor = NeuroMotorFindingsVoAssembler.extractNeuExamMotor(factory, collNeuroMotorFindings.get(0));
    	if (motor != null)
    	{
    		if (motor.getLeftMotorLevel() != null)
    			summaryVo.setMotorLeft(motor.getLeftMotorLevel().getName());
    		if (motor.getRightMotorLevel() != null)
    			summaryVo.setMotorRight(motor.getRightMotorLevel().getName());

    		summaryVo.setAsiaScore(getAverrallAsiaScore(motor));
    	}
    }
    */
    NeuroSenastionFindingsVoCollection collNeuroSensationFindings =
        new NeuroSenastionFindingsVoCollection();
    hql = " from NeuExamSens neuExamSens";
    condStr = new StringBuffer();
    andStr = " ";

    markers.clear();
    values.clear();

    condStr.append(andStr + " neuExamSens.clinicalContact.contactType = :contactType");
    markers.add("contactType");
    values.add(getDomLookup(ContactType.SPINALMEDICALADMISSION));
    andStr = " and ";

    if (careContext != null) {
      condStr.append(andStr + " neuExamSens.careContext.id = :id_CareContext");
      markers.add("id_CareContext");
      values.add(careContext.getID_CareContext());
      andStr = " and ";
    } else if (clinicalContact != null) {
      condStr.append(andStr + " neuExamSens.clinicalContact.id = :id_ClinicalContact");
      markers.add("id_ClinicalContact");
      values.add(clinicalContact.getID_ClinicalContact());
      andStr = " and ";
    }

    if (andStr.equals(" and ")) hql += " where ";

    hql += condStr.toString();
    collNeuroSensationFindings =
        NeuroSenastionFindingsVoAssembler.createNeuroSenastionFindingsVoCollectionFromNeuExamSens(
            factory.find(hql, markers, values));

    if (collNeuroSensationFindings.size() > 0) {
      NeuExamSens sensation =
          NeuroSenastionFindingsVoAssembler.extractNeuExamSens(
              factory, collNeuroSensationFindings.get(0));
      if (sensation != null) {
        if (sensation.getFrankleGrade() != null)
          summaryVo.setFrankleGrade(sensation.getFrankleGrade().getText());
        if (sensation.getLeftSensoryLevel() != null)
          summaryVo.setSensoryLeft(sensation.getLeftSensoryLevel().getName());
        if (sensation.getRightSensoryLevel() != null)
          summaryVo.setSensoryRight(sensation.getRightSensoryLevel().getName());
      }
    }

    MSKSpinePathologyFindingVoCollection collMSKSpinePathologyFinding =
        new MSKSpinePathologyFindingVoCollection();

    hql = " from MskSpinePath mskSpinePath ";
    condStr = new StringBuffer();
    andStr = " ";

    markers.clear();
    values.clear();

    condStr.append(andStr + " mskSpinePath.clinicalContact.contactType = :contactType");
    markers.add("contactType");
    values.add(getDomLookup(ContactType.SPINALMEDICALADMISSION));
    andStr = " and ";

    if (careContext != null) {
      condStr.append(andStr + " mskSpinePath.careContext.id = :id_CareContext");
      markers.add("id_CareContext");
      values.add(careContext.getID_CareContext());
      andStr = " and ";
    } else if (clinicalContact != null) {
      condStr.append(andStr + " mskSpinePath.clinicalContact.id = :id_ClinicalContact");
      markers.add("id_ClinicalContact");
      values.add(clinicalContact.getID_ClinicalContact());
      andStr = " and ";
    }

    condStr.append(andStr + " mskSpinePath.isPrimaryPathology = :isprimary");
    markers.add("isprimary");
    values.add(Boolean.TRUE);
    andStr = " and ";

    if (andStr.equals(" and ")) hql += " where ";

    hql += condStr.toString();

    collMSKSpinePathologyFinding =
        MSKSpinePathologyFindingVoAssembler
            .createMSKSpinePathologyFindingVoCollectionFromMskSpinePath(
                factory.find(hql, markers, values));

    // java.util.List pathLst = factory.find(domContact.getMskPath(), " where
    // this.isPrimaryPathology = :primary", new String[]{"primary"}, new Object[]{Boolean.TRUE});
    // Should only be one returned
    if (collMSKSpinePathologyFinding != null && collMSKSpinePathologyFinding.size() > 0) {
      MskSpinePath path =
          MSKSpinePathologyFindingVoAssembler.extractMskSpinePath(
              factory, collMSKSpinePathologyFinding.get(0));
      if (path.getPathSite() != null)
        summaryVo.setLevelOfInjury(path.getPathSite().getDescription());
      if (path.getTypeOfInjury() != null)
        summaryVo.setTypeOfInjury(path.getTypeOfInjury().getText());
    }

    NeuroInterpretVoCollection collNeuroInterpretVo = new NeuroInterpretVoCollection();
    hql = " from NeuInterpret neuInterpret";
    condStr = new StringBuffer();
    andStr = " ";

    markers.clear();
    values.clear();

    condStr.append(andStr + " neuInterpret.clinicalContact.contactType = :contactType");
    markers.add("contactType");
    values.add(getDomLookup(ContactType.SPINALMEDICALADMISSION));
    andStr = " and ";

    if (careContext != null) {
      condStr.append(andStr + " neuInterpret.careContext.id = :id_CareContext");
      markers.add("id_CareContext");
      values.add(careContext.getID_CareContext());
      andStr = " and ";
    } else if (clinicalContact != null) {
      condStr.append(andStr + " neuInterpret.clinicalContact.id = :id_ClinicalContact");
      markers.add("id_ClinicalContact");
      values.add(clinicalContact.getID_ClinicalContact());
      andStr = " and ";
    }

    if (andStr.equals(" and ")) hql += " where ";

    hql += condStr.toString();
    collNeuroInterpretVo =
        NeuroInterpretVoAssembler.createNeuroInterpretVoCollectionFromNeuInterpret(
            factory.find(hql, markers, values));

    if (collNeuroInterpretVo != null && collNeuroInterpretVo.size() > 0) {
      NeuInterpret interpret =
          NeuroInterpretVoAssembler.extractNeuInterpret(factory, collNeuroInterpretVo.get(0));
      if (interpret != null) {
        if (interpret.getSpinalSyndrome() != null)
          summaryVo.setSpineSyndrome(interpret.getSpinalSyndrome().getText());
        if (interpret.getAsiaGrade() != null)
          summaryVo.setAsiaGrade(interpret.getAsiaGrade().getText());
        if (interpret.getOverallNeuroLevel() != null)
          summaryVo.setOverallNeuro(interpret.getOverallNeuroLevel().getName());
        if (interpret.getCompleteIncomplete() != null)
          summaryVo.setCompleteIncomplete(interpret.getCompleteIncomplete().getText());
      }
    }

    // Get the First Admission date for this patient.
    EpisodeofCareVo voEpisodeOfCare = null;
    CareContextVoCollection collCareContextVo = null;
    markers.clear();
    values.clear();

    if (careContext != null)
      voEpisodeOfCare =
          EpisodeofCareVoAssembler.create(
              (EpisodeOfCare)
                  factory.getDomainObject(
                      EpisodeOfCare.class, careContext.getEpisodeOfCare().getID_EpisodeOfCare()));
    else if (clinicalContact != null) {
      CareContextVo voCareContext =
          CareContextVoAssembler.create(
              (CareContext)
                  factory.getDomainObject(
                      CareContext.class, clinicalContact.getCareContext().getID_CareContext()));
      voEpisodeOfCare =
          EpisodeofCareVoAssembler.create(
              (EpisodeOfCare)
                  factory.getDomainObject(
                      EpisodeOfCare.class, voCareContext.getEpisodeOfCare().getID_EpisodeOfCare()));
    }

    collCareContextVo = voEpisodeOfCare.getCareContexts().sort();

    if ((collCareContextVo != null) && (collCareContextVo.size() > 0))
      for (int i = 0; i < collCareContextVo.size(); i++) {
        if (collCareContextVo.get(i).getContext().equals(ContextType.INPATIENT))
          summaryVo.setFirstAdmissionDate(collCareContextVo.get(i).getStartDateTime().getDate());
      }

    // MRSA record.
    MRSASitesResultsVoCollection collMRSAVo = new MRSASitesResultsVoCollection();
    hql = "select siteres from MRSAAssessment t join t.sitesAndResults as siteres ";
    condStr = new StringBuffer();
    andStr = " ";

    markers.clear();
    values.clear();

    condStr.append(andStr + " t.clinicalContact.contactType = :contactType");
    markers.add("contactType");
    values.add(getDomLookup(ContactType.SPINALMEDICALADMISSION));
    andStr = " and ";

    if (careContext != null) {
      condStr.append(andStr + " t.careContext.id like :cc");
      markers.add("cc");
      values.add(careContext.getID_CareContext());
      andStr = " and ";
    } else if (clinicalContact != null) {
      condStr.append(andStr + " t.clinicalContact.id like :cc");
      markers.add("cc");
      values.add(clinicalContact.getID_ClinicalContact());
      andStr = " and ";
    }

    condStr.append(andStr + " siteres.result = :res");
    markers.add("res");
    values.add(getDomLookup(MRSAResult.POSITIVE));
    andStr = " and ";

    hql += " where " + condStr.toString();

    collMRSAVo =
        MRSASitesResultsVoAssembler.createMRSASitesResultsVoCollectionFromMRSASitesResults(
            factory.find(hql, markers, values));

    if (collMRSAVo != null && collMRSAVo.size() > 0) summaryVo.setMRSAStatus(Boolean.TRUE);
    else summaryVo.setMRSAStatus(Boolean.FALSE);

    return summaryVo;
  }