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

settle.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. <template>
  2. <div>
  3. <div style="display: flex;justify-content: space-between;margin-bottom:10px;">
  4. <div>
  5. <!--<el-button size="small" style="margin-left:10px;" class="filter-item" type="primary"-->
  6. <!--@click="Action">-->
  7. <!--导出-->
  8. <!--</el-button>-->
  9. <el-input size="small" style="width:150px;" v-model="keywords" @input="searchAction"
  10. @keyup.enter.native='searchAction'
  11. class="filter-item"/>
  12. <el-select size="small" v-model="item_type" placeholder="请选择"
  13. style="width:150px;margin-left:10px;" @change="changeItem">
  14. <el-option
  15. label="全部"
  16. value="0">
  17. </el-option>
  18. <el-option
  19. v-for="item,index in items"
  20. :key="index"
  21. :label="item.name"
  22. :value="item.id">
  23. </el-option>
  24. </el-select>
  25. <el-date-picker
  26. v-model="chargeDate"
  27. type="daterange"
  28. value-format="yyyy-MM-dd"
  29. range-separator="至"
  30. start-placeholder="开始日期"
  31. @change="changeDate"
  32. end-placeholder="结束日期">
  33. </el-date-picker>
  34. <!--<el-radio v-model="radio" label="1">明细</el-radio>-->
  35. <!--<el-radio v-model="radio" label="2">汇总</el-radio>-->
  36. </div>
  37. <div>
  38. <!-- <el-popover
  39. placement="bottom"
  40. width="210"
  41. trigger="click">
  42. <el-button size="small" ref="button_two" @click="open(1)">打印清单</el-button>
  43. <el-button size="small" ref="button_six" @click="open(2)">打印汇总</el-button>
  44. <el-button slot="reference" style="margin:0 10px;" type="primary" size="small">打印</el-button>
  45. </el-popover> -->
  46. <el-button size="small" type="primary" @click="export_detail">报表下载</el-button>
  47. </div>
  48. </div>
  49. <el-table :data="tableData" border :row-style="{ color: '#303133' }" ref="report-table"
  50. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  51. show-summary
  52. v-loading="settle_loading"
  53. max-height="600"
  54. :span-method="merge"
  55. :summary-method="getTotal"
  56. highlight-current-row>
  57. <el-table-column align="center" prop="name" label="患者名字">
  58. <template slot-scope="scope">{{ scope.row.other_name }}</template>
  59. </el-table-column>
  60. <el-table-column align="center" prop="item_name" label="结算日期">
  61. <template slot-scope="scope">
  62. {{scope.row.setl_time?scope.row.setl_time.split(" ")[0]:getTimes(scope.row.settle_accounts_date)}}
  63. </template>
  64. </el-table-column>
  65. <el-table-column align="center" prop="item_name" label="结算类型">
  66. <template slot-scope="scope">
  67. <div v-if="scope.row.is_medicine_insurance == 0">自费</div>
  68. <div v-if="scope.row.is_medicine_insurance == 1">医保</div>
  69. </template>
  70. </el-table-column>
  71. <el-table-column align="center" prop="item_name" label="处方类型">
  72. <template slot-scope="scope">
  73. <div v-if="scope.row.med_type == '14'">门诊特殊病</div>
  74. <div v-if="scope.row.med_type == '11'">普通门诊</div>
  75. </template>
  76. </el-table-column>
  77. <el-table-column align="center" prop="item_name" label="医疗费总额">
  78. <template slot-scope="scope">{{scope.row.medfee_sumamt}}</template>
  79. </el-table-column>
  80. <el-table-column align="center" prop="item_name" label="基金支付金额">
  81. <template slot-scope="scope">{{scope.row.fund_pay_sumamt}}</template>
  82. </el-table-column>
  83. <el-table-column align="center" prop="item_name" label="个人账户支付金额">
  84. <template slot-scope="scope">{{scope.row.acct_pay}}</template>
  85. </el-table-column>
  86. <el-table-column align="center" prop="item_name" label="个人支付金额">
  87. <template slot-scope="scope">{{scope.row.psn_cash_pay}}</template>
  88. </el-table-column>
  89. <el-table-column align="center" prop="total" label="费用总额">
  90. <template slot-scope="scope">
  91. <div>{{scope.row.total.toFixed(2)}}</div>
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. </div>
  96. </template>
  97. <script>
  98. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  99. import { GetSummarySettle } from '@/api/his/his'
  100. import { uParseTime } from '@/utils/tools'
  101. // import NewStatementPrint from './newStatementPrint'
  102. const moment = require('moment')
  103. export default {
  104. components: {
  105. BreadCrumb
  106. },
  107. data() {
  108. return {
  109. settle_loading:false,
  110. crumbs: [],
  111. tempArr: [],
  112. sameRowArr: [],
  113. tableData: [],
  114. chargeDate: [moment(new Date()).add('year', 0).format('YYYY-MM-DD'), moment(new Date()).add('year', 0).format('YYYY-MM-DD')],
  115. item_type: '0',
  116. items: [
  117. { id: 1, name: '医保' },
  118. { id: 2, name: '自费' },
  119. { id: 3, name: '门诊特殊病' },
  120. { id: 4, name: '普通门诊' }
  121. ]
  122. }
  123. },
  124. methods: {
  125. getTimes(time) {
  126. return uParseTime(time, '{y}-{m}-{d}')
  127. },
  128. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  129. if (columnIndex === 0) {
  130. if (rowIndex % 2 === 0) {
  131. return {
  132. rowspan: 2,
  133. colspan: 1
  134. }
  135. } else {
  136. return {
  137. rowspan: 0,
  138. colspan: 0
  139. }
  140. }
  141. }
  142. },
  143. unique(arr) {
  144. const res = new Map()
  145. return arr.filter((arr) => !res.has(arr.id) && res.set(arr.id, 1))
  146. },
  147. changeDate() {
  148. // console.log(this.chargeDate)
  149. this.getSummarySettleList()
  150. },
  151. changeItem() {
  152. this.getSummarySettleList()
  153. },
  154. searchAction() {
  155. this.item_type = '0'
  156. this.getSummarySettleList()
  157. },
  158. getSummarySettleList() {
  159. let start_time = this.chargeDate[0]
  160. let end_time = this.chargeDate[1]
  161. let params = {
  162. start_time: start_time,
  163. end_time: end_time,
  164. type: this.item_type,
  165. keyword: this.keywords
  166. }
  167. this.settle_loading = true
  168. GetSummarySettle(params).then(response => {
  169. if (response.data.state == 0) {
  170. this.settle_loading = false
  171. this.$message.error(response.data.msg)
  172. return false
  173. } else {
  174. this.settle_loading = false
  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 = order.other_name
  294. let time = ''
  295. let balance_accounts = ""
  296. let med_type = ""
  297. let medfee_sumamt = ""
  298. let fund_pay_sumamt = ""
  299. let acct_pay = ""
  300. let psn_cash_pay = ""
  301. let total = ""
  302. if(order.setl_time.length == 0){
  303. time = this.getTimes(order.settle_accounts_date)
  304. }else {
  305. time = order.setl_time.split(" ")[0]
  306. }
  307. if (order.is_medicine_insurance == 0) {
  308. balance_accounts = '自费'
  309. }
  310. if (order.is_medicine_insurance == 1) {
  311. balance_accounts = '医保'
  312. }
  313. if (order.med_type == '14') {
  314. med_type = '门诊特殊病'
  315. }
  316. if (order.med_type == '11') {
  317. med_type = '普通门诊'
  318. }
  319. medfee_sumamt = order.medfee_sumamt
  320. fund_pay_sumamt = order.fund_pay_sumamt
  321. acct_pay = order.acct_pay
  322. psn_cash_pay = order.psn_cash_pay
  323. total = order.total
  324. let obj = {
  325. '患者姓名': name,
  326. '结算日期': time,
  327. '结算类型': balance_accounts,
  328. '处方类型': med_type,
  329. '医疗费总额': medfee_sumamt,
  330. '基金支付金额': fund_pay_sumamt,
  331. '个人账户支付金额': acct_pay,
  332. '个人支付基金': psn_cash_pay,
  333. '费用总额':total,
  334. }
  335. list.push(obj)
  336. }
  337. import('@/vendor/Export2Excel').then(excel => {
  338. const tHeader = [ '患者姓名', '结算日期', '结算类型', '处方类型', '医疗费总额', '基金支付金额', '个人账户支付金额', '个人支付基金', '费用总额']
  339. const filterVal = [ '患者姓名', '结算日期', '结算类型', '处方类型', '医疗费总额', '基金支付金额', '个人账户支付金额', '个人支付基金', '费用总额']
  340. const data = this.formatJson(filterVal, list)
  341. excel.export_json_to_excel1({
  342. header: tHeader,
  343. data,
  344. filename: '结算明细',
  345. ref:this.$refs['report-table'].$el
  346. })
  347. })
  348. }, formatJson(filterVal, jsonData) {
  349. return jsonData.map(v => filterVal.map(j => v[j]))
  350. }
  351. },
  352. created() {
  353. this.getSummarySettleList()
  354. }
  355. }
  356. </script>