Esempio n. 1
0
  public Boolean isAmbulanceArrival(ModeOfArrival arrivalMode) {
    if (arrivalMode == null) return false;

    if (ModeOfArrival.AMBULANCE.equals(arrivalMode)) return true;

    String hql =
        "SELECT COUNT(amb.id) FROM AmbulanceArrivalsConfig AS amb LEFT JOIN amb.ambulanceArrivals AS ambArr LEFT JOIN ambArr.instance AS ambArrInst WHERE ambArrInst.id = :MODE_OF_ARRIVAL";

    long count =
        getDomainFactory()
            .countWithHQL(
                hql, new String[] {"MODE_OF_ARRIVAL"}, new Object[] {arrivalMode.getID()});

    if (count > 0) return true;

    return false;
  }
  /**
   * Update the ValueObject with the Domain Object.
   *
   * @param map DomainObjectMap of DomainObjects to already created ValueObjects.
   * @param valueObject to be updated
   * @param domainObject ims.core.admin.domain.objects.EmergencyAttendance
   */
  public static ims.emergency.vo.EmergencyAttendanceForTriageLiteVo insert(
      DomainObjectMap map,
      ims.emergency.vo.EmergencyAttendanceForTriageLiteVo valueObject,
      ims.core.admin.domain.objects.EmergencyAttendance domainObject) {
    if (null == domainObject) {
      return valueObject;
    }
    if (null == map) {
      map = new DomainObjectMap();
    }

    valueObject.setID_EmergencyAttendance(domainObject.getId());
    valueObject.setIsRIE(domainObject.getIsRIE());

    // If this is a recordedInError record, and the domainObject
    // value isIncludeRecord has not been set, then we return null and
    // not the value object
    if (valueObject.getIsRIE() != null
        && valueObject.getIsRIE().booleanValue() == true
        && !domainObject.isIncludeRecord()) return null;

    // If this is not a recordedInError record, and the domainObject
    // value isIncludeRecord has been set, then we return null and
    // not the value object
    if ((valueObject.getIsRIE() == null || valueObject.getIsRIE().booleanValue() == false)
        && domainObject.isIncludeRecord()) return null;

    // ArrivalDateTime
    java.util.Date ArrivalDateTime = domainObject.getArrivalDateTime();
    if (null != ArrivalDateTime) {
      valueObject.setArrivalDateTime(new ims.framework.utils.DateTime(ArrivalDateTime));
    }
    // DischargeDateTime
    java.util.Date DischargeDateTime = domainObject.getDischargeDateTime();
    if (null != DischargeDateTime) {
      valueObject.setDischargeDateTime(new ims.framework.utils.DateTime(DischargeDateTime));
    }
    // CareContext
    if (domainObject.getCareContext() != null) {
      if (domainObject.getCareContext()
          instanceof
          HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the
                          // id already.
      {
        HibernateProxy p = (HibernateProxy) domainObject.getCareContext();
        int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString());
        valueObject.setCareContext(new ims.core.admin.vo.CareContextRefVo(id, -1));
      } else {
        valueObject.setCareContext(
            new ims.core.admin.vo.CareContextRefVo(
                domainObject.getCareContext().getId(), domainObject.getCareContext().getVersion()));
      }
    }
    // UrgencyLevel
    ims.domain.lookups.LookupInstance instance4 = domainObject.getUrgencyLevel();
    if (null != instance4) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance4.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance4.getImage().getImageId(), instance4.getImage().getImagePath());
      }
      color = instance4.getColor();
      if (color != null) color.getValue();

      ims.emergency.vo.lookups.UrgencyLevel voLookup4 =
          new ims.emergency.vo.lookups.UrgencyLevel(
              instance4.getId(), instance4.getText(), instance4.isActive(), null, img, color);
      ims.emergency.vo.lookups.UrgencyLevel parentVoLookup4 = voLookup4;
      ims.domain.lookups.LookupInstance parent4 = instance4.getParent();
      while (parent4 != null) {
        if (parent4.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent4.getImage().getImageId(), parent4.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent4.getColor();
        if (color != null) color.getValue();
        parentVoLookup4.setParent(
            new ims.emergency.vo.lookups.UrgencyLevel(
                parent4.getId(), parent4.getText(), parent4.isActive(), null, img, color));
        parentVoLookup4 = parentVoLookup4.getParent();
        parent4 = parent4.getParent();
      }
      valueObject.setUrgencyLevel(voLookup4);
    }
    // ConclusionDateTime
    java.util.Date ConclusionDateTime = domainObject.getConclusionDateTime();
    if (null != ConclusionDateTime) {
      valueObject.setConclusionDateTime(new ims.framework.utils.DateTime(ConclusionDateTime));
    }
    // BedTypeRequested
    ims.domain.lookups.LookupInstance instance6 = domainObject.getBedTypeRequested();
    if (null != instance6) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance6.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance6.getImage().getImageId(), instance6.getImage().getImagePath());
      }
      color = instance6.getColor();
      if (color != null) color.getValue();

      ims.core.vo.lookups.BedTypeRequested voLookup6 =
          new ims.core.vo.lookups.BedTypeRequested(
              instance6.getId(), instance6.getText(), instance6.isActive(), null, img, color);
      ims.core.vo.lookups.BedTypeRequested parentVoLookup6 = voLookup6;
      ims.domain.lookups.LookupInstance parent6 = instance6.getParent();
      while (parent6 != null) {
        if (parent6.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent6.getImage().getImageId(), parent6.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent6.getColor();
        if (color != null) color.getValue();
        parentVoLookup6.setParent(
            new ims.core.vo.lookups.BedTypeRequested(
                parent6.getId(), parent6.getText(), parent6.isActive(), null, img, color));
        parentVoLookup6 = parentVoLookup6.getParent();
        parent6 = parent6.getParent();
      }
      valueObject.setBedTypeRequested(voLookup6);
    }
    // MC
    valueObject.setMC(domainObject.getMC());
    // COTA
    valueObject.setCOTA(domainObject.getCOTA());
    // PCG1
    valueObject.setPCG1(domainObject.getPCG1());
    // PCG2
    valueObject.setPCG2(domainObject.getPCG2());
    // HAR
    valueObject.setHAR(domainObject.getHAR());
    // Purchaser
    valueObject.setPurchaser(domainObject.getPurchaser());
    // SequenceNumber
    valueObject.setSequenceNumber(domainObject.getSequenceNumber());
    // customID
    valueObject.setCustomID(domainObject.getCustomID());
    // EndOfRegistrationDateTime
    java.util.Date EndOfRegistrationDateTime = domainObject.getEndOfRegistrationDateTime();
    if (null != EndOfRegistrationDateTime) {
      valueObject.setEndOfRegistrationDateTime(
          new ims.framework.utils.DateTime(EndOfRegistrationDateTime));
    }
    // ModeOfArrival
    ims.domain.lookups.LookupInstance instance16 = domainObject.getModeOfArrival();
    if (null != instance16) {
      ims.framework.utils.ImagePath img = null;
      ims.framework.utils.Color color = null;
      img = null;
      if (instance16.getImage() != null) {
        img =
            new ims.framework.utils.ImagePath(
                instance16.getImage().getImageId(), instance16.getImage().getImagePath());
      }
      color = instance16.getColor();
      if (color != null) color.getValue();

      ims.emergency.vo.lookups.ModeOfArrival voLookup16 =
          new ims.emergency.vo.lookups.ModeOfArrival(
              instance16.getId(), instance16.getText(), instance16.isActive(), null, img, color);
      ims.emergency.vo.lookups.ModeOfArrival parentVoLookup16 = voLookup16;
      ims.domain.lookups.LookupInstance parent16 = instance16.getParent();
      while (parent16 != null) {
        if (parent16.getImage() != null) {
          img =
              new ims.framework.utils.ImagePath(
                  parent16.getImage().getImageId(), parent16.getImage().getImagePath());
        } else {
          img = null;
        }
        color = parent16.getColor();
        if (color != null) color.getValue();
        parentVoLookup16.setParent(
            new ims.emergency.vo.lookups.ModeOfArrival(
                parent16.getId(), parent16.getText(), parent16.isActive(), null, img, color));
        parentVoLookup16 = parentVoLookup16.getParent();
        parent16 = parent16.getParent();
      }
      valueObject.setModeOfArrival(voLookup16);
    }
    // RegistrationDateTime
    java.util.Date RegistrationDateTime = domainObject.getRegistrationDateTime();
    if (null != RegistrationDateTime) {
      valueObject.setRegistrationDateTime(new ims.framework.utils.DateTime(RegistrationDateTime));
    }
    // AgeAtAttendance
    valueObject.setAgeAtAttendance(domainObject.getAgeAtAttendance());
    return valueObject;
  }