Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * 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.terem_link;
- import java.util.Map;
- import org.openmrs.Patient;
- import org.openmrs.PatientIdentifier;
- import org.openmrs.api.context.Context;
- import org.openmrs.module.Extension;
- public class TEREM_linkExt extends Extension {
- private String patientId = "";
- @Override
- public void initialize(final Map<String, String> parameters) {
- patientId = parameters.get("patientId");
- }
- //Gets the value of the global property
- Integer identifierId = Integer.parseInt(Context.getAdministrationService().getGlobalProperty("TEREM_link.mispar_bakasha_type_id"));
- //Gets the patient
- Patient patient = Context.getPatientService().getPatient(Integer.parseInt(patientId));
- //Gets the Parpar identifier
- PatientIdentifier identifier = patient.getPatientIdentifier(identifierId);
- //Checks whether this patient really has that identifier
- if (identifier != null) {
- String thisIsWhatYouNeed = identifier.getIdentifier();//Change this variable name and concatinate this to the href string
- }
- else {
- //do something (like - don't add the link)
- }
- @Override
- public Extension.MEDIA_TYPE getMediaType() {
- return Extension.MEDIA_TYPE.html;
- }
- @Override
- public String getOverrideContent(String bodyContent) {
- return patientId;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement