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

Adds a liaison outcome model refs #1664 #1665

Open
wants to merge 2 commits into
base: v0.7.1.2
Choose a base branch
from
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions elcid/data/lookuplists/lookuplists.json
@@ -1,4 +1,34 @@
{
"liaisonproblem": [
{
"synonyms": [],
"name": "Malaria"
},
{
"synonyms": [],
"name": "Febrile returning traveller"
},
{
"synonyms": [],
"name": "Rash"
},
{
"synonyms": [],
"name": "Diarrhoea"
},
{
"synonyms": [],
"name": "PUO"
},
{
"synonyms": [],
"name": "Localising infection"
},
{
"synonyms": [],
"name": "Known tropical diagnosis"
}
],
"line_removal_reason": [
{
"synonyms": [],
Expand Down
44 changes: 44 additions & 0 deletions infectiousdiseases/migrations/0006_liaisonoutcome.py
@@ -0,0 +1,44 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-12-20 14:51
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import opal.models


class Migration(migrations.Migration):

dependencies = [
('opal', '0034_auto_20171214_1845'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('infectiousdiseases', '0005_auto_20180303_1431'),
]

operations = [
migrations.CreateModel(
name='LiaisonOutcome',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(blank=True, null=True)),
('updated', models.DateTimeField(blank=True, null=True)),
('consistency_token', models.CharField(max_length=8)),
('when', models.DateTimeField(blank=True, null=True)),
('phone_advice_given', models.BooleanField(default=False)),
('redirected_to_clinic', models.CharField(blank=True, choices=[(b'OPAT', b'OPAT'), (b'RAID', b'RAID'), (b'Walk-in', b'Walk-in')], max_length=256, null=True)),
('email_advice_given', models.BooleanField(default=False)),
('transfer_offered', models.BooleanField(default=False)),
('transfer_response', models.CharField(blank=True, choices=[(b'Declined', b'Declined'), (b'Accepted', b'Accepted')], max_length=256, null=True)),
('liaison_ended', models.NullBooleanField()),
('next_date_of_contact', models.DateField(blank=True, null=True)),
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_infectiousdiseases_liaisonoutcome_subrecords', to=settings.AUTH_USER_MODEL)),
('episode', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='opal.Episode')),
('updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='updated_infectiousdiseases_liaisonoutcome_subrecords', to=settings.AUTH_USER_MODEL)),
],
options={
'abstract': False,
},
bases=(opal.models.UpdatesFromDictMixin, opal.models.ToDictMixin, models.Model),
),
]
37 changes: 37 additions & 0 deletions infectiousdiseases/migrations/0007_auto_20181220_1645.py
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-12-20 16:45
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('infectiousdiseases', '0006_liaisonoutcome'),
]

operations = [
migrations.CreateModel(
name='LiaisonProblem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, unique=True)),
],
options={
'ordering': ['name'],
'abstract': False,
},
),
migrations.AddField(
model_name='liaisonoutcome',
name='problem_category_ft',
field=models.CharField(blank=True, default=b'', max_length=255, null=True),
),
migrations.AddField(
model_name='liaisonoutcome',
name='problem_category_fk',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='infectiousdiseases.LiaisonProblem'),
),
]
47 changes: 47 additions & 0 deletions infectiousdiseases/models.py
@@ -1,5 +1,7 @@
from opal.models import EpisodeSubrecord
from opal.core.fields import ForeignKeyOrFreeText
from django.db import models
from opal.core import lookuplists


class ExternalLiaisonContactDetails(EpisodeSubrecord):
Expand Down Expand Up @@ -33,3 +35,48 @@ class ExternalLiaisonContactDetails(EpisodeSubrecord):
)

contact_notes = models.TextField(null=True, blank=True)


class LiaisonProblem(lookuplists.LookupList):
# category of liaison problems, e.g. malartia
pass


class LiaisonOutcome(EpisodeSubrecord):
CLINIC_OPTIONS = (
("OPAT", "OPAT",),
("RAID", "RAID",),
("Walk-in", "Walk-in"),
)

LIAISON_STATE = (
("liaison ongoing", "liaison ongoing", ),
("end of liaison", "enf of liaison", ),
)

TRANSFER_OPTIONS = (
("Declined", "Declined",),
("Accepted", "Accepted",),
)

when = models.DateTimeField(null=True, blank=True)
problem_category = ForeignKeyOrFreeText(
LiaisonProblem, verbose_name="Category of problem"
)
phone_advice_given = models.BooleanField(default=False)
redirected_to_clinic = models.CharField(
max_length=256, blank=True, null=True, choices=CLINIC_OPTIONS
)

email_advice_given = models.BooleanField(default=False)
transfer_offered = models.BooleanField(default=False)
transfer_response = models.CharField(
max_length=256,
blank=True,
null=True,
choices=TRANSFER_OPTIONS
)

liaison_ended = models.NullBooleanField()
next_date_of_contact = models.DateField(blank=True, null=True)

1 change: 1 addition & 0 deletions infectiousdiseases/patient_lists.py
Expand Up @@ -22,6 +22,7 @@
models.Antimicrobial,
models.MicrobiologyTest,
models.MicrobiologyInput,
id_models.LiaisonOutcome,
models.GeneralNote
]

Expand Down
1 change: 1 addition & 0 deletions infectiousdiseases/templates/detail/tropical_liaison.html
Expand Up @@ -41,5 +41,6 @@ <h3>
{% record_panel models.Antimicrobial %}
{% record_panel models.MicrobiologyTest %}
{% record_panel models.Todo %}
{% record_panel models.LiaisonOutcome %}
{% record_panel models.GeneralNote %}
</div> <!-- Ends Detail panels col 2 -->
32 changes: 32 additions & 0 deletions infectiousdiseases/templates/forms/liaison_outcome_form.html
@@ -0,0 +1,32 @@
{% load forms %}
{% datetimepicker field="LiaisonOutcome.when" %}
{% select field="LiaisonOutcome.problem_category" %}
{% checkbox field="LiaisonOutcome.phone_advice_given" %}
<div ng-show="editing.liaison_outcome.phone_advice_given">
{% select field="LiaisonOutcome.redirected_to_clinic" %}
</div>
{% checkbox field="LiaisonOutcome.email_advice_given" %}

{% checkbox field="LiaisonOutcome.transfer_offered" %}
<div ng-show="editing.liaison_outcome.transfer_offered">
{% radio field="LiaisonOutcome.transfer_response" %}
</div>

<div class="form-group">
<label class="control-label col-sm-3">Liason Finished?</label>
<div class="col-sm-8">
<label class="radio-inline">
<input class="" type="radio" ng-value="true" ng-model="editing.liaison_outcome.liaison_ended">
Liaison ended
</label>
<label class="radio-inline">
<input class="" type="radio" ng-value="false" ng-model="editing.liaison_outcome.liaison_ended">
Liaison ongoing
</label>
</div>
</div>

<div ng-show="editing.liaison_outcome.liaison_ended === false">
{% datepicker field="LiaisonOutcome.next_date_of_contact" %}
</div>

38 changes: 38 additions & 0 deletions infectiousdiseases/templates/records/liaison_outcome.html
@@ -0,0 +1,38 @@
<span ng-show="item.when">
[[ item.when | shortDateTime ]]
<br />
</span>
<span ng-show="item.problem_category">
[[ item.problem_category ]]
<br />
</span>
<span ng-show="item.phone_advice_given">
Phone Advice Given
<span ng-show="item.redirected_to_clinic">
- Referred To [[ item.redirected_to_clinic ]]
</span>
<br />
</span>
<span ng-show="item.email_advice_given">
Email Advice Given
<br />
</span>
<span ng-show="item.transfer_offered">
Transfer Offered
<span ng-show="item.transfer_response">
- [[ item.transfer_response ]]
</span>
<br />
</span>
</span>
<span ng-show="item.liaison_ended === true">
Liaison Ended
<br />
</span>
<span ng-show="item.liaison_ended === false">
Liaison Ongoing
<span ng-show="item.next_date_of_contact">
- [[ item.next_date_of_contact | shortDate ]]
</span>
<br />
</span>