Exemplo n.º 1
0
  public TrackingLiteVo saveTrackingAndTrackingMovementTimes(
      TrackingLiteVo record,
      TrackingMovementTimesVo trackingMovementTimes,
      CurrentPartialAdmissionForSendToAreaVo partialAdmission,
      Boolean trigersPreAdmissiontoPAS,
      EpisodeofCareVo epOfCare,
      CareContextVo careContext)
      throws StaleObjectException // WDEV-18278
      {
    if (record == null || trackingMovementTimes == null)
      throw new DomainRuntimeException(" Tracking or TrackingMovementTimes are not validated.");

    DomainFactory factory = getDomainFactory();

    Tracking doTracking = TrackingLiteVoAssembler.extractTracking(factory, record);

    factory.save(doTracking);

    TrackingMovementTimes doTrackingMovementTimes =
        TrackingMovementTimesVoAssembler.extractTrackingMovementTimes(
            factory, trackingMovementTimes);
    factory.save(doTrackingMovementTimes);

    if (Boolean.TRUE.equals(trigersPreAdmissiontoPAS)) {
      if (partialAdmission != null) {
        EDPartialAdmission doPartialAdmission =
            CurrentPartialAdmissionForSendToAreaVoAssembler.extractEDPartialAdmission(
                factory, partialAdmission);
        factory.save(doPartialAdmission);
      }

      if (record != null) {
        EDPartialAdmissionDialog dom =
            (EDPartialAdmissionDialog) getDomainImpl(EDPartialAdmissionDialogImpl.class);
        try {
          dom.triggerCancelPartialAdmission(
              record.getAttendance(), record.getCurrentPartialAdmission());
        } catch (DomainInterfaceException e) {
          e.printStackTrace();
        }
      }
    }

    if (careContext != null && epOfCare != null) {
      CareContext doCare = CareContextVoAssembler.extractCareContext(factory, careContext);
      factory.save(doCare);

      EpisodeofCareVo lastEpofcare = getEpisodeOfCare(epOfCare.getID_EpisodeOfCare());
      EpisodeOfCare doEpisode =
          EpisodeofCareVoAssembler.extractEpisodeOfCare(factory, lastEpofcare);
      doEpisode.getCareContexts().add(doCare);
      factory.save(doEpisode);
    }

    return TrackingLiteVoAssembler.create(doTracking);
  }
 public static void fillFieldsfromXML(
     org.dom4j.Element el,
     ims.domain.DomainFactory factory,
     SentToXray obj,
     java.util.HashMap domMap)
     throws Exception {
   org.dom4j.Element fldEl;
   fldEl = el.element("patient");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setPatient(
         ims.core.patient.domain.objects.Patient.getPatientfromXML(fldEl, factory, domMap));
   }
   fldEl = el.element("episode");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setEpisode(
         ims.core.admin.domain.objects.EpisodeOfCare.getEpisodeOfCarefromXML(
             fldEl, factory, domMap));
   }
   fldEl = el.element("attendance");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setAttendance(
         ims.core.admin.domain.objects.CareContext.getCareContextfromXML(fldEl, factory, domMap));
   }
   fldEl = el.element("trackingArea");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setTrackingArea(
         ims.emergency.configuration.domain.objects.TrackingArea.getTrackingAreafromXML(
             fldEl, factory, domMap));
   }
   fldEl = el.element("sentDateTime");
   if (fldEl != null) {
     obj.setSentDateTime(
         new java.text.SimpleDateFormat("yyyyMMddHHmmssSSS").parse(fldEl.getTextTrim()));
   }
   fldEl = el.element("sentBy");
   if (fldEl != null) {
     fldEl = fldEl.element("class");
     obj.setSentBy(
         ims.core.resource.people.domain.objects.MemberOfStaff.getMemberOfStafffromXML(
             fldEl, factory, domMap));
   }
   fldEl = el.element("returnedDateTime");
   if (fldEl != null) {
     obj.setReturnedDateTime(
         new java.text.SimpleDateFormat("yyyyMMddHHmmssSSS").parse(fldEl.getTextTrim()));
   }
 }
  public String toAuditString() {
    StringBuffer auditStr = new StringBuffer();

    auditStr.append("\r\n*patient* :");
    if (patient != null) {
      auditStr.append(toShortClassName(patient));

      auditStr.append(patient.getId());
    }
    auditStr.append("; ");
    auditStr.append("\r\n*episode* :");
    if (episode != null) {
      auditStr.append(toShortClassName(episode));

      auditStr.append(episode.getId());
    }
    auditStr.append("; ");
    auditStr.append("\r\n*attendance* :");
    if (attendance != null) {
      auditStr.append(toShortClassName(attendance));

      auditStr.append(attendance.getId());
    }
    auditStr.append("; ");
    auditStr.append("\r\n*trackingArea* :");
    if (trackingArea != null) {
      auditStr.append(toShortClassName(trackingArea));

      auditStr.append(trackingArea.getId());
    }
    auditStr.append("; ");
    auditStr.append("\r\n*sentDateTime* :");
    auditStr.append(sentDateTime);
    auditStr.append("; ");
    auditStr.append("\r\n*sentBy* :");
    if (sentBy != null) {
      auditStr.append(toShortClassName(sentBy));

      auditStr.append(sentBy.getId());
    }
    auditStr.append("; ");
    auditStr.append("\r\n*returnedDateTime* :");
    auditStr.append(returnedDateTime);
    auditStr.append("; ");
    return auditStr.toString();
  }