Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In JSP File:
- <script src="<openmrs:contextPath/>/dwr/interface/DWRAppointmentService.js"></script>
- <script type="text/javascript">
- function updatePatient(formFieldId, patientObj, isPageLoad) {
- if(!isPageLoad){
- DWRAppointmentService.getPatientDescription(patientObj.patientId, function(details){
- if(details==null){
- document.getElementById('labelPhone').value = "";
- document.getElementById('labelMissed').value = "";
- }
- else{
- if(details[0]!=null)
- document.getElementById('labelPhone').value = details[0];
- if(details[1]!=null)
- document.getElementById('labelMissed').value = details[1];
- }
- });
- }
- }
- </script>
- In DWRAppointmentService Class
- public class DWRAppointmentService {
- public PatientDescription getPatientDescription(Integer patientId) {
- Patient patient = Context.getPatientService().getPatient(patientId);
- if (patient == null)
- return null;
- PatientDescription patientDescription = new PatientDescription("test","test");
- /*patientDescription
- .setPhoneNumber(patient.getAttribute(
- Context.getAdministrationService().getGlobalProperty("appointment.phoneNumberPersonAttributeTypeId"))
- .getValue());
- Date missedLastAppointment = Context.getService(AppointmentService.class).getMissedLastAppointment(patient);
- if (missedLastAppointment != null)
- patientDescription.setDateMissed(Context.getDateFormat().format(missedLastAppointment));
- */
- return patientDescription;
- }
- }
- In config.xml
- <dwr>
- <allow>
- <create creator="yony258" javascript="DWRAppointmentService">
- <param name="class" value="@MODULE_PACKAGE@.web.DWRAppointmentService" />
- <include method="getPatientDescription" />
- </create>
- </allow>
- <signatures>
- <![CDATA[
- import @MODULE_PACKAGE@.web.DWRAppointmentService;
- DWRAppointmentService.getPatientDescription(Integer patientId);
- ]]>
- </signatures>
- </dwr>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement