123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709 |
- <template>
- <div>
- <div style="display: flex;justify-content: space-between;margin-bottom:10px;">
- <div>
- <el-select size="small" v-model="item_type" placeholder="请选择"
- style="width:150px;margin-left:10px;" @change="changeItem">
- <el-option
- label="全部"
- value="0">
- </el-option>
- <el-option
- v-for="(item,index) in items"
- :key="index"
- :label="item.name"
- :value="item.id">
- </el-option>
- </el-select>
-
- <el-input
- size="small"
- style="width: 150px"
- v-model="keywords"
- class="filter-item"
- placeholder="请输入项目名称"
- />
- <el-button
- size="small"
- style="margin: 0 10px"
- 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>
- <el-button type="primary" size="small" @click="toPrint">打印</el-button>
- <el-button type="primary" size="small" @click="toPrintInvoice">发票打印</el-button>
- </div>
- <div>
- </div>
- </div>
- <el-table :data="list" border :row-style="{ color: '#303133' }" ref="table"
- :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
- max-height="600"
- v-loading="detail_loading"
- highlight-current-row>
- <el-table-column type="index" label="序号" width="60px" align="center">
- <template slot-scope="scope">{{scope.row.index}}</template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="处方日期">
- <template slot-scope="scope">
- <span v-if="scope.row.record_date > 0">{{getTimes(scope.row.record_date)}} </span>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="费用分类">
- <template slot-scope="scope">
- {{ scope.row.med_chrgitm_type }}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="项目名称">
- <template slot-scope="scope">
- <span>{{scope.row.name}}</span>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="规格型号">
- <template slot-scope="scope">
- {{ scope.row.spec }}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="数量">
- <template slot-scope="scope">
- {{ scope.row.count }}{{ scope.row.unit }}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="单价">
- <template slot-scope="scope">
- {{scope.row.price}}
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="金额">
- <template slot-scope="scope">
- <span v-if="scope.row.is_total == 1">{{ scope.row.total }}</span>
- <span v-if="scope.row.is_total == 2">{{ (scope.row.price * scope.row.count).toFixed(2) }}</span>
- </template>
- </el-table-column>
- <el-table-column align="center" prop="name" label="医保类别">
- <template slot-scope="scope">
- <span v-if="scope.row.chrgitm_lv== '01'">甲类</span>
- <span v-if="scope.row.chrgitm_lv== '02'">乙类</span>
- <span v-if="scope.row.chrgitm_lv== '03'">自费</span>
- </template>
- </el-table-column>
-
- </el-table>
- <div>
- <div class="listInfo">
- <div>西药:</div>
- <div>中成药:{{chineseTraditionalMedicineCostTotal}}</div>
- <div>中草药:</div>
- </div>
- <div class="listInfo">
- <div>检查费:{{checkCostTotal}}</div>
- <div>输氧费:</div>
- <div>手术费:</div>
- </div>
- <div class="listInfo">
- <div>化验费:{{laboratoryCostTotal}}</div>
- <div>输血费:</div>
- <div>诊断费:{{zhenChaCostTotal}}</div>
- </div>
- <div class="listInfo">
- <div>治疗费:</div>
- <div>护理费:</div>
- <div>床位费:{{bedCostTotal}}</div>
- </div>
- <div class="listInfo" style="margin-bottom: 20px;">
- <div>麻醉费:</div>
- <div>材料费:{{materialCostTotal}}</div>
- <div>其他:{{otherCostTotal}}</div>
- </div>
- </div>
- </div>
- </template>
-
-
- <script>
- import BreadCrumb from '@/xt_pages/components/bread-crumb'
- import { getGatherDetailList } from '@/api/his/his_tools'
- import { uParseTime } from '@/utils/tools'
- const moment = require('moment')
- export default {
- components: {
- BreadCrumb
-
- },
- props: {
- patient_id: {
- type: Number,
- default: 0
- }
- },
-
- data() {
-
- return {
- detail_loading: false,
- tempArr: [],
- pos: 0,
- search_input: '',
-
- sameRowArr: [],
- keywords: '',
- tableData: [],
- tableList:[],
- chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
- item_type: '0',
- items: [
- { id: 1, name: '药品' },
- { id: 3, name: '耗材' },
- { id: 2, name: '项目' }
-
- ],
- list:[],
- his_patient:{},
- hisDepatment:[],
- chineseTraditionalMedicineCostTotal:0,
- checkCostTotal:0,
- laboratoryCostTotal:0,
- zhenChaCostTotal:0,
- bedCostTotal:0,
- materialCostTotal:0,
- otherCostTotal:0,
- }
- },
- methods: {
- searchAction(){
- this.getGatherDetailList()
- },
- changeDate() {
- this.getGatherDetailList()
- },
- changeItem() {
- this.getGatherDetailList()
- },
- getGatherDetailList() {
- let start_time = this.chargeDate[0]
- let end_time = this.chargeDate[1]
- let params = {
- patient_id:this.patient_id,
- start_time: start_time,
- end_time: end_time,
- type: this.item_type,
- keyword: this.keywords
- }
- getGatherDetailList(params).then(response=>{
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
- this.order = response.data.data.order
- this.patient = response.data.data.patient
- this.admin = response.data.data.admin_info
- this.his_hospital = response.data.data.his_hospital
- var order_info = response.data.data.order_info
- console.log(" 汇总order_info2332322323232323",order_info)
- if(order_info!=undefined&&order_info ==null){
- this.list = []
- return
- }
- this.his_patient = response.data.data.his_patient
- this.hisDepatment = response.data.data.hisDepatment
- this.list = []
- if(this.$store.getters.xt_user.org_id == 10215 || this.$store.getters.xt_user.org_id == 0){
- //获取所有项目类型进行去重
- let med_chrgitm_types = []
- for (let i = 0; i < order_info.length; i++) {
- med_chrgitm_types.push(order_info[i].med_chrgitm_type)
- }
- const obj = {}
- med_chrgitm_types = med_chrgitm_types.reduce((cur, next) => {
- obj[next] ? '' : obj[next] = true && cur.push(next)
- return cur
- }, []) // 设置cur默认类型为数组,并且初始值为空的数组
-
- let tempOrderInfo = []
- console.log("med_chrgitm_types3323232323232233",med_chrgitm_types)
- for (let i = 0; i < med_chrgitm_types.length; i++) {
- let obj = {
- total: 0,
- details: [],
- is_total:0,
- }
- let tempDetails = []
- for (let b = 0; b < order_info.length; b++) {
- if (med_chrgitm_types[i] == order_info[b].med_chrgitm_type) {
- tempDetails.push(order_info[b])
- }
- }
- obj.details = this.setNewData(tempDetails)
- this.list = []
- this.list = this.list.concat(obj.details)
- for(let i=0;i<this.list.length;i++){
- if(this.list[i].is_total == 1){
- this.list[i].index = "合计"
- }else{
- this.list[i].index = i+1
- }
-
- }
- }
- let newobj = {}
- newobj['total'] = this.order.medfee_sumamt
- newobj['is_total'] = 1
- this.list = []
- this.list.push(newobj)
- var new_arr = []
- if(this.keywords!=""){
- for(let i=0;i<this.list.length;i++){
- if(this.list[i].is_total == 2){
- if(this.list[i].name.indexOf(this.keywords)>-1){
- new_arr.push(this.list[i])
- }
- }
-
- }
- var new_arr_two = []
-
- for(let i=0;i<tempDetails.length;i++){
- if(tempDetails[i].advice_id >0){
- tempDetails[i].name = tempDetails[i].advice.advice_name
- }
- if(tempDetails[i].project_id > 0){
- if(tempDetails[i].type == 2 ){
- tempDetails[i].name = tempDetails[i].project.project_name
- }
- if(tempDetails[i].type == 3){
- tempDetails[i].name = tempDetails[i].good_info.good_name
- }
- }
- if(tempDetails[i].name.indexOf(this.keywords) > -1){
- new_arr_two.push(tempDetails[i])
- }
- }
- this.list = []
-
- this.list = new_arr
- obj.details = []
- obj.details = this.setNewData(new_arr_two)
-
- obj.total = this.getTotal(obj.details)
- obj.details.push({
- total: obj.total,
- is_total: 1,
- })
- for(let i=0;i<obj.details.length;i++){
- if(obj.details[i].is_total == 1){
- obj.details[i].index = "合计"
- }else{
- obj.details[i].index = i+1
- }
- }
- this.list = obj.details
- }
- }else{
- //获取所有项目类型进行去重
- let med_chrgitm_types = []
- if(order_info!=undefined && order_info.length > 0){
- for (let i = 0; i < order_info.length; i++) {
- med_chrgitm_types.push(order_info[i].med_chrgitm_type)
- }
- }
-
- const obj = {}
- med_chrgitm_types = med_chrgitm_types.reduce((cur, next) => {
- obj[next] ? '' : obj[next] = true && cur.push(next)
- return cur
- }, []) // 设置cur默认类型为数组,并且初始值为空的数组
- let tempOrderInfo = []
- console.log("med_chrgitm_type323223322323233223",med_chrgitm_types)
- for (let i = 0; i < med_chrgitm_types.length; i++) {
- let obj = {
- total: 0,
- details: []
- }
- let tempDetails = []
- for (let b = 0; b < order_info.length; b++) {
- if (med_chrgitm_types[i] == order_info[b].med_chrgitm_type) {
- tempDetails.push(order_info[b])
- }
- }
- console.log("tempDetails2332323232",tempDetails)
- obj.details = this.setNewData(tempDetails)
- console.log("2332233232322323",obj.details)
- obj.total = this.getTotal(obj.details)
-
- obj.details.push({
- total: obj.total,
- is_total: 1,
- })
- this.list = []
- this.list = this.list.concat(obj.details)
- for(let i=0;i<this.list.length;i++){
- if(this.list[i].is_total == 1){
- this.list[i].index = "合计"
- }else{
- this.list[i].index = i+1
- }
-
- }
- console.log("list2323223232323",this.list)
- var new_arr = []
- if(this.keywords!=""){
-
- for(let i=0;i<this.list.length;i++){
- if(this.list[i].is_total == 2){
- if(this.list[i].name.indexOf(this.keywords)>-1){
- new_arr.push(this.list[i])
- }
- }
-
- }
- var new_arr_two = []
- for(let i=0;i<tempDetails.length;i++){
- if(tempDetails[i].advice_id >0){
- tempDetails[i].name = tempDetails[i].advice.advice_name
- }
- if(tempDetails[i].project_id > 0){
- if(tempDetails[i].type == 2 ){
- tempDetails[i].name = tempDetails[i].project.project_name
- }
- if(tempDetails[i].type == 3){
- tempDetails[i].name = tempDetails[i].good_info.good_name
- }
- }
- if(tempDetails[i].name.indexOf(this.keywords) > -1){
- new_arr_two.push(tempDetails[i])
- }
- }
- this.list = []
-
-
- this.list = new_arr
- obj.details = []
- obj.details = this.setNewData(new_arr_two)
-
- obj.total = this.getTotal(obj.details)
- obj.details.push({
- total: obj.total,
- is_total: 1,
- })
- for(let i=0;i<obj.details.length;i++){
- if(obj.details[i].is_total == 1){
- obj.details[i].index = "合计"
- }else{
- obj.details[i].index = i+1
- }
- }
- console.log("obj23323232323232323232",obj.details)
- this.list = obj.details
- }
- }
- }
- }
- })
- },
- getAdviceName(id){
- var drug_name = ""
- for(let i= 0;i<this.tableData.length;i++){
- if(id == this.tableData[i].advice_id){
- drug_name = this.tableData[i].advice.advice_name
- }
- }
- return drug_name
- },
- getProjectName(id){
- var project_name = ""
- for(let i=0;i<this.tableData.length;i++){
- if(id == this.tableData[i].project_id){
- project_name = this.tableData[i].project.project.project_name
- }
- }
- return project_name
- },
- setNewData(details) {
- // console.log("detail23332323232322332332322323232332",details)
- let drug_ids = []
- let project_ids = []
-
- for (let i = 0; i < details.length; i++) {
- if (details[i].advice && details[i].advice.id > 0 && details[i].advice.prescription && details[i].advice.prescription.type == 1) { //药品
- let obj = {
- id: details[i].advice.drug_id,
- price: details[i].advice.price,
- record_date:details[i].advice.advice_date
- }
- drug_ids.push(obj)
- } else if (details[i].project && details[i].project.id > 0 && details[i].project.prescription && details[i].project.prescription.type == 2) { //项目
- let obj = {
- id: details[i].project.project_id,
- price: details[i].project.price,
- record_date:details[i].project.record_date
- }
- project_ids.push(obj)
-
- }
-
- }
- let new_drug_ids = this.unique(drug_ids)
- let new_project_ids = this.unique(project_ids)
- let list = []
-
- if (new_drug_ids.length > 0 && new_project_ids.length == 0) {
- for (let i = 0; i < new_drug_ids.length; i++) {
- let obj = {}
- let count = 0
- for (let a = 0; a < details.length; a++) {
- if (new_drug_ids[i].id == details[a].advice.drug_id && new_drug_ids[i].price == details[a].advice.price) {
- obj['name'] = details[a].advice.advice_name
- obj['spec'] = details[a].advice.drug.dose + details[a].advice.drug.dose_unit+"*" + details[a].advice.drug.min_number + details[a].advice.drug.min_unit+"/"+ details[a].advice.drug.max_unit
- obj['unit'] = details[a].advice.drug.min_unit
- obj['medicine_insurance_kind'] = this.getMedicineInsuranceType(details[a].chrgitm_lv)
- obj['med_chrgitm_type'] = this.getType(details[a].med_chrgitm_type)
- obj['price'] = parseFloat(details[a].pric)
- obj['is_total'] = 2
- obj['record_date'] = details[a].advice.record_date
- obj['chrgitm_lv'] = details[a].chrgitm_lv
- count = count + details[a].cnt
- }
- }
- obj['count'] = count
- list.push(obj)
-
- }
- }
- if (new_drug_ids.length == 0 && new_project_ids.length > 0) {
- for (let i = 0; i < new_project_ids.length; i++) {
- let obj = {}
- let count = 0
- for (let a = 0; a < details.length; a++) {
- if (new_project_ids[i].id == details[a].project.project_id && new_project_ids[i].price == details[a].project.price) {
- if( details[a].project.type == 2){
- obj['name'] = details[a].project.project.project_name
- obj['spec'] = details[a].project.project.project_name
- obj['unit'] = details[a].project.project.unit
- obj['record_date'] = details[a].project.record_date
-
-
-
- }else if(details[a].project.type == 3){
- obj['name'] = details[a].project.good_info.good_name
- obj['spec'] = details[a].project.good_info.specification_name
- obj['unit'] = details[a].project.good_info.packing_unit
- obj['record_date'] = details[a].project.record_date
-
- }
- obj['medicine_insurance_kind'] = this.getMedicineInsuranceType(details[a].chrgitm_lv)
- obj['med_chrgitm_type'] = this.getType(details[a].med_chrgitm_type)
- obj['price'] = parseFloat(details[a].pric)
- obj['chrgitm_lv'] = details[a].chrgitm_lv
- obj['is_total'] = 2
-
- count = count + details[a].cnt
- }
- }
- obj['count'] = count
- list.push(obj)
-
- }
- }
-
- if (new_drug_ids.length > 0 && new_project_ids.length > 0) {
- for (let i = 0; i < new_drug_ids.length; i++) {
- let obj = {}
- let count = 0
- for (let a = 0; a < details.length; a++) {
- if (new_drug_ids[i].id == details[a].advice.drug_id && new_drug_ids[i].price == details[a].advice.price) {
- obj['name'] = details[a].advice.advice_name
- obj['spec'] = details[a].advice.drug.dose + details[a].advice.drug.dose_unit+"*" + details[a].advice.drug.min_number + details[a].advice.drug.min_unit+"/"+ details[a].advice.drug.max_unit
- obj['unit'] = details[a].advice.drug.min_unit
- obj['medicine_insurance_kind'] = this.getMedicineInsuranceType(details[a].chrgitm_lv)
- obj['med_chrgitm_type'] = this.getType(details[a].med_chrgitm_type)
- obj['price'] = parseFloat(details[a].pric)
- obj['is_total'] = 2
- obj['record_date'] = details[a].advice.record_date
- obj['chrgitm_lv'] = details[a].chrgitm_lv
- count = count + details[a].cnt
- }
- }
- obj['count'] = count
- list.push(obj)
-
- }
-
- for (let i = 0; i < new_project_ids.length; i++) {
- let obj = {}
- let count = 0
- for (let a = 0; a < details.length; a++) {
- if (new_project_ids[i].id == details[a].project.project_id && new_project_ids[i].price == details[a].project.price) {
- if( details[a].project.type == 2){
- obj['name'] = details[a].project.project.project_name
- obj['spec'] = ''
- obj['unit'] = details[a].project.project.unit
-
- }else if(details[a].project.type == 3){
- obj['name'] = details[a].project.good_info.good_name
- obj['spec'] = ''
- obj['unit'] = details[a].project.good_info.packing_unit
- }
- obj['medicine_insurance_kind'] = this.getMedicineInsuranceType(details[a].chrgitm_lv)
- obj['med_chrgitm_type'] = this.getType(details[a].med_chrgitm_type)
- obj['price'] = parseFloat(details[a].pric)
- obj['is_total'] = 2
- obj['record_date'] = details[a].project.record_date
- obj['chrgitm_lv'] = details[a].chrgitm_lv
- count = count + details[a].cnt
- }
- }
- obj['count'] = count
- list.push(obj)
-
- }
- }
-
-
-
- return list
- },
-
- getMedicineInsuranceType(type) {
- switch (type) {
- case "01":
- return '甲类'
- break
- case "02":
- return '乙类'
-
- break
- case "03":
- return '自费'
- break
-
- }
-
- },
- getType(med_chrgitm_type){
- switch (med_chrgitm_type) {
- case '01':
- return '床位费'
- break
- case '02':
- return '诊察费'
-
- break
- case '03':
- return '检查费'
-
- break
- case '04':
- return '化验费'
- break
- case '05':
- return '治疗费'
-
- break
- case '06':
- return '手术费'
-
- break
- case '07':
- return '护理费'
-
- break
- case '08':
- return '材料费'
-
- break
- case '09':
- return '西药费'
-
- break
- case '10':
- return '中药饮片费'
-
- break
- case '11':
- return '中成药费'
-
- break
- case '12':
- return '一般诊疗费'
-
- break
- case '13':
- return '挂号费'
-
- break
- case '14':
- return '其他费'
-
- break
-
- }
- },
- unique(array) {
- // res用来存储结果
- var res = []
- for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
- for (var j = 0, resLen = res.length; j < resLen; j++) {
- if (array[i].id === res[j].id && array[i].price === res[j].price) {
- break
- }
- }
- // 如果array[i]是唯一的,那么执行完循环,j等于resLen
- if (j === resLen) {
- res.push(array[i])
- }
- }
- return res
- },
- getTotal:function(items){
- let total = 0
- for(let i = 0; i < items.length; i++){
- total = Number(total) + Number((parseFloat(items[i].count) * parseFloat(items[i].price)).toFixed(2))
- }
- return total.toFixed(2)
- },
- getTimes(time) {
- if(time < 0){
- return ""
- }else{
- return uParseTime(time, '{y}-{m}-{d}')
- }
- },
- toPrint(){
- this.$router.push({path:"/hisTool/gatherPrint?patient_id="+this.patient_id+"&start_time="+this.chargeDate[0]+"&end_time="+this.chargeDate[1]+"&type="+this.item_type +"&keyword="+this.keywords})
- },
- toPrintInvoice(){
- this.$router.push({path:"/hisTool/gatherPrintInvoice?patient_id="+this.patient_id+"&start_time="+this.chargeDate[0]+"&end_time="+this.chargeDate[1]+"&type="+this.item_type +"&keyword="+this.keywords})
- }
- },
- created() {
- this.getGatherDetailList()
-
- },
- watch:{
- "patient_id":function(){
- this.patient_id = this.patient_id
- this.getGatherDetailList()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .listInfo{
- display: flex;
- justify-content: space-around;
- div{
- width: 200px;
- }
- }
- </style>
|