Skip to content
Open
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
14 changes: 14 additions & 0 deletions PointOfDispensingApp/src/brokerRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,18 @@ export default {
return toResponse(e);
});
},

// Data should contain
// id, id of resource to update, and
// status, the new status
encounterStatus: (data) => {
return axios
.patch(`/broker/Encounter/${data.id}/Status`, { status: data.status })
.then((response) => {
return { data: response.data };
})
.catch((e) => {
return toResponse(e);
});
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ export default {
onSuccess(payload) {
//send data to Vuex
this.$store.dispatch("patientAdmitted", payload);

//advance to the consent & screening page
this.$router.push('ConsentScreening');
},
checkIn() {
let data = {
Expand Down
11 changes: 3 additions & 8 deletions PointOfDispensingApp/src/components/PatientLookupPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -360,14 +360,9 @@ export default {
this.setTwoDoseColorScheme();
}

if(this.$store.getters.hasPatientBeenCheckedIn) {
//Advance to the Consent and Screening page
this.$router.push("ConsentScreening");
}
else {
//Advance to the Check In page
this.$router.push("CheckIn");
}
let nextPage = this.$store.getters.resumePatientWorkflowPage;
//advance to the next appropriate page in the patient workflow
this.$router.push(nextPage);
});
},
parseDate(date) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@
<v-divider></v-divider>
</v-row>
<v-col cols="12">
<v-card class="mx-auto my-12" color="accent" dark height="50%" v-show="screeningComplete">
<v-card class="mx-auto my-12" color="accent" dark height="50%" v-show="true">
<v-card-title class="headline justify-center">
Proceed with vaccination?
</v-card-title>
Expand All @@ -343,13 +343,16 @@
</template>

<script>

import brokerRequests from "../brokerRequests";
export default {
name: 'VaccinationScreeningComponent',
computed: {
isConsentScreeningPageReadOnly() {
return this.$store.getters.isConsentScreeningPageReadOnly
},
encounterID() {
return this.$store.state.encounterResource.id;
},
},
methods:
{
Expand All @@ -376,7 +379,40 @@
vaccinationProceedDecision()
{
this.storeVaccinationScreeningData()

let encounterStatus;

if(this.vaccinationProceed == 'Yes') {
//update encounter status to "in-progress"
encounterStatus = "in-progress"
}
else if(this.vaccinationProceed == 'No') {
//update encounter status to "cancelled"
encounterStatus = "cancelled"
}

//send the updated encounter status to broker
let data = {
status: encounterStatus,
id: this.encounterID,
}
brokerRequests.encounterStatus(data).then((response) => {
if (response.data) {
this.onSuccess(response.data);
} else if (response.error) {
//console.log(response.error);
alert("Encounter status not updated");
}
});

//Advance to the Vaccination Event page
this.$router.push('VaccinationEvent');
},
onSuccess(payload) {
//send data to Vuex
console.log(payload)
//this.$store.dispatch('encounterStatusUpdate', response.data)
},
storeVaccinationScreeningData()
{
const screeningResponsesPayload = {
Expand All @@ -396,7 +432,8 @@
}
//send data to Vuex
this.$store.dispatch('vaccinationScreeningUpdate', screeningResponsesPayload)
}
},

},
components:
{
Expand Down
58 changes: 42 additions & 16 deletions PointOfDispensingApp/src/store/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ export default new Vuex.Store({
return (state.activeWorkflowState != 'DISCHARGED')
},
isConsentScreeningPageDisabled: state => {
//Consent and Screening page is not accessible before the patient record has been loaded
return (state.activeWorkflowState == 'NO_PATIENT_LOADED')
//Consent and Screening page is not accessible before the patient has been checked in
return ((state.activeWorkflowState == 'NO_PATIENT_LOADED') || (state.activeWorkflowState == 'RECORD_RETRIEVED'))
},
isConsentScreeningPageReadOnly: state => {
//Consent and Screening page is "read only" after the patient has been discharged
Expand All @@ -98,8 +98,16 @@ export default new Vuex.Store({
//(in other words, a user cannot go to the Configuration page while a patient record is actively in use)
return ((state.activeWorkflowState != 'NO_PATIENT_LOADED') && (state.activeWorkflowState != 'DISCHARGED'))
},
hasPatientBeenCheckedIn: state => {
return (state.encounterResource.status == 'arrived')
resumePatientWorkflowPage: state => {
switch (state.encounterResource.status) {
case 'arrived':
return "ConsentScreening";
case 'in-progress':
case 'cancelled':
return "VaccinationEvent";
default:
return "CheckIn";
}
},
howManyDosesHasPatientReceived: state => {
let numberOfDoses = 0;
Expand Down Expand Up @@ -142,18 +150,21 @@ export default new Vuex.Store({
},
patientRecordRetrieved(state, payload) {
state.patientResource = payload.Patient;
if(state.patientHistory) {
let numberOfDoses = payload.Immunization.length;

if(state.patientHistory) {
state.patientHistory = payload.Immunization;

let numberOfDoses = payload.Immunization.length;

if (numberOfDoses > 0) state.immunizationResource = payload.Immunization[numberOfDoses-1];

//Check the status of the immunization resource to determine the screening status
if(state.immunizationResource) {
if(state.immunizationResource.status == 'completed') {
state.screeningResponses.screeningComplete = true;
state.screeningResponses.vaccinationDecision = 'Yes';
}
else if(state.immunizationResource.status == 'not-done') {
else {
state.screeningResponses.screeningComplete = true;
state.screeningResponses.vaccinationDecision = 'No';
}
Expand All @@ -166,16 +177,31 @@ export default new Vuex.Store({
state.appointmentResource = payload.Appointment;
}

//Retrieve encounter resource 'status' field to determine the workflow state
//Retrieve encounter resource 'status' field to determine the workflow state and screening status
if(state.encounterResource.status) {
if (state.encounterResource.status == 'arrived') {
state.activeWorkflowState = 'ADMITTED'
}
else if (state.encounterResource.status == 'finished') {
state.activeWorkflowState = 'DISCHARGED'
}
else {
console.log(state.encounterResource.status)
switch(state.encounterResource.status) {
case 'arrived':
state.activeWorkflowState = 'ADMITTED'
state.screeningResponses.screeningComplete = false;
state.screeningResponses.vaccinationDecision = ' ';
break;
case 'in-progress':
state.activeWorkflowState = 'ADMITTED'
state.screeningResponses.screeningComplete = true;
state.screeningResponses.vaccinationDecision = 'Yes';
break;
case 'cancelled':
state.activeWorkflowState = 'ADMITTED'
state.screeningResponses.screeningComplete = true;
state.screeningResponses.vaccinationDecision = 'No';
break;
case 'finished':
state.activeWorkflowState = 'DISCHARGED'
//Screening state is determined via the immunization resource status
break;
default:
console.log(state.encounterResource.status)
break;
}
}
else {
Expand Down
47 changes: 35 additions & 12 deletions broker/endpoints/Encounter.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,35 @@ exports.post = (req, res) => {
exports.create = (req) => {
const encounter = req.body.Encounter;
const resource = Encounter.toFHIR(encounter);

return axios.post(`/Encounter`, resource).then((response) => {
return Encounter.toModel(response.data);
return Encounter.toModel(response.data);
});
};

exports.status = async (req, res) => {
const encounterId = req.params.id;
const status = req.body.status;

if (!status) {
res.status(400).send("Status must be provided ");
return;
}

const patch = [
{
op: "add",
path: "/status",
value: status
}
];

// update the database with new encounter
res.json(await axios.patch(`/Encounter/${encounterId}`, patch).then((response) => {
return Encounter.toModel(response.data);
}));
};

exports.discharge = async (req) => {
const status = "finished";
const id = req.query.encounter;
Expand All @@ -52,16 +75,16 @@ exports.discharge = async (req) => {

// patch status and end time
const patch = [
{
op: "add",
path: "/status",
value: status
},
{
op: "add",
path: "/period/end",
value: new Date().toISOString()
}
{
op: "add",
path: "/status",
value: status
},
{
op: "add",
path: "/period/end",
value: new Date().toISOString()
}
];

// update the database with new encounter
Expand Down
1 change: 1 addition & 0 deletions broker/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ app.get("/Observation*", keycloak.protect(), Observation.read);
app.post("/SendHL7Message", keycloak.protect(), SendHL7Message);

app.post("/Encounter", keycloak.protect(), Encounter.post);
app.patch("/Encounter/:id/Status", keycloak.protect(), Encounter.status)
app.get("/Encounter*", keycloak.protect(), Encounter.read);

app.post("/EpisodeOfCare", keycloak.protect(), EpisodeOfCare.create);
Expand Down