Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample collection #26

Merged
merged 17 commits into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions configuration/patientidentifiertypes/identifierTypes.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Uuid,Void/Retire,Name,Description,Required,Format,Format description,Validator,Location behavior,Uniqueness behavior
${patientIdentifierType.sesEmrId.uuid},0,SES EMR ID,An ID generated by the SES EMR,0,,,,NOT_USED,
Uuid,Void/Retire,Name,Description,Required,Format,Format description,Validator,Location behavior,Uniqueness behavior
${patientIdentifierType.sesEmrId.uuid},0,SES EMR ID,An ID generated by the SES EMR,0,,,,NOT_USED,
${patientIdentifierType.DNI.uuid},0,DNI,peruvian indentification document,0,,,,NOT_USED,UNIQUE
${patientIdentifierType.Passport.uuid},0,Passport,international identification document,0,,,,NOT_USED,UNIQUE
70 changes: 70 additions & 0 deletions configuration/pih/htmlforms/patientRegistration-social.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<htmlform formUuid="3C953068-B460-4B1A-8889-0AAD43447CD7" formName="Patient Registration Social" formEncounterType="873f968a-73a8-4f9c-ac78-9f4778b751b6" formVersion="1.0">

<!-- TODO find a better way to do this rather than copying the entire form: all we are doing here is removing the religion question -->

<ifMode mode="VIEW" include="false">
<script type="text/javascript">

jq(function() {

// remove the first title span that is automatically generated by the HFE
if ( jq("#social span.title").length ) {
jq("#social span.title").remove();
}

});
</script>
</ifMode>

<ifMode mode="VIEW" include="false">
<h2><uimessage code="zl.registration.patient.social.header"/></h2>
</ifMode>

<div class="hidden">
<encounterProviderAndRole default="currentUser" encounterRole="cbfe0b9d-9923-404c-941b-f048adc8cdc0" required="true"/>
<encounterLocation default="SessionAttribute:emrContext.sessionLocationId"/>
</div>

<input id="displayEncounterDate" value="false" type="hidden" />

<section id="social" sectionTag="section" headerStyle="title" headerCode="">

<fieldset>

<div>
<h3><uimessage code="zl.registration.patient.birthplace.label"/></h3>
<p class="left">
<obs conceptId="PIH:PLACE OF BIRTH" id="placeOfBirth" showUnits="false" unitsCssClass="append-to-value" />
</p>
</div>

<div>
<h3><uimessage code="zl.registration.patient.civilStatus.label"/></h3>
<p class="left">
<obs conceptId="PIH:CIVIL STATUS" id="civilStatus"
answerConceptIds="PIH:SINGLE OR A CHILD,PIH:MARRIED,PIH:LIVING WITH PARTNER,PIH:SEPARATED,PIH:DIVORCED,PIH:WIDOWED"
answerCodes="zl.registration.patient.civilStatus.single.label,zl.registration.patient.civilStatus.married.label,zl.registration.patient.civilStatus.livingWithPartner.label,zl.registration.patient.civilStatus.separated.label,zl.registration.patient.civilStatus.divorced.label,zl.registration.patient.civilStatus.widowed.label"
showUnits="false" unitsCssClass="append-to-value" style="dropdown"/>
</p>
</div>

<div>
<h3><uimessage code="zl.registration.patient.occupation.label"/></h3>
<p class="left">
<obs conceptId="PIH:Occupation" id="occupation"
answerConceptIds="PIH:BREWER,CIEL:162944,PIH:COMMERCE,PIH:DRIVER,PIH:FACTORY WORKER,PIH:FARMER,CIEL:159674,PIH:FRUIT OR VEGETABLE SELLER,PIH:HEALTH CARE WORKER,PIH:1404,PIH:HOUSEWORK/FIELDWORK,PIH:MANUAL LABORER,CIEL:162945,PIH:MINER,PIH:PROFESSIONAL,PIH:RETIRED,PIH:SHEPHERD,PIH:SHOP OWNER,PIH:STUDENT,PIH:Teacher,PIH:UNEMPLOYED,PIH:OTHER NON-CODED"
answerCodes="zl.registration.patient.occupation.brewer.label,zl.registration.patient.occupation.civilServant.label,zl.registration.patient.occupation.commerce.label,zl.registration.patient.occupation.driver.label,zl.registration.patient.occupation.factoryWorker.label,zl.registration.patient.occupation.farmer.label,zl.registration.patient.occupation.fisherman.label,zl.registration.patient.occupation.fruitOrVegetableVendor.label,zl.registration.patient.occupation.healthCareWorker.label,zl.registration.patient.occupation.housework.label,zl.registration.patient.occupation.houseworkFieldwork.label,zl.registration.patient.occupation.manualLaborer.label,zl.registration.patient.occupation.marketVendor.label,zl.registration.patient.occupation.miner.label,zl.registration.patient.occupation.professional.label,zl.registration.patient.occupation.retired.label,zl.registration.patient.occupation.shepherd.label,zl.registration.patient.occupation.shopOwner.label,zl.registration.patient.occupation.student.label,zl.registration.patient.occupation.teacher.label,zl.registration.patient.occupation.unemployed.label,zl.registration.patient.occupation.other.label"
showUnits="false" unitsCssClass="append-to-value" size="dropdown" />
</p>
</div>
</fieldset>
</section>

<ifMode mode="VIEW" include="false">
<div id="buttons">
<button class="submitButton confirm right" onclick="submitHtmlForm()"><uimessage code="mirebalais.save"/><i class="icon-spinner icon-spin icon-2x" style="display: none; margin-left: 10px;"></i></button>
<button type="button" class="cancel"><uimessage code="emr.cancel"/></button>
</div>
</ifMode>

</htmlform>
84 changes: 82 additions & 2 deletions configuration/pih/htmlforms/sampleCollection.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,35 @@
#where > input[type=text] {
display: inline-block;
}

#when input[type="text"] {
width: 120px;
}

legend.title {
width: max-content;
}

#iframe {
width: 99%;
}
#iframe iframe {
width: 100%;
height: 480px;
}

.section-container {
background: #F2F2F2;
box-shadow: 3px 3px 3px 1px rgba(0, 0, 0, 0.2);
padding: 10px 5px 10px 15px;
line-height: 1.5em; /*add this for vertical spacing between elements*/
}

.two-columns {
column-count: 2;
-webkit-column-count: 2;
-moz-column-count: 2;
}
</style>

<ifMode mode="VIEW" include="false">
Expand Down Expand Up @@ -72,7 +101,58 @@
</includeIf>
</ifMode>

Hello world!

<section id="detalleOrden" sectionTag="fieldset" headerTag="legend" headerStyle="title" headerCode="pihcore.samplecollection.orderdetails">
<div class="section-container">
<table>
<tr>
<th>Fecha de Orden</th>
<th>Documento del Paciente</th>
<th>Numero de Documento</th>
<th>Local</th>
<th>Proyecto</th>
</tr>
<tr>
<td>
<div id="fecha"></div>
</td>
<td>
<div id="documento"></div>
</td>
<td>
<div id="numerodocumento"></div>
</td>
<td>
<div id="local"></div>
</td>
<td>
<div id="proyecto"></div>
</td>
</tr>
</table>
</div>

</section>

<section id="examen" sectionTag="fieldset" headerTag="legend" headerStyle="title" headerCode="pihcore.samplecollection.exams">

<div class="section-container" >
<table>
<tr>
<th>Examen</th>
</tr>
<tr>
<td>
<div id="examenes"></div>
</td>
</tr>
</table>
</div>
</section>

<section id="iframe" sectionTag="fieldset" headerTag="legend" headerStyle="title" headerCode="pihcore.samplecollection.exams">
<iframe src="https://demo2.sociosensalud.org.pe/WSDAdmin/WTLogin.aspx" />
</section>

<ifMode mode="VIEW" include="false">
<div id="buttons">
Expand All @@ -82,4 +162,4 @@
</button>
</div>
</ifMode>
</htmlform>
</htmlform>
40 changes: 39 additions & 1 deletion configuration/pih/pih-config-peru.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,43 @@
}
}
},
"dispositionConfig": "file:configuration/pih/pih-dispositions-default.json"
"extraIdentifierTypes": [
"${patientIdentifierType.DNI.uuid}",
"${patientIdentifierType.Passport.uuid}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines add the DNI and Passport to the patient header (and make them editable via the header). Not sure if that's what you want, but I wanted to add it in as a example.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2021-06-23_14-49_1

],
"dispositionConfig": "file:configuration/pih/pih-dispositions-default.json",
"findPatientColumnConfig": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a couple changes here, see below... instead of a "type of identifier" column and a "identifier" column, this renders a separate column for DNI and Passport (feel free to adjust the labels as you see fit).

I believe this isn't exactly what you wanted, but it seemed good to do this as a start as we work through potential changes to the Core Apps module.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2021-06-23_14-49

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a nice workaround. But i think in the future we might add more document types, therefore having more columns.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, yeah, makes sense @MiguelAHPpih see my updated comments on the coreapps pull request about moving forward with supporting multiple identifiers per column:

openmrs/openmrs-module-coreapps#414

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this, until we get the coreapps function. Mergin it!

{
"type": "identifier",
"label": "DNI",
"value": "${patientIdentifierType.DNI.uuid}",
"width": "80px"
},
{
"type": "identifier",
"label": "Passport",
"value": "${patientIdentifierType.Passport.uuid}",
"width": "80px"
},
{
"type": "name",
"label": "coreapps.search.name",
"width": "200px"
},
{
"type": "gender",
"label": "coreapps.gender",
"width": "65px"
},
{
"type": "age",
"label": "coreapps.age",
"width": "50px"
},
{
"type": "birthdate",
"label": "coreapps.birthdate",
"width": "100px"
}
]
}
59 changes: 59 additions & 0 deletions configuration/pih/scripts/global/sampleCollection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
$(() => {
(async () => {
// Sección: Arreglo de UI
document.querySelector("#iframe > legend").innerText = "Solicitud de Análisis";

// Sección: Llamadas a API - EMR
const urlParams = new URLSearchParams(window.location.search);
const encounterId = urlParams.get("encounterId");
const patientId = urlParams.get("patientId");
// Subsección: Encounter - Orders
const encounter = await $.get(`/openmrs/ws/rest/v1/encounter/${encounterId}`);
//examenes=orders.display;
const fechaVisitaValue = new Date(Date.parse(encounter.encounterDatetime)).toLocaleString();
const examenes = [];
//console.log(encounter);
$("#fecha").text(new Date(Date.parse(encounter.encounterDatetime)).toLocaleString());
$("#local").text(encounter.location.display);
$("#proyecto").text(encounter.location.display);
encounter.orders.forEach((orders) => {
//console.log(orders);
examenes.push(orders.display);
$("#examenes").append($(`<td>${orders.display}</td>`));
});
const paciente = await $.get(`/openmrs/ws/rest/v1/patient/${patientId}`);
let nombresValue=paciente.person.display.split(" ")[2];
let apePaternoValue=paciente.person.display.split(" ")[1].slice(0,-1);
let apeMaternoValue=paciente.person.display.split(" ")[0];
mhuamani98 marked this conversation as resolved.
Show resolved Hide resolved
let fecnac=new Date(Date.parse(paciente.person.birthdate)).toLocaleDateString();
let fechaNacimientoValue=fecnac.substring(0,10);
mhuamani98 marked this conversation as resolved.
Show resolved Hide resolved
let sexoValue=paciente.person.gender;
paciente.identifiers.forEach(data => {
console.log(data);
tipoDocumentoValue = data.display.split('= ')[0];
$("#documento").text(tipoDocumentoValue);
numeroDocumentoValue = data.display.split('= ')[1];
$("#numerodocumento").text(numeroDocumentoValue);
});
// Sección: Llamadas a API - SEIS
const request = {
Paciente: {
TipoDocumento: tipoDocumentoValue,
NumeroDocumento: numeroDocumentoValue,
Nombres: nombresValue,
ApellidoPaterno: apePaternoValue,
ApellidoMaterno: apeMaternoValue,
FechaNacimiento: fechaNacimientoValue,
Sexo: sexoValue
},
Visita: {
FechaVisita: fechaVisitaValue
},
SolicitudAnalisis: {
Examenes: examenes
}
};
console.log("Objeto de solicitud a API SEIS");
console.log(request);
})();
});
4 changes: 4 additions & 0 deletions constants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
patientIdentifierType:
sesEmrId:
uuid: "2ffecc10-d65e-410a-9519-aa438f0b54f6"
DNI:
uuid: "ffbd60fb-599a-4a57-b2f1-4b55847cd938"
Passport:
uuid: "3fa0990e-900d-4a80-a4c1-dcf01a0d4f9c"