Skip to content
37 changes: 31 additions & 6 deletions app/routes/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -2061,16 +2061,35 @@ module.exports = (router) => {

const formData = {
machineRoom: mammogramData.machineRoom,
isIncompleteMammography:
mammogramData.isIncompleteMammography === 'yes' ? ['yes'] : [],
incompleteMammographyReason: mammogramData.incompleteMammographyReason,
isIncompleteMammography: Array.isArray(
mammogramData.isIncompleteMammography
)
? mammogramData.isIncompleteMammography
: mammogramData.isIncompleteMammography === 'yes'
? ['yes']
: [],
incompleteMammographyReasons: Array.isArray(
mammogramData.incompleteMammographyReasons
)
? mammogramData.incompleteMammographyReasons
: mammogramData.incompleteMammographyReasons
? [mammogramData.incompleteMammographyReasons]
: [],
incompleteMammographyReasonDetails:
mammogramData.incompleteMammographyReasonDetails,
incompleteMammographyFollowUpAppointment:
mammogramData.incompleteMammographyFollowUpAppointment,
incompleteMammographyFollowUpAppointmentDetails:
mammogramData.incompleteMammographyFollowUpAppointmentDetails,
isImperfectButBestPossible: Array.isArray(
mammogramData.isImperfectButBestPossible
)
? mammogramData.isImperfectButBestPossible
: mammogramData.isImperfectButBestPossible === 'yes'
? ['yes']
: [],
additionalDetails: mammogramData.additionalDetails,
notesForReader: mammogramData.notesForReader,
viewsRightBreast: [],
viewsLeftBreast: []
} // Convert views back to checkbox/input format
Expand Down Expand Up @@ -2257,9 +2276,9 @@ module.exports = (router) => {
isManualEntry: true,
machineRoom: formData.machineRoom,
views,
isIncompleteMammography: hasIncompleteMammography ? 'yes' : null,
incompleteMammographyReason: hasIncompleteMammography
? formData.incompleteMammographyReason
isIncompleteMammography: hasIncompleteMammography ? ['yes'] : null,
incompleteMammographyReasons: hasIncompleteMammography
? formData.incompleteMammographyReasons
: null,
incompleteMammographyReasonDetails: hasIncompleteMammography
? formData.incompleteMammographyReasonDetails
Expand All @@ -2270,7 +2289,13 @@ module.exports = (router) => {
incompleteMammographyFollowUpAppointmentDetails: hasIncompleteMammography
? formData.incompleteMammographyFollowUpAppointmentDetails
: null,
isImperfectButBestPossible: formData.isImperfectButBestPossible?.includes(
'yes'
)
? ['yes']
: null,
additionalDetails: formData.additionalDetails,
notesForReader: formData.notesForReader,
metadata: {
totalImages,
standardViewsCompleted,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{# app/views/_includes/incomplete-mammography-question.njk #}
{# app/views/_includes/additional-image-details.njk #}

{#
Include for incomplete mammography question
Include for additional image details section

Contains:
- Incomplete mammography checkbox with reasons and follow-up questions
- Imperfect but best possible images checkbox
- Notes for reader textarea

Parameters:
- namePrefix: string - prefix for form field names (e.g., "event[mammogramData]" or "event[mammogramDataTemp]")
Expand All @@ -10,13 +15,13 @@

{% set reasonHtml %}

{{ radios({
idPrefix: "incompleteMammographyReason",
name: namePrefix + "[incompleteMammographyReason]",
value: mammogramSource.incompleteMammographyReason,
{{ checkboxes({
idPrefix: "incompleteMammographyReasons",
name: namePrefix + "[incompleteMammographyReasons]",
values: mammogramSource.incompleteMammographyReasons,
fieldset: {
legend: {
text: "Why was imaging not completed?",
text: "Why could you not take all the images?",
classes: "nhsuk-fieldset__legend--s"
}
},
Expand All @@ -31,7 +36,10 @@
},
{
value: "Unable to scan tissue",
text: "Unable to scan tissue"
text: "Unable to scan tissue",
hint: {
text: "For example, large breasts or implanted device"
}
},
{
value: "Positioning difficulties due to wheelchair",
Expand Down Expand Up @@ -65,13 +73,13 @@
rows: 2
}) }}

{% set yesWhenPhysicalConditionImprovesDetailsHtml %}
{% set yesRecallRescheduleDetailsHtml %}
{{ textarea({
name: namePrefix + "[incompleteMammographyFollowUpAppointmentDetails]",
value: mammogramSource.incompleteMammographyFollowUpAppointmentDetails,
id: "incompleteMammographyFollowUpAppointmentDetails",
label: {
text: "Provide details for staff rebooking the appointment"
text: "Note for scheduling recall appointment"
},
rows: 3
}) }}
Expand All @@ -83,49 +91,67 @@
value: mammogramSource.incompleteMammographyFollowUpAppointment,
fieldset: {
legend: {
text: "Can another appointment be scheduled to take the remaining images?",
text: "Should the participant be recalled to take more images?",
classes: "nhsuk-fieldset__legend--s"
}
},
items: [
{
value: "Yes, as soon as possible",
text: "Yes, as soon as possible"
},
{
value: "Yes, when physical condition improves",
text: "Yes, when physical condition improves",
value: "Yes, record as 'to be recalled'",
text: "Yes, record as 'to be recalled'",
conditional: {
html: yesWhenPhysicalConditionImprovesDetailsHtml
html: yesRecallRescheduleDetailsHtml
}
},
{
value: "No, best possible images taken",
text: "No, best possible images taken"
value: "No, record as 'partial mammography'",
text: "No, record as 'partial mammography'"
}
]
}) }}

{% endset %}

{{ checkboxes({
idPrefix: "isImperfectButBestPossible",
name: namePrefix + "[isImperfectButBestPossible]",
values: mammogramSource.isImperfectButBestPossible,
items: [
{
value: "yes",
text: "Imperfect, but best possible images",
hint: {
text: "Image readers will be advised not to request a technical recall"
}
}
]
}) }}

{{ checkboxes({
idPrefix: "isIncompleteMammography",
name: namePrefix + "[isIncompleteMammography]",
values: mammogramSource.isIncompleteMammography,
fieldset: {
legend: {
text: "Incomplete mammography",
classes: "nhsuk-fieldset__legend--m",
isPageHeading: false
}
},
items: [
{
value: "yes",
text: "Incomplete set of mammograms",
text: "Not all mammograms taken",
conditional: {
html: reasonHtml
}
}
]
}) }}

{{ textarea({
name: namePrefix + "[notesForReader]",
id: "notesForReader",
value: mammogramSource.notesForReader,
label: {
text: "Notes for reader (optional)",
classes: "nhsuk-label--s"
},
hint: {
text: "Provide information for image readers when reviewing"
},
rows: 2
}) }}
4 changes: 1 addition & 3 deletions app/views/_includes/appointment/appointment-header.njk
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
{% endif %}

{% if currentUser | isClinician %}
{% if event | isInProgress %}
{% if event | isPaused or (event | isInProgress and event | startedByCurrentUser) %}
<div class="nhsuk-button-group">
{{ button({
text: "Resume appointment",
Expand All @@ -146,6 +146,4 @@
{% endif %}
{% endif %}



{% include "_includes/appointment/appointment-tabs.njk" %}
4 changes: 2 additions & 2 deletions app/views/_includes/reading/opinion-ui.njk
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@
{% set incompleteMammographyHtml %}
<p>
<b>Incomplete mammography</b>
{% if event.mammogramData.incompleteMammographyReason %}
<br>Reason: {{ event.mammogramData.incompleteMammographyReason }}
{% if event.mammogramData.incompleteMammographyReasons and event.mammogramData.incompleteMammographyReasons | length > 0 %}
<br>{{ "Reason" | pluralise(event.mammogramData.incompleteMammographyReasons | length) }}: {{ event.mammogramData.incompleteMammographyReasons | join(", ") }}
{% endif %}
{% if event.mammogramData.incompleteMammographyReasonDetails %}
<br>Details: {{ event.mammogramData.incompleteMammographyReasonDetails }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,29 +257,69 @@
}
}) %} #}

{# Imperfect but best possible images #}
{% if event.mammogramData.isImperfectButBestPossible and event.mammogramData.isImperfectButBestPossible | includes("yes") %}
{% set summaryRows = summaryRows | push({
key: {
text: "Image quality"
},
value: {
text: "Imperfect, but best possible images"
},
actions: {
items: [
{
href: ("./images-manual-details" if isManualEntry else defaultHref) | urlWithReferrer(referrerChain, scrollTo),
text: "Change",
visuallyHiddenText: "image quality note"
}
]
} if allowEdits
}) %}
{% endif %}

{# Incomplete mammography #}
{% if event.mammogramData.isIncompleteMammography == 'yes' %}
{% if event.mammogramData.isIncompleteMammography and event.mammogramData.isIncompleteMammography | includes("yes") %}
{% set incompleteMammographyHtml %}
{% if event.mammogramData.incompleteMammographyReason %}
<p class="nhsuk-u-margin-bottom-2"><strong>Reason:</strong> {{ event.mammogramData.incompleteMammographyReason }}</p>
{% if event.mammogramData.incompleteMammographyReasons and event.mammogramData.incompleteMammographyReasons | length > 0 %}
{% if event.mammogramData.incompleteMammographyReasons | length == 1 %}
<p class="nhsuk-u-margin-bottom-2">Reason: {{ event.mammogramData.incompleteMammographyReasons[0] | lower }}</p>
{% else %}
<p class="nhsuk-u-margin-bottom-1">{{ "Reason" | pluralise(event.mammogramData.incompleteMammographyReasons | length) }}:</p>
<ul class="nhsuk-list nhsuk-list--bullet nhsuk-u-margin-bottom-2">
{% for reason in event.mammogramData.incompleteMammographyReasons %}
<li>{{ reason }}</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% if event.mammogramData.incompleteMammographyReasonDetails %}
<p class="nhsuk-u-margin-bottom-2"><strong>Details:</strong> {{ event.mammogramData.incompleteMammographyReasonDetails }}</p>
<p class="nhsuk-u-margin-bottom-2">Details: {{ event.mammogramData.incompleteMammographyReasonDetails }}</p>
{% endif %}
{% if event.mammogramData.incompleteMammographyFollowUpAppointment %}
<p class="nhsuk-u-margin-bottom-2"><strong>Follow-up appointment:</strong> {{ event.mammogramData.incompleteMammographyFollowUpAppointment }}</p>
{% endif %}
{% if event.mammogramData.incompleteMammographyFollowUpAppointmentDetails %}
<p class="nhsuk-u-margin-bottom-0"><strong>Follow-up details:</strong> {{ event.mammogramData.incompleteMammographyFollowUpAppointmentDetails }}</p>
{% endif %}
{% if not event.mammogramData.incompleteMammographyReason and not event.mammogramData.incompleteMammographyFollowUpAppointment %}
Yes, no details provided
{% set followUpValue = event.mammogramData.incompleteMammographyFollowUpAppointment %}
{% if followUpValue.startsWith("No") %}
{{ tag({
text: "Partial mammography",
classes: "nhsuk-tag--orange nhsuk-u-margin-top-2 nhsuk-u-margin-bottom-2"
}) }}
{# <p class="nhsuk-u-margin-bottom-0">Recorded as partial mammography.</p> #}
{% else %}
{{ tag({
text: "Recall requested",
classes: "nhsuk-tag--orange nhsuk-u-margin-top-2 nhsuk-u-margin-bottom-2"
}) }}
{# <p class="nhsuk-u-margin-bottom-{% if event.mammogramData.incompleteMammographyFollowUpAppointmentDetails %}1{% else %}0{% endif %}">Participant to be invited to a recall appointment to take more images.</p> #}
{% if event.mammogramData.incompleteMammographyFollowUpAppointmentDetails %}
<p class="nhsuk-u-margin-bottom-0">Note for scheduling recall appointment:<br>{{ event.mammogramData.incompleteMammographyFollowUpAppointmentDetails }}</p>
{% endif %}
{% endif %}
{% endif %}
{% endset %}

{% set summaryRows = summaryRows | push({
key: {
text: "Incomplete mammography"
text: "Not all mammograms taken"
},
value: {
html: incompleteMammographyHtml
Expand All @@ -289,13 +329,15 @@
{
href: ("./images-manual-details" if isManualEntry else defaultHref) | urlWithReferrer(referrerChain, scrollTo),
text: "Change",
visuallyHiddenText: "incomplete mammography"
visuallyHiddenText: "not all mammograms taken"
}
]
} if allowEdits
}) %}
{% endif %}



{# OLD Repeats and additional images (separate row) - keeping for reference #}
{# {% if hasRepeatsOrExtras %}
{% set summaryRows = summaryRows | push({
Expand All @@ -317,21 +359,21 @@
}) %}
{% endif %} #}

{# Additional details #}
{# {% if event.mammogramData.additionalDetails %} #}
{# Notes for reader #}
{# {% if event.mammogramData.notesForReader %} #}
{% set summaryRows = summaryRows | push({
key: {
text: "Additional details"
text: "Notes for reader"
},
value: {
text: event.mammogramData.additionalDetails
text: event.mammogramData.notesForReader
},
actions: {
items: [
{
href: ("./images-manual-details" if isManualEntry else defaultHref) | urlWithReferrer(referrerChain, scrollTo),
text: "Change",
visuallyHiddenText: "additional details"
visuallyHiddenText: "notes for reader"
}
]
} if allowEdits
Expand Down
21 changes: 5 additions & 16 deletions app/views/events/images-automatic.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,22 +178,11 @@ <h2>Additional images</h2>
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-two-thirds">

{# {% include "_includes/partial-mammography-question.njk" %} #}
{% include "_includes/incomplete-mammography-question.njk" %}

{{ textarea({
name: "event[mammogramData][additionalDetails]",
id: "additional-details",
value: event.mammogramData.additionalDetails,
label: {
text: "Additional details (optional)",
classes: "nhsuk-label--m"
},
hint: {
text: "Provide information for image readers when reviewing"
},
rows: 2
}) }}
<h2>Additional details</h2>

{% set namePrefix = "event[mammogramData]" %}
{% set mammogramSource = event.mammogramData %}
{% include "_includes/additional-image-details.njk" %}

{{ button({
text: "Confirm images"
Expand Down
Loading