Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Provider Default, Waiting Time, Status Buttons
- Loading branch information
Showing
13 changed files
with
444 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,14 @@ | |
*/ | ||
package org.openmrs.module.appointment.api.db.hibernate; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
import org.hibernate.Criteria; | ||
import org.hibernate.criterion.MatchMode; | ||
import org.hibernate.criterion.Order; | ||
import org.hibernate.criterion.Restrictions; | ||
import org.openmrs.module.appointment.Appointment; | ||
import org.openmrs.module.appointment.AppointmentStatusHistory; | ||
import org.openmrs.module.appointment.api.db.AppointmentStatusHistoryDAO; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
@@ -38,4 +40,15 @@ public List<AppointmentStatusHistory> getAll(String status) { | |
return criteria.list(); | ||
} | ||
|
||
@Override | ||
@Transactional(readOnly = true) | ||
This comment has been minimized.
Sorry, something went wrong.
dkayiwa
Member
|
||
public Date getStartDateOfCurrentStatus(Appointment appointment) { | ||
String query = "Select Max(endDate) from AppointmentStatusHistory where appointment=:appointment"; | ||
Date endDate = (Date) super.sessionFactory.getCurrentSession().createQuery(query).setParameter("appointment", | ||
appointment).uniqueResult(); | ||
endDate = (endDate == null && appointment != null) ? appointment.getDateCreated() : endDate; | ||
|
||
return endDate; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
omod/src/main/java/org/openmrs/module/appointment/web/AppointmentEditor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* The contents of this file are subject to the OpenMRS Public License | ||
* Version 1.0 (the "License"); you may not use this file except in | ||
* compliance with the License. You may obtain a copy of the License at | ||
* http://license.openmrs.org | ||
* | ||
* Software distributed under the License is distributed on an "AS IS" | ||
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing rights and limitations | ||
* under the License. | ||
* | ||
* Copyright (C) OpenMRS, LLC. All Rights Reserved. | ||
*/ | ||
package org.openmrs.module.appointment.web; | ||
|
||
import java.beans.PropertyEditorSupport; | ||
|
||
import org.apache.commons.logging.Log; | ||
import org.apache.commons.logging.LogFactory; | ||
import org.openmrs.api.context.Context; | ||
import org.openmrs.module.appointment.Appointment; | ||
import org.openmrs.module.appointment.api.AppointmentService; | ||
import org.springframework.util.StringUtils; | ||
|
||
public class AppointmentEditor extends PropertyEditorSupport { | ||
|
||
private Log log = LogFactory.getLog(this.getClass()); | ||
|
||
public AppointmentEditor() { | ||
} | ||
|
||
/** | ||
* @should set using id | ||
* @should set using uuid | ||
*/ | ||
public void setAsText(String text) throws IllegalArgumentException { | ||
AppointmentService as = Context.getService(AppointmentService.class); | ||
if (StringUtils.hasText(text)) { | ||
try { | ||
setValue(as.getAppointment(Integer.valueOf(text))); | ||
} | ||
catch (Exception ex) { | ||
Appointment ts = as.getAppointmentByUuid(text); | ||
setValue(ts); | ||
if (ts == null) { | ||
log.error("Error setting text: " + text, ex); | ||
throw new IllegalArgumentException("Appointment not found: " + ex.getMessage()); | ||
} | ||
} | ||
} else { | ||
setValue(null); | ||
} | ||
} | ||
|
||
public String getAsText() { | ||
Appointment t = (Appointment) getValue(); | ||
if (t == null) { | ||
return ""; | ||
} else { | ||
return t.getId().toString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Don't we put the transactional attribute at the service layer instead of hibernate layer?