|
@@ -1,29 +1,15 @@
|
|
|
<?php
|
|
|
|
|
|
use App\Models\Point;
|
|
|
+use \App\Models\Client;
|
|
|
+use \App\Models\Note;
|
|
|
+use \App\Models\Segment;
|
|
|
|
|
|
-/** @var \App\Models\Client $patient */
|
|
|
+/** @var Client $patient */
|
|
|
+/** @var Note $note */
|
|
|
+/** @var Segment $segment */
|
|
|
|
|
|
-$medications = Point
|
|
|
- ::where('client_id', $patient->id)
|
|
|
- ->where('category', 'MEDICATION')
|
|
|
- ->where('addition_reason_category', 'ON_INTAKE')
|
|
|
- ->where(function ($query1) use ($note) {
|
|
|
- $query1
|
|
|
- ->where('is_removed', false)
|
|
|
- ->orWhere(function ($query2) use ($note) {
|
|
|
- $query2->where('is_removed', true)
|
|
|
- ->where('removed_in_note_id', $note->id);
|
|
|
- });
|
|
|
- })
|
|
|
- ->orderBy('created_at')
|
|
|
- ->get();
|
|
|
-
|
|
|
-foreach ($medications as $medication) {
|
|
|
- if ($medication->data) {
|
|
|
- $medication->data = json_decode($medication->data);
|
|
|
- }
|
|
|
-}
|
|
|
+$medications = Point::getIntakePointsOfCategory($patient, 'MEDICATION', $note);
|
|
|
|
|
|
?>
|
|
|
<div>
|
|
@@ -47,65 +33,15 @@ foreach ($medications as $medication) {
|
|
|
<?= !!@($medication->data->route) ? '/ ' . @($medication->data->route) : '' ?>
|
|
|
<?= !!@($medication->data->frequency) ? '/ ' . @($medication->data->frequency) : '' ?>
|
|
|
</div>
|
|
|
- <div class="ml-auto d-inline-flex align-items-baseline pr-2">
|
|
|
- <?php if ($medication->is_removed): ?>
|
|
|
- <?php if ($medication->is_removed_due_to_entry_error): ?>
|
|
|
- <span class="font-weight-bold text-secondary mr-2">Entry error</span>
|
|
|
- <?php else: ?>
|
|
|
- <span class="font-weight-bold text-secondary mr-2">Removed on intake</span>
|
|
|
- <?php endif; ?>
|
|
|
- <div visit-moe>
|
|
|
- <form show url="/api/visitPoint/undoMarkRemoved" class="mcp-theme-1">
|
|
|
- <input type="hidden" name="uid" value="<?= $medication->uid ?>">
|
|
|
- <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
|
|
|
- <a submit href="#">Undo</a>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- <?php else: ?>
|
|
|
- <?php if($medication->added_in_note_id === $note->id): ?>
|
|
|
- <span class="font-weight-bold text-success mr-2">* Added on intake</span>
|
|
|
- <?php endif; ?>
|
|
|
- <div visit-moe>
|
|
|
- <a start show href="#">Remove</a>
|
|
|
- <form url="/api/visitPoint/markRemovedOnIntake" class="mcp-theme-1">
|
|
|
- <input type="hidden" name="uid" value="<?= $medication->uid ?>">
|
|
|
- <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
|
|
|
-
|
|
|
- <p class="mb-2"><b>Remove Medication (on intake)</b></p>
|
|
|
|
|
|
- <div class="mb-2">
|
|
|
- <label class="text-sm text-secondary mb-1">Removal Reason</label>
|
|
|
- <textarea name="removalReasonMemo" class="form-control form-control-sm" rows="2"></textarea>
|
|
|
- </div>
|
|
|
- <?php if($medication->added_in_note_id === $note->id): ?>
|
|
|
- <div class="mb-2">
|
|
|
- <label class="text-sm text-secondary mb-1">Is Entry Error? *</label>
|
|
|
- <select name="isRemovedDueToEntryError" class="form-control form-control-sm" required>
|
|
|
- <option value="">-- select --</option>
|
|
|
- <option value="1" selected>Yes</option>
|
|
|
- <option value="0">No</option>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- <?php else: ?>
|
|
|
- <input type="hidden" name="isRemovedDueToEntryError" value="0">
|
|
|
- <?php endif; ?>
|
|
|
- <div class="mb-2">
|
|
|
- <label class="text-sm text-secondary mb-1">Removal Effective Date</label>
|
|
|
- <input type="date" name="removalEffectiveDate"
|
|
|
- value="<?= date('Y-m-d') ?>"
|
|
|
- max="<?= date('Y-m-d') ?>"
|
|
|
- class="form-control form-control-sm">
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <button submit class="btn btn-sm btn-danger mr-2">Remove</button>
|
|
|
- <button cancel class="btn btn-sm btn-default border">Cancel</button>
|
|
|
- </div>
|
|
|
- </form>
|
|
|
- </div>
|
|
|
- <?php endif; ?>
|
|
|
+ <!-- common actions -->
|
|
|
+ <div class="ml-auto d-inline-flex align-items-baseline pr-2">
|
|
|
+ <?php
|
|
|
+ $point = $medication;
|
|
|
+ $label = 'Medication';
|
|
|
+ include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
|
|
|
+ ?>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
</div>
|
|
|
</td>
|
|
|
<td>
|