Advertisement
Guest User

Untitled

a guest
Dec 29th, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. /**
  2. * The contents of this file are subject to the OpenMRS Public License
  3. * Version 1.0 (the "License"); you may not use this file except in
  4. * compliance with the License. You may obtain a copy of the License at
  5. * http://license.openmrs.org
  6. *
  7. * Software distributed under the License is distributed on an "AS IS"
  8. * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
  9. * License for the specific language governing rights and limitations
  10. * under the License.
  11. *
  12. * Copyright (C) OpenMRS, LLC. All Rights Reserved.
  13. */
  14. package org.openmrs.module.terem_link;
  15.  
  16. import java.util.Map;
  17.  
  18. import org.openmrs.Patient;
  19. import org.openmrs.PatientIdentifier;
  20. import org.openmrs.api.context.Context;
  21. import org.openmrs.module.Extension;
  22.  
  23. public class TEREM_linkExt extends Extension {
  24.  
  25. private String patientId = "";
  26.  
  27. @Override
  28. public void initialize(final Map<String, String> parameters) {
  29. patientId = parameters.get("patientId");
  30. }
  31.  
  32.  
  33. //Gets the value of the global property
  34. Integer identifierId = Integer.parseInt(Context.getAdministrationService().getGlobalProperty("TEREM_link.mispar_bakasha_type_id"));
  35.  
  36. //Gets the patient
  37. Patient patient = Context.getPatientService().getPatient(Integer.parseInt(patientId));
  38.  
  39. //Gets the Parpar identifier
  40. PatientIdentifier identifier = patient.getPatientIdentifier(identifierId);
  41.  
  42. //Checks whether this patient really has that identifier
  43. if (identifier != null) {
  44. String thisIsWhatYouNeed = identifier.getIdentifier();//Change this variable name and concatinate this to the href string
  45. }
  46.  
  47. else {
  48. //do something (like - don't add the link)
  49. }
  50.  
  51. @Override
  52. public Extension.MEDIA_TYPE getMediaType() {
  53. return Extension.MEDIA_TYPE.html;
  54. }
  55.  
  56. @Override
  57. public String getOverrideContent(String bodyContent) {
  58. return patientId;
  59. }
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement