123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <template>
- <div>
- <div style="display: flex;justify-content: space-between;margin-bottom:10px;">
- <div>
- <el-input size="small" style="width:150px;" v-model="keywords"
- @keyup.enter.native='searchAction'
- placeholder="请输入药品名称"
- class="filter-item"/>
- <el-button size="small" class="filter-item" type="primary" @click="searchAction">搜索</el-button>
- <el-date-picker
- v-model="chargeDate"
- type="daterange"
- value-format="yyyy-MM-dd"
- range-separator="至"
- start-placeholder="开始日期"
- @change="changeDate"
- end-placeholder="结束日期">
- </el-date-picker>
- </div>
- </div>
- <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="table"
- :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
- max-height="600"
- highlight-current-row>
-
- <el-table-column align="center" prop="name" label="序号">
- <template slot-scope="scope">
- {{scope.$index + 1}}
- </template>
- </el-table-column>
-
- <el-table-column align="center" prop="name" label="日期">
- <template slot-scope="scope">
- {{getTime(scope.row.advice_date)}}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="药品类型">
- <template slot-scope="scope">
- {{getDrugTypeName(scope.row.drug_id)}}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="药品名称">
- <template slot-scope="scope">
- {{getDrugName(scope.row.drug_id)}}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="规格">
- <template slot-scope="scope">
- {{getSpecialName(scope.row.drug_id)}}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="数量">
- <template slot-scope="scope">
- {{getCount(scope.row.child,scope.row.min_number,scope.row.max_unit,scope.row.min_unit)}}
- </template>
- </el-table-column>
-
-
- <el-table-column align="center" prop="total" label="操作">
- <template slot-scope="scope">
- <div style="color: #589ff8" @click="jump(scope.row.child,scope.row.min_number,scope.row.drug_id,scope.row.max_unit,scope.row.min_unit)">使用明细</div>
- </template>
- </el-table-column>
-
- </el-table>
-
-
- <el-dialog
- title="药品明细"
- :visible.sync="dialogVisible"
- width="60%">
- <div style="margin-bottom:10px"> <span>药品类型:{{getDrugTypeName(drug_id)}}</span>
- <span>药品名称:{{getDrugName(drug_id)}}</span>
- </div>
- <span>
- <el-table :data="tableList" border :row-style="{ color: '#303133' }" ref="table"
- :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
- max-height="600"
- highlight-current-row>
-
- <el-table-column align="center" prop="name" label="序号">
- <template slot-scope="scope">
- {{scope.$index + 1}}
- </template>
- </el-table-column>
-
- <el-table-column align="center" prop="name" label="使用日期">
- <template slot-scope="scope">
- {{getTime(scope.row.advice_date)}}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="患者名字">
- <template slot-scope="scope">
- {{getPatientName(scope.row.patient_id)}}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="数量">
- <template slot-scope="scope">
- <span v-if="scope.row.prescribing_number_unit == max_unit">{{scope.row.prescribing_number/min_number}}</span>
- <span v-if="scope.row.prescribing_number_unit == min_unit && max_unit!=min_unit">{{scope.row.prescribing_number}}</span>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="单位">
- <template slot-scope="scope">
- {{scope.row.prescribing_number_unit}}
- </template>
- </el-table-column>
-
- </el-table>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
- </span>
- </el-dialog>
-
- </div>
-
-
- </template>
-
-
- <script>
- import BreadCrumb from '@/xt_pages/components/bread-crumb'
- import {getDrugDetailSummary} from "@/api/stock"
- import { uParseTime } from '@/utils/tools'
- import { min } from 'moment'
- const moment = require('moment')
- export default {
- components: {
- BreadCrumb
-
- },
- data() {
- return {
- detail_loading: false,
- tempArr: [],
- pos: 0,
- sameRowArr: [],
- keywords: '',
- tableData: [],
- chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
- limit:10,
- page:1,
- total:0,
- drugList:[],
- drugTypeList:[],
- dialogVisible:false,
- tableList:[],
- patients:[],
- min_number:0,
- drug_type:"",
- drug_id:0,
- max_unit:"",
- min_unit:"",
- }
- },
- methods:{
- changeDate(){
- this.tableData = []
- this.getlist()
- },
- getlist(){
- let start_time = this.chargeDate[0]
- let end_time = this.chargeDate[1]
- var params = {
- start_time: start_time,
- end_time: end_time,
- keyword: this.keywords,
- limit:this.limit,
- page:this.page,
- }
-
- getDrugDetailSummary(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
-
- var total = response.data.data.total
- var drug = response.data.data.drug
- this.patients = response.data.data.patients
- for(let i =0;i<list.length;i++){
-
- for(let j=0;j<drug.length;j++){
- if(list[i].drug_id == drug[j].id){
- if(list[i].child!=null && list[i].child.length > 0){
- for(let z=0;z<list[i].child.length;z++){
- if(list[i].child[z].prescribing_number_unit == drug[j].max_unit){
- list[i].child[z].prescribing_number = parseInt(list[i].child[z].prescribing_number) * drug[j].min_number
- }
- }
- }
- }
- }
- }
- this.drugList = drug
- this.total = total
- this.drugTypeList = response.data.data.drugTypeList
- for(let i=0;i<list.length;i++){
- list[i].min_number = 0
- list[i].max_unit = ""
- list[i].min_unit = ""
- for(let j=0;j<drug.length;j++){
- if(list[i].drug_id == drug[j].id){
- list[i].min_number = drug[j].min_number
- list[i].max_unit = drug[j].max_unit
- list[i].min_unit = drug[j].min_unit
- this.tableData.push(list[i])
- }
- }
- }
- }
- })
- },
- getTime(val) {
- if(val < 0){
- return ""
- }
- if(val == ""){
- return ""
- }else {
- return uParseTime(val, '{y}-{m}-{d}')
- }
- },
- getDrugName(id){
- var drug_name = ""
- for(let i=0;i<this.drugList.length;i++){
- if(id == this.drugList[i].id){
- drug_name = this.drugList[i].drug_name
- }
- }
- return drug_name
- },
- getSpecialName(id){
- var specification_name = ""
- for(let i=0;i<this.drugList.length;i++){
- if(id == this.drugList[i].id){
- specification_name = this.drugList[i].dose + this.drugList[i].dose_unit +"*" + this.drugList[i].min_number +this.drugList[i].min_unit +"/" + this.drugList[i].max_unit;
- }
- }
- return specification_name
- },
- searchAction(){
- this.tableData = []
- this.getlist()
- },
- getDrugTypeName(drug_id){
-
- var drug_type = ""
- for(let i=0;i<this.drugList.length;i++){
- if(drug_id == this.drugList[i].id){
- drug_type = this.drugList[i].drug_type
- }
- }
- var type_name = ""
- for(let i=0;i<this.drugTypeList.length;i++ ){
- if(drug_type == this.drugTypeList[i].value){
- type_name = this.drugTypeList[i].name
- }
- }
- return type_name
- },
- getCount(val,min_number,max_unit,min_unit){
-
- var total = 0
- var min_str = ""
- var max_str = ""
- if(val!=null && val!=undefined && val.length > 0){
- for(let i=0;i<val.length;i++){
- total += parseInt(val[i].prescribing_number)
- }
- }
- if (total < min_number){
- min_str = total + min_unit
- }
- if (total == 0) {
- min_str = ""
- max_str = ""
- }
-
- if (total >=min_number) {
- if(parseInt(total/min_number)!=0){
- max_str = parseInt(total/min_number) + max_unit
- }
- if(total%min_number!=0){
- min_str = total%min_number + min_unit
- }
-
- }
- return max_str + min_str
- },
- jump(val,min_number,drug_id,max_unit,min_unit){
- console.log("max_unit23232233",max_unit)
- console.log("min_unit23232233",min_unit)
- this.dialogVisible = true
- this.tableList= val
- this.min_number = min_number
- this.max_unit = max_unit
- this.min_unit = min_unit
- this.drug_id = drug_id
- },
- getPatientName(id){
- var name = ""
- for(let i=0;i<this.patients.length;i++){
- if(id == this.patients[i].id){
- name = this.patients[i].name
- }
- }
- return name
- }
-
- },
- created() {
- this.getlist()
- }
- }
- </script>
|