예제 #1
0
  public ims.emergency.vo.TrackingAreaVoCollection listTrackingAreas(
      ims.core.resource.place.vo.LocationRefVo locRef, TrackingAreaRefVo trackingAreaRef) {
    if (locRef == null) return null;

    DomainFactory factory = getDomainFactory();

    List trackingAreas = null;

    if (trackingAreaRef == null) // AttendanceDetails
    {
      String hsql =
          "select t1_1 from TrackingArea as t1_1 left join t1_1.eDLocation as l1_1 where(l1_1.id = :idLocation and t1_1.isRegistrationArea = 1)";
      trackingAreas =
          factory.find(hsql, new String[] {"idLocation"}, new Object[] {locRef.getID_Location()});
    } else // Tracking form, Move button
    {
      String hsql =
          "select t2_1 from TrackingArea as t1_1 left join t1_1.eDLocation as l1_1 left join t1_1.sendToAreas as t2_1 left join t2_1.status as l2_1 where	(t1_1.id = :idtrackingArea and l1_1.id = :idLocation and l2_1.id = :idStatus)";
      trackingAreas =
          factory.find(
              hsql,
              new String[] {"idtrackingArea", "idLocation", "idStatus"},
              new Object[] {
                trackingAreaRef.getID_TrackingArea(),
                locRef.getID_Location(),
                PreActiveActiveInactiveStatus.ACTIVE.getID()
              });
    }

    return TrackingAreaVoAssembler.createTrackingAreaVoCollectionFromTrackingArea(trackingAreas);
  }
  public ims.core.vo.LocationLiteVoCollection listWardsForCurrentLocation(ILocation location) {
    if (location == null) return null;

    OrganisationAndLocation implLoc =
        (OrganisationAndLocation) getDomainImpl(OrganisationAndLocationImpl.class);
    LocationRefVo voRef = new LocationRefVo();
    voRef.setID_Location(location.getID());
    return implLoc.listActiveWardsForHospitalLite(voRef).sort();
  }
  public InpatientEpisodeLiteVoCollection listInpatientEpisodeByWard(LocationRefVo ward) {
    if (ward == null || ward.getID_Location() == null)
      throw new CodingRuntimeException(
          "ward is null or id not provide in method listInpatientEpisodeByWard");

    String hql =
        "from InpatientEpisode inpat join fetch inpat.bed as bed where (inpat.pasEvent.location.id = :idWard and bed is not null) order by bed.bay asc, inpat.pasEvent.patient.name.upperSurname asc,inpat.pasEvent.patient.name.upperForename asc";
    List inpatEpis =
        getDomainFactory().find(hql, new String[] {"idWard"}, new Object[] {ward.getID_Location()});
    return InpatientEpisodeLiteVoAssembler
        .createInpatientEpisodeLiteVoCollectionFromInpatientEpisode(inpatEpis);
  }
  // wdev-18936
  public PatientElectiveListForWardViewVoCollection listPatientElectiveListForWardViewVo(
      LocationRefVo ward, Date tcidate) {
    StringBuilder query = new StringBuilder();
    ArrayList<String> paramNames = new ArrayList<String>();
    ArrayList<Object> paramValues = new ArrayList<Object>();

    query.append("SELECT pel FROM PatientElectiveList AS pel ");
    query.append(
        "LEFT JOIN pel.electiveListStatus AS els LEFT JOIN els.electiveListStatus AS elStatus ");
    query.append("LEFT JOIN pel.tCIDetails AS tci LEFT JOIN tci.tCIWard AS ward ");
    query.append("LEFT JOIN pel.patient AS patient ");

    query.append(
        "WHERE ward.id = :WARD AND elStatus.id = :TCI_GIVEN AND tci.isActive = 1 AND tci.currentOutcome is null ");
    paramNames.add("WARD");
    paramValues.add(ward.getID_Location());
    paramNames.add("TCI_GIVEN");
    paramValues.add(WaitingListStatus.TCI_GIVEN.getId());
    if (tcidate != null) // wdev-19115
    {
      query.append(" AND tci.tCIDate = :CURRENT_DATE");
      paramNames.add("CURRENT_DATE");
      paramValues.add(tcidate.getDate());
    }

    query.append(" ORDER BY patient.name.surname, patient.name.forename");

    return PatientElectiveListForWardViewVoAssembler
        .createPatientElectiveListForWardViewVoCollectionFromPatientElectiveList(
            getDomainFactory().find(query.toString(), paramNames, paramValues));
  }
  public InpatientEpisodeLiteVoCollection listWaitingAreaPatientsByWard(LocationRefVo ward) {
    if (ward == null || ward.getID_Location() == null)
      throw new CodingRuntimeException(
          "ward is null or id not provided in method listWaitingAreaPatientsByWard");

    String hql =
        "from InpatientEpisode inpat left join fetch inpat.bed as bedspace where inpat.pasEvent.location.id = :idWard and bedspace is null and (inpat.isOnHomeLeave is null or inpat.isOnHomeLeave = :bFalse) order by inpat.pasEvent.patient.name.upperSurname ";
    List inpatEpis =
        getDomainFactory()
            .find(
                hql,
                new String[] {"idWard", "bFalse"},
                new Object[] {ward.getID_Location(), Boolean.FALSE});
    return InpatientEpisodeLiteVoAssembler
        .createInpatientEpisodeLiteVoCollectionFromInpatientEpisode(inpatEpis);
  }
  public PendingTransfersLiteVoCollection listPendingTransfersInByWard(LocationRefVo destWard) {
    if (destWard == null || destWard.getID_Location() == null)
      throw new CodingRuntimeException(
          "destWard is null or id not provided in method listPendingTransfersInByWard");

    String hql =
        "from PendingTransfers pend where pend.destinationWard.id = :idWard and pend.currentStatus = :status";
    List pendingTrans =
        getDomainFactory()
            .find(
                hql,
                new String[] {"idWard", "status"},
                new Object[] {destWard.getID_Location(), getDomLookup(TransferStatus.PENDING)});
    return PendingTransfersLiteVoAssembler
        .createPendingTransfersLiteVoCollectionFromPendingTransfers(pendingTrans);
  }
  public PendingTransfersLiteVoCollection listPendingTransfersOutByWard(
      LocationRefVo currentLocation) {
    if (currentLocation == null || currentLocation.getID_Location() == null)
      throw new CodingRuntimeException(
          "currentLocation is null or id not provided in method listPendingTransfersOutByWard");

    String hql =
        "from PendingTransfers pend where pend.inpatientEpisode.pasEvent.location.id = :idWard and pend.currentStatus = :status order by pend.inpatientEpisode.pasEvent.patient.name.upperSurname asc, pend.inpatientEpisode.pasEvent.patient.name.upperForename asc";
    List pendingTrans =
        getDomainFactory()
            .find(
                hql,
                new String[] {"idWard", "status"},
                new Object[] {
                  currentLocation.getID_Location(), getDomLookup(TransferStatus.PENDING)
                });
    return PendingTransfersLiteVoAssembler
        .createPendingTransfersLiteVoCollectionFromPendingTransfers(pendingTrans);
  }
  public TrackingAreaVoCollection getTrackingAreasByLocation(LocationRefVo locationRef) {
    if (locationRef == null)
      throw new CodingRuntimeException("Can not get Areas value on null Location.");

    StringBuffer hql = new StringBuffer();
    hql.append("select trackConfig.areas from TrackingConfiguration as trackConfig ");
    hql.append("where trackConfig.eDLocation.id = :locationID ");

    DomainFactory factory = getDomainFactory();
    List<?> list =
        factory.find(
            hql.toString(),
            new String[] {"locationID"},
            new Object[] {locationRef.getID_Location()});

    return TrackingAreaVoAssembler.createTrackingAreaVoCollectionFromTrackingArea(list);
  }
예제 #9
0
  // WDEV-17140
  public TrackingAreaLiteVo getRegistrationAreaByLocation(LocationRefVo locationRef) {
    if (locationRef == null)
      throw new CodingRuntimeException("Can not get TrackingArea value on null locationID.");

    StringBuffer hql = new StringBuffer();
    hql.append("select trackArea from TrackingArea as trackArea ");
    hql.append("where trackArea.eDLocation.id = :locationID and trackArea.isRegistrationArea = 1");

    DomainFactory factory = getDomainFactory();
    List<?> list =
        factory.find(
            hql.toString(),
            new String[] {"locationID"},
            new Object[] {locationRef.getID_Location()});

    if (list != null && list.size() > 0) {
      return TrackingAreaLiteVoAssembler.create((TrackingArea) list.get(0));
    }
    return null;
  }
  public PendingElectiveAdmissionAdmitVoCollection listPendingElectiveAdmission(
      LocationRefVo voLocation) {
    if (voLocation == null)
      throw new CodingRuntimeException("voLocation is null in method listPendingElectiveAdmission");

    DomainFactory factory = getDomainFactory();
    List pendingElectives =
        factory.find(
            "from PendingElectiveAdmission pea where (pea.tCIDate = :today or pea.tCIDate = :yesterday) and pea.allocatedWard.id = :idWard and pea.electiveAdmissionStatus = :status",
            new String[] {"today", "yesterday", "idWard", "status"},
            new Object[] {
              new Date().getDate(),
              new Date().addDay(-1).getDate(),
              voLocation.getID_Location(),
              getDomLookup(ElectiveAdmissionStatus.TCI)
            });
    return PendingElectiveAdmissionAdmitVoAssembler
        .createPendingElectiveAdmissionAdmitVoCollectionFromPendingElectiveAdmission(
            pendingElectives);
  }
  public TrackingConfigurationVo getTrackingConfig(LocationRefVo locationRef) {
    if (locationRef == null)
      throw new CodingRuntimeException(
          "Can not get TrackingConfiguration value on null locationID.");

    StringBuffer hql = new StringBuffer();
    hql.append("select trackConfig from TrackingConfiguration as trackConfig ");
    hql.append("where trackConfig.eDLocation.id = :locationID ");

    DomainFactory factory = getDomainFactory();
    List<?> list =
        factory.find(
            hql.toString(),
            new String[] {"locationID"},
            new Object[] {locationRef.getID_Location()});

    if (list != null && list.size() > 0) {
      return TrackingConfigurationVoAssembler
          .createTrackingConfigurationVoCollectionFromTrackingConfiguration(list)
          .get(0);
    }
    return null;
  }
 public LocMostVo getLocation(LocationRefVo voLocRef) {
   DomainFactory factory = getDomainFactory();
   return LocMostVoAssembler.create(
       (Location) factory.getDomainObject(Location.class, voLocRef.getID_Location()));
 }