cost-use-registration.vue 19.7 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475
<!--医院对账单 - 列表-->
<template>
  <div class="container resource close-left-menu contaNEW">
    <div class="pop-banner clearfix">
     <div class="operate-btns">
                <a class="fbtn fb-save" @click="saveTrmedHvwvs()">保存</a>
                <a class="fbtn fb-submit" @click="subMittrmedHvwvs()">提交</a> 
    </div>
    <h3 class="current-module">高值使用登记</h3>
  </div>
  <div class="order-orderlist-view clearfix"> 
              <div class="fheader">
             <h4 class='fh-notes'>高值使用登记</h4> 
              </div>
              <div class="w660 mb-30" style="margin:0 auto;">
              <div class="group-row">
              <div class="form-group form-label w660">
                <label for="cc0" class="label bar-code-img"></label>
                <div class="control">
                  <input class="h-70 w660 border-blue pl80 f-size24" type="text" id="cc0" v-model="barcode" placeholder="请扫描条码" @keydown="keyCodeList($event)">
                </div>
              </div>
              </div>
              <div class="group-row mt-20">  
             <div class="form-group form-label">
               <label for="cn1" class="label h-44 f-size18 lh-44">医院</label>
                <div class="control">
                  <select v-model="medguid" id='cn1' class="inp2 h-44 f-size18" @change="getdepname(medguid)">
                    <option value="">请选择</option>
                    <option v-for='item in getMedList' :value="item.guid">{{item.name}}</option>
                  </select>
                </div>
              </div>
            </div>
            <div class="group-row mt-20">  
             <div class="form-group form-label">
               <label for="cn2" class="label h-44 f-size18 lh-44">科室</label>
                <div class="control">
                  <select v-model="deptguid" id='cn2' class="inp2 h-44 f-size18" @change="getrealname(deptguid)">
                    <option value="">请选择</option>
                    <option v-for='item in getdepartmentList' :value="item.guid">{{item.hdeptname}}</option>
                  </select>
                </div>
              </div>
            </div>
            <div class="group-row mt-20">  
              <div class="form-group form-label">
              <label for="cn3" class="label h-44 f-size18 lh-44">手术日期</label>
                <div class="control control-date h-44" style="overflow: inherit;">
                  <div>
                    <datepicker :target.sync="surgerydate | getYMD" :readonly="readonlyFlag" styleobj="width:100% !important;border-radius:8px !important; height:42px; line-height:44px; font-size:18px; padding-left:90px;"></datepicker>
                  </div> 
                </div> 
                </div>
            </div> 
            <div class="group-row mt-20"> 
              <div class="form-group form-label">
              <label for="cn4" class="label h-44 f-size18 lh-44">手术编号</label>
                <div class="control">
                  <input type="text" id="cn4" class="h-44 f-size18 inp4" v-model="surgerybillno">
                  </div>
              </div> 
            </div> 
            <div class="group-row mt-20"> 
              <div class="form-group form-label">
              <label for="cn5" class="label h-44 f-size18 lh-44">医生姓名</label>
                <div class="control">
                  <input type="text" id="cn5" class="h-44 f-size18 inp4" v-model="doctorname">
                  </div>
              </div> 
            </div> 
              <div class="group-row mt-20"> 
                    <div class="form-group form-label">
                    <label for="cn6" class="label h-44 f-size18 lh-44">住院号</label>
                        <div class="control">
                          <input type="text" id="cn6" class="h-44 f-size18 inp3" v-model="inhospitalnumber">
                          </div>
                    </div>  
            </div>
            <div class="group-row mt-20"> 
              <div class="form-group form-label">
              <label for="cn7" class="label h-44 f-size18 lh-44">病床号</label>
                <div class="control">
                    <input type="text" id="cn7" class="h-44 f-size18 inp3" v-model="bednumber">
                    </div>
                </div>
            </div> 
            <div class="group-row mt-20"> 
              <div class="form-group form-label">
              <label for="cn8" class="label h-44 f-size18 lh-44">患者姓名</label>
                <div class="control">
                  <input type="text" id="cn8" class="h-44 f-size18 inp4" v-model="patientname">
                  </div>
              </div> 
            </div> 
             <div class="group-row mt-20"> 
                    <div class="form-group form-label">
                    <label for="cn9" class="label h-44 f-size18 lh-44">单据编号</label>
                        <div class="control">
                          <input type="text" id="cn9" class="h-44 f-size18 inp4" v-model="billno" readonly="readonly">
                          </div>
                    </div>  
            </div>
            <div class="group-row mt-20"> 
                    <div class="form-group form-label">
                    <label for="cn10" class="label h-44 f-size18 lh-44">备注</label>
                        <div class="control">
                          <input type="text" id="cn10" class="h-44 f-size18 inp2" v-model="memo">
                          </div>
                    </div>  
            </div>
          </div>
    </div>

    <table class="itable itable-td-long-text mb-30">
      <thead id="t_header">
        <tr>
          <th class="w40">序号</th>
          <th class="w80"> 商品编号</th>
          <th class="w150">商品名称</th>
          <th class="w80">规格</th>
          <th class="w60">单位</th>
          <th class="w120">生产厂商</th>
          <th class="w120">注册证号/批准文号</th>
          <th class="w80">批号</th>
          <th class="w100">条码</th> 
          <th class="w80">操作</th> 
        </tr>
      </thead>
      <tbody >
        <tr v-if="getTrmedHvstockList.length==0">
          <td colspan="10" >
          暂无符合条件的记录
          </td>
        </tr> 
        <tr v-else v-for='item in getTrmedHvstockList'>
          <td class="v-top">{{$index+1}}</td>
          <td class="t-left pr10 v-top">{{item.goodscode}}</td>
          <td class="t-left pr10 v-top">{{item.goodsname}}</td> 
          <td class="t-left pr10 v-top">{{item.goodsspec}}</td>
          <td class="v-top">{{item.unit}}</td>
          <td class="t-left pr10 v-top">{{item.producer}}</td>
          <td class="t-left pr10 v-top">{{item.register}}</td>
          <td class="t-left v-top">{{item.lot}}<br>{{item.productiondate | getYMD}}<br>{{item.expiredate | getYMD}}</td> 
          <td class="t-left pr10 v-top">{{item.barcode}}</td> 
          <td  class="v-top"><a href="javascript:;" class="btn button-red" v-on:click="delList($index)">删 除</a></td>
        </tr>
      </tbody>
    </table>  
  </div>

  <div class="modal" v-if='modelFlag'>
                <div class="container resource">
                    <div class="audit-detail" style="margin:200px auto;width:1003px;">
                        <span class="close-win" v-on:click="close()"></span>
                        <div class="sdiv-9-9b no-border pb0">
                            <form class="search-bar" active="###">
                            <input type="text" style="width: 370px;" placeholder="输入商品名称查询" v-model="goodsname">
                            <div class="search-btn">
                              <input type="button" @click="getDataGoods()">
                            </div> 
                          </form> 
                        </div> 
                        <div style="padding-top:0px; max-height: 350px; overflow-y: auto; padding-bottom:10px;">
                        <table class="itable itable-thead-13px itable-td-long-text">
                            <thead>
                                <tr>
                                    <th class="w50">序号</th> 
                                    <th class="w80"> 商品编号</th>
                                    <th class="w150">商品名称</th>
                                    <th class="w80">规格</th>
                                    <th class="w60">单位</th>
                                    <th class="w120">生产厂商</th>
                                    <th class="w120">注册证号/批准文号</th>
                                    <th class="w80">批号</th>
                                    <th class="w100">条码</th> 
                                    <th class="w80">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr v-for='item in zsmsList' track-by="$index">
                                    <td  class=" v-top">
                                        <div>{{$index+1 | getIndex}}</div>
                                    </td>
                                    <td class="t-left pr10 v-top">{{item.goodscode}}</td>
                                    <td class="t-left pr10 v-top">{{item.goodsname}}</td> 
                                    <td class="t-left pr10 v-top">{{item.goodsspec}}</td>
                                    <td class="v-top">{{item.unit}}</td>
                                    <td class="t-left pr10 v-top">{{item.producer}}</td>
                                    <td class="t-left pr10 v-top">{{item.register}}</td>
                                    <td class="t-left v-top">{{item.lot}}<br>{{item.productiondate | getYMD}}<br>{{item.expiredate | getYMD}}</td> 
                                    <td class="t-left pr10 v-top">{{item.barcode}}</td> 
                                    <td  class=" v-top"> 
                                            <a href="javascript:;" class="btn button-green" @click="addCode($index,item.guid)">添加</a>
                                    </td>  
                                </tr>
                            </tbody>
                        </table>  
                        </div>
                        <a href="javascript:;" class="btn button-green mt-20" style='margin-left:430px;' v-on:click="close()">确 认</a>  
                    </div>
                </div>
            </div>
  
</template>
<script >
  module.exports = {
    data: function () {
      return {  
        getTrmedHvstockList:[],
        getdepartmentList:[],
        // 查询条件 
        surgerydate: '', 
        deptguid:'',
        deptname:'',
        surgerybillno:'',
        inhospitalnumber: '',
        bednumber: '',
        patientname:'',
        barcode:'', 
        memo:'',
        billno:'',
        doctorname:'',
        guid:'', 
        getMedList:'',
        goodsname:'',
        modelFlag:false,
        zsmsList:[],
      };
    },
    watch: { 
      'search.goodstate': function(val) {
        this.getData(); 
      } 
    },
    methods: {
      close: function () {
          var self = this; 
          self.modelFlag =false;  
      },
      // 获取当前时间和之前一个月时间
      Date:function(){
        var self = this; 
        var nowdate = new Date();  
        // 开始日期
        nowdate.setMonth(nowdate.getMonth());
        var yn = nowdate.getFullYear();
        var mn = nowdate.getMonth()+1;

        mn=mn<10?'0'+mn:mn;

        var dn= nowdate.getDate();
        dn=dn<10?'0'+dn:dn;
        self.surgerydate = yn+'-'+mn+'-'+dn;
      },
      keyCodeList: function (ev) {
            if(ev.keyCode==13){ 
              this.getData();
            }
      },
      getData: function () {
        var self = this; 
        if(self.medguid == '' || self.medguid == null){
            layer.msg('请选择医院!')
            return;
        } 
        Ajax.post('/cost/gettrmedhvstock',{'barcode':self.barcode,'medguid':self.medguid})
          .then(function (response){
            var data = response.data.data;
            if(response.data.errorCode==0){ 
              if(data.length > 1){
                  self.$set('zsmsList',data); 
                  self.modelFlag =true;
              }else{
                for (var i = 0; i < self.getTrmedHvstockList.length; i++) {
                       if(self.getTrmedHvstockList[i].guid == data[0].guid){
                            layer.msg('商品已存在!')
                            return;
                       }
                    }
                    self.getTrmedHvstockList.push(data[0]);  
              } 
            } else {
                    layer.msg(response.data.message);
             } 
        })          
      },
      getDataGoods: function () {
        var self = this; 
        Ajax.post('/cost/gettrmedhvstock',{'barcode':self.barcode,'goodsname':self.goodsname})
          .then(function (response){
            var data = response.data.data;
            if(response.data.errorCode==0){ 
              self.$set('zsmsList',data); 
            } else {
                    layer.msg(response.data.message);
             } 
        })          
      },
      addCode: function(index,guid) {
            var self = this; 
            for (var i = 0; i < self.zsmsList.length; i++) {
               if(self.zsmsList[i].guid == guid){
                  for (var j = 0; j < self.getTrmedHvstockList.length; j++) {
                       if(self.getTrmedHvstockList[j].guid == guid){
                            layer.msg('商品已存在!')
                            return;
                       }
                    }
                    self.getTrmedHvstockList.push(self.zsmsList[i]);  
               }
            }
            self.zsmsList.splice(index, 1);
            if(self.zsmsList.length == 0){ 
              self.close();
            } 
      },
      delList: function(index) {
            var self = this; 
            self.getTrmedHvstockList.splice(index, 1);
      },
      getmedlist: function () {
        var self = this; 
        Ajax.post('/cost/getmedlist',{})
          .then(function (response){
            var data = response.data.data;
            if(response.data.errorCode==0){
              self.$set('getMedList',data); 
            } 
        })          
      }, 
      getdepname: function (guid) {
                var self = this;
                self.getTrmedHvstockList = [];
                self.getdepartmentLists(guid);
      },
      getdepartmentLists: function (guid) {
        var self = this; 
        Ajax.post('/cost/getdepartmentlist',{'medguid':guid})
          .then(function (response){
            var data = response.data.data;
            if(response.data.errorCode==0){
              self.$set('getdepartmentList',data); 
            } 
        })          
      }, 
      getrealname: function (guid) {
                var self = this;
                for (var i = 0; i < self.getdepartmentList.length; i++) {
                     if(guid == self.getdepartmentList[i].guid){
                            self.deptname =  self.getdepartmentList[i].hdeptname;
                     }
                }    
      },
      // 保存
      saveTrmedHvwvs: function () {
        var self = this; 
        if(self.medguid == '' || self.medguid == null){
            layer.msg('请选择医院!')
            return;
        }
        if(self.deptguid == '' || self.deptguid == null){
            layer.msg('请选择科室!')
            return;
        }   
        if(self.surgerydate == '' || self.surgerydate == null){
            layer.msg('请选择手术日期!')
            return;
        } 
        if(self.surgerybillno == '' || self.surgerybillno == null){
            layer.msg('请填写手术编号!')
            return;
        } 
        if(self.doctorname == '' || self.doctorname == null){
            layer.msg('请填写医生姓名!')
            return;
        } 
        if(self.inhospitalnumber == '' || self.inhospitalnumber == null){
            layer.msg('请填写住院号!')
            return;
        }
        if(self.bednumber == '' || self.bednumber == null){
            layer.msg('请填写病床号!')
            return;
        }
        if(self.patientname == '' || self.patientname == null){
            layer.msg('请填写患者姓名!')
            return;
        }
        Ajax.post('/cost/savetrmedhvur',{'surgerydate':self.surgerydate,'guid':self.guid,'medguid':self.medguid,'doctorname':self.doctorname,'deptguid':self.deptguid,'deptname':self.deptname,'surgerybillno':self.surgerybillno,'inhospitalnumber':self.inhospitalnumber,'bednumber':self.bednumber,'patientname':self.patientname,'billno':self.billno,'memo':self.memo,'list':self.getTrmedHvstockList})
          .then(function (response){
            var data = response.data.data;
            if(response.data.errorCode==0){     
              layer.msg('保存成功!') 
              self.billno = data.billno;
              self.guid = data.guid;
              self.deptguid = data.deptguid;
              self.surgerybillno = data.surgerybillno;
              self.inhospitalnumber = data.inhospitalnumber;
              self.bednumber = data.bednumber;
              self.patientname = data.patientname;
              self.memo = data.memo; 
              self.doctorname = data.doctorname;
              self.surgerydate = data.surgerydate;  
            }else {
                  layer.msg(response.data.message)
             } 
        })          
      },
      // 提交
      subMittrmedHvwvs: function () {
        var self = this;   
        if(self.medguid == '' || self.medguid == null){
            layer.msg('请选择医院!')
            return;
        }
        if(self.deptguid == '' || self.deptguid == null){
            layer.msg('请选择科室!')
            return;
        }   
        if(self.surgerydate == '' || self.surgerydate == null){
            layer.msg('请选择手术日期!')
            return;
        } 
        if(self.surgerybillno == '' || self.surgerybillno == null){
            layer.msg('请填写手术编号!')
            return;
        } 
        if(self.doctorname == '' || self.doctorname == null){
            layer.msg('请填写医生姓名!')
            return;
        } 
        if(self.inhospitalnumber == '' || self.inhospitalnumber == null){
            layer.msg('请填写住院号!')
            return;
        }
        if(self.bednumber == '' || self.bednumber == null){
            layer.msg('请填写病床号!')
            return;
        }
        if(self.patientname == '' || self.patientname == null){
            layer.msg('请填写患者姓名!')
            return;
        }
        Ajax.post('/cost/submittrmedhvur',{'surgerydate':self.surgerydate,'guid':self.guid,'medguid':self.medguid,'doctorname':self.doctorname,'deptguid':self.deptguid,'deptname':self.deptname,'surgerybillno':self.surgerybillno,'inhospitalnumber':self.inhospitalnumber,'bednumber':self.bednumber,'patientname':self.patientname,'billno':self.billno,'memo':self.memo,'list':self.getTrmedHvstockList})
          .then(function (response){
            var data = response.data.data;
            if(response.data.errorCode==0){    

                self.MessageBox({
                        title: '提示',
                        message: '提交成功!',
                        type: 'alert'
                    }, function (action) {
                      self.$route.router.go('/cost/costUseRegistrationList');
                 });  
            }else {
                layer.msg(response.data.message)
             } 
        })          
      },
    },
    route: {
      activate: function () {
        this.Date();
        // this.getData();
        this.getmedlist(); 
      }
    },
    ready:function(){
      var self=this;
      $("#cc0").focus(); 
    }
  };
</script>