|
@@ -4,45 +4,135 @@ use App\Models\Point;
|
|
|
|
|
|
/** @var \App\Models\Client $patient */
|
|
|
|
|
|
-$medicationsAddedOnIntake = Point::where('client_id', $patient->id)
|
|
|
+$medications = Point
|
|
|
+ ::where('client_id', $patient->id)
|
|
|
->where('category', 'MEDICATION')
|
|
|
- ->where('addition_reason_category', 'ADDED_ON_INTAKE')
|
|
|
- ->where('is_removed', false)
|
|
|
+ ->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();
|
|
|
|
|
|
-$medicationsRemovedOnIntake = Point::where('client_id', $patient->id)
|
|
|
- ->where('category', 'MEDICATION')
|
|
|
- ->where('addition_reason_category', 'ADDED_ON_INTAKE')
|
|
|
- ->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);
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
?>
|
|
|
<div>
|
|
|
|
|
|
+ <div class="d-flex mb-2">
|
|
|
+ <table class="table table-sm table-bordered table-striped mb-0 bg-white">
|
|
|
+ <thead>
|
|
|
+ <tr class="">
|
|
|
+ <th class="border-bottom-0">Medication</th>
|
|
|
+ <th class="border-bottom-0">Last Review</th>
|
|
|
+ <th class="border-bottom-0">Review Today</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <?php foreach($medications as $medication): ?>
|
|
|
+ <tr>
|
|
|
+ <td>
|
|
|
+ <div class="d-flex align-items-baseline">
|
|
|
+ <div class="<?= $medication->is_removed ? 'strike-through' : '' ?>">
|
|
|
+ <b><?= !!@($medication->data->name) ? @($medication->data->name) : '-' ?></b>
|
|
|
+ <?= !!@($medication->data->dose) ? '/ ' . @($medication->data->dose) : '' ?>
|
|
|
+ <?= !!@($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): ?>
|
|
|
+ <span class="font-weight-bold text-secondary">Removed on intake</span>
|
|
|
+ <div visit-moe class="ml-2">
|
|
|
+ <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: ?>
|
|
|
+ <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>
|
|
|
+ <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">Yes</option>
|
|
|
+ <option value="0">No</option>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ <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; ?>
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ </tr>
|
|
|
+ <?php endforeach; ?>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div visit-moe>
|
|
|
- <b>Add New</b>
|
|
|
+ <a href="#" start show>Add New</a>
|
|
|
<form url="/api/visitPoint/addTopLevelOnIntake" class="mcp-theme-1">
|
|
|
<input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
|
|
|
<input type="hidden" name="category" value="MEDICATION">
|
|
|
<input type="hidden" name="data">
|
|
|
|
|
|
- <div>
|
|
|
- <input type="text" data-name="name" placeholder="name">
|
|
|
+ <p class="mb-2"><b>Add Medication (on intake)</b></p>
|
|
|
+
|
|
|
+ <div class="mb-2">
|
|
|
+ <label class="text-sm text-secondary mb-1">Name</label>
|
|
|
+ <input type="text" data-name="name" class="form-control form-control-sm">
|
|
|
</div>
|
|
|
- <div>
|
|
|
- <input type="text" data-name="dose" placeholder="dose">
|
|
|
+ <div class="mb-2">
|
|
|
+ <label class="text-sm text-secondary mb-1">Dose</label>
|
|
|
+ <input type="text" data-name="dose" class="form-control form-control-sm">
|
|
|
</div>
|
|
|
- <div>
|
|
|
- <input type="text" data-name="route" placeholder="route">
|
|
|
+ <div class="mb-2">
|
|
|
+ <label class="text-sm text-secondary mb-1">Route</label>
|
|
|
+ <input type="text" data-name="route" class="form-control form-control-sm">
|
|
|
</div>
|
|
|
- <div>
|
|
|
- <input type="text" data-name="frequency" placeholder="frequency">
|
|
|
+ <div class="mb-2">
|
|
|
+ <label class="text-sm text-secondary mb-1">Frequency</label>
|
|
|
+ <input type="text" data-name="frequency" class="form-control form-control-sm">
|
|
|
</div>
|
|
|
- <div>
|
|
|
- <input type="text" data-name="description" placeholder="description">
|
|
|
+ <div class="mb-2">
|
|
|
+ <label class="text-sm text-secondary mb-1">Description</label>
|
|
|
+ <input type="text" data-name="description" class="form-control form-control-sm">
|
|
|
</div>
|
|
|
|
|
|
<div>
|