Skip to content

Commit

Permalink
#73 Added Patient questions, answers, patient list, updated api, doct…
Browse files Browse the repository at this point in the history
…or feed, and login form to fix some race conditions
  • Loading branch information
TareqK committed Sep 25, 2020
1 parent ec5242d commit baf4145
Show file tree
Hide file tree
Showing 18 changed files with 408 additions and 86 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/openmymed/accessmd/app/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public static void startServer() {
app.get("/", new VueComponent("<login></login>"), roles(NONE));
app.get("/dashboard", new VueComponent("<doctor-home></doctor-home>"), roles(ROLE_DOCTOR));
app.get("/patient", new VueComponent("<patient-list></patient-list>"), roles(ROLE_DOCTOR));
app.get("/patient/:patientId", new VueComponent("<patient-details></patient-details>"), roles(ROLE_DOCTOR));
app.get("/patient/:patientId", new VueComponent("<patient-profile></patient-profile>"), roles(ROLE_DOCTOR));

app.get("/admin/dashboard", new VueComponent("<admin-home></admin-home>"), roles(ROLE_ADMIN));

Expand Down
70 changes: 15 additions & 55 deletions core/src/main/resources/vue/components/add-doctor-modal.vue
Original file line number Diff line number Diff line change
@@ -1,78 +1,38 @@
<template id="add-doctor-modal">
<div
class="modal fade"
id="exampleModal"
tabindex="-1"
role="dialog"
aria-labelledby="exampleModalLabel"
aria-hidden="true"
>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" >
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">
Add Doctor
</h5>
<button
type="button"
class="close"
data-dismiss="modal"
aria-label="Close"
>
<button type="button" class="close" data-dismiss="modal"aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body text-left container-fluid">
<div class="form-group container-fluid">
<label for="username">Username</label>
<input
class="form-control"
id="username"
type="text"
v-model="username"
></input>
<input class="form-control" id="username" type="text" v-model="username"></input>
</div>
<div class="form-group container-fluid">
<label for="password">Password</label>
<input
class="form-control"
id="password"
type="password"
v-model="password"
></input>
<input class="form-control" id="password" type="password" v-model="password"></input>
</div>
<div class="form-group container-fluid">
<label for="firstName">First Name</label>
<input
class="form-control"
id="firstName"
type="text"
v-model="firstName"
></input>
<input class="form-control" id="firstName" type="text" v-model="firstName"></input>
</div>
<div class="form-group container-fluid">
<label for="lastName">Last Name</label>
<input
class="form-control"
id="lastName"
type="text"
v-model="lastName"
></input>
<input class="form-control" id="lastName" type="text" v-model="lastName" ></input>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-secondary"
data-dismiss="modal"
>
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Close
</button>
<button
class="btn btn-primary"
data-dismiss="modal"
v-on:click="addDoctor"
>
<button class="btn btn-primary" data-dismiss="modal" v-on:click="addDoctor" >
Add
</button>
</div>
Expand All @@ -83,12 +43,12 @@
<script>
Vue.component('add-doctor-modal', {
template: '#add-doctor-modal',
data : () =>({
username : "",
password : "",
firstName:"",
lastName:""
}),
data: () => ({
username: "",
password: "",
firstName: "",
lastName: ""
}),
methods: {
addDoctor: function () {
window.apiService.addDoctor({
Expand All @@ -99,7 +59,7 @@
});
},
show: function () {
$(this.$el).modal({backdrop: false});
$(this.$el).modal({backdrop: false});
}
}
});
Expand Down
28 changes: 14 additions & 14 deletions core/src/main/resources/vue/components/doctor-feed-item.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<template id="doctor-feed-item">
<tr>
<th scope="row" class="text-left">
{{feedItem.patientName}}
{{update.patientName}}
</th>
<td this="updateType" class="text-center">
{{updateType}}
</td>
<td this="time" class="text-center">
{{feedItem.time}}
{{update.time}}
</td>
<td this="value" class="text-center">
{{content}}
Expand All @@ -21,32 +21,32 @@
<script>
Vue.component("doctor-feed-item", {
template: "#doctor-feed-item",
props: ["feedItem"],
props: ["update"],
computed: {
profileLink: function () {
return "/patient/" + this.feedItem.patientId;
return "/patient/" + this.update.patientId;
},
updateType: function () {
if (this.feedItem.type === "UNSEEN_SYMPTOM") {
if (this.update.type === "UNSEEN_SYMPTOM") {
return "Symptom";
} else if (this.feedItem.type === "UNSEEN_ANSWER") {
} else if (this.update.type === "UNSEEN_ANSWER") {
return "Answer";
}
},
content: function () {
if (this.feedItem.type === "UNSEEN_SYMPTOM") {
return window.icpcService.getTitle(this.feedItem.value)
} else if (this.feedItem.type === "UNSEEN_ANSWER") {
return "Question : " + this.feedItem.value;
if (this.update.type === "UNSEEN_SYMPTOM") {
return window.icpcService.getTitle(this.update.value)
} else if (this.update.type === "UNSEEN_ANSWER") {
return "Question : " + this.update.value;
}
}
},
methods: {
dismiss: function () {
if (this.feedItem.type === "UNSEEN_SYMPTOM") {
window.apiService.archiveSymptom(this.data.patientId, this.data.entityId);
} else if (this.feedItem.type === "UNSEEN_ANSWER") {
window.apiService.archiveAnswer(this.data.patientId, this.data.entityId);
if (this.update.type === "UNSEEN_SYMPTOM") {
window.apiService.archiveSymptom(this.update.patientId, this.update.entityId);
} else if (this.update.type === "UNSEEN_ANSWER") {
window.apiService.archiveAnswer(this.update.patientId, this.update.entityId);
}
this.$emit("dismiss");
}
Expand Down
5 changes: 4 additions & 1 deletion core/src/main/resources/vue/components/doctor-feed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<th scope="col" class="text-right"></th>
</thead>
<tbody>
<doctor-feed-item v-for="(update, index) in updates" :key="update.entityId" v-bind="update" v-on:dismiss="dismissRow(index)"></doctor-feed-item>
<template v-for="(update, index) in updates" :key="update.entityId">
<doctor-feed-item v-bind:update="update" v-on:dismiss="dismissRow(index)"></doctor-feed-item>
</template>
</tbody>
</table>
</div>
Expand All @@ -26,6 +28,7 @@
methods: {
dismissRow: function (index) {
this.updates.splice(index, 1);
this.$emit("dismiss");
}
},
created() {
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/resources/vue/components/login-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@
let fullName = json.firstName + " " + json.lastName;
if (json.userRole == "ROLE_DOCTOR") {
sessionStorage.setItem("auth", true)
window.icpcService.loadIcpc();
sessionStorage.setItem("name", fullName);
window.location.href = "/dashboard";
window.icpcService.loadIcpc().then(() => {
window.location.href = "/dashboard";
});
} else if (json.userRole == "ROLE_ADMIN") {
sessionStorage.setItem("auth", true)
sessionStorage.setItem("name", fullName);
Expand Down
85 changes: 85 additions & 0 deletions core/src/main/resources/vue/components/medical-profile.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<template id="medical-profile">
<div this="el" class="col-lg-3 p-0 border-right">
<div class="d-flex row mt-4 pl-5">
<img alt="patient-profile-img" class="profile-img" src="https://upload.wikimedia.org/wikipedia/commons/thumb/7/7e/Circle-icons-profile.svg/768px-Circle-icons-profile.svg.png" ></img>
<div class="ml-2">
<h5 this="name" class="mb-0"></h5>
<h6 this="age" class="text-secondary"></h6>
</div>
</div>
<h5 class="bg-blue-primary text-white d-block mx-auto p-2 mt-3">
General Info
</h5>
<div class="row text-center p-3">
<div class="col-4">
<h6>Sex</h6>
<h4 this="sex" class="text-info">
</h4>
</div>
<div class="col-4">
<h6>Height</h6>
<div class="d-inline-flex text-info">
<h4 this="height"></h4>
<p class="ml-1">cm</p>
</div>
</div>
<div class="col-4">
<h6>Weight</h6>
<div class="d-inline-flex text-info">
<h4 this="weight"></h4>
<p class="ml-1">kg</p>
</div>
</div>
</div>
<h5 class="bg-blue-primary text-white d-block mx-auto p-2 mt-3">
Medical Flags
</h5>
<div class="col-12 py-1">
<input disabled="disabled" type="checkbox" id="G6PD" this="g6pdDeficiency" name="G6PD" value="G6PD Deficiency" ></input>
<label class="ml-1" for="G6PD">
G6PD Deficiency
</label>
<br></br>
<input disabled="disabled" type="checkbox" id="respiratory" name="respiratory" value="Respiratory Diseases" this="respiratoryDiseases"></input>
<label class="ml-1" for="respiratory">
Respiratory Diseases
</label>
<br ></br>
<input disabled="disabled" type="checkbox" id="diabetes" name="diabetes" value="Diabetes" this="diabetes"></input>
<label class="ml-1" for="diabetes">
Diabetes
</label>
<br ></br>
<input disabled="disabled" type="checkbox" id="cardio" name="cardio" value="Cardiovascular Diseases" this="cardiovascularDiseases"></input>
<label class="ml-1" for="cardio">
Cardiovascular Diseases
</label>
<br ></br>
<input disabled="disabled" type="checkbox" id="obesity" name="obesity" value="Obesity" this="obesity"></input>
<label class="ml-1" for="obesity">
Obesity
</label>
<br></br>
</div>
<h5 class="bg-blue-primary text-white d-block mx-auto p-2 mt-3">
Current Medications
</h5>
<div class="p-1">
{this.medications = list('ul', Medication)}
</div>
</div>
</template>
<script>
Vue.component("medical-profile", {
template: "#medical-profile",
props: ["patientId"],
data: () => ({
medications: [],
medicalData: {},
personaldata: {}
}),
created() {
}
})
</script>
39 changes: 39 additions & 0 deletions core/src/main/resources/vue/components/patient-answer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template id="patient-answer">
<div class="row">
<div class="answer-card card card-common rounded-lg w-100">
<div class="card-header d-flex justify-content-start">
<h6>{{answer.question.question}}</h6>
</div>
<div class="card-body w-100">
<div class="answer-note">{{answer.answer}}</div>
<p>
<div class="d-flex justify-content-between w-100">
<div>
<div>{{answer.creationDate}}</div>
<div class="d-flex">
<i class="fa fa-clock"></i>&nbsp;
<div>{{answer.creationDate}}</div>
</div>
</div>
<div>
<button v-on:click="dismiss" class="btn btn-danger">Dismiss</button>
</div>
</div>
</p>
</div>
</div>
</div>
</template>
<script>
Vue.component("patient-answer", {
template: "patient-answer",
props: ["answer"],
methods: {
dismiss: function () {
window.apiService.archiveAnswer(this.answer.patientId, this.answer.id).then((res) => {
this.$emit("dismiss");
});
}
}
})
</script>
43 changes: 43 additions & 0 deletions core/src/main/resources/vue/components/patient-answers.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<template id="patient-answers">
<div class="col-lg-6">
<div class="bg-light-grey mx-2 my-4 ">
<div class="col-12 d-flex justify-content-between">
<h5 class="py-3 text-info font-weight-bold">Patient Answers</h5>
<div class="py-2">
<a v-bind:href="askLink" class="btn btn-primary">Questions</a>
</div>
</div>
<div class="col-12">
<div v-if="answers && answers.length>0" class="container-fluid">
<template v-for="(answer, index) in answers" :key="index">
<patient-answer v-bind:answer="answer" v-on:dismiss="dismiss(index)" ></patient-answer>
</template>
</div>
</div>
</div>
</div>
</template>
<script>
Vue.component('patient-answers', {
template: "#patient-answers",
props: ["patientId"],
data: () => ({
answers: []
}),
computed: {
askLink: function () {
return"/patient/" + this.patientId + "/ask"
}
},
methods: {
dismiss: function (index) {
this.answers.splice(index, 1);
}
},
created() {
window.apiService.getPatientAnswers(this.patientId).then((data) => {
this.answers = data;
});
}
})
</script>
Loading

0 comments on commit baf4145

Please sign in to comment.