Advertisement
yony258

Untitled

May 16th, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.33 KB | None | 0 0
  1. package org.openmrs.module.appointmentscheduling.extension.html;
  2.  
  3. import java.util.Map;
  4.  
  5. import org.openmrs.Patient;
  6. import org.openmrs.api.context.Context;
  7. import org.openmrs.module.Extension;
  8. import org.openmrs.module.appointmentscheduling.Appointment;
  9. import org.openmrs.module.appointmentscheduling.AppointmentUtils;
  10. import org.openmrs.module.appointmentscheduling.Appointment.AppointmentStatus;
  11. import org.openmrs.module.appointmentscheduling.api.AppointmentService;
  12.  
  13. public class PatientDashboardAppointmentExt extends Extension {
  14.  
  15. private String patientId = "";
  16.  
  17. @Override
  18. public void initialize(final Map<String, String> parameters) {
  19. patientId = parameters.get("patientId");
  20. }
  21.  
  22. @Override
  23. public MEDIA_TYPE getMediaType() {
  24. return MEDIA_TYPE.html;
  25. }
  26.  
  27. @Override
  28. public String getOverrideContent(String bodyContent) {
  29. Patient patient = Context.getPatientService().getPatient(Integer.parseInt(patientId));
  30. Appointment appointment = Context.getService(AppointmentService.class).getLastAppointment(patient);
  31.  
  32. if (!Context.hasPrivilege(AppointmentUtils.PRIV_UPDATE_APPOINTMENT_STATES))
  33. return "";
  34.  
  35. //Check if latest appointment is In Consultation
  36. if (appointment != null && appointment.getStatus() == AppointmentStatus.INCONSULTATION) {
  37. String value = Context.getMessageSourceService().getMessage(
  38. "appointmentscheduling.Appointment.list.button.endConsultation");
  39. String action = "endConsult";
  40. String style = "<style>"
  41. + ".saveButton {background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #A3A3A3), color-stop(1, #757575) ); background: -moz-linear-gradient(center top, #A3A3A3 0%, #757575 100% ); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#A3A3A3', endColorstr='#757575' ); background-color: #a2dec8; border: 1px solid #CCCCCC; display: inline-block; color: #ffffff; padding: 8px 35px; text-decoration: none; text-shadow: 1px 1px 0px #666666; font-weight: bold; font-size:16px; border-radius:6px;}"
  42. + ".saveButton:hover:enabled {background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #757575), color-stop(1, #A3A3A3) ); background: -moz-linear-gradient(center top, #757575 0%, #A3A3A3 100% ); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#757575', endColorstr='#A3A3A3' ); background-color: #a2dec8; cursor:pointer;}"
  43. + "</style>";
  44. return style
  45. + "<input type=\"button\" class=\"saveButton\" value=\""
  46. + value
  47. + "\" onclick=\"window.location.href='module/appointmentscheduling/patientDashboardAppointmentExt.form?patientId="
  48. + patientId + "&action=" + action + "'\" />";
  49. }
  50. //Check if latest appointment is Waiting
  51. else if (appointment != null
  52. && (appointment.getStatus() == AppointmentStatus.WAITING || appointment.getStatus() == AppointmentStatus.WALKIN)) {
  53. String value = Context.getMessageSourceService().getMessage(
  54. "appointmentscheduling.Appointment.list.button.startConsultation");
  55. String action = "startConsult";
  56.  
  57. String style = "<style>"
  58. + ".saveButton {background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #A3A3A3), color-stop(1, #757575) ); background: -moz-linear-gradient(center top, #A3A3A3 0%, #757575 100% ); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#A3A3A3', endColorstr='#757575' ); background-color: #a2dec8; border: 1px solid #CCCCCC; display: inline-block; color: #ffffff; padding: 8px 35px; text-decoration: none; text-shadow: 1px 1px 0px #666666; font-weight: bold; font-size:16px; border-radius:6px;}"
  59. + ".saveButton:hover:enabled {background: -webkit-gradient(linear, left top, left bottom, color-stop(0.05, #757575), color-stop(1, #A3A3A3) ); background: -moz-linear-gradient(center top, #757575 0%, #A3A3A3 100% ); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#757575', endColorstr='#A3A3A3' ); background-color: #a2dec8; cursor:pointer;}"
  60. + "</style>";
  61. return style
  62. + "<input type=\"button\" class=\"saveButton\" value=\""
  63. + value
  64. + "\" onclick=\"window.location.href='module/appointmentscheduling/patientDashboardAppointmentExt.form?patientId="
  65. + patientId + "&action=" + action + "'\" />";
  66. }
  67.  
  68. return "";
  69.  
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement