Browse Source

Claim: new create & update UI

Vijayakrishnan 4 năm trước cách đây
mục cha
commit
2bb16fa040

+ 1 - 0
public/css/yemi.css

@@ -18,6 +18,7 @@
     position: fixed !important;
     top: 50% !important;
     left: 50% !important;
+    width: 600px;
     transform: translate(-50%, -50%) !important;
 }
 [moe] [url][right] {

+ 177 - 12
resources/views/app/patient/note/_create-claim.blade.php

@@ -1,17 +1,182 @@
-<?php $noteRates = $pro->noteRates(); ?>
 <span class="mx-2 text-secondary">|</span>
-<div moe wide class="">
-    <a class="" href="" show start>Create Claim</a>
-    <form url="/api/claim/createForNote">
+<a href="#" onclick="return showStagPopup('create-claim')">Create Claim</a>
+<div class="stag-popup stag-popup-md mcp-theme-1" stag-popup-key="create-claim">
+    <form action="/api/claim/createForNote" id="createClaimApp">
+        <h3 class="stag-popup-title border-bottom-0 mb-0">
+            <span>Create Claim</span>
+            <span class="mx-2 text-secondary">|</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="noteUid" value="{{$note->uid}}">
-        <div class="mb-2">
-            <label for="">Are you sure you want to create a claim for this note?</label>
-        </div>
-        
-        <div class="">
-            <button class="btn btn-primary btn-sm" submit>Yes</button>
-            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+        <table class="table table-sm table-condensed mb-3 border-left border-right border-bottom">
+            <thead>
+            <tr class="bg-light">
+                <th class="width-100px border-bottom-0">CPT Code</th>
+                <th class="width-100px border-bottom-0">Date of Service</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="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> 
+    </form>
 </div>
+<script>
+    window.createClaimApp = new Vue({
+        el: '#createClaimApp',
+        delimiters: ['@{{', '}}'],
+        data: {
+            payload: {
+                lines: [
+                    {
+                        cpt: '',
+                        dateOfService: '{{date('Y-m-d')}}',
+                        icds: [
+                            {
+                                code: '',
+                                description: '',
+                            }
+                        ]
+                    }
+                ]
+            }
+        },
+        methods: {
+            addLine: function () {
+                this.payload.lines.push({
+                    cpt: '',
+                    dateOfService: '{{date('Y-m-d')}}',
+                    icds: [
+                        {
+                            code: '',
+                            description: '',
+                        }
+                    ]
+                });
+                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;
+                $('#createClaimApp 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();
+                        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#createClaimApp').first();
+                if(!form[0].checkValidity()) {
+                    form[0].reportValidity();
+                    return false;
+                }
 
+                $.post('/api/claim/create', {
+                    noteUid: '{{$note->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')
+            }
+        },
+        mounted: function () {
+            this.initICDAutoSuggest();
+        }
+    })
+</script>

+ 188 - 0
resources/views/app/patient/note/_update-claim.blade.php

@@ -0,0 +1,188 @@
+<span class="mx-2 text-secondary">|</span>
+<?php $componentID = rand(10001, 99999); ?>
+<a href="#" onclick="return showStagPopup('update-claim-{{$componentID}}')">Update Claim</a>
+<div class="stag-popup stag-popup-md mcp-theme-1" stag-popup-key="update-claim-{{$componentID}}">
+    <form action="/api/claim/createForNote" id="updateClaimApp{{$componentID}}">
+        <h3 class="stag-popup-title border-bottom-0 mb-0">
+            <span>Update Claim</span>
+            <span class="mx-2 text-secondary">|</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="uid" value="{{$claim->uid}}">
+        <table class="table table-sm table-condensed mb-3 border-left border-right border-bottom">
+            <thead>
+            <tr class="bg-light">
+                <th class="width-100px border-bottom-0">CPT Code</th>
+                <th class="width-100px border-bottom-0">Date of Service</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="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()">Update</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>
+    <?php
+        $loadedLines = [];
+        foreach ($claim->lines as $line) {
+            $newLine = (object)[];
+            $newLine->cpt = $line->cpt;
+            $newLine->dateOfService = $line->date_of_service;
+            $newLine->icds = [];
+            foreach ($line->claimLineIcds as $icd) {
+                $newICD = (object)[];
+                $newICD->code = $icd->code;
+                $newICD->description = $icd->description;
+                $newLine->icds[] = $newICD;
+            }
+            $loadedLines[] = $newLine;
+        }
+    ?>
+    window.updateClaimApp{{$componentID}} = new Vue({
+        el: '#updateClaimApp{{$componentID}}',
+        delimiters: ['@{{', '}}'],
+        data: {
+            payload: {
+                lines: <?= json_encode($loadedLines) ?>
+            }
+        },
+        methods: {
+            addLine: function () {
+                this.payload.lines.push({
+                    cpt: '',
+                    dateOfService: '{{date('Y-m-d')}}',
+                    icds: [
+                        {
+                            code: '',
+                            description: '',
+                        }
+                    ]
+                });
+                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;
+                $('#updateClaimApp{{$componentID}} 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();
+                        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#updateClaimApp{{$componentID}}').first();
+                if(!form[0].checkValidity()) {
+                    form[0].reportValidity();
+                    return false;
+                }
+
+                $.post('/api/claim/update', {
+                    uid: '{{$claim->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')
+            }
+        },
+        mounted: function () {
+            this.initICDAutoSuggest();
+        }
+    })
+</script>

+ 4 - 4
resources/views/app/patient/note/dashboard.blade.php

@@ -434,11 +434,11 @@
                             @foreach ($note->claims as $claim)
                                 <tr>
                                     <td class="pl-3">
-                                        <div>IID: {{ $claim->iid }}</div>
+                                        <div v-on:click.prevent="py-2">
+                                            IID: {{ $claim->iid }}
+                                            @include('app/patient/note/_update-claim')
+                                        </div>
                                         <div>
-                                            <div class="my-1">
-                                                @include('app.patient.note._update-claim-lines')
-                                            </div>
                                             @if($claim->lines->count())
 
                                                 <table class="table table-sm table-condensed table-striped">