Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

settle.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <div class="main-contain outpatientChargesManagement">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <div class="app-container">
  7. <div style="display: flex;justify-content: space-between;margin-bottom:10px;">
  8. <div>
  9. <!--<el-button size="small" style="margin-left:10px;" class="filter-item" type="primary"-->
  10. <!--@click="Action">-->
  11. <!--导出-->
  12. <!--</el-button>-->
  13. <el-input size="small" style="width:150px;" v-model="keywords" @input="searchAction"
  14. @keyup.enter.native='searchAction'
  15. class="filter-item"/>
  16. <el-select size="small" v-model="item_type" placeholder="请选择"
  17. style="width:150px;margin-left:10px;" @change="changeItem">
  18. <el-option
  19. label="全部"
  20. value="0">
  21. </el-option>
  22. <el-option
  23. v-for="item,index in items"
  24. :key="index"
  25. :label="item.name"
  26. :value="item.id">
  27. </el-option>
  28. </el-select>
  29. <el-date-picker
  30. v-model="chargeDate"
  31. type="daterange"
  32. value-format="yyyy-MM-dd"
  33. range-separator="至"
  34. start-placeholder="开始日期"
  35. @change="changeDate"
  36. end-placeholder="结束日期">
  37. </el-date-picker>
  38. <!--<el-radio v-model="radio" label="1">明细</el-radio>-->
  39. <!--<el-radio v-model="radio" label="2">汇总</el-radio>-->
  40. </div>
  41. <div>
  42. <!-- <el-popover
  43. placement="bottom"
  44. width="210"
  45. trigger="click">
  46. <el-button size="small" ref="button_two" @click="open(1)">打印清单</el-button>
  47. <el-button size="small" ref="button_six" @click="open(2)">打印汇总</el-button>
  48. <el-button slot="reference" style="margin:0 10px;" type="primary" size="small">打印</el-button>
  49. </el-popover> -->
  50. <el-button size="small" type="primary" @click="export_detail">报表下载</el-button>
  51. </div>
  52. </div>
  53. <el-table :data="tableData" border :row-style="{ color: '#303133' }"
  54. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  55. show-summary
  56. max-height="600"
  57. :span-method="merge"
  58. :summary-method="getTotal"
  59. highlight-current-row>
  60. <el-table-column align="center" prop="name" label="患者名字">
  61. <template slot-scope="scope">{{ scope.row.other_name }}</template>
  62. </el-table-column>
  63. <el-table-column align="center" prop="item_name" label="结算日期">
  64. <template slot-scope="scope">
  65. {{scope.row.setl_time?scope.row.setl_time:getTimes(scope.row.settle_accounts_date)}}
  66. </template>
  67. </el-table-column>
  68. <el-table-column align="center" prop="item_name" label="结算类型">
  69. <template slot-scope="scope">
  70. <div v-if="scope.row.is_medicine_insurance == 0">自费</div>
  71. <div v-if="scope.row.is_medicine_insurance == 1">医保</div>
  72. </template>
  73. </el-table-column>
  74. <el-table-column align="center" prop="item_name" label="处方类型">
  75. <template slot-scope="scope">
  76. <div v-if="scope.row.med_type == '14'">门诊特殊病</div>
  77. <div v-if="scope.row.med_type == '11'">普通门诊</div>
  78. </template>
  79. </el-table-column>
  80. <el-table-column align="center" prop="item_name" label="医疗费总额">
  81. <template slot-scope="scope">{{scope.row.medfee_sumamt}}</template>
  82. </el-table-column>
  83. <el-table-column align="center" prop="item_name" label="基金支付金额">
  84. <template slot-scope="scope">{{scope.row.fund_pay_sumamt}}</template>
  85. </el-table-column>
  86. <el-table-column align="center" prop="item_name" label="个人账户支付金额">
  87. <template slot-scope="scope">{{scope.row.acct_pay}}</template>
  88. </el-table-column>
  89. <el-table-column align="center" prop="item_name" label="个人支付金额">
  90. <template slot-scope="scope">{{scope.row.psn_cash_pay}}</template>
  91. </el-table-column>
  92. <el-table-column align="center" prop="total" label="费用总额">
  93. <template slot-scope="scope">
  94. <div>{{scope.row.total.toFixed(2)}}</div>
  95. </template>
  96. </el-table-column>
  97. </el-table>
  98. </div>
  99. </div>
  100. </template>
  101. <script>
  102. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  103. import { GetSummarySettle } from '@/api/his/his'
  104. import { uParseTime } from '@/utils/tools'
  105. // import NewStatementPrint from './newStatementPrint'
  106. const moment = require('moment')
  107. export default {
  108. components: {
  109. BreadCrumb
  110. },
  111. data() {
  112. return {
  113. crumbs: [],
  114. tempArr: [],
  115. sameRowArr: [],
  116. tableData: [],
  117. chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
  118. item_type: '0',
  119. items: [
  120. { id: 1, name: '医保' },
  121. { id: 2, name: '自费' },
  122. { id: 3, name: '门诊特殊病' },
  123. { id: 4, name: '普通门诊' }
  124. ]
  125. }
  126. },
  127. methods: {
  128. getTimes(time) {
  129. return uParseTime(time, '{y}-{m}-{d}')
  130. },
  131. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  132. if (columnIndex === 0) {
  133. if (rowIndex % 2 === 0) {
  134. return {
  135. rowspan: 2,
  136. colspan: 1
  137. }
  138. } else {
  139. return {
  140. rowspan: 0,
  141. colspan: 0
  142. }
  143. }
  144. }
  145. },
  146. unique(arr) {
  147. const res = new Map()
  148. return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1))
  149. },
  150. changeDate() {
  151. // console.log(this.chargeDate)
  152. this.getSummarySettleList()
  153. },
  154. changeItem() {
  155. this.getSummarySettleList()
  156. },
  157. searchAction() {
  158. this.item_type = '0'
  159. this.getSummarySettleList()
  160. },
  161. getSummarySettleList() {
  162. let start_time = this.chargeDate[0]
  163. let end_time = this.chargeDate[1]
  164. let params = {
  165. start_time: start_time,
  166. end_time: end_time,
  167. type: this.item_type,
  168. keyword: this.keywords
  169. }
  170. GetSummarySettle(params).then(response => {
  171. if (response.data.state == 0) {
  172. this.$message.error(response.data.msg)
  173. return false
  174. } else {
  175. this.tableData = []
  176. let data = response.data.data.patients
  177. for (let i = 0; i < data.length; i++) {
  178. let total = 0
  179. for (let b = 0; b < data[i].orders.length; b++) {
  180. let order = data[i].orders[b]
  181. order['other_name'] = data[i].name
  182. total = parseFloat((parseFloat(total.toString()) + parseFloat(data[i].orders[b].medfee_sumamt.toString())).toFixed(2).toString())
  183. }
  184. data[i]['total'] = total
  185. }
  186. console.log(data)
  187. for (let i = 0; i < data.length; i++) {
  188. for (let b = 0; b < data[i].orders.length; b++) {
  189. let order = data[i].orders[b]
  190. order['total'] = data[i].total
  191. this.tableData.push(order)
  192. }
  193. }
  194. console.log(this.tableData)
  195. this.handleSpanTempArr()
  196. }
  197. })
  198. }, uniqueProjectAndAdvice(array) {
  199. // res用来存储结果
  200. var res = []
  201. for (var i = 0, arrayLen = array.length; i < arrayLen; i++) {
  202. for (var j = 0, resLen = res.length; j < resLen; j++) {
  203. if (array[i].item_id === res[j].item_id && array[i].price === res[j].price) {
  204. break
  205. }
  206. }
  207. // 如果array[i]是唯一的,那么执行完循环,j等于resLen
  208. if (j === resLen) {
  209. res.push(array[i])
  210. }
  211. }
  212. return res
  213. }, sort(arr) {
  214. for (var i = 0; i < arr.length - 1; i++) {
  215. for (var j = 0; j < arr.length - i - 1; j++) {
  216. if (arr[j].patient_id > arr[j + 1].patient_id) {// 相邻元素两两对比
  217. var hand = arr[j]
  218. arr[j] = arr[j + 1]
  219. arr[j + 1] = hand
  220. }
  221. }
  222. }
  223. return arr
  224. }, handleSpanTempArr() {
  225. this.tempArr = []
  226. for (let i = 0; i < this.tableData.length; i++) {
  227. if (i === 0) {
  228. this.tempArr.push(1)
  229. this.pos = 0
  230. } else {
  231. // 判断当前元素与上一个元素是否相同
  232. if (this.tableData[i].patient_id === this.tableData[i - 1].patient_id) {
  233. this.tempArr[this.pos] += 1
  234. this.tempArr.push(0)
  235. } else {
  236. this.tempArr.push(1)
  237. this.pos = i
  238. }
  239. }
  240. }
  241. let sameRowArr = [], sIdx = 0
  242. this.tableData.forEach((item, index) => {
  243. item.index = index
  244. if (index === 0) {
  245. sameRowArr.push([index])
  246. } else {
  247. if (item.patient_id === this.tableData[index - 1].patient_id) {
  248. sameRowArr[sIdx].push(index)
  249. } else {
  250. sIdx = sIdx + 1
  251. sameRowArr.push([index])
  252. }
  253. }
  254. })
  255. this.sameRowArr = sameRowArr
  256. }, merge({ row, column, rowIndex, columnIndex }) {
  257. if (columnIndex === 0 || columnIndex === 8) {
  258. const _row = this.tempArr[rowIndex]
  259. const _col = _row > 0 ? 1 : 0
  260. return {
  261. rowspan: _row,
  262. colspan: _col
  263. }
  264. }
  265. }, getTotal(param) {
  266. const { columns, data } = param
  267. const sums = []
  268. columns.forEach((column, index) => {
  269. if (index === 0) {
  270. sums[index] = '合计'
  271. return
  272. }
  273. const values = data.map(item => Number(item[column.property]))
  274. if (column.property === 'total') {
  275. sums[index] = values.reduce((prev, curr) => {
  276. const value = Number(curr)
  277. if (!isNaN(value)) {
  278. return prev + curr
  279. } else {
  280. return prev
  281. }
  282. }, 0)
  283. sums[index] = sums[index].toFixed(2)
  284. } else {
  285. sums[index] = '--'
  286. }
  287. })
  288. return sums
  289. }, export_detail() {
  290. let list = []
  291. for (let i = 0; i < this.tableData.length; i++) {
  292. let order = this.tableData[i]
  293. let name = ''
  294. let time = ''
  295. let balance_accounts = ""
  296. let med_type = ""
  297. if (order.is_medicine_insurance == 0) {
  298. balance_accounts = '自费'
  299. }
  300. if (order.is_medicine_insurance == 1) {
  301. balance_accounts = '医保'
  302. }
  303. if (order.med_type == '14') {
  304. med_type = '门诊特殊病'
  305. }
  306. if (order.med_type == '11') {
  307. med_type = '普通门诊'
  308. }
  309. let number = ''
  310. let department = ''
  311. let doctor_name = ''
  312. let order_status = ''
  313. let charge_name = ''
  314. let insutypeName = ''
  315. if (order.patient != null && order.patient.name.length > 0) {
  316. name = order.patient.name
  317. }
  318. if (order.p_info != null && order.p_info.department != null && order.p_info.department.name.length > 0) {
  319. department = order.p_info.department.name
  320. }
  321. if (order.p_info != null && order.p_info.doctor.length > 0) {
  322. doctor_name = order.p_info.doctor
  323. }
  324. if (order.creator != null) {
  325. charge_name = this.getName(order.creator)
  326. }
  327. if (order.insutype == '390') {
  328. insutypeName = '城乡居民基本医疗保险'
  329. } else if (order.insutype == '310') {
  330. insutypeName = '职工基本医疗保险'
  331. }
  332. if (order.order_status == 1) {
  333. order_status = '待结算'
  334. }
  335. if (order.order_status == 2) {
  336. order_status = '已结算'
  337. }
  338. if (order.order_status == 3) {
  339. order_status = '已退费'
  340. }
  341. if (order.settle_type == 2) {
  342. time = this.getTimes(order.settle_start_time)
  343. } else {
  344. time = this.getTimes(order.settle_accounts_date)
  345. }
  346. var hifmi_pay = 0.00
  347. if (order.setl_detail.length > 0) {
  348. var jsonObj = JSON.parse(order.setl_detail)
  349. for (let i = 0; i < jsonObj.length; i++) {
  350. if (order.insutype == '310') {
  351. if (jsonObj[i].fund_pay_type == '310300') {
  352. hifmi_pay = jsonObj[i].fund_payamt
  353. }
  354. } else if (order.insutype == '390') {
  355. if (order.fund_pay_type == '390200') {
  356. hifmi_pay = jsonObj[i].fund_payamt
  357. }
  358. }
  359. }
  360. }
  361. var hifmi_pay = 0.00
  362. if (order.setl_detail.length > 0) {
  363. var jsonObj = JSON.parse(order.setl_detail)
  364. for (let i = 0; i < jsonObj.length; i++) {
  365. if (order.insutype == '310') {
  366. if (jsonObj[i].fund_pay_type == '310300') {
  367. hifmi_pay = jsonObj[i].fund_payamt
  368. }
  369. }
  370. if (order.insutype == '390') {
  371. if (jsonObj[i].fund_pay_type == '390200') {
  372. hifmi_pay = jsonObj[i].fund_payamt
  373. }
  374. }
  375. }
  376. }
  377. let obj = {
  378. '就诊号': order.mdtrt_id,
  379. '患者姓名': name,
  380. '开处时间': time,
  381. '险种类型': insutypeName,
  382. '应收金额': order.medfee_sumamt,
  383. '实收金额': order.medfee_sumamt,
  384. '医保统筹金额': order.hifp_pay,
  385. '大额基金金额': order.hifob_pay,
  386. '大病基金金额': hifmi_pay,
  387. '补充保险基金金额': order.hifes_pay,
  388. '医疗救助基金金额': order.maf_pay,
  389. '公务员基金': order.cvlserv_pay,
  390. '个人支付基金': order.psn_cash_pay,
  391. '个人账户支付金额': order.acct_pay,
  392. '科室': department,
  393. '医生姓名': doctor_name,
  394. '收费类别': balance_accounts,
  395. '收费者姓名': charge_name,
  396. '总金额': order.medfee_sumamt,
  397. '现金支付': '',
  398. '账户支付': '',
  399. '支付宝支付': '',
  400. '微信支付': '',
  401. '其他支付': '',
  402. '收费时间': order.setl_time,
  403. '收费状态': order_status,
  404. '退费日期': ''
  405. }
  406. list.push(obj)
  407. }
  408. import('@/vendor/Export2Excel').then(excel => {
  409. const tHeader = ['就诊号', '患者姓名', '开处时间', '险种类型', '应收金额', '实收金额', '医保统筹金额', '大额基金金额', '大病基金金额', '补充保险基金金额', '医疗救助基金金额', '公务员基金', '个人支付基金', '个人账户支付金额', '科室', '医生姓名', '收费类别', '收费者姓名', '总金额', '现金支付', '账户支付', '支付宝支付', '微信支付', '其他支付', '收费时间', '收费状态', '退费日期']
  410. const filterVal = ['就诊号', '患者姓名', '开处时间', '险种类型', '应收金额', '实收金额', '医保统筹金额', '大额基金金额', '大病基金金额', '补充保险基金金额', '医疗救助基金金额', '公务员基金', '个人支付基金', '个人账户支付金额', '科室', '医生姓名', '收费类别', '收费者姓名', '总金额', '现金支付', '账户支付', '支付宝支付', '微信支付', '其他支付', '收费时间', '收费状态', '退费日期']
  411. const data = this.formatJson(filterVal, list)
  412. excel.export_json_to_excel({
  413. header: tHeader,
  414. data,
  415. filename: '消费明细'
  416. })
  417. })
  418. }, formatJson(filterVal, jsonData) {
  419. return jsonData.map(v => filterVal.map(j => v[j]))
  420. }
  421. },
  422. created() {
  423. this.getSummarySettleList()
  424. }
  425. }
  426. </script>