Sfoglia il codice sorgente

Swap top level point feature (all segments)

Vijayakrishnan 3 anni fa
parent
commit
a5b4de12ce

+ 34 - 2
resources/views/app/patient/segment-templates/intake_allergies/edit.blade.php

@@ -40,6 +40,38 @@ $allergies = Point::getIntakePointsOfCategory($patient, 'ALLERGY', $note);
                                 $label = 'Allergy';
                                 include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                                 ?>
+                                @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'ON_INTAKE')
+                                <div visit-moe class="ml-2">
+                                    <a href="#" start show class="">Swap</a>
+                                    <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                        <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                        <input type="hidden" name="category" value="ALLERGY">
+                                        <input type="hidden" name="data">
+
+                                        <p class="mb-2"><b>Replace with new (on intake)</b></p>
+
+                                        <input type="hidden" data-name="damConceptId">
+                                        <input type="hidden" data-name="damConceptIdType">
+
+                                        <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"
+                                                   stag-suggest
+                                                   stag-suggest-ep="/fdb-allergy-suggest/json">
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Description</label>
+                                            <textarea type="text" data-name="description" class="form-control form-control-sm"></textarea>
+                                        </div>
+
+                                        <div>
+                                            <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                                @endif
                             </div>
                         </div>
                     </td>
@@ -130,8 +162,8 @@ $allergies = Point::getIntakePointsOfCategory($patient, 'ALLERGY', $note);
         parentSegment.find('input[stag-suggest][data-name="name"]')
             .off('stag-suggest-selected')
             .on('stag-suggest-selected', (_e, _input, _data) => {
-                $('input[data-name="damConceptId"]').val(_data.dam_concept_id);
-                $('input[data-name="damConceptIdType"]').val(_data.dam_concept_id_typ);
+                _input.closest('form').find('input[data-name="damConceptId"]').val(_data.dam_concept_id);
+                _input.closest('form').find('input[data-name="damConceptIdType"]').val(_data.dam_concept_id_typ);
             });
 
     };

+ 47 - 0
resources/views/app/patient/segment-templates/intake_care_team/edit.blade.php

@@ -46,6 +46,53 @@ $careTeamMembers = Point::getIntakePointsOfCategory($patient, 'CARE_TEAM_MEMBER'
                                 $label = 'Care Team Member';
                                 include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                                 ?>
+                                @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'ON_INTAKE')
+                                <div visit-moe class="ml-2">
+                                    <a href="#" start show class="">Swap</a>
+                                    <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                        <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                        <input type="hidden" name="category" value="CARE_TEAM_MEMBER">
+                                        <input type="hidden" name="data">
+
+                                        <p class="mb-2"><b>Add Care Team Member (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 class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Specialty</label>
+                                            <input type="text" data-name="specialty" class="form-control form-control-sm">
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Organization</label>
+                                            <input type="text" data-name="organization" class="form-control form-control-sm">
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Phone</label>
+                                            <input type="text" data-name="phone" class="form-control form-control-sm">
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Fax</label>
+                                            <input type="text" data-name="fax" class="form-control form-control-sm">
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Date</label>
+                                            <input type="date" data-name="date" class="form-control form-control-sm">
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Memo</label>
+                                            <textarea type="text" data-name="memo" class="form-control form-control-sm"></textarea>
+                                        </div>
+
+                                        <div>
+                                            <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                                @endif
                             </div>
                         </div>
                     </td>

+ 99 - 2
resources/views/app/patient/segment-templates/intake_goals/edit.blade.php

@@ -49,6 +49,103 @@ $goals = Point::getIntakePointsOfCategory($patient, 'GOAL', $note);
                                 $label = 'Goal';
                                 include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                                 ?>
+                                @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'ON_INTAKE')
+                                <div visit-moe class="ml-2">
+                                    <a href="#" start show class="">Swap</a>
+                                    <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                        <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                        <input type="hidden" name="category" value="GOAL">
+                                        <input type="hidden" name="data">
+
+                                        <p class="mb-2"><b>Add Goal (on intake)</b></p>
+
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Category</label>
+                                            <select type="text" data-name="category" class="form-control form-control-sm">
+                                                <option value="">-- select --</option>
+                                                <option value="NUTRITION">NUTRITION</option>
+                                                <option value="ACTIVITY">ACTIVITY</option>
+                                                <option value="SLEEP">SLEEP</option>
+                                                <option value="SOCIAL CONNECTION">SOCIAL CONNECTION</option>
+                                                <option value="STRESS REDUCTION">STRESS REDUCTION</option>
+                                                <option value="RISKY SUBSTANCE AVOIDANCE">RISKY SUBSTANCE AVOIDANCE</option>
+                                                <option value="OTHER">OTHER</option>
+                                            </select>
+                                        </div>
+
+                                        <div class="bg-light border mb-2 p-2 help-text d-none" data-category="NUTRITION">
+                                            <div class="mb-1">Specific - What specific food would you like to add/change?</div>
+                                            <div class="mb-1">Measurable - How much or how many will you add or change?</div>
+                                            <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                            <div class="mb-1">Realistic - What can you do? (improvement over perfection)</div>
+                                            <div class="mb-2">Time-Connected - How often or for how long will you make this change?</div>
+                                            <div class="font-italic"><b>Example:</b> "I will add 1 cup of berries to breakfast and a small apple or orange as an afternoon snack at least five days this week."</div>
+                                        </div>
+
+                                        <div class="bg-light border mb-2 p-2 help-text d-none" data-category="ACTIVITY">
+                                            <div class="mb-1">Specific - What specific activity would you like to add/change?</div>
+                                            <div class="mb-1">Measurable - How much activity, how many sessions?</div>
+                                            <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                            <div class="mb-1">Realistic - What can you actually do? (know your limits, start small, build)</div>
+                                            <div class="mb-2">Time-Connected - How frequent or how long will you do the activity?</div>
+                                            <div class="font-italic"><b>Example:</b> "I will walk with a friend or family member for at least 20 minutes after dinner, every weekday for the next two months."</div>
+                                        </div>
+
+                                        <div class="bg-light border mb-2 p-2 help-text d-none" data-category="SLEEP">
+                                            <div class="mb-1">Specific - What are you going to do to improve your sleep quality/quantity?</div>
+                                            <div class="mb-1">Measurable - How much time, how many sessions?</div>
+                                            <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                            <div class="mb-1">Realistic - What can you actually do? (improvement over perfection)</div>
+                                            <div class="mb-2">Time-Connected - How frequent? How long will you commit?</div>
+                                            <div class="font-italic"><b>Example:</b> "I will begin a new bedtime routine of shutting off the television and instead, read a book for at least 30 minutes before bed, four nights this week."</div>
+                                        </div>
+
+                                        <div class="bg-light border mb-2 p-2 help-text d-none" data-category="SOCIAL CONNECTION">
+                                            <div class="mb-1">Specific - What are you going to do to improve feelings of connectedness?</div>
+                                            <div class="mb-1">Measurable - How much time, how many sessions?</div>
+                                            <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                            <div class="mb-1">Realistic - What can you actually do? (improvement over perfection)</div>
+                                            <div class="mb-2">Time-Connected - How frequent? How long will you commit?</div>
+                                            <div class="font-italic"><b>Example:</b> "I will increase my feeling of social connectedness by joining a group fitness class that meets for an hour, three nights of the week."</div>
+                                        </div>
+
+                                        <div class="bg-light border mb-2 p-2 help-text d-none" data-category="STRESS REDUCTION">
+                                            <div class="mb-1">Specific - What are you going to do to manage your stress?</div>
+                                            <div class="mb-1">Measurable - How much time, how many sessions?</div>
+                                            <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                            <div class="mb-1">Realistic - What can you actually do? (improvement over perfection)</div>
+                                            <div class="mb-2">Time-Connected - How frequent? How long will you commit?</div>
+                                            <div class="font-italic"><b>Example:</b> "I will write about what I am thankful for at least 10 minutes three times per week."</div>
+                                        </div>
+
+                                        <div class="bg-light border mb-2 p-2 help-text d-none" data-category="RISKY SUBSTANCE AVOIDANCE">
+                                            <div class="mb-1">Specific - What are you going to do to decrease your substance use?</div>
+                                            <div class="mb-1">Measurable - How much will you reduce it by?</div>
+                                            <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                            <div class="mb-1">Realistic - What can you actually do? (improvement over perfection)</div>
+                                            <div class="mb-2">Time-Connected - How frequent? How long will you commit?</div>
+                                            <div class="font-italic"><b>Example:</b> "I will swap my morning cigarette with chewing gum at least 5 days this week for the next four weeks. I will ask my partner to help keep me on track and use the free texting service for more support."</div>
+                                        </div>
+
+                                        <div class="bg-light border mb-2 p-2 help-text d-none" data-category="OTHER">
+                                            <div class="">Ensure that the goal is Specific, Measurable, Attainable, Realistic and Time-Connected.</div>
+                                        </div>
+
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Goal</label>
+                                            <div note-rte
+                                                 class="form-group mb-2 border-left border-right rte-holder"
+                                                 data-field-name="goal"></div>
+                                        </div>
+
+                                        <div>
+                                            <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                                @endif
                             </div>
                         </div>
                     </td>
@@ -204,8 +301,8 @@ $goals = Point::getIntakePointsOfCategory($patient, 'GOAL', $note);
         parentSegment.find('select[data-name="category"]')
             .off('change')
             .on('change', function() {
-                parentSegment.find('.help-text').addClass('d-none');
-                parentSegment.find('.help-text[data-category="' + this.value + '"]').removeClass('d-none');
+                $(this).closest('form').find('.help-text').addClass('d-none');
+                $(this).closest('form').find('.help-text[data-category="' + this.value + '"]').removeClass('d-none');
             });
 
     };

+ 44 - 0
resources/views/app/patient/segment-templates/intake_interventions/edit.blade.php

@@ -50,6 +50,50 @@ $interventions = Point::getIntakePointsOfCategory($patient, 'INTERVENTION', $not
                                 $label = 'Intervention';
                                 include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                                 ?>
+                                @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'ON_INTAKE')
+                                <div visit-moe class="ml-2">
+                                    <a href="#" start show class="">Swap</a>
+                                    <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                        <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                        <input type="hidden" name="category" value="INTERVENTION">
+                                        <input type="hidden" name="data">
+
+                                        <p class="mb-2"><b>Add Intervention (on intake)</b></p>
+
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Category</label>
+                                            <select type="text" data-name="category" class="form-control form-control-sm">
+                                                <option value="">-- select --</option>
+                                                <option value="Self-Monitoring">Self-Monitoring</option>
+                                                <option value="Labs">Labs</option>
+                                                <option value="Radiology / Imaging">Radiology / Imaging</option>
+                                                <option value="Screenings">Screenings</option>
+                                                <option value="Medication Rx">Medication Rx</option>
+                                                <option value="Physical Therapy Rx">Physical Therapy Rx</option>
+                                                <option value="Occupational Therapy Rx">Occupational Therapy Rx</option>
+                                                <option value="Referral to Specialist / HCP">Referral to Specialist / HCP</option>
+                                                <option value="Clinical Instructions / Other">Clinical Instructions / Other</option>
+                                                <option value="SMS Reminders">SMS Reminders</option>
+                                                <option value="Handouts / Education Provided">Handouts / Education Provided</option>
+                                            </select>
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Intervention</label>
+                                            <input type="text" data-name="intervention" class="form-control form-control-sm">
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Description</label>
+                                            <textarea type="text" data-name="description" class="form-control form-control-sm"></textarea>
+                                        </div>
+
+                                        <div>
+                                            <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                                @endif
                             </div>
                         </div>
                     </td>

+ 57 - 4
resources/views/app/patient/segment-templates/intake_medications/edit.blade.php

@@ -40,6 +40,59 @@ $medications = Point::getIntakePointsOfCategory($patient, 'MEDICATION', $note);
                                 $label = 'Medication';
                                 include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                                 ?>
+                                @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'ON_INTAKE')
+                                <div visit-moe class="ml-2">
+                                    <a href="#" start show class="">Swap</a>
+                                    <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                        <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                        <input type="hidden" name="category" value="MEDICATION">
+                                        <input type="hidden" name="data">
+
+                                        <input type="hidden" data-name="medId">
+                                        <input type="hidden" data-name="routedMedId">
+                                        <input type="hidden" data-name="routedDosageFormMedId">
+                                        <input type="hidden" data-name="gcnSeqno">
+
+                                        <p class="mb-2"><b>Add Medication (on intake)</b></p>
+
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Medication</label>
+                                            <input type="text"
+                                                   data-name="name"
+                                                   class="form-control form-control-sm"
+                                                   stag-suggest
+                                                   stag-suggest-ep="/fdb-med-suggest-v2/json">
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Frequency</label>
+                                            <input type="text" class="form-control form-control-sm" data-name="frequency"
+                                                   data-option-list="frequency-options" autocomplete="off">
+                                            <div id="frequency-options" class="data-option-list">
+                                                <div>Once a day</div>
+                                                <div>Twice a day</div>
+                                            </div>
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Start Date</label>
+                                            <input type="date" class="form-control form-control-sm" data-name="start_date">
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Prescribed By</label>
+                                            <input type="text" class="form-control form-control-sm" data-name="prescriber">
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Description</label>
+                                            <textarea type="text" data-name="description" class="form-control form-control-sm"></textarea>
+                                        </div>
+
+                                        <div>
+                                            <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                                @endif
                             </div>
                         </div>
                         <?php if(!!@($medication->data->prescriber)): ?>
@@ -177,10 +230,10 @@ $medications = Point::getIntakePointsOfCategory($patient, 'MEDICATION', $note);
                     // text: "metoprolol succinate ER 100 mg capsule sprinkle, ext. release 24 hr"
                 // }
 
-                parentSegment.find('input[data-name="routedMedId"]').val(_data.routed_med_id);
-                parentSegment.find('input[data-name="routedDosageFormMedId"]').val(_data.routed_dosage_form_med_id);
-                parentSegment.find('input[data-name="gcnSeqno"]').val(_data.gcn_seqno);
-                parentSegment.find('input[data-name="medId"]').val(_data.medid);
+                $(_input).closest('form').find('input[data-name="routedMedId"]').val(_data.routed_med_id);
+                $(_input).closest('form').find('input[data-name="routedDosageFormMedId"]').val(_data.routed_dosage_form_med_id);
+                $(_input).closest('form').find('input[data-name="gcnSeqno"]').val(_data.gcn_seqno);
+                $(_input).closest('form').find('input[data-name="medId"]').val(_data.medid);
 
                 return false;
             });

+ 44 - 3
resources/views/app/patient/segment-templates/intake_problems/edit.blade.php

@@ -41,6 +41,47 @@ $problems = Point::getIntakePointsOfCategory($patient, 'PROBLEM', $note);
                             $label = 'Problem';
                             include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                             ?>
+                            @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'ON_INTAKE')
+                            <div visit-moe class="ml-2">
+                                <a href="#" start show class="">Swap</a>
+                                <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                    <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                    <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                    <input type="hidden" name="category" value="PROBLEM">
+                                    <input type="hidden" name="data">
+
+                                    <input type="hidden" data-name="dxid">
+                                    <input type="hidden" data-name="icd-type">
+
+                                    <p class="mb-2"><b>Add Problem (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"
+                                               stag-suggest
+                                               stag-suggest-ep="/fdb-dx-suggest/json">
+                                    </div>
+
+                                    <div class="mb-2">
+                                        <label class="text-sm text-secondary mb-1">ICD</label>
+                                        <select data-name="icd"
+                                                class="form-control form-control-sm"
+                                                disabled>
+                                        </select>
+                                    </div>
+
+                                    <div class="mb-2">
+                                        <label class="text-sm text-secondary mb-1">Description</label>
+                                        <textarea type="text" data-name="description" class="form-control form-control-sm"></textarea>
+                                    </div>
+
+                                    <div>
+                                        <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                        <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                            @endif
                         </div>
                     </div>
                 </td>
@@ -145,9 +186,9 @@ $problems = Point::getIntakePointsOfCategory($patient, 'PROBLEM', $note);
                 // _input is the textbox
                 // _data is {med_name_id: "50567", text: "Children's Tylenol"}
 
-                parentSegment.find('input[data-name="dxid"]').val(_data.dxid);
+                $(_input).closest('form').find('input[data-name="dxid"]').val(_data.dxid);
 
-                let icdSelect = parentSegment.find('[data-name="icd"]').empty().prop('disabled', true);
+                let icdSelect = $(_input).closest('form').find('[data-name="icd"]').empty().prop('disabled', true);
 
                 $.get('/fdb-dx-icds-for-dxid?dxid=' + _data.dxid, _data => {
                     icdSelect
@@ -166,7 +207,7 @@ $problems = Point::getIntakePointsOfCategory($patient, 'PROBLEM', $note);
         // on route selection
         $(document).off('change', '[data-segment-template-name="<?= $segment->segmentTemplate->internal_name ?>"] [data-name="icd"]');
         $(document).on('change', '[data-segment-template-name="<?= $segment->segmentTemplate->internal_name ?>"] [data-name="icd"]', function () {
-            parentSegment.find('input[data-name="icd-type"]').val($(this).find('option:selected').attr('data-icd-type'));
+            $(this).closest('form').find('input[data-name="icd-type"]').val($(this).find('option:selected').attr('data-icd-type'));
         });
 
     };

+ 32 - 0
resources/views/app/patient/segment-templates/plan_allergies/edit.blade.php

@@ -58,6 +58,38 @@ else {
                                 $label = 'Allergy';
                                 include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                                 ?>
+                                @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'DURING_VISIT')
+                                    <div visit-moe class="ml-2">
+                                        <a href="#" start show class="">Swap</a>
+                                        <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                            <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                            <input type="hidden" name="category" value="ALLERGY">
+                                            <input type="hidden" name="data">
+
+                                            <p class="mb-2"><b>Add Allergy (plan)</b></p>
+
+                                            <input type="hidden" data-name="damConceptId">
+                                            <input type="hidden" data-name="damConceptIdType">
+
+                                            <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"
+                                                       stag-suggest
+                                                       stag-suggest-ep="/fdb-allergy-suggest/json">
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Description</label>
+                                                <textarea type="text" data-name="description" class="form-control form-control-sm"></textarea>
+                                            </div>
+
+                                            <div>
+                                                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                @endif
                             </div>
                         </div>
                     </td>

+ 47 - 0
resources/views/app/patient/segment-templates/plan_care_team/edit.blade.php

@@ -64,6 +64,53 @@ else {
                                 $label = 'Care Team Member';
                                 include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                                 ?>
+                                @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'DURING_VISIT')
+                                    <div visit-moe class="ml-2">
+                                        <a href="#" start show class="">Swap</a>
+                                        <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                            <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                            <input type="hidden" name="category" value="CARE_TEAM_MEMBER">
+                                            <input type="hidden" name="data">
+
+                                            <p class="mb-2"><b>Add Care Team Member (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 class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Specialty</label>
+                                                <input type="text" data-name="specialty" class="form-control form-control-sm">
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Organization</label>
+                                                <input type="text" data-name="organization" class="form-control form-control-sm">
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Phone</label>
+                                                <input type="text" data-name="phone" class="form-control form-control-sm">
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Fax</label>
+                                                <input type="text" data-name="fax" class="form-control form-control-sm">
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Date</label>
+                                                <input type="date" data-name="date" class="form-control form-control-sm">
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Memo</label>
+                                                <textarea type="text" data-name="memo" class="form-control form-control-sm"></textarea>
+                                            </div>
+
+                                            <div>
+                                                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                @endif
                             </div>
                         </div>
                     </td>

+ 99 - 2
resources/views/app/patient/segment-templates/plan_goals/edit.blade.php

@@ -67,6 +67,103 @@ else {
                                 $label = 'Goal';
                                 include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                                 ?>
+                                @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'DURING_VISIT')
+                                    <div visit-moe class="ml-2">
+                                        <a href="#" start show class="">Swap</a>
+                                        <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                            <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                            <input type="hidden" name="category" value="GOAL">
+                                            <input type="hidden" name="data">
+
+                                            <p class="mb-2"><b>Add Goal (plan)</b></p>
+
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Category</label>
+                                                <select type="text" data-name="category" class="form-control form-control-sm">
+                                                    <option value="">-- select --</option>
+                                                    <option value="NUTRITION">NUTRITION</option>
+                                                    <option value="ACTIVITY">ACTIVITY</option>
+                                                    <option value="SLEEP">SLEEP</option>
+                                                    <option value="SOCIAL CONNECTION">SOCIAL CONNECTION</option>
+                                                    <option value="STRESS REDUCTION">STRESS REDUCTION</option>
+                                                    <option value="RISKY SUBSTANCE AVOIDANCE">RISKY SUBSTANCE AVOIDANCE</option>
+                                                    <option value="OTHER">OTHER</option>
+                                                </select>
+                                            </div>
+
+                                            <div class="bg-light border mb-2 p-2 help-text d-none" data-category="NUTRITION">
+                                                <div class="mb-1">Specific - What specific food would you like to add/change?</div>
+                                                <div class="mb-1">Measurable - How much or how many will you add or change?</div>
+                                                <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                                <div class="mb-1">Realistic - What can you do? (improvement over perfection)</div>
+                                                <div class="mb-2">Time-Connected - How often or for how long will you make this change?</div>
+                                                <div class="font-italic"><b>Example:</b> "I will add 1 cup of berries to breakfast and a small apple or orange as an afternoon snack at least five days this week."</div>
+                                            </div>
+
+                                            <div class="bg-light border mb-2 p-2 help-text d-none" data-category="ACTIVITY">
+                                                <div class="mb-1">Specific - What specific activity would you like to add/change?</div>
+                                                <div class="mb-1">Measurable - How much activity, how many sessions?</div>
+                                                <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                                <div class="mb-1">Realistic - What can you actually do? (know your limits, start small, build)</div>
+                                                <div class="mb-2">Time-Connected - How frequent or how long will you do the activity?</div>
+                                                <div class="font-italic"><b>Example:</b> "I will walk with a friend or family member for at least 20 minutes after dinner, every weekday for the next two months."</div>
+                                            </div>
+
+                                            <div class="bg-light border mb-2 p-2 help-text d-none" data-category="SLEEP">
+                                                <div class="mb-1">Specific - What are you going to do to improve your sleep quality/quantity?</div>
+                                                <div class="mb-1">Measurable - How much time, how many sessions?</div>
+                                                <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                                <div class="mb-1">Realistic - What can you actually do? (improvement over perfection)</div>
+                                                <div class="mb-2">Time-Connected - How frequent? How long will you commit?</div>
+                                                <div class="font-italic"><b>Example:</b> "I will begin a new bedtime routine of shutting off the television and instead, read a book for at least 30 minutes before bed, four nights this week."</div>
+                                            </div>
+
+                                            <div class="bg-light border mb-2 p-2 help-text d-none" data-category="SOCIAL CONNECTION">
+                                                <div class="mb-1">Specific - What are you going to do to improve feelings of connectedness?</div>
+                                                <div class="mb-1">Measurable - How much time, how many sessions?</div>
+                                                <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                                <div class="mb-1">Realistic - What can you actually do? (improvement over perfection)</div>
+                                                <div class="mb-2">Time-Connected - How frequent? How long will you commit?</div>
+                                                <div class="font-italic"><b>Example:</b> "I will increase my feeling of social connectedness by joining a group fitness class that meets for an hour, three nights of the week."</div>
+                                            </div>
+
+                                            <div class="bg-light border mb-2 p-2 help-text d-none" data-category="STRESS REDUCTION">
+                                                <div class="mb-1">Specific - What are you going to do to manage your stress?</div>
+                                                <div class="mb-1">Measurable - How much time, how many sessions?</div>
+                                                <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                                <div class="mb-1">Realistic - What can you actually do? (improvement over perfection)</div>
+                                                <div class="mb-2">Time-Connected - How frequent? How long will you commit?</div>
+                                                <div class="font-italic"><b>Example:</b> "I will write about what I am thankful for at least 10 minutes three times per week."</div>
+                                            </div>
+
+                                            <div class="bg-light border mb-2 p-2 help-text d-none" data-category="RISKY SUBSTANCE AVOIDANCE">
+                                                <div class="mb-1">Specific - What are you going to do to decrease your substance use?</div>
+                                                <div class="mb-1">Measurable - How much will you reduce it by?</div>
+                                                <div class="mb-1">Attainable - Do you have what it takes to follow through?</div>
+                                                <div class="mb-1">Realistic - What can you actually do? (improvement over perfection)</div>
+                                                <div class="mb-2">Time-Connected - How frequent? How long will you commit?</div>
+                                                <div class="font-italic"><b>Example:</b> "I will swap my morning cigarette with chewing gum at least 5 days this week for the next four weeks. I will ask my partner to help keep me on track and use the free texting service for more support."</div>
+                                            </div>
+
+                                            <div class="bg-light border mb-2 p-2 help-text d-none" data-category="OTHER">
+                                                <div class="">Ensure that the goal is Specific, Measurable, Attainable, Realistic and Time-Connected.</div>
+                                            </div>
+
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Goal</label>
+                                                <div note-rte
+                                                     class="form-group mb-2 border-left border-right rte-holder"
+                                                     data-field-name="goal"></div>
+                                            </div>
+
+                                            <div>
+                                                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                @endif
                             </div>
                         </div>
                     </td>
@@ -256,8 +353,8 @@ else {
         parentSegment.find('select[data-name="category"]')
             .off('change')
             .on('change', function() {
-                parentSegment.find('.help-text').addClass('d-none');
-                parentSegment.find('.help-text[data-category="' + this.value + '"]').removeClass('d-none');
+                $(this).closest('form').find('.help-text').addClass('d-none');
+                $(this).closest('form').find('.help-text[data-category="' + this.value + '"]').removeClass('d-none');
             });
 
         parentSegment.find('.chk-relevance').trigger('change');

+ 44 - 0
resources/views/app/patient/segment-templates/plan_interventions/edit.blade.php

@@ -68,6 +68,50 @@ else {
                                 $label = 'Intervention';
                                 include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                                 ?>
+                                @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'DURING_VISIT')
+                                    <div visit-moe class="ml-2">
+                                        <a href="#" start show class="">Swap</a>
+                                        <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                            <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                            <input type="hidden" name="category" value="INTERVENTION">
+                                            <input type="hidden" name="data">
+
+                                            <p class="mb-2"><b>Add Intervention (on intake)</b></p>
+
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Name</label>
+                                                <select type="text" data-name="category" class="form-control form-control-sm">
+                                                    <option value="">-- select --</option>
+                                                    <option value="Self-Monitoring">Self-Monitoring</option>
+                                                    <option value="Labs">Labs</option>
+                                                    <option value="Radiology / Imaging">Radiology / Imaging</option>
+                                                    <option value="Screenings">Screenings</option>
+                                                    <option value="Medication Rx">Medication Rx</option>
+                                                    <option value="Physical Therapy Rx">Physical Therapy Rx</option>
+                                                    <option value="Occupational Therapy Rx">Occupational Therapy Rx</option>
+                                                    <option value="Referral to Specialist / HCP">Referral to Specialist / HCP</option>
+                                                    <option value="Clinical Instructions / Other">Clinical Instructions / Other</option>
+                                                    <option value="SMS Reminders">SMS Reminders</option>
+                                                    <option value="Handouts / Education Provided">Handouts / Education Provided</option>
+                                                </select>
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Intervention</label>
+                                                <input type="text" data-name="intervention" class="form-control form-control-sm">
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Description</label>
+                                                <textarea type="text" data-name="description" class="form-control form-control-sm"></textarea>
+                                            </div>
+
+                                            <div>
+                                                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                @endif
                             </div>
                         </div>
                     </td>

+ 49 - 4
resources/views/app/patient/segment-templates/plan_medications/edit.blade.php

@@ -57,6 +57,51 @@ else {
                                 $label = 'Medication';
                                 include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                                 ?>
+                                @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'DURING_VISIT')
+                                    <div visit-moe class="ml-2">
+                                        <a href="#" start show class="">Swap</a>
+                                        <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                            <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                            <input type="hidden" name="category" value="MEDICATION">
+                                            <input type="hidden" name="data">
+
+                                            <input type="hidden" data-name="medId">
+                                            <input type="hidden" data-name="routedMedId">
+                                            <input type="hidden" data-name="routedDosageFormMedId">
+                                            <input type="hidden" data-name="gcnSeqno">
+
+                                            <p class="mb-2"><b>Add Medication (during visit)</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"
+                                                       stag-suggest
+                                                       stag-suggest-ep="/fdb-med-suggest-v2/json">
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Frequency</label>
+                                                <input type="text" class="form-control form-control-sm" data-name="frequency"
+                                                       data-option-list="frequency-options" autocomplete="off">
+                                                <div id="frequency-options" class="data-option-list">
+                                                    <div>Once a day</div>
+                                                    <div>Twice a day</div>
+                                                </div>
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="text-sm text-secondary mb-1">Description</label>
+                                                <textarea type="text" data-name="description" class="form-control form-control-sm"></textarea>
+                                            </div>
+
+                                            <div>
+                                                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                @endif
                             </div>
                         </div>
                     </td>
@@ -178,10 +223,10 @@ else {
                 // text: "metoprolol succinate ER 100 mg capsule sprinkle, ext. release 24 hr"
                 // }
 
-                parentSegment.find('input[data-name="routedMedId"]').val(_data.routed_med_id);
-                parentSegment.find('input[data-name="routedDosageFormMedId"]').val(_data.routed_dosage_form_med_id);
-                parentSegment.find('input[data-name="gcnSeqno"]').val(_data.gcn_seqno);
-                parentSegment.find('input[data-name="medId"]').val(_data.medid);
+                $(_input).closest('form').find('input[data-name="routedMedId"]').val(_data.routed_med_id);
+                $(_input).closest('form').find('input[data-name="routedDosageFormMedId"]').val(_data.routed_dosage_form_med_id);
+                $(_input).closest('form').find('input[data-name="gcnSeqno"]').val(_data.gcn_seqno);
+                $(_input).closest('form').find('input[data-name="medId"]').val(_data.medid);
 
                 return false;
             });

+ 44 - 3
resources/views/app/patient/segment-templates/plan_problems/edit.blade.php

@@ -59,6 +59,47 @@ else {
                             $label = 'Problem';
                             include resource_path('views/app/patient/segment-templates/_common_actions/remove-undo.php');
                             ?>
+                            @if($point->added_in_note_id === $note->id && $point->addition_reason_category == 'DURING_VISIT')
+                                <div visit-moe class="ml-2">
+                                    <a href="#" start show class="">Swap</a>
+                                    <form url="/api/visitPoint/swapTopLevelEntryError" class="mcp-theme-1">
+                                        <input type="hidden" name="uid" value="<?= $point->uid ?>">
+                                        <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+                                        <input type="hidden" name="category" value="PROBLEM">
+                                        <input type="hidden" name="data">
+
+                                        <input type="hidden" data-name="dxid">
+                                        <input type="hidden" data-name="icd-type">
+
+                                        <p class="mb-2"><b>Add Problem (plan)</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"
+                                                   stag-suggest
+                                                   stag-suggest-ep="/fdb-dx-suggest/json">
+                                        </div>
+
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">ICD</label>
+                                            <select data-name="icd"
+                                                    class="form-control form-control-sm"
+                                                    disabled>
+                                            </select>
+                                        </div>
+
+                                        <div class="mb-2">
+                                            <label class="text-sm text-secondary mb-1">Description</label>
+                                            <textarea type="text" data-name="description" class="form-control form-control-sm"></textarea>
+                                        </div>
+
+                                        <div>
+                                            <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @endif
                         </div>
                     </div>
                 </td>
@@ -168,9 +209,9 @@ else {
                 // _input is the textbox
                 // _data is {med_name_id: "50567", text: "Children's Tylenol"}
 
-                parentSegment.find('input[data-name="dxid"]').val(_data.dxid);
+                $(_input).closest('form').find('input[data-name="dxid"]').val(_data.dxid);
 
-                let icdSelect = parentSegment.find('[data-name="icd"]').empty().prop('disabled', true);
+                let icdSelect = $(_input).closest('form').find('[data-name="icd"]').empty().prop('disabled', true);
 
                 $.get('/fdb-dx-icds-for-dxid?dxid=' + _data.dxid, _data => {
                     icdSelect
@@ -189,7 +230,7 @@ else {
         // on icd selection
         $(document).off('change', '[data-segment-template-name="<?= $segment->segmentTemplate->internal_name ?>"]  [data-name="icd"]');
         $(document).on('change', '[data-segment-template-name="<?= $segment->segmentTemplate->internal_name ?>"]  [data-name="icd"]', function () {
-            parentSegment.find('input[data-name="icd-type"]').val($(this).find('option:selected').attr('data-icd-type'));
+            $(this).closest('form').find('input[data-name="icd-type"]').val($(this).find('option:selected').attr('data-icd-type'));
         });
 
         // relevance