-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
379 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
from opal.core.patient_lists import TaggedPatientList | ||
from elcid import models as elcid_models | ||
from opal import models as opal_models | ||
from plugins.tb import models as tb_models | ||
|
||
|
||
class TBPatientReview(TaggedPatientList): | ||
display_name = "Patient Review" | ||
|
||
direct_add = False | ||
tag = "tb_patient_review" | ||
|
||
# template name is not actually used | ||
template_name = "tb_patient_review_list.html" | ||
|
||
# schema is not used | ||
schema = [] | ||
|
||
def to_dict(self, user): | ||
tagging = opal_models.Tagging.objects.filter( | ||
archived=False, | ||
value=self.tag | ||
) | ||
episode_qs = opal_models.Episode.objects.filter( | ||
tagging__in=tagging | ||
).prefetch_related( | ||
'patient__bedstatus' | ||
).prefetch_related( | ||
'patient__demographics_set' | ||
) | ||
episode_dicts = [] | ||
for episode in episode_qs: | ||
episode_id = episode.id | ||
episode_dict = {"id": episode_id} | ||
demographics = episode.patient.demographics_set.all() | ||
episode_dict['demographics'] = [d.to_dict(user) for d in demographics] | ||
statuses = episode.patient.bedstatus.all() | ||
episode_dict["bed_status"] = [s.to_dict() for s in statuses] | ||
primary_diagnosis = elcid_models.Diagnosis.objects.filter( | ||
episode_id=episode_id | ||
).filter(category=elcid_models.Diagnosis.PRIMARY) | ||
episode_dict[elcid_models.Diagnosis.get_api_name()] = [ | ||
pd.to_dict(user) for pd in primary_diagnosis | ||
] | ||
patient_consultation_qs = tb_models.PatientConsultation.objects.filter( | ||
episode_id=episode_id | ||
) | ||
recent_patient_consultation = patient_consultation_qs.order_by( | ||
"-when" | ||
).first() | ||
episode_dict["recent_patient_consultation"] = None | ||
if recent_patient_consultation: | ||
episode_dict[ | ||
"recent_patient_consultation" | ||
] = recent_patient_consultation.to_dict(user) | ||
# this is required to remove the episode tag | ||
episode_dict["tagging"] = { | ||
self.tag: True | ||
} | ||
episode_dicts.append(episode_dict) | ||
return episode_dicts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
plugins/tb/static/js/tb/controllers/add_remove_tag_modal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
angular | ||
.module("opal.controllers") | ||
.controller( | ||
"AddRemoveTagCtrl", | ||
function ( | ||
$scope, | ||
ngProgressLite, | ||
$modalInstance, | ||
episode, | ||
tagName, | ||
tagDisplayName, | ||
addTag | ||
) { | ||
"use strict"; | ||
$scope.episode = episode; | ||
$scope.tagName = tagName; | ||
$scope.tagDisplayName = tagDisplayName; | ||
$scope.demographics = $scope.episode.demographics[0]; | ||
$scope.editingName = $scope.demographics.first_name + " " + $scope.demographics.surname; | ||
$scope.addTag = addTag; | ||
|
||
var tagging = {}; | ||
if (episode.tagging.length) { | ||
tagging = episode.tagging[0].makeCopy(); | ||
} | ||
|
||
$scope.cancel = function(){ | ||
$modalInstance.close(); | ||
} | ||
|
||
$scope.save = function () { | ||
ngProgressLite.set(0); | ||
ngProgressLite.start(); | ||
if ($scope.addTag) { | ||
tagging[tagName] = true; | ||
} else { | ||
tagging[tagName] = false; | ||
} | ||
|
||
episode.tagging[0].save(tagging).then( | ||
function () { | ||
ngProgressLite.done(); | ||
$modalInstance.close(); | ||
}, | ||
function () { | ||
ngProgressLite.done(); | ||
$modalInstance.close(); | ||
} | ||
); | ||
}; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{% extends "base_templates/form_modal_base.html" %} | ||
{% block title %} | ||
<span ng-show="addTag">Add ([[ editingName ]])</span> | ||
<span ng-hide="addTag">Remove ([[ editingName ]])</span> | ||
{% endblock %} | ||
|
||
{% block modal_body%} | ||
{# Add the patient to the list #} | ||
<div ng-show="addTag"> | ||
<div class="row"> | ||
<div class="col-md-8 col-md-offset-2 text-center"> | ||
<p class="lead"> | ||
Add [[ editingName ]] to the <strong>[[ tagDisplayName ]]</strong> | ||
</p> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-6 col-md-offset-3 text-center"> | ||
<button class="btn btn-primary btn-save" one-click-only ng-click="save()"> | ||
<i class="fa fa-plus"></i> Add to list | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
|
||
{# Remove the patient from the list #} | ||
<div ng-hide="addTag"> | ||
<div class="row"> | ||
<div class="col-md-8 col-md-offset-2 text-center"> | ||
<p class="lead"> | ||
Remove [[ editingName ]] from the <strong>[[ tagDisplayName ]]</strong> | ||
</p> | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-6 col-md-offset-3 text-center"> | ||
<button class="btn btn-primary btn-save" one-click-only ng-click="save()"> | ||
<i class="fa fa-sign-out"></i> Remove from list | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block modal_save %}{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
{% extends "tb/base.html" %} {% load forms %} {% load elcid_panels %} | ||
{% block tb_content %} | ||
<div class="panel panel-default tb-clinic-list"> | ||
<div class="panel-heading"> | ||
<div class="row"> | ||
<div class="col-md-6"> | ||
<h1>TB Patient Review List</h1> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="panel-body"> | ||
<div class="row"> | ||
<div class="col-md-11"> | ||
<div | ||
ng-repeat="row in rows" | ||
class="panel panel-default patient-row" | ||
ng-class="{'collapsed': isCardCollapsed}" | ||
> | ||
<a | ||
class="panel-link" | ||
href="[[ '/#/patient/' + row.demographics[0].patient_id + '/' + row.id ]]" | ||
> | ||
<div class="panel-heading"> | ||
<div class="row"> | ||
<div class="col-md-10"> | ||
<h3> | ||
<i class="fa fa-user"></i> | ||
[[ row.demographics[0].first_name ]] [[ | ||
row.demographics[0].surname ]] [[ | ||
row.demographics[0].hospital_number ]] | ||
<small> | ||
[[ row.demographics[0].date_of_birth|displayDate ]] | ||
<span ng-show="row.bed_statuses.length"> | ||
[[row.bed_statuses[0].hospital]] | ||
[[row.bed_statuses[0].ward]] | ||
[[row.bed_statuses[0].room]] [[row.bed_statuses[0].bed]] | ||
</span> | ||
</small> | ||
</h3> | ||
</div> | ||
<div class="col-md-2 text-right"> | ||
<button | ||
class="btn btn-primary" | ||
pathway-episode="row" | ||
open-pathway="remove" | ||
pathway-callback="removeFromList(row.id)" | ||
> | ||
{% icon 'fa-sign-out' %} Remove | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div uib-collapse="isCardCollapsed" class="panel-body"> | ||
<div class="col-md-5"> | ||
<h4> | ||
<strong> | ||
{% icon models.Diagnosis.get_icon %} Primary Diagnosis | ||
</strong> | ||
</h4> | ||
<div ng-repeat="item in row.diagnosis"> | ||
<span ng-show="item.condition"> | ||
<p><b>Condition:</b> [[ item.condition ]]</p> | ||
<p><b>Date:</b> [[ item.date_of_diagnosis | displayDate ]]</p> | ||
<p>[[ item.details ]]</p> | ||
</span> | ||
</div> | ||
</div> | ||
<div class="col-md-7 overflow-x-auto"> | ||
<h4> | ||
<strong | ||
>{% icon 'fa fa-comments' %} Most Recent Clinical | ||
Note</strong | ||
> | ||
</h4> | ||
<div ng-if="row.recent_patient_consultation"> | ||
<p> | ||
<span | ||
ng-show="row.recent_patient_consultation.initials && row.recent_patient_consultation.initials.trim().length" | ||
> | ||
<p> | ||
<b>By: </b> [[row.recent_patient_consultation.initials]] | ||
</p> | ||
</span> | ||
<span | ||
ng-show="row.recent_patient_consultation.reason_for_interaction" | ||
> | ||
<p> | ||
<b>Reason For Interaction: </b | ||
>[[row.recent_patient_consultation.reason_for_interaction]] | ||
</p> | ||
</span> | ||
<span | ||
ng-show="row.recent_patient_consultation.examination_findings" | ||
> | ||
<b>Examination Findings: </b> | ||
<div markdown="examination_findings"></div> | ||
</span> | ||
<span ng-show="row.recent_patient_consultation.discussion"> | ||
<b>Discussion: </b> | ||
<div markdown="discussion"></div> | ||
</span> | ||
<span ng-show="row.recent_patient_consultation.progress"> | ||
<b>Progress: </b> | ||
<div markdown="progress"></div> | ||
</span> | ||
<span | ||
ng-show="row.recent_patient_consultation.infection_control" | ||
> | ||
<b>Infection Control: </b> | ||
<div markdown="infection_control"></div> | ||
</span> | ||
<span ng-show="row.recent_patient_consultation.plan"> | ||
<b>Plan: </b> | ||
<div markdown="plan"></div> | ||
</span> | ||
<span class="bg-success" ng-show="row.recent_patient_consultation.sent_upstream"> | ||
<br> | ||
Note written to EPR | ||
</span> | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |
Oops, something went wrong.