|
@@ -28,7 +28,7 @@ if(!@$summaryView) {
|
|
|
<div @if(!@$summaryView) class="mt-3 p-3 border-top" id="problems-center-{{$note->id}}" @else class="mt-2 pr-2" @endif>
|
|
|
<div class="point-table-container">
|
|
|
|
|
|
- @if(!@$summaryView && $patient->core_note_id !== $note->id)
|
|
|
+ @if(!@$summaryView && $patient->core_note_id !== $note->id && $ccSegment)
|
|
|
<div class="d-flex align-items-baseline">
|
|
|
<div class="mb-2 font-weight-bold font-size-14 text-secondary">Chief Complaint</div>
|
|
|
<span class="mx-2 text-secondary">|</span>
|
|
@@ -36,17 +36,45 @@ if(!@$summaryView) {
|
|
|
</div>
|
|
|
|
|
|
<?php
|
|
|
- $segment = $note->getSegmentByInternalName('chief_complaint');
|
|
|
- if(!$segment) $segment = $note->getSegmentByInternalName('omega_cc');
|
|
|
$ccPoint = Point::where('added_in_note_id', $note->id)->where('category', 'CHIEF_COMPLAINT')->orderBy('id', 'DESC')->first();
|
|
|
$parsed = null;
|
|
|
if ($ccPoint && !!@$ccPoint->data) {
|
|
|
$parsed = json_decode($ccPoint->data);
|
|
|
}
|
|
|
+ if(!$parsed || !@$parsed->free_text) {
|
|
|
+ list($problemPoints, $counts) = Point::getPointsOfCategoryExtended($patient, 'PROBLEM', $note);
|
|
|
+ $problemNames = [];
|
|
|
+ foreach ($problemPoints as $problemPoint) {
|
|
|
+ if($problemPoint->relevanceToNote($note)) {
|
|
|
+ $problemNames[] = $problemPoint->data->name;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $ccProblems = '';
|
|
|
+ for($i = 0; $i < count($problemNames); $i++) {
|
|
|
+ if($i > 0) {
|
|
|
+ if($i === count($problemNames) - 1) {
|
|
|
+ $ccProblems .= " and ";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $ccProblems .= ", ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $ccProblems .= $problemNames[$i];
|
|
|
+ }
|
|
|
+ $defaultCC = "Patient {$patient->name_first} {$patient->name_last} " .
|
|
|
+ "is a {$patient->age_in_years} year old" .
|
|
|
+ ($patient->sex ? ($patient->sex === 'F' ? ' female' : ($patient->sex === 'M' ? ' male' : ' ' . $patient->sex)) : '') .
|
|
|
+ ($ccProblems ? " with a history of {$ccProblems}" : "") .
|
|
|
+ ($note->new_or_fu_or_na === 'NEW' ? ' presenting for establishing care' : ' presenting for follow-up') .
|
|
|
+ ".";
|
|
|
+ $parsed = json_decode(json_encode([
|
|
|
+ "free_text" => $defaultCC
|
|
|
+ ]));
|
|
|
+ }
|
|
|
?>
|
|
|
<div visit-moe class="d-block">
|
|
|
<form show="" url="/api/visitPoint/upsertNoteSingleton" class="mcp-theme-1" id="frm-cc-regenerate">
|
|
|
- <input type="hidden" name="segmentUid" value="{{$segment->uid}}">
|
|
|
+ <input type="hidden" name="segmentUid" value="{{$ccSegment->uid}}">
|
|
|
<input type="hidden" name="category" value="CHIEF_COMPLAINT">
|
|
|
<input type="hidden" name="data" value="">
|
|
|
<div note-rte slim-rte
|