浏览代码

Added createclaim form to table

Samson Mutunga 3 年之前
父节点
当前提交
82ca519b0c

+ 240 - 0
resources/views/app/patient/care-month/_create-claim-table-action.blade.php

@@ -0,0 +1,240 @@
+@if($careMonth->is_claim_closed)
+    <b class="ml-2 text-info">[CLAIMING CLOSED]</b>
+@elseif($pro->pro_type === 'ADMIN' && $careMonth->was_rm_setup_performed && !$careMonth->rm_setup_claim_id)
+    <span class="text-warning-mellow font-weight-bold">
+        <i class="fa fa-exclamation-triangle"></i>
+        RM setup was performed, but RM setup claim is missing
+    </span>
+@else
+    <a href="#" onclick="return showStagPopup('create-claim{{ $careMonth->uid }}')">Create Claim</a>
+@endif
+@if($pro->pro_type === 'ADMIN')
+    @if(!$careMonth->is_claim_closed)
+        <span class="d-block" moe relative>
+            <a class="text-danger" href="" show start>Close Claiming</a>
+            <form url="/api/careMonth/closeClaiming" right>
+                <input type="hidden" name="uid" value="{{$careMonth->uid}}">
+                <p>Close claiming?</p>
+                <div class="mb-0">
+                    <button class="btn btn-success btn-sm" submit>Submit</button>
+                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                </div>
+            </form>
+        </span>
+    @elseif($careMonth->is_claim_closed)
+        <span class="d-block" moe relative>
+            <a class="text-danger" href="" show start>Reopen Claiming</a>
+            <form url="/api/careMonth/reopenClaiming" right>
+                <input type="hidden" name="uid" value="{{$careMonth->uid}}">
+                <p>Reopen claiming?</p>
+                <div class="mb-0">
+                    <button class="btn btn-success btn-sm" submit>Submit</button>
+                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                </div>
+            </form>
+        </span>
+        <span class="d-block" moe relative>
+            <a class="text-danger" href="" show start>Update Claim Total Paid</a>
+            <form url="/api/careMonth/updateClaimTotalPaid" right>
+                <input type="hidden" name="uid" value="{{$careMonth->uid}}">
+                <div class="form-group">
+                    <input type="number" class="form-control" name="claimTotalPaid">
+                </div>
+                <div class="mb-0">
+                    <button class="btn btn-success btn-sm" submit>Submit</button>
+                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                </div>
+            </form>
+        </span>
+    @endif
+@endif
+<div class="stag-popup stag-popup-md mcp-theme-1" style="width:100%" stag-popup-key="create-claim{{ $careMonth->uid }}">
+    <form action="/api/claim/createForCareMonth" id="createCareMonthClaimApp{{$careMonth->uid}}">
+        <h3 class="stag-popup-title border-bottom-0 mb-0">
+            <span class="mr-2">Create Claim</span>
+            <a href="#" v-on:click.prevent="addLine()">Add Line</a>
+            <a href="#" class="ml-auto text-secondary"
+               onclick="return closeStagPopup()"><i class="fa fa-times-circle"></i></a>
+        </h3>
+        <input type="hidden" name="careMonthUid" value="{{$careMonth->uid}}">
+        <table class="table table-sm table-condensed mb-3 border-left border-right border-bottom">
+            <thead>
+            <tr class="bg-light">
+                <th style="min-width: 100px;" class="border-bottom-0">CPT Code</th>
+                <th style="min-width: 100px;" class="border-bottom-0">DOS</th>
+                <th class="border-bottom-0">Units</th>
+                <th class="border-bottom-0">ICDs</th>
+                <th class="border-bottom-0">&nbsp;</th>
+            </tr>
+            </thead>
+            <tbody>
+            <tr v-for="(line, lineIndex) in payload.lines">
+                <td class="py-2">
+                    <input required type="text" class="min-width-unset form-control form-control-sm" v-model="line.cpt">
+                </td>
+                <td class="py-2">
+                    <input required type="date" class="min-width-unset form-control form-control-sm" v-model="line.dateOfService">
+                </td>
+                <td class="py-2">
+                    <input required type="number" class="min-width-unset form-control form-control-sm" v-model="line.numberOfUnits">
+                </td>
+                <td class="p-2 bg-light">
+                    <div class="d-flex align-items-baseline">
+                        <a href="#" class="text-nowrap text-primary mr-2"
+                           v-on:click.prevent="addICD(lineIndex)" title="Add ICD">
+                            <i class="fa fa-plus-square text-primary"></i>
+                        </a>
+                        <div class="flex-grow-1">
+                            <div v-for="(icd, icdIndex) in line.icds" class="d-flex align-items-center" :class="icdIndex > 0 ? 'mt-1' : ''">
+                                <input required type="text" class="form-control form-control-sm width-100px"
+                                       data-field="icd"
+                                       :data-line-index="lineIndex"
+                                       :data-icd-index="icdIndex"
+                                       v-model="icd.code">
+                                <input required type="text" class="form-control form-control-sm flex-grow-1 ml-2"
+                                       v-model="icd.description">
+                                <a href="#" class="text-nowrap text-danger ml-2"
+                                   v-on:click.prevent="removeICD(lineIndex, icdIndex)"
+                                   v-if="line.icds.length > 1" title="Remove ICD">
+                                    <i class="fa fa-trash-alt text-danger"></i>
+                                </a>
+                            </div>
+                        </div>
+                    </div>
+                </td>
+                <td class="text-center pt-2">
+                    <a href="#" class="text-nowrap text-danger d-block mt-1"
+                       :class="payload.lines.length <= 1 ? 'opacity-60' : ''"
+                       v-on:click.prevent="removeLine(lineIndex)">
+                        <i class="fa fa-trash-alt text-danger"></i>
+                        Remove Line
+                    </a>
+                </td>
+            </tr>
+            </tbody>
+        </table>
+
+        <div class="mt-2">
+            <button type="button" class="btn btn-primary btn-sm font-weight-bold" v-on:click.prevent="saveClaim()">Create</button>
+            <button type="button" class="btn btn-default border btn-sm font-weight-bold ml-2" onclick="return closeStagPopup()">Cancel</button>
+        </div>
+    </form>
+</div>
+
+<script>
+    window.rmReasons = [];
+    var careMonthClaimSuggestionJson = <?= $careMonth->claim_suggestion_json ?? 0 ?>;
+   
+    new Vue({
+        el: '#createCareMonthClaimApp{{$careMonth->uid}}',
+        delimiters: ['@{{', '}}'],
+        data: {
+            payload: {
+                lines: [
+                    {
+                        cpt: '',
+                        dateOfService: '{{date_format($careMonth->created_at, "Y-m-d")}}',
+                        icds: JSON.parse(JSON.stringify(window.rmReasons)),
+                        numberOfUnits: 1
+                    }
+                ]
+            }
+        },
+        methods: {
+            addLine: function () {
+                this.payload.lines.push({
+                    cpt: '',
+                    dateOfService: '{{date("Y-m-d")}}',
+                    icds: JSON.parse(JSON.stringify(window.rmReasons)),
+                    numberOfUnits: 1
+                });
+                Vue.nextTick(() => {
+                    this.initICDAutoSuggest();
+                });
+            },
+            removeLine: function (_index) {
+                if(this.payload.lines.length > 1) {
+                    this.payload.lines.splice(_index, 1);
+                }
+            },
+            addICD: function(_lineIndex) {
+                this.payload.lines[_lineIndex].icds.push({
+                    code: '',
+                    description: '',
+                });
+                Vue.nextTick(() => {
+                    this.initICDAutoSuggest();
+                });
+            },
+            removeICD: function(_lineIndex, _icdIndex) {
+                if(this.payload.lines[_lineIndex].icds.length > 1) {
+                    this.payload.lines[_lineIndex].icds.splice(_icdIndex, 1);
+                }
+            },
+            initICDAutoSuggest: function () {
+                let self = this;
+                $('#createCareMonthClaimApp{{$careMonth->uid}} input[type="text"][data-field="icd"]:not([ac-initialized])').each(function () {
+                    var elem = this,
+                        dynID = 'icd-' + Math.ceil(Math.random() * 1000000),
+                        lineIndex = $(this).attr('data-line-index'),
+                        icdIndex = $(this).attr('data-icd-index');
+                    $(elem).attr('id', dynID);
+                    new window.Def.Autocompleter.Search(dynID,
+                        'https://clinicaltables.nlm.nih.gov/api/icd10cm/v3/search?sf=code,name&ef=name', {
+                            tableFormat: true,
+                            valueCols: [0],
+                            colHeaders: ['Code', 'Name'],
+                        }
+                    );
+                    window.Def.Autocompleter.Event.observeListSelections(dynID, function () {
+                        let acData = elem.autocomp.getSelectedItemData();
+                        console.log('ALIX', lineIndex, icdIndex);
+                        self.payload.lines[lineIndex].icds[icdIndex].code = acData[0].code;
+                        self.payload.lines[lineIndex].icds[icdIndex].description = acData[0].data.name;
+                        return false;
+                    });
+                    $(elem).attr('ac-initialized', 1);
+                });
+            },
+            saveClaim: function() {
+                let form = $('form#createCareMonthClaimApp{{$careMonth->uid}}').first();
+                if(!form[0].checkValidity()) {
+                    form[0].reportValidity();
+                    return false;
+                }
+
+                $.post('/api/claim/createForCareMonth', {
+                    careMonthUid: '{{$careMonth->uid}}',
+                    data: JSON.stringify(this.payload)
+                }, function(_data) {
+                    if (!_data.success) {
+                        if (_data.message) {
+                            toastr.error(_data.message);
+                        }
+                        else {
+                            toastr.error('Unable to save the claim!');
+                        }
+                    }
+                    else {
+                        toastr.success('Claim saved!');
+                        closeStagPopup();
+                        fastReload();
+                    }
+                }, 'json')
+            },
+            getPrefillValues: function() {
+                if(careMonthClaimSuggestionJson){
+                    let csj = careMonthClaimSuggestionJson;
+                    if(csj && csj.lines && csj.lines.length) {
+                        this.payload.lines.splice(0, 1);
+                        this.payload.lines = csj.lines;
+                    }
+                }
+            }
+        },
+        mounted: function () {
+            this.initICDAutoSuggest();
+            this.getPrefillValues();
+        }
+    });
+</script>

+ 1 - 0
resources/views/app/practice-management/rm-action-report.blade.php

@@ -227,6 +227,7 @@
                                 <span>457: --</span>
                                 <span>458: --</span>
                             </div>--}}
+                            @include('app.patient.care-month._create-claim-table-action', ['careMonth' => $row])
                         </td>
                         <td>
                             {{$row->has_anyone_interacted_with_client_about_rm_outside_note? 'YES': 'NO'}}