diff --git a/api/pom.xml b/api/pom.xml index 0870a99..7614496 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -16,8 +16,20 @@ src/main/resources + + *.properties + *.xml + true + + src/main/resources + + *.properties + *.xml + + false + diff --git a/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageAppActivator.java b/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageAppActivator.java index c2169b4..c694417 100644 --- a/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageAppActivator.java +++ b/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageAppActivator.java @@ -13,32 +13,135 @@ */ package org.openmrs.module.edtriageapp; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.openmrs.Concept; +import org.openmrs.ConceptSource; +import org.openmrs.EncounterRole; +import org.openmrs.EncounterType; +import org.openmrs.api.ConceptService; +import org.openmrs.api.EncounterService; +import org.openmrs.api.context.Context; import org.openmrs.module.BaseModuleActivator; +import org.openmrs.module.ModuleActivator; import org.openmrs.module.DaemonToken; import org.openmrs.module.DaemonTokenAware; -import org.openmrs.module.ModuleActivator; +import org.openmrs.module.Module; +import org.openmrs.module.ModuleFactory; import org.openmrs.module.edtriageapp.task.TriageTask; +import org.openmrs.module.emrapi.utils.MetadataUtil; +import org.springframework.transaction.annotation.Transactional; /** * This class contains the logic that is run every time this module is either started or stopped. */ -public class EDTriageAppActivator extends BaseModuleActivator implements DaemonTokenAware{ - - protected Log log = LogFactory.getLog(getClass()); - +@SuppressWarnings("unused") +public class EDTriageAppActivator extends BaseModuleActivator implements DaemonTokenAware { + protected Log log = LogFactory.getLog(getClass()); + private ConceptService conceptService; + private EncounterService encounterService; /** * @see ModuleActivator#started() */ + @Transactional public void started() { + if (conceptService == null) { + conceptService = Context.getConceptService(); + } + + if (encounterService == null) { + encounterService = Context.getEncounterService(); + } + + log.info("Checking and creating metadata for the ED Triage module"); + retireOldConcepts(); + + // ensure we have the required concept sources + addConceptSource("ICD-10-WHO 2nd", EDTriageConstants.ICD_10_WHO_2ND_MAP_UUID, + "Preferred secondary map to ICD-10-WHO"); + addConceptSource("org.openmrs.module.mirebalaisreports", EDTriageConstants.MIREBALAIS_REPORTS_CONCEPT_SOURCE_UUID, + "Used to indicate concepts that are used and grouped to represent various notifiable diseases to the Haiti" + + " Ministry of Health (ie. Tetanus)"); + + // ensure we have the required encounter type + EncounterType edTriageEncounterType = encounterService.getEncounterTypeByUuid( + EDTriageConstants.ED_TRIAGE_ENCOUNTER_TYPE_UUID); + if (edTriageEncounterType == null) { + edTriageEncounterType = new EncounterType(); + edTriageEncounterType.setUuid(EDTriageConstants.ED_TRIAGE_ENCOUNTER_TYPE_UUID); + edTriageEncounterType.setName("Emergency Triage"); + edTriageEncounterType.setDescription("Emergency Department patient triage"); + encounterService.saveEncounterType(edTriageEncounterType); + } + + // ensure we have the consulting clinician encounter role + EncounterRole edTriageEncounterRole = encounterService.getEncounterRoleByUuid( + EDTriageConstants.CONSULTING_CLINICIAN_ENCOUNTER_ROLE_UUID); + if (edTriageEncounterRole == null) { + edTriageEncounterRole = new EncounterRole(); + edTriageEncounterRole.setUuid(EDTriageConstants.CONSULTING_CLINICIAN_ENCOUNTER_ROLE_UUID); + edTriageEncounterRole.setName("Consulting Clinician"); + edTriageEncounterRole.setDescription( + "Clinician who is primarily responsible for examining and diagnosing a patient"); + encounterService.saveEncounterRole(edTriageEncounterRole); + } + + try { + // Note that this has been specifically setup to run in PEER_TO_PEER mode, meaning that all current + // mappings will be used + log.info("Importing ED Triage Metadata"); + MetadataUtil.setupSpecificMetadata(getClass().getClassLoader(), "HUM_Emergency_Triage"); + } + catch (Exception e) { + try { + Module mod = ModuleFactory.getModuleById(EDTriageConstants.ED_TRIAGE_MOD); + ModuleFactory.stopModule(mod); + } + catch (Exception ignored) {} + + throw new RuntimeException("Failed to start the edtriageapp module", e); + } + TriageTask.setEnabled(true); log.info("ED Triage App Module started"); } + private void addConceptSource(String name, String uuid, String description) { + ConceptSource conceptSource = conceptService.getConceptSourceByName(name); + + if (conceptSource == null) { + conceptSource = new ConceptSource(); + conceptSource.setUuid(uuid); + conceptSource.setName(name); + conceptSource.setDescription(description); + conceptService.saveConceptSource(conceptSource); + } + } + + private void retireOldConcepts() { + // Retire YES and NO so as to prevent duplicate errors + Concept yesConcept = conceptService.getConcept(1); + if (!yesConcept.isRetired()) { + log.warn("Retiring default YES concept in favor of CIEL:1065"); + conceptService.retireConcept(conceptService.getConcept(1), "Replaced by CIEL:1065"); + } + + Concept noConcept = conceptService.getConcept(2); + if (!noConcept.isRetired()) { + log.warn("Retiring default NO concept in favor of CIEL:1066"); + conceptService.retireConcept(conceptService.getConcept(2), "Replaced by CIEL:1066"); + } + + // Adopted from PIH + // Removed concept "cerebellar infarction” from HUM ED set, and added “cerebral infarction" + Concept concept = conceptService.getConceptByUuid("145906AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); + if (concept != null) { + conceptService.retireConcept(concept, "replaced with by 155479AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"); + } + } + /** * @see ModuleActivator#stopped() */ @@ -50,4 +153,12 @@ public void stopped() { public void setDaemonToken(DaemonToken daemonToken) { TriageTask.setDaemonToken(daemonToken); } + + public void setConceptService(ConceptService conceptService) { + this.conceptService = conceptService; + } + + public void setEncounterService(EncounterService encounterService) { + this.encounterService = encounterService; + } } diff --git a/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageConstants.java b/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageConstants.java index 141334d..fea9e26 100644 --- a/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageConstants.java +++ b/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageConstants.java @@ -1,13 +1,21 @@ package org.openmrs.module.edtriageapp; - +@SuppressWarnings({"unused"}) public class EDTriageConstants { + public static final String ED_TRIAGE_MOD = "edtriageapp"; public static final String ED_TRIAGE = "edtriageapp.app.edTriage"; + public static final String PRIVILEGE_ED_TRIAGE = "App: edtriageapp.edtriage"; + public static final String PRIVILEGE_ED_TRIAGE_QUEUE = "App: edtriageapp.edtriage.queue"; public static final String ED_TRIAGE_QUEUE = "edtriageapp.app.triageQueue"; public static final String TRIAGE_QUEUE_STATUS_CONCEPT_UUID = "66c18ba5-459e-4049-94ab-f80aca5c6a98"; public static final String TRIAGE_QUEUE_WAITING_FOR_EVALUATION_CONCEPT_UUID = "4dd3244d-fcb9-424d-ad8a-afd773c69923"; public static final String TRIAGE_QUEUE_EXPIRED_CONCEPT_UUID = "1fa8d25e-7471-4201-815f-79fac44d9a5f"; public static final String TRIAGE_WAITING_TIME_UUID = "d9a8fc6f-8695-46b8-854f-2c9e818b4568"; + public static final String ED_TRIAGE_ENCOUNTER_TYPE_NAME = "Emergency Triage"; public static final String ED_TRIAGE_ENCOUNTER_TYPE_UUID = "74cef0a6-2801-11e6-b67b-9e71128cae77"; + public static final String CONSULTING_CLINICIAN_ENCOUNTER_ROLE_UUID = "4f10ad1a-ec49-48df-98c7-1391c6ac7f05"; + public static final String ICD_10_WHO_2ND_MAP_UUID = "8ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"; + public static final String MIREBALAIS_REPORTS_CONCEPT_SOURCE_UUID = "947a1410-1987-4399-8017-c1ea70f242d1"; + } diff --git a/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageUtil.java b/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageUtil.java index 3149a92..75ac2d4 100644 --- a/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageUtil.java +++ b/api/src/main/java/org/openmrs/module/edtriageapp/EDTriageUtil.java @@ -4,30 +4,30 @@ public class EDTriageUtil { - public static String parseUrl(String url, String parameterName) { - String parameterValue = null; + public static String parseUrl(String url, String parameterName) { + String parameterValue = null; - if (StringUtils.isNotBlank(url)) { - String substring = url.substring(url.indexOf("?") + 1); - if (StringUtils.isNotBlank(substring)) { - String[] kvPairs = substring.split("&"); - if (kvPairs != null && kvPairs.length > 0) { - for (String kvPair: kvPairs) { - int i = kvPair.indexOf("="); - String key = null; - String value = null; - if (i > 0) { - key = kvPair.substring(0, i); - value = kvPair.substring(i + 1); - if (StringUtils.equals(key, parameterName)) { - parameterValue = value; - break; - } - } - } - } - } - } - return parameterValue; - } + if (StringUtils.isNotBlank(url)) { + int parameterStart = url.indexOf("?"); + if (parameterStart >= 0) { + String substring = url.substring(parameterStart + 1); + if (StringUtils.isNotBlank(substring)) { + String[] kvPairs = substring.split("&"); + for (String kvPair : kvPairs) { + int i = kvPair.indexOf("="); + if (i > 0) { + String key = kvPair.substring(0, i); + String value = kvPair.substring(i + 1); + if (StringUtils.equals(key, parameterName)) { + parameterValue = value; + break; + } + } + } + } + } + } + + return parameterValue; + } } diff --git a/api/src/main/java/org/openmrs/module/edtriageapp/api/EdTriageAppService.java b/api/src/main/java/org/openmrs/module/edtriageapp/api/EdTriageAppService.java index 2297b77..f330685 100644 --- a/api/src/main/java/org/openmrs/module/edtriageapp/api/EdTriageAppService.java +++ b/api/src/main/java/org/openmrs/module/edtriageapp/api/EdTriageAppService.java @@ -57,8 +57,15 @@ public interface EdTriageAppService extends OpenmrsService { */ Encounter getEDTriageEncounterForActiveVisit(String locationUuid, String patientUuid); + /** + * Get the ED Triage encounter (if any) for the patient's active visit + * (Note that getEDTriageEncounterForActiveVisit should be preferred if a location is available) + * @param patientUuid - the uuid for the patient in question + */ + Encounter getEDTriageEncounterForActiveVisit(String patientUuid); + /* * expires ED Triage encounters with a status of "waiting for evaluation" that are part of non-active visits */ void expireEDTriageEncounters(); -} \ No newline at end of file +} diff --git a/api/src/main/java/org/openmrs/module/edtriageapp/api/impl/EdTriageAppServiceImpl.java b/api/src/main/java/org/openmrs/module/edtriageapp/api/impl/EdTriageAppServiceImpl.java index 870a449..5f9a225 100644 --- a/api/src/main/java/org/openmrs/module/edtriageapp/api/impl/EdTriageAppServiceImpl.java +++ b/api/src/main/java/org/openmrs/module/edtriageapp/api/impl/EdTriageAppServiceImpl.java @@ -19,11 +19,13 @@ import org.openmrs.Location; import org.openmrs.Obs; import org.openmrs.Patient; +import org.openmrs.Visit; import org.openmrs.api.ConceptService; import org.openmrs.api.EncounterService; import org.openmrs.api.LocationService; import org.openmrs.api.ObsService; import org.openmrs.api.PatientService; +import org.openmrs.api.context.Context; import org.openmrs.api.impl.BaseOpenmrsService; import org.openmrs.module.edtriageapp.EDTriageConstants; import org.openmrs.module.edtriageapp.api.EdTriageAppService; @@ -41,6 +43,7 @@ /** * It is a default implementation of {@link EdTriageAppService}. */ +@SuppressWarnings("unused") public class EdTriageAppServiceImpl extends BaseOpenmrsService implements EdTriageAppService { private AdtService adtService; @@ -173,6 +176,30 @@ public Encounter getEDTriageEncounterForActiveVisit(String locationUuid, String return null; } + @Override + public Encounter getEDTriageEncounterForActiveVisit(String patientUuid) { + + if (StringUtils.isBlank(patientUuid)) { + return null; + } + + Patient patient = patientService.getPatientByUuid(patientUuid); + + if (patient == null) { + return null; + } + + for (Visit visit : Context.getVisitService().getActiveVisitsByPatient(patient)) { + for (Encounter encounter : visit.getEncounters()) { + if (EDTriageConstants.ED_TRIAGE_ENCOUNTER_TYPE_UUID.equals(encounter.getEncounterType().getUuid())) { + return encounter; + } + } + } + + return null; + } + @Override @Transactional public void expireEDTriageEncounters() { @@ -198,4 +225,4 @@ public void expireEDTriageEncounters() { } } -} \ No newline at end of file +} diff --git a/api/src/main/resources/HUM_Emergency_Triage-45.zip b/api/src/main/resources/HUM_Emergency_Triage-45.zip new file mode 100644 index 0000000..f9518ef Binary files /dev/null and b/api/src/main/resources/HUM_Emergency_Triage-45.zip differ diff --git a/api/src/main/resources/messages.properties b/api/src/main/resources/messages.properties index b149395..39dcecb 100644 --- a/api/src/main/resources/messages.properties +++ b/api/src/main/resources/messages.properties @@ -79,16 +79,18 @@ edtriageapp.confirmSubmit=Are you sure you want to submit the form? edtriageapp.formHistory=Form History # symptoms that need translations +edtriageapp.5242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Respitory rate +edtriageapp.5092AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Blood oxygen saturation edtriageapp.117617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Pregnancy & trauma or vaginal bleeding -edtriageapp.120977AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Burn - facial/inhalation +edtriageapp.120977AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Burn - facial / inhalation edtriageapp.12d9f052-6980-4542-91ef-190247811228=Shortness of breath - acute edtriageapp.130334AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Vomiting - persistent edtriageapp.139006AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Vomiting - fresh blood edtriageapp.163476AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Burn over 10% or circumferential -edtriageapp.3ccccc20-26fe-102b-80cb-0017a47871b2=Poisoning/overdose +edtriageapp.3ccccc20-26fe-102b-80cb-0017a47871b2=Poisoning / Overdose edtriageapp.c05b25f1-07d1-47de-a61e-fc9d3bfe95eb=Burn - electrical or chemical edtriageapp.3ccd21e8-26fe-102b-80cb-0017a47871b2=Burn - other -edtriageapp.3cce938e-26fe-102b-80cb-0017a47871b2=Seizure - convulsive +edtriageapp.206AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Seizure - convulsive edtriageapp.f7ef0b85-6af3-43b9-87a5-5abf89e3a3f5=Hypersalivation edtriageapp.24fa118d-f81d-439d-82a5-d7c6ac6ef72b=Laryngeal stridor edtriageapp.3ceade68-26fe-102b-80cb-0017a47871b2=Sibilance @@ -109,5 +111,5 @@ edtriageapp.2b436367-c44b-4835-90ad-e93e77d45a97=Floppy infant syndrome edtriageapp.143582AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Constantly crying edtriageapp.aca0abff-a38a-4191-a5c4-041fa1809306=Dislocation of large joint edtriageapp.a218b3d9-2ead-4fa2-afbd-64849012e125=Dislocation of small joint -edtriageapp.3ccea7fc-26fe-102b-80cb-0017a47871b2=Psychosis/Aggression +edtriageapp.3ccea7fc-26fe-102b-80cb-0017a47871b2=Psychosis / Aggression edtriageapp.dd050085-ef34-4318-9423-c4ed666ac372=Left without seeing a clinician diff --git a/api/src/main/resources/messages_fr.properties b/api/src/main/resources/messages_fr.properties index f08d304..4727c0c 100644 --- a/api/src/main/resources/messages_fr.properties +++ b/api/src/main/resources/messages_fr.properties @@ -76,16 +76,18 @@ edtriageapp.warning.noSymptoms=Pas de symptômes qui ont ete sélectionnés edtriageapp.confirmSubmit=Est ce que vous etes sûr que vous voulez envoyer le formulaire? # symptoms that need translations +edtriageapp.5242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Fréquence respiratoire +edtriageapp.5092AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Saturation en oxygène du sang edtriageapp.117617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Grossesse & traumatisme ou saignements vaginaux -edtriageapp.120977AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Brûlure ‐ visage /inhalation +edtriageapp.120977AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Brûlure ‐ visage / inhalation edtriageapp.12d9f052-6980-4542-91ef-190247811228=Dyspnée ‐ aigue edtriageapp.130334AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Vomissements ‐ tenaces edtriageapp.139006AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Vomissements ‐ saignements aigus edtriageapp.163476AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Brûlure dépassant 10% ou circonférentielle -edtriageapp.3ccccc20-26fe-102b-80cb-0017a47871b2=Empoisonnement /Overdose +edtriageapp.3ccccc20-26fe-102b-80cb-0017a47871b2=Empoisonnement / Overdose edtriageapp.c05b25f1-07d1-47de-a61e-fc9d3bfe95eb=Brûlure ‐ électrique ou chimique edtriageapp.3ccd21e8-26fe-102b-80cb-0017a47871b2=Brûlure ‐ autres -edtriageapp.3cce938e-26fe-102b-80cb-0017a47871b2=Crise - convulsive +edtriageapp.206AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Crise - convulsive edtriageapp.f7ef0b85-6af3-43b9-87a5-5abf89e3a3f5=Hypersialorrhée edtriageapp.24fa118d-f81d-439d-82a5-d7c6ac6ef72b=Stridor Laryngé edtriageapp.3ceade68-26fe-102b-80cb-0017a47871b2=Sibilance diff --git a/api/src/main/resources/messages_ht.properties b/api/src/main/resources/messages_ht.properties index 222bc4b..c3681ac 100644 --- a/api/src/main/resources/messages_ht.properties +++ b/api/src/main/resources/messages_ht.properties @@ -76,16 +76,18 @@ edtriageapp.warning.noSymptoms=No symptoms have been selected. edtriageapp.confirmSubmit=Are you sure you want to submit the form? # symptoms that need translations +edtriageapp.5242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Rit respiratwa +edtriageapp.5092AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Saturation oksijèn san edtriageapp.117617AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Pregnancy & trauma or vaginal bleeding -edtriageapp.120977AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Burn - facial/inhalation +edtriageapp.120977AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Burn - facial / inhalation edtriageapp.12d9f052-6980-4542-91ef-190247811228=Shortness of breath - acute edtriageapp.130334AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Vomiting - persistent edtriageapp.139006AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Vomiting - fresh blood edtriageapp.163476AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Burn over 10% or circumferential -edtriageapp.3ccccc20-26fe-102b-80cb-0017a47871b2=Poisoning/overdose +edtriageapp.3ccccc20-26fe-102b-80cb-0017a47871b2=Poisoning / Overdose edtriageapp.c05b25f1-07d1-47de-a61e-fc9d3bfe95eb=Burn - electrical or chemical edtriageapp.3ccd21e8-26fe-102b-80cb-0017a47871b2=Burn - other -edtriageapp.3cce938e-26fe-102b-80cb-0017a47871b2=Seizure - convulsive +edtriageapp.206AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=Seizure - convulsive edtriageapp.f7ef0b85-6af3-43b9-87a5-5abf89e3a3f5=Hypersalivation edtriageapp.24fa118d-f81d-439d-82a5-d7c6ac6ef72b=Laryngeal stridor edtriageapp.3ceade68-26fe-102b-80cb-0017a47871b2=Sibilance diff --git a/api/src/main/resources/packages.xml b/api/src/main/resources/packages.xml new file mode 100644 index 0000000..9b6ed5e --- /dev/null +++ b/api/src/main/resources/packages.xml @@ -0,0 +1,10 @@ + + + + HUM_Emergency_Triage + 05fa9aa6-017d-410b-90f9-decf407fdf65 + 45 + PEER_TO_PEER + + + diff --git a/omod/src/main/java/org/openmrs/module/edtriageapp/page/controller/EdtriageEditPatientPageController.java b/omod/src/main/java/org/openmrs/module/edtriageapp/page/controller/EdtriageEditPatientPageController.java index 80a2fa2..7cf22bd 100644 --- a/omod/src/main/java/org/openmrs/module/edtriageapp/page/controller/EdtriageEditPatientPageController.java +++ b/omod/src/main/java/org/openmrs/module/edtriageapp/page/controller/EdtriageEditPatientPageController.java @@ -1,68 +1,95 @@ package org.openmrs.module.edtriageapp.page.controller; - import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.codehaus.jackson.JsonNode; import org.codehaus.jackson.node.ObjectNode; import org.openmrs.Encounter; import org.openmrs.Patient; +import org.openmrs.api.context.Context; import org.openmrs.module.appframework.domain.AppDescriptor; import org.openmrs.module.appframework.service.AppFrameworkService; import org.openmrs.module.appui.UiSessionContext; +import org.openmrs.module.coreapps.CoreAppsProperties; import org.openmrs.module.edtriageapp.EDTriageConstants; import org.openmrs.module.edtriageapp.EDTriageUtil; +import org.openmrs.module.edtriageapp.api.EdTriageAppService; +import org.openmrs.ui.framework.UiUtils; import org.openmrs.ui.framework.annotation.SpringBean; import org.openmrs.ui.framework.page.PageModel; import org.openmrs.ui.framework.page.Redirect; import org.springframework.web.bind.annotation.RequestParam; -import java.util.Iterator; - +@SuppressWarnings("unused") public class EdtriageEditPatientPageController { - public Object controller(@RequestParam("patientId") Patient patient, PageModel model, - @RequestParam(value = "encounterId", required = false) Encounter encounter, - @SpringBean AppFrameworkService appFrameworkService, - @RequestParam(value = "search", required = false) String search, - @RequestParam(value = "breadcrumbOverride", required = false) String breadcrumbOverride, - @RequestParam(value = "returnUrl", required = false) String returnUrl, - @RequestParam(value = "editable", required = false) Boolean editable, - @RequestParam(value = "returnLabel", required = false) String returnLabel, - UiSessionContext uiSessionContext) { + protected Log log = LogFactory.getLog(getClass()); + + public Object controller(@RequestParam("patientId") Patient patient, PageModel model, + @RequestParam(value = "encounterId", required = false) Encounter encounter, + @SpringBean AppFrameworkService appFrameworkService, + @SpringBean CoreAppsProperties coreAppsProperties, + @SpringBean UiUtils uiUtils, + @RequestParam(value = "search", required = false) String search, + @RequestParam(value = "breadcrumbOverride", required = false) String breadcrumbOverride, + @RequestParam(value = "returnUrl", required = false) String returnUrl, + @RequestParam(value = "editable", required = false) Boolean editable, + @RequestParam(value = "returnLabel", required = false) String returnLabel, + UiSessionContext uiSessionContext) { + + if (!Context.hasPrivilege(EDTriageConstants.PRIVILEGE_ED_TRIAGE)) { + return new Redirect("coreapps", "noAccess", ""); + } + + if (patient.isVoided() || patient.isPersonVoided()) { + return new Redirect("coreapps", "patientdashboard/deletedPatient", "patientId=" + patient.getId()); + } + + // set the returnUrl to the patient dashboard for the visit if we are coming from a specific encounter + if (StringUtils.isEmpty(returnUrl) && encounter != null && encounter.getVisit() != null) { + returnUrl = "/" + uiUtils.contextPath() + "/" + coreAppsProperties.getVisitsPageWithSpecificVisitUrl(); + returnUrl = returnUrl.replace("{{patientId}}", patient.getUuid()) + .replace("{{patient.uuid}}", patient.getUuid()) + .replace("{{visitId}}", encounter.getVisit().getUuid()) + .replace("{{visit.id}}", encounter.getVisit().getUuid()); + } + + // try to get an active ED Triage encounter, if one exists + // assumes 1 Triage encounter per active visit + if (encounter == null) { + encounter = Context.getService(EdTriageAppService.class).getEDTriageEncounterForActiveVisit(patient.getUuid()); + } - if (patient.isVoided() || patient.isPersonVoided()) { - return new Redirect("coreapps", "patientdashboard/deletedPatient", "patientId=" + patient.getId()); - } + model.addAttribute("appId", EDTriageConstants.ED_TRIAGE); + model.addAttribute("search", search); + model.addAttribute("breadcrumbOverride", breadcrumbOverride); + model.addAttribute("returnUrl", returnUrl); + model.addAttribute("returnLabel", returnLabel); + model.addAttribute("locale", uiSessionContext.getLocale()); + model.addAttribute("location", uiSessionContext.getSessionLocation()); + model.addAttribute("patient", patient); + model.addAttribute("currentDateTimeInMillis", System.currentTimeMillis()); - model.addAttribute("appId", EDTriageConstants.ED_TRIAGE); - model.addAttribute("search", search); - model.addAttribute("breadcrumbOverride", breadcrumbOverride); - model.addAttribute("returnUrl", returnUrl); - model.addAttribute("returnLabel", returnLabel); - model.addAttribute("locale", uiSessionContext.getLocale()); - model.addAttribute("location", uiSessionContext.getSessionLocation()); - model.addAttribute("patient", patient); - model.addAttribute("currentDateTimeInMillis", System.currentTimeMillis()); + model.addAttribute("encounter", encounter); + model.addAttribute("editable", editable != null ? editable : true); - model.addAttribute("encounter", encounter); - model.addAttribute("editable", editable != null ? editable : true); + AppDescriptor app = appFrameworkService.getApp(EDTriageConstants.ED_TRIAGE); + String patientDashboard = null; + if (app != null) { + ObjectNode config = app.getConfig(); + JsonNode afterSelectedUrl = config.get("afterSelectedUrl"); + if (afterSelectedUrl != null) { + String textValue = afterSelectedUrl.getTextValue(); + if (StringUtils.isNotBlank(textValue)) { + patientDashboard = EDTriageUtil.parseUrl(textValue, "dashboardUrl"); + } + } + } - AppDescriptor app = app = appFrameworkService.getApp(EDTriageConstants.ED_TRIAGE); - String patientDashboard = null; - if (app != null) { - ObjectNode config = app.getConfig(); - JsonNode afterSelectedUrl = config.get("afterSelectedUrl"); - if (afterSelectedUrl != null) { - String textValue = afterSelectedUrl.getTextValue(); - if (StringUtils.isNotBlank(textValue)) { - patientDashboard = EDTriageUtil.parseUrl(textValue, "dashboardUrl"); - } - } - Iterator elements = afterSelectedUrl.getElements(); - } - model.addAttribute("dashboardUrl", patientDashboard); + model.addAttribute("dashboardUrl", patientDashboard); - return null; + return null; + } - } } diff --git a/omod/src/main/java/org/openmrs/module/edtriageapp/page/controller/EdtriageViewQueuePageController.java b/omod/src/main/java/org/openmrs/module/edtriageapp/page/controller/EdtriageViewQueuePageController.java index eed2a01..beb93b1 100644 --- a/omod/src/main/java/org/openmrs/module/edtriageapp/page/controller/EdtriageViewQueuePageController.java +++ b/omod/src/main/java/org/openmrs/module/edtriageapp/page/controller/EdtriageViewQueuePageController.java @@ -1,19 +1,27 @@ package org.openmrs.module.edtriageapp.page.controller; - +import org.openmrs.api.context.Context; import org.openmrs.module.appframework.domain.AppDescriptor; import org.openmrs.module.appui.UiSessionContext; +import org.openmrs.module.edtriageapp.EDTriageConstants; import org.openmrs.ui.framework.page.PageModel; +import org.openmrs.ui.framework.page.Redirect; import org.springframework.web.bind.annotation.RequestParam; +@SuppressWarnings("unused") public class EdtriageViewQueuePageController { + public Object controller(PageModel model, @RequestParam(value = "appId", required = true) AppDescriptor app, @RequestParam(value = "search", required = false) String search, @RequestParam(value = "breadcrumbOverride", required = false) String breadcrumbOverride, UiSessionContext uiSessionContext) { - model.addAttribute("appId", app !=null ? app.getId() : null); + if (!Context.hasPrivilege(EDTriageConstants.PRIVILEGE_ED_TRIAGE_QUEUE)) { + return new Redirect("coreapps", "noAccess", ""); + } + + model.addAttribute("appId", app.getId()); model.addAttribute("dashboardUrl", app.getConfig().get("dashboardUrl").getTextValue()); model.addAttribute("search", search); model.addAttribute("breadcrumbOverride", breadcrumbOverride); @@ -22,6 +30,6 @@ public Object controller(PageModel model, model.addAttribute("currentDateTimeInMillis", System.currentTimeMillis()); return null; - } + } diff --git a/omod/src/main/java/org/openmrs/module/edtriageapp/rest/web/v1_0/search/openmrs1_10/ActiveEdTriageEncountersSearchHandler1_10.java b/omod/src/main/java/org/openmrs/module/edtriageapp/rest/web/v1_0/search/openmrs1_10/ActiveEdTriageEncountersSearchHandler1_10.java index bbdde12..6903bac 100644 --- a/omod/src/main/java/org/openmrs/module/edtriageapp/rest/web/v1_0/search/openmrs1_10/ActiveEdTriageEncountersSearchHandler1_10.java +++ b/omod/src/main/java/org/openmrs/module/edtriageapp/rest/web/v1_0/search/openmrs1_10/ActiveEdTriageEncountersSearchHandler1_10.java @@ -63,7 +63,7 @@ public SearchConfig getSearchConfig() { @Override public PageableResult search(RequestContext context) throws ResponseException { - boolean useFullRepresentation = toInt(context.getParameter(REQUEST_PARAM_OVERRIDE_REPRESENTATION),0)>0; + boolean useFullRepresentation = toInt(context.getParameter(REQUEST_PARAM_OVERRIDE_REPRESENTATION), 0) > 0; String patient = context.getParameter(REQUEST_PARAM_PATIENT); // UHM-3163, show all EDTriage encounters from all locations String location = null; // context.getParameter(REQUEST_PARAM_LOCATION); diff --git a/omod/src/main/resources/apps/edtriageapp_app.json b/omod/src/main/resources/apps/edtriageapp_app.json new file mode 100644 index 0000000..b73531d --- /dev/null +++ b/omod/src/main/resources/apps/edtriageapp_app.json @@ -0,0 +1,71 @@ +[ + { + "id": "edtriageapp.app.edTriage", + "order": 201, + "config": { + "label": "edtriageapp.label", + "afterSelectedUrl": "/edtriageapp/edtriageEditPatient.page?patientId={{patientId}}&breadcrumbOverride={{breadcrumbOverride}}", + "showLastViewedPatients": true, + "heading": "" + }, + "extensions": [ + { + "id": "edtriageapp.homepageLink", + "extensionPointId": "org.openmrs.referenceapplication.homepageLink", + "icon": "icon-ambulance", + "label": "edtriageapp.label", + "url": "coreapps/findpatient/findPatient.page?app=edtriageapp.app.edTriage", + "type": "link", + "require": "typeof user !== 'undefined' && user !== null && ((hasMemberWithProperty(user.privileges, 'display', 'App: coreapps.findPatient') && hasMemberWithProperty(user.privileges, 'display', 'App: edtriage.app.triage')) || user.systemId == 'admin')" + }, + { + "id": "edtriageapp.patientVisitLink", + "extensionPointId": "patientDashboard.visitActions", + "icon": "icon-ambulance", + "label": "edtriageapp.label", + "url": "edtriageapp/edtriageEditPatient.page?patientId={{patient.uuid}}&returnUrl={{returnUrl}}&breadcrumbOverride={{breadcrumbOverride}}", + "type": "link", + "require": "typeof visit !== 'undefined' && visit !== null && visit.active && !visit.admitted", + "requiredPrivilege": "App: edtriageapp.edtriage" + }, + { + "id": "edtriageapp.patientEncounterLink", + "extensionPointId": "org.openmrs.referenceapplication.encounterTemplate", + "label": "edtriageapp.label", + "extensionParams": { + "templateId": "defaultEncounterTemplate", + "templateFragmentProviderName": "coreapps", + "templateFragmentId": "patientdashboard/encountertemplate/defaultEncounterTemplate", + "supportedEncounterTypes": { + "74cef0a6-2801-11e6-b67b-9e71128cae77": { + "icon": "icon-ambulance", + "editUrl": "edtriageapp/edtriageEditPatient.page?patientId={{patient.uuid}}&encounterId={{encounter.id}}&editable=true", + "viewUrl": "edtriageapp/edtriageEditPatient.page?patientId={{patient.uuid}}&encounterId={{encounter.id}}&editable=false", + "editable": true + } + } + }, + "type": "fragment", + "requiredPrivilege": "App: edtriageapp.edtriage" + } + ] + }, + { + "id": "edtriageapp.app.triageQueue", + "order": 202, + "config": { + "dashboardUrl": "/coreapps/clinicianfacing/patient.page?patientId={{patientId}}" + }, + "extensions": [ + { + "id": "edtriageapp.queue.homepageLink", + "extensionPointId": "org.openmrs.referenceapplication.homepageLink", + "icon": "icon-list-ol", + "label": "edtriageapp.queue.label", + "url": "edtriageapp/edtriageViewQueue.page?appId=edtriageapp.app.triageQueue", + "type": "link", + "requiredPrivilege": "App: edtriageapp.edtriage.queue" + } + ] + } +] diff --git a/omod/src/main/resources/apps/edtriageapp_extension.json b/omod/src/main/resources/apps/edtriageapp_extension.json deleted file mode 100644 index c760165..0000000 --- a/omod/src/main/resources/apps/edtriageapp_extension.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "id": "edtriageapp.app", - "extensionPointId": "org.openmrs.referenceapplication.homepageLink", - "type": "link", - "label": "ED Triage", - "url": "edtriageapp/findPatient?appId=edtriageapp.app", - "icon": "icon-desktop", - "order": 201 - } -] \ No newline at end of file diff --git a/omod/src/main/resources/config.xml b/omod/src/main/resources/config.xml index 6872eaa..fb4c634 100644 --- a/omod/src/main/resources/config.xml +++ b/omod/src/main/resources/config.xml @@ -13,14 +13,17 @@ https://modules.openmrs.org/modules/download/${project.parent.artifactId}/update.rdf ${openMRSVersion} - - org.openmrs.module.appframework - org.openmrs.module.appui - org.openmrs.module.uicommons - org.openmrs.module.uiframework + + org.openmrs.module.appframework + org.openmrs.module.appui + org.openmrs.module.uicommons + org.openmrs.module.uiframework + org.openmrs.module.coreapps org.openmrs.module.emrapi - org.openmrs.module.webservices.rest - + org.openmrs.module.webservices.rest + org.openmrs.module.metadatasharing + org.openmrs.module.metadatadeploy + ${project.parent.groupId}.${project.parent.artifactId}.EDTriageAppActivator @@ -33,10 +36,15 @@ messages_fr.properties - - App: edtriage.app.triage - Able to triage a patient - + + 1b699660-245a-11e6-bdf4-0800200c9a66 + App: edtriageapp.edtriage + Able to triage a patient + + + f7bae2f7-78aB-4d7a-8470-8068e4969f56 + App: edtriageapp.edtriage.queue + Use ED Triage Queue provided by the ED Triage module + - diff --git a/omod/src/main/webapp/fragments/translations.gsp b/omod/src/main/webapp/fragments/translations.gsp index 89883d9..f319f37 100644 --- a/omod/src/main/webapp/fragments/translations.gsp +++ b/omod/src/main/webapp/fragments/translations.gsp @@ -7,9 +7,11 @@ '130334AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA':"${ui.message("edtriageapp.130334AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")}", '139006AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA':"${ui.message("edtriageapp.139006AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")}", '163476AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA':"${ui.message("edtriageapp.163476AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")}", + '5242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA':"${ui.message("edtriageapp.5242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")}", + '5092AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA':"${ui.message("edtriageapp.5092AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")}", '3ccccc20-26fe-102b-80cb-0017a47871b2':"${ui.message("edtriageapp.3ccccc20-26fe-102b-80cb-0017a47871b2")}", '3ccd21e8-26fe-102b-80cb-0017a47871b2':"${ui.message("edtriageapp.3ccd21e8-26fe-102b-80cb-0017a47871b2")}", - '3cce938e-26fe-102b-80cb-0017a47871b2':"${ui.message("edtriageapp.3cce938e-26fe-102b-80cb-0017a47871b2")}", + '206AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA':"${ui.message("edtriageapp.206AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")}", '3ceade68-26fe-102b-80cb-0017a47871b2':"${ui.message("edtriageapp.3ceade68-26fe-102b-80cb-0017a47871b2")}", '3cf1a95a-26fe-102b-80cb-0017a47871b2':"${ui.message("edtriageapp.3cf1a95a-26fe-102b-80cb-0017a47871b2")}", '7c4d837b-5967-4ba6-902c-ca7651bebf34':"${ui.message("edtriageapp.7c4d837b-5967-4ba6-902c-ca7651bebf34")}", diff --git a/omod/src/main/webapp/pages/edtriageEditPatient.gsp b/omod/src/main/webapp/pages/edtriageEditPatient.gsp index d97153a..cd96877 100644 --- a/omod/src/main/webapp/pages/edtriageEditPatient.gsp +++ b/omod/src/main/webapp/pages/edtriageEditPatient.gsp @@ -107,12 +107,13 @@ ${ ui.includeFragment("coreapps", "patientHeader", [ patient: patient ]) } - {{edTriagePatientConcept.vitals.weight.label}} + {{ edTriagePatientConcept.vitals.weight.label | titleCase }} - + @@ -129,227 +130,226 @@ ${ ui.includeFragment("coreapps", "patientHeader", [ patient: patient ]) } - - - ${ ui.message("edtriageapp.emergencySigns") } - - - - - - ${ui.message("edtriageapp.emergencySigns.impairedAirway")} - - - - ${ui.message("edtriageapp.emergencySigns.impairedBreathing")} - - - - ${ui.message("edtriageapp.emergencySigns.shock")} + + + ${ ui.message("edtriageapp.emergencySigns") } + + + + + + ${ui.message("edtriageapp.emergencySigns.impairedAirway")} + + + + ${ui.message("edtriageapp.emergencySigns.impairedBreathing")} + + + + ${ui.message("edtriageapp.emergencySigns.shock")} + - - - - - - ${ ui.message("edtriageapp.vitals") } - - - - - - Large - Small - Small - Small - Small - Small - - - - - - {{edTriagePatientConcept.vitals.respiratoryRate.label}} - - ${ ui.message("edtriageapp.perMinute") } - - - - - {{edTriagePatientConcept.vitals.oxygenSaturation.label}} - - ${ ui.message("edtriageapp.percent") } - - - - - {{edTriagePatientConcept.vitals.heartRate.label}} - - ${ ui.message("edtriageapp.perMinute") } - - - - - ${ ui.message("edtriageapp.bloodPressure") } - - - - / - - - - - - - - - - ${ui.message("edtriageapp.temperature")} - - C - - F - - - - - - - ${ui.message("edtriageapp.trauma")} - - ${ ui.message("uicommons.yes")} - - - ${ ui.message("uicommons.no")} - - - - - - - ${ui.message("Person.age")} - ${ ui.message("edtriageapp.lessThan4WeeksOld") } - - - - ${ui.message("edtriageapp.total")} - - {{currentScore.numericScore}} - - - - - - - - - - ${ ui.message("edtriageapp.symptoms") } - - - - - - - + + + + ${ ui.message("edtriageapp.vitals") } + + + + + + Large + Small + Small + Small + Small + Small + + + + + selected-concept="edTriagePatient.vitals.mobility.value" + score-label-class="'edtriage-label-score'" + score="currentScore.individualScores[edTriagePatient.vitals.mobility.value]"> + + {{edTriagePatientConcept.vitals.respiratoryRate.label | translate: edTriagePatientConcept.vitals.respiratoryRate.uuid:EdTriageConcept.ageType.ALL}} + + ${ ui.message("edtriageapp.perMinute") } + + - + + {{edTriagePatientConcept.vitals.oxygenSaturation.label | translate: edTriagePatientConcept.vitals.oxygenSaturation.uuid:EdTriageConcept.ageType.ALL}} + + ${ ui.message("edtriageapp.percent") } + + - + + {{edTriagePatientConcept.vitals.heartRate.label}} + + ${ ui.message("edtriageapp.perMinute") } + + - + + ${ ui.message("edtriageapp.bloodPressure") } + + + + / + + - + + + + - + + ${ui.message("edtriageapp.temperature")} + + C + + F + + - + concept-label="'${ui.message("edtriageapp.consciousness")}'" + selected-concept="edTriagePatient.vitals.consciousness.value" score-label-class="'edtriage-label-score'" + score="currentScore.individualScores[edTriagePatient.vitals.consciousness.value]"> - + ${ui.message("edtriageapp.trauma")} - ${ui.message("edtriageapp.noSymptomsPresent")} - - - + ${ ui.message("uicommons.yes")} + + + ${ ui.message("uicommons.no")} + + + - - - - - - - + + ${ui.message("Person.age")} + ${ ui.message("edtriageapp.lessThan4WeeksOld") } + + + + ${ui.message("edtriageapp.total")} + + {{currentScore.numericScore}} + + + + + + + + + + ${ ui.message("edtriageapp.symptoms") } + + + + + + + + + + + + + + + + + + + + + + + + ${ui.message("edtriageapp.noSymptomsPresent")} + + + + + + + + + + + @@ -361,59 +361,57 @@ ${ ui.includeFragment("coreapps", "patientHeader", [ patient: patient ]) } - - Large - Small - Small - Small - Small - Small - + + Large + Small + Small + Small + Small + Small + - - ${ui.message("edtriageapp.labs.glucose")} - - - - - - mg/dl - - - - - - - ${ui.message("edtriageapp.high")} - - - - - - ${ui.message("edtriageapp.low")} - - - - - - - - - - + + ${ui.message("edtriageapp.labs.glucose")} + + + + + mg/dl + + + + + + + ${ui.message("edtriageapp.high")} + + + + + + ${ui.message("edtriageapp.low")} + + + + + + + + + @@ -429,55 +427,53 @@ ${ ui.includeFragment("coreapps", "patientHeader", [ patient: patient ]) } - - Large - Small - Small - Small - Small - Small - + + Large + Small + Small + Small + Small + Small + - - ${ui.message("edtriageapp.feverInstructions")} - - ${ui.message("edtriageapp.paracetamol")} - - - - - - - - - 15 mg/kg - - - - - mg - - - ${ui.message("edtriageapp.oxygenInstructions")} - - ${ui.message("edtriageapp.oxygen")} - - - - - + + ${ui.message("edtriageapp.feverInstructions")} + ${ui.message("edtriageapp.paracetamol")} + + + + + + + + 15 mg/kg + + + + + mg + + + ${ui.message("edtriageapp.oxygenInstructions")} + + ${ui.message("edtriageapp.oxygen")} + + + + + - + @@ -503,7 +499,6 @@ ${ ui.includeFragment("coreapps", "patientHeader", [ patient: patient ]) } - @@ -513,17 +508,17 @@ ${ ui.includeFragment("coreapps", "patientHeader", [ patient: patient ]) } {{message.text}} - - - ${ ui.message("edtriageapp.submitButton") } - - + + + ${ ui.message("edtriageapp.submitButton") } + + ${ ui.message("edtriageapp.beginConsult") } - - + + ${ editable ? ui.message("edtriageapp.exitButton") : ui.message("edtriageapp.backButton") } - - + + @@ -549,5 +544,4 @@ ${ ui.includeFragment("edtriageapp", "translations") } window.location.reload(); }); }); - diff --git a/omod/src/main/webapp/pages/edtriageViewQueue.gsp b/omod/src/main/webapp/pages/edtriageViewQueue.gsp index 5428036..a6fb19f 100644 --- a/omod/src/main/webapp/pages/edtriageViewQueue.gsp +++ b/omod/src/main/webapp/pages/edtriageViewQueue.gsp @@ -264,7 +264,7 @@ ${ ui.includeFragment("edtriageapp", "translations") } angular.module('edTriageApp') .value('patientDashboard', '${ dashboardUrl }') .value('serverDateTimeInMillis', ${ currentDateTimeInMillis }) - .value('locationUuid', '${ location.uuid }') + .value('locationUuid', '${ location?.uuid }') .value('translations', translations); jq(function () { diff --git a/omod/src/main/webapp/resources/scripts/components/EdTriageConceptFactory.js b/omod/src/main/webapp/resources/scripts/components/EdTriageConceptFactory.js index cf7ac7a..5293621 100644 --- a/omod/src/main/webapp/resources/scripts/components/EdTriageConceptFactory.js +++ b/omod/src/main/webapp/resources/scripts/components/EdTriageConceptFactory.js @@ -85,7 +85,7 @@ angular.module("edTriageConceptFactory", []) toAnswer("3cd65f7e-26fe-102b-80cb-0017a47871b2", "walking", { numericScore: 0, colorCode: EdTriageConcept.score.green } , 'AC', 1), toAnswer("3cd750a0-26fe-102b-80cb-0017a47871b2", "normal for age", { numericScore: 0, colorCode: EdTriageConcept.score.green } , EdTriageConcept.ageType.INFANT, 3)] , "611e7b0a-5b34-47ac-b352-02c2dc653255"), - respiratoryRate: toAnswer("3ceb11f8-26fe-102b-80cb-0017a47871b2", "respiratoryRate", function(ageType, value){ + respiratoryRate: toAnswer("5242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "respiratoryRate", function(ageType, value) { if (!isNumber(value)) { return { numericScore: 0, colorCode: EdTriageConcept.score.green }; } @@ -111,7 +111,7 @@ angular.module("edTriageConceptFactory", []) return { numericScore: 3, colorCode: EdTriageConcept.score.green }; } }), - oxygenSaturation: toAnswer("3ce9401c-26fe-102b-80cb-0017a47871b2", "oxygenSaturation", function(ageType, value){ + oxygenSaturation: toAnswer("5092AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "oxygenSaturation", function(ageType, value) { if (!isNumber(value)) { return { numericScore: 0, colorCode: EdTriageConcept.score.green }; } @@ -124,7 +124,7 @@ angular.module("edTriageConceptFactory", []) return { numericScore: 0, colorCode: EdTriageConcept.score.green }; } }), - heartRate: toAnswer("3ce93824-26fe-102b-80cb-0017a47871b2", "heartRate", function(ageType, value){ + heartRate: toAnswer("5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "heartRate", function(ageType, value) { if (!isNumber(value)) { return { numericScore: 0, colorCode: EdTriageConcept.score.green }; } @@ -155,11 +155,11 @@ angular.module("edTriageConceptFactory", []) return { numericScore: 3, colorCode: EdTriageConcept.score.green }; } }), - systolicBloodPressure: toAnswer("3ce934fa-26fe-102b-80cb-0017a47871b2", "systolicBloodPressure", function(ageType, value){ + systolicBloodPressure: toAnswer("5085AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "systolicBloodPressure", function(ageType, value){ if (!isNumber(value)) { return { numericScore: 0, colorCode: EdTriageConcept.score.green }; } - if(ageType == EdTriageConcept.ageType.ADULT){ + if (ageType === EdTriageConcept.ageType.ADULT){ if(value < 71) return { numericScore: 3, colorCode: EdTriageConcept.score.green }; if(value < 81) return { numericScore: 2, colorCode: EdTriageConcept.score.green }; if(value < 101) return { numericScore: 1, colorCode: EdTriageConcept.score.green }; @@ -168,10 +168,10 @@ angular.module("edTriageConceptFactory", []) } return { numericScore: 0, colorCode: EdTriageConcept.score.green }; }, EdTriageConcept.ageType.ADULT), - diastolicBloodPressure: toAnswer("3ce93694-26fe-102b-80cb-0017a47871b2", "diastolicBloodPressure", function(ageType, value){ + diastolicBloodPressure: toAnswer("5086AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "diastolicBloodPressure", function(ageType, value){ return { numericScore: 0, colorCode: EdTriageConcept.score.green }; }, EdTriageConcept.ageType.ADULT), - temperature: toAnswer("3ce939d2-26fe-102b-80cb-0017a47871b2", "temperature", function(ageType, value){ + temperature: toAnswer("5088AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "temperature", function(ageType, value){ if (!isNumber(value)) { return { numericScore: 0, colorCode: EdTriageConcept.score.green }; } @@ -193,20 +193,19 @@ angular.module("edTriageConceptFactory", []) trauma: toAnswers('trauma', [toAnswer("124193AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "trauma", function(ageType, value){ return value.length > 0 ? { numericScore: 1, colorCode: EdTriageConcept.score.green } : { numericScore: 0, colorCode: EdTriageConcept.score.green };})], GENERIC_TRIAGE_SYMPTOM_CONCEPT_SET_UUID), - weight: toAnswer("3ce93b62-26fe-102b-80cb-0017a47871b2", "weight", function(ageType, value){ + weight: toAnswer("5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "weight", function(ageType, value){ return { numericScore: 0, colorCode: EdTriageConcept.score.green }; }) } ; - this.symptoms = { emergencySigns: toAnswers('emergencySigns',[ toAnswer("164348AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "impaired airway", { numericScore: 0, colorCode: EdTriageConcept.score.red }, null, 1), - toAnswer("3cedf31e-26fe-102b-80cb-0017a47871b2", "impaired breathing", { numericScore: 0, colorCode: EdTriageConcept.score.red }, null, 2), - toAnswer("911c064e-5247-4017-a9fd-b30105c36052", "shock", { numericScore: 0, colorCode: EdTriageConcept.score.red }, null, 3),] + toAnswer("142373AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "impaired breathing", { numericScore: 0, colorCode: EdTriageConcept.score.red }, null, 2), + toAnswer("112989AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "shock", { numericScore: 0, colorCode: EdTriageConcept.score.red }, null, 3),] ,GENERIC_TRIAGE_SYMPTOM_CONCEPT_SET_UUID), neurological: toAnswers('neurological',[ - toAnswer("3cce938e-26fe-102b-80cb-0017a47871b2", "seizure - convulsive", { numericScore: 0, colorCode: EdTriageConcept.score.red }, null, 1), + toAnswer("206AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "seizure - convulsive", { numericScore: 0, colorCode: EdTriageConcept.score.red }, null, 1), toAnswer("ad52aee5-c789-4442-8dfc-2242375f22e8", "seizure - post convulsive", { numericScore: 0, colorCode: EdTriageConcept.score.orange }, null, 2), toAnswer("f4433b74-6396-47ff-aa63-3900493ebf23", "acute focal neurologic deficit", { numericScore: 0, colorCode: EdTriageConcept.score.orange }, null, 3), toAnswer("eacf7a54-b2fb-4dc1-b2f8-ee0b5926c16c", "level of consciousness reduced", { numericScore: 0, colorCode: EdTriageConcept.score.orange }, null, 4), @@ -255,8 +254,8 @@ angular.module("edTriageConceptFactory", []) return { numericScore: 0, colorCode: EdTriageConcept.score.orange }; } }, 'I', 2), - toAnswer("3cf1a95a-26fe-102b-80cb-0017a47871b2", "dyspnea-shortness of breath", { numericScore: 0, colorCode: EdTriageConcept.score.orange }, 'I', 3), - toAnswer("3cf1a95a-26fe-102b-80cb-0017a47871b2", "dyspnea-shortness of breath", { numericScore: 0, colorCode: EdTriageConcept.score.orange }, 'C', 4), + toAnswer("141600AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "dyspnea-shortness of breath", { numericScore: 0, colorCode: EdTriageConcept.score.orange }, 'I', 3), + toAnswer("141600AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "dyspnea-shortness of breath", { numericScore: 0, colorCode: EdTriageConcept.score.orange }, 'C', 4), toAnswer("24fa118d-f81d-439d-82a5-d7c6ac6ef72b", "stridor", { numericScore: 0, colorCode: EdTriageConcept.score.orange }, 'C', 5), toAnswer("3ceade68-26fe-102b-80cb-0017a47871b2", "sibilance", { numericScore: 0, colorCode: EdTriageConcept.score.orange }, 'CI', 6), toAnswer("12d9f052-6980-4542-91ef-190247811228", "shortness of breath - acute", { numericScore: 0, colorCode: EdTriageConcept.score.orange }, EdTriageConcept.ageType.ADULT, 7), @@ -326,9 +325,9 @@ angular.module("edTriageConceptFactory", []) expired: "1fa8d25e-7471-4201-815f-79fac44d9a5f" }; - EdTriageConcept.heartRate = "3ce93824-26fe-102b-80cb-0017a47871b2"; - EdTriageConcept.respiratoryRate = "3ceb11f8-26fe-102b-80cb-0017a47871b2"; - EdTriageConcept.oxygenSaturation = "3ce9401c-26fe-102b-80cb-0017a47871b2"; + EdTriageConcept.heartRate = "5087AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + EdTriageConcept.respiratoryRate = "5242AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; + EdTriageConcept.oxygenSaturation = "5092AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; EdTriageConcept.numericScore = "f6ee497c-1db0-4c58-a55c-d65175a91fb9"; EdTriageConcept.lowGlucoseLevel = { @@ -375,6 +374,10 @@ angular.module("edTriageConceptFactory", []) * */ function updateConceptLabels(obj, data, level) { for (var propertyName in obj) { + if (!obj.hasOwnProperty(propertyName)) { + continue; + } + var p = obj[propertyName]; if (p != null && typeof p == "object") { if (p.hasOwnProperty('uuid')) { @@ -415,29 +418,31 @@ angular.module("edTriageConceptFactory", []) obj.label = concept.display; return; } + //then check if the object has answers we can check - if(concept.answers != null && concept.answers.length>0){ - for(var j=0;j0){ - for(var j=0;j' + '{{conceptLabel}}' + @@ -341,24 +346,22 @@ angular.module("edTriagePatientController", []) '' + '' }; -}).directive('conceptSelectBox', function () { - +}).directive('conceptSelectBox', function() { return { restrict: 'E', scope: { edTriagePatient: "=", concept: "=", selectedConcept: "=", - inputId:"=", - sorter:"=" + inputId: "=", + sorter: "=" }, template: '' + '' + - '{{a.labelTranslated(edTriagePatient.patient.ageType)}}' + + '{{a.labelTranslated(edTriagePatient.patient.ageType)}}' + '' }; -}).directive('conceptDisplayBox', function () { - +}).directive('conceptDisplayBox', function() { return { restrict: 'E', scope: { @@ -367,7 +370,7 @@ angular.module("edTriagePatientController", []) }, template: "{{ concept | findAnswer: selectedConcept | property: 'label' }}" }; -}).directive('scoreDisplay', function () { +}).directive('scoreDisplay', function() { return { restrict: 'E', replace:true, @@ -377,8 +380,7 @@ angular.module("edTriagePatientController", []) }, template: '{{ score.numericScore ? score.numericScore : " " }}' }; -}).directive('numberOnlyInput', function () { - +}).directive('numberOnlyInput', function() { return { restrict: 'E', replace:true, @@ -401,4 +403,4 @@ angular.module("edTriagePatientController", []) }); } }; -}); \ No newline at end of file +}); diff --git a/omod/src/main/webapp/resources/scripts/components/EdTriagePatientFactory.js b/omod/src/main/webapp/resources/scripts/components/EdTriagePatientFactory.js index 9f2014a..660dba0 100644 --- a/omod/src/main/webapp/resources/scripts/components/EdTriagePatientFactory.js +++ b/omod/src/main/webapp/resources/scripts/components/EdTriagePatientFactory.js @@ -166,11 +166,11 @@ angular.module("edTriagePatientFactory", []) (this.symptoms.respiratory && this.symptoms.respiratory.value) || (this.symptoms.pain && this.symptoms.pain.value) || (this.symptoms.other && this.symptoms.other.value) || - this.confirmNoSymptoms + this.confirmNoSymptoms; }; - - /* creates a new EdTriagePatient + /** + * creates a new EdTriagePatient * returns an empty one with the patient and location info filled in * @param {String} uuid - the patient uuid * @param {Object} dateOfBirth - the patient date of birth @@ -315,7 +315,7 @@ angular.module("edTriagePatientFactory", []) //there is a generic concept set uuis for symptoms (and one vital), that all the symptoms share // we need to find out which question the observation answers - //theck the vital that uses this + // check the vital that uses this var found = _handleAnswerList(concepts.vitals.consciousness, v.uuid, obsUuid); if(found != null){ ret.vitals.consciousness = found; @@ -329,12 +329,14 @@ angular.module("edTriagePatientFactory", []) } - for(var prop in concepts.symptoms){ - var symptom = concepts.symptoms[prop]; - var found = _handleAnswerList(symptom, v.uuid, obsUuid); - if(found){ - ret.symptoms[prop] = found; - break; + for (var prop in concepts.symptoms){ + if (concepts.symptoms.hasOwnProperty(prop)) { + var symptom = concepts.symptoms[prop]; + found = _handleAnswerList(symptom, v.uuid, obsUuid); + if (found) { + ret.symptoms[prop] = found; + break; + } } } } @@ -364,9 +366,8 @@ angular.module("edTriagePatientFactory", []) } }; - /** * Return the constructor function */ return EdTriagePatient; - }]); \ No newline at end of file + }]); diff --git a/omod/src/main/webapp/resources/scripts/components/EdTriageViewQueueController.js b/omod/src/main/webapp/resources/scripts/components/EdTriageViewQueueController.js index a53fae9..91b3ea5 100644 --- a/omod/src/main/webapp/resources/scripts/components/EdTriageViewQueueController.js +++ b/omod/src/main/webapp/resources/scripts/components/EdTriageViewQueueController.js @@ -297,4 +297,4 @@ angular.module("edTriageViewQueueController", []) "" + " {{itemLabel}}" }; -}); \ No newline at end of file +}); diff --git a/omod/src/main/webapp/resources/scripts/filters.js b/omod/src/main/webapp/resources/scripts/filters.js index 14ba661..c1923cf 100644 --- a/omod/src/main/webapp/resources/scripts/filters.js +++ b/omod/src/main/webapp/resources/scripts/filters.js @@ -50,4 +50,10 @@ angular.module("filters", ['uicommons.filters']) } return ""; } - }) \ No newline at end of file + }) + .filter('titleCase', function() { + return function(input) { + input = input || ''; + return input.replace(/\w\S*/g, function(txt){ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }); + }; + }); diff --git a/pom.xml b/pom.xml index ff7d673..9e42f71 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,8 @@ 1.8 3.15.0 1.5 + 1.23.0-SNAPSHOT + 3.9.2 2.13 1.27.0 1.18.0 @@ -63,6 +65,8 @@ 0.2.14 2.10.0 1.3.4 + 1.2.2 + 1.10.0 @@ -158,6 +162,34 @@ provided + + org.openmrs.module + coreapps-api + ${coreappsVersion} + provided + + + + org.openmrs.module + htmlformentry-api + ${htmlformentryVersion} + provided + + + + org.openmrs.module + htmlformentry-api-1.10 + ${htmlformentryVersion} + provided + + + + org.openmrs.module + metadatadeploy-api + ${metadatadeployVersion} + provided + + @@ -202,6 +234,13 @@ test + + org.openmrs.module + metadatasharing-api + ${metadatasharingVersion} + test + + org.openmrs.module metadatamapping-api