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

all_ktv.vue 22KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688
  1. <template>
  2. <div>
  3. <el-row :gutter="25">
  4. <el-col :span="5">
  5. <div class="block">
  6. <span>查询时间:</span>
  7. <el-select size="small" v-model="time_type" placeholder="请选择"
  8. style="width:150px;margin-left:10px;" @change="changeItem">
  9. <el-option
  10. v-for="item,index in times"
  11. :key="index"
  12. :label="item.label"
  13. :value="item.value">
  14. </el-option>
  15. </el-select>
  16. </div>
  17. </el-col>
  18. <el-col :span="8">
  19. <div>
  20. <el-date-picker
  21. style="width: 200px"
  22. v-model="start_time"
  23. format="yyyy-MM-dd"
  24. value-format="yyyy-MM-dd"
  25. type="date"
  26. placeholder="选择日期">
  27. </el-date-picker>
  28. <span>-</span>
  29. <el-date-picker
  30. style="width: 200px"
  31. v-model="end_time"
  32. format="yyyy-MM-dd"
  33. value-format="yyyy-MM-dd"
  34. type="date"
  35. placeholder="选择日期">
  36. </el-date-picker>
  37. </div>
  38. </el-col>
  39. <el-col :span="3">
  40. <el-button type="primary" @click="getData()">查询</el-button>
  41. </el-col>
  42. </el-row>
  43. <div class="cell clearfix" style="margin: 20px; font-weight: bold;">
  44. <p class="chartTitle">统计图</p>
  45. </div>
  46. <div class="echart" id="mychart" :style={width:width,height:height}></div>
  47. <div style="width: 80%;margin: auto;">
  48. <el-table
  49. :data="tableData"
  50. border
  51. :header-cell-style="{
  52. backgroundColor: 'rgb(245, 247, 250)',
  53. color: '#606266'
  54. }"
  55. style="width: 100%;">
  56. <el-table-column
  57. prop="name"
  58. align="center"
  59. label="KTV"
  60. >
  61. </el-table-column>
  62. <el-table-column
  63. prop="count"
  64. align="center"
  65. label="人数"
  66. >
  67. </el-table-column>
  68. <el-table-column
  69. prop="address"
  70. align="center"
  71. label="操作">
  72. <template slot-scope="scope">
  73. <el-button @click="handleClick(scope.row)" style="font-size:16px;"
  74. type="text">查看详情
  75. </el-button>
  76. </template>
  77. </el-table-column>
  78. </el-table>
  79. </div>
  80. <el-dialog
  81. width="1000px" class="registerDialog" :visible.sync="detailVisibility"
  82. :close-on-click-modal="isClose"
  83. :close-on-press-escape="isClose"
  84. >
  85. <el-row :gutter="25">
  86. <el-col :span="5">
  87. <div class="block">
  88. <span>查询时间:</span>
  89. <el-select size="small" v-model="time_type_two" placeholder="请选择"
  90. style="width:100px;margin-left:5px;" @change="changeItemTwo">
  91. <el-option
  92. v-for="item,index in times"
  93. :key="index"
  94. :label="item.label"
  95. :value="item.value">
  96. </el-option>
  97. </el-select>
  98. </div>
  99. </el-col>
  100. <el-col :span="10">
  101. <div>
  102. <el-date-picker
  103. style="width: 120px"
  104. v-model="start_time_one"
  105. format="yyyy-MM-dd"
  106. value-format="yyyy-MM-dd"
  107. type="date"
  108. placeholder="选择日期">
  109. </el-date-picker>
  110. <span>-</span>
  111. <el-date-picker
  112. style="width: 120px"
  113. v-model="end_time_one"
  114. format="yyyy-MM-dd"
  115. value-format="yyyy-MM-dd"
  116. type="date"
  117. placeholder="选择日期">
  118. </el-date-picker>
  119. </div>
  120. </el-col>
  121. <el-col :span="4">
  122. <div>
  123. <el-select size="small" v-model="statistics_type" placeholder="请选择"
  124. style="width:100px;margin-left:5px;">
  125. <el-option
  126. v-for="item,index in statistics_types"
  127. :key="index"
  128. :label="item.label"
  129. :value="item.value">
  130. </el-option>
  131. </el-select>
  132. </div>
  133. </el-col>
  134. <!-- <el-col :span="4">-->
  135. <!-- <div>-->
  136. <!-- <el-select size="small" v-model="sort_type" placeholder="请选择"-->
  137. <!-- style="width:100px;margin-left:5px;">-->
  138. <!-- <el-option-->
  139. <!-- v-for="item,index in sort_types"-->
  140. <!-- :key="index"-->
  141. <!-- :label="item.label"-->
  142. <!-- :value="item.value">-->
  143. <!-- </el-option>-->
  144. <!-- </el-select>-->
  145. <!-- </div>-->
  146. <!-- </el-col>-->
  147. <el-col :span="4">
  148. <div >
  149. <el-input v-model="keyword" placeholder="请输入患者姓名或透析号"></el-input>
  150. </div>
  151. </el-col>
  152. <el-col :span="2">
  153. <div>
  154. <el-button @click="getDataTwo()">查询</el-button>
  155. </div>
  156. </el-col>
  157. <el-col :span="2">
  158. <div>
  159. <el-button @click="exportAction()">导出</el-button>
  160. </div>
  161. </el-col>
  162. <!-- <el-col :span="2">-->
  163. <!-- <div>-->
  164. <!-- <el-button @click="getDataTwo()">打印</el-button>-->
  165. <!-- </div>-->
  166. <!-- </el-col>-->
  167. </el-row>
  168. <el-table
  169. :data="patientTableData"
  170. border
  171. ref="table"
  172. max-height="500px"
  173. style="width: 100%">
  174. <el-table-column
  175. prop="dialysis_no"
  176. align="center"
  177. label="透析号"
  178. >
  179. </el-table-column>
  180. <el-table-column
  181. prop="name"
  182. label="患者姓名"
  183. >
  184. </el-table-column>
  185. <el-table-column
  186. prop="date"
  187. label="检查日期"
  188. >
  189. </el-table-column>
  190. <el-table-column
  191. prop="inspect_value"
  192. label="结果"
  193. >
  194. <template slot-scope="scope">{{ parseFloat(scope.row.inspect_value).toFixed(1)}}</template>
  195. </el-table-column>
  196. </el-table>
  197. <div slot="footer" class="dialog-footer">
  198. <el-button @click="detailVisibility = false">取消</el-button>
  199. <el-button type="primary" @click="detailVisibility = false">确定</el-button>
  200. </div>
  201. </el-dialog>
  202. </div>
  203. </template>
  204. <script>
  205. import * as echarts from 'echarts'
  206. import { GetAllQCStatistisData, GetQCStatistisData } from '../../../api/qcd'
  207. const moment = require('moment')
  208. export default {
  209. props: {
  210. width: {
  211. type: String,
  212. default: '100%'
  213. },
  214. height: {
  215. type: String,
  216. default: '400px'
  217. }
  218. },
  219. data() {
  220. return {
  221. statistics_types:[
  222. { value: 1, label: '不达标患者' },
  223. { value: 2, label: '未检查患者' },
  224. { value: 3, label: '达标患者' },
  225. ],
  226. sort_types:[
  227. { value: 1, label: '时间' },
  228. { value: 2, label: '患者' },
  229. ],
  230. detailVisibility:false,
  231. isClose:true,
  232. time_type: 1,
  233. time_type_two:1,
  234. times: [
  235. { value: 1, label: '本月' },
  236. { value: 2, label: '上月' },
  237. { value: 3, label: '今年' },
  238. { value: 4, label: '上一年' },
  239. { value: 5, label: '第一季度' },
  240. { value: 6, label: '第二季度' },
  241. { value: 7, label: '第三季度' },
  242. { value: 8, label: '第四季度' },
  243. { value: 9, label: '自定义' }
  244. ],
  245. time_month: '',
  246. start_time: new Date(new Date().getFullYear(), new Date().getMonth(), 1).toLocaleDateString('en-CA'),
  247. end_time: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).toLocaleDateString('en-CA'),
  248. start_time_one: new Date(new Date().getFullYear(), new Date().getMonth(), 1).toLocaleDateString('en-CA'),
  249. end_time_one: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).toLocaleDateString('en-CA'),
  250. input: '',
  251. myChart: {},
  252. pieData: [],
  253. pieName: [],
  254. reference:{},
  255. // myChartStyle:{float: "right", width: "100%", height: "400px"},
  256. tableData: [],
  257. statistics_type:1,
  258. sort_type:"",
  259. keyword:"",
  260. patientTableData:[],
  261. }
  262. },
  263. mounted() {
  264. this.getData()
  265. },
  266. methods: {
  267. exportAction(){
  268. let list = []
  269. for (let i = 0; i < this.patientTableData.length; i++) {
  270. let order = this.patientTableData[i]
  271. let name = order.name
  272. let value = order.inspect_value
  273. let inspect_date = order.date
  274. let obj = {
  275. '姓名': name,
  276. '数值': value,
  277. '日期': inspect_date,
  278. }
  279. list.push(obj)
  280. }
  281. import('@/vendor/Export2Excel').then(excel => {
  282. const tHeader = ['姓名', '数值', '日期']
  283. const filterVal = ['姓名', '数值', '日期']
  284. const data = this.formatJson(filterVal, list)
  285. excel.export_json_to_excel1({
  286. header: tHeader,
  287. data,
  288. filename: '明细',
  289. ref: this.$refs['table'].$el
  290. })
  291. })
  292. },
  293. formatJson(filterVal, jsonData) {
  294. return jsonData.map(v => filterVal.map(j => v[j]))
  295. },
  296. getDataTwo() {
  297. if(this.start_time_one.length == 0){
  298. this.$message.error("请选择开始时间")
  299. }
  300. if(this.end_time_one.length == 0){
  301. this.$message.error("请选择结束时间")
  302. }
  303. let params = {
  304. start_date: this.start_time_one,
  305. end_date: this.end_time_one,
  306. item_type:this.statistics_type,
  307. order_type:this.sort_type,
  308. keyword: this.keyword,
  309. type:2,
  310. }
  311. this.patientTableData = []
  312. GetAllQCStatistisData(params).then(response => {
  313. if (response.data.state == 1) {
  314. this.detailVisibility = true
  315. this.patientTableData = this.patientTableData.concat(response.data.data.list)
  316. } else {
  317. this.$message.error(response.data.msg)
  318. }
  319. })
  320. },
  321. getData() {
  322. if(this.start_time.length == 0){
  323. this.$message.error("请选择开始时间")
  324. }
  325. if(this.end_time.length == 0){
  326. this.$message.error("请选择结束时间")
  327. }
  328. let params = {
  329. start_date: this.start_time,
  330. end_date: this.end_time,
  331. type:2,
  332. }
  333. this.pieData = []
  334. this.tableData = []
  335. GetQCStatistisData(params).then(response => {
  336. if (response.data.state == 1) {
  337. // this.reference = response.data.data.reference
  338. // this.input = response.data.data.reference.range_min + "<=" + response.data.data.reference.item_name + "<=" + response.data.data.reference.range_max
  339. let objone = {
  340. value: response.data.data.unusual_total ,
  341. name: '不达标值患者',
  342. count:response.data.data.unusual_total,
  343. }
  344. this.pieData.push(objone)
  345. this.tableData.push(objone)
  346. let objtwo = {
  347. value: response.data.data.normal_total,
  348. name: '达标值患者',
  349. count:response.data.data.normal_total,
  350. }
  351. this.pieData.push(objtwo)
  352. this.tableData.push(objtwo)
  353. let objthree = {
  354. value: response.data.data.no_check_total ,
  355. name: '未检查患者',
  356. count:response.data.data.no_check_total,
  357. }
  358. this.pieData.push(objthree)
  359. this.tableData.push(objthree)
  360. let objfour = {
  361. value: response.data.data.patient_count,
  362. name: '合计',
  363. count:response.data.data.patient_count,
  364. }
  365. this.tableData.push(objfour)
  366. for (let i = 0; i < this.pieData.length; i++) {
  367. this.pieName[i] = this.pieData[i].name
  368. }
  369. this.myChart = echarts.init(document.getElementById('mychart'))
  370. window.addEventListener('resize', () => {
  371. this.myChart.resize()
  372. })
  373. const option = {
  374. legend: {
  375. // 图例
  376. data: this.pieName,
  377. left: '10%',
  378. top: '30%',
  379. orient: 'vertical'
  380. },
  381. color: ['#F74587', '#32D79B', '#6590FF'],
  382. title: {
  383. // 设置饼图标题,位置设为顶部居中
  384. // text: "国内院士前五省份图示",
  385. top: '0%',
  386. left: 'center'
  387. },
  388. series: [
  389. {
  390. type: 'pie',
  391. label: {
  392. normal : {
  393. formatter: '{b}:{c}: ({d}%)',
  394. textStyle : {
  395. fontWeight : 'normal',
  396. fontSize : 15,
  397. color : "black"
  398. }
  399. }
  400. // b代表名称,c代表对应值,d代表百分比"{b} : {d}% ({c})"
  401. },
  402. radius: '65%', //饼图半径
  403. data: this.pieData,
  404. itemStyle : {
  405. emphasis: {
  406. shadowBlur: 10,
  407. shadowOffsetX: 0,
  408. shadowColor: 'rgba(0, 0, 0, 0.5)'
  409. }
  410. }
  411. }
  412. ]
  413. }
  414. // console.log(this.seriesData);
  415. const optionFree = {
  416. series: [
  417. {
  418. data: this.seriesData,
  419. type: 'line',
  420. smooth: true
  421. }
  422. ]
  423. }
  424. this.myChart = echarts.init(document.getElementById('mychart'))
  425. this.myChart.setOption(option)
  426. } else {
  427. this.$message.error(response.data.msg)
  428. }
  429. })
  430. },
  431. changeItem(val) {
  432. const currentDate = new Date()
  433. switch (val) {
  434. case 1:
  435. const startOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1).toLocaleDateString('en-CA')
  436. const endOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0).toLocaleDateString('en-CA')
  437. this.start_time = startOfMonth
  438. this.end_time = endOfMonth
  439. this.getData()
  440. break
  441. case 2:
  442. // 上月的起始日期和结束日期
  443. const startOfLastMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, 1).toLocaleDateString('en-CA')
  444. const endOfLastMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 0).toLocaleDateString('en-CA')
  445. this.start_time = startOfLastMonth
  446. this.end_time = endOfLastMonth
  447. this.getData()
  448. break
  449. case 3:
  450. // 今年的起始日期和结束日期
  451. const startOfYear = new Date(currentDate.getFullYear(), 0, 1).toLocaleDateString('en-CA')
  452. const endOfYear = new Date(currentDate.getFullYear(), 11, 31).toLocaleDateString('en-CA')
  453. this.start_time = startOfYear
  454. this.end_time = endOfYear
  455. this.getData()
  456. break
  457. case 4:
  458. // 上一年的起始日期和结束日期
  459. const startOfLastYear = new Date(currentDate.getFullYear() - 1, 0, 1).toLocaleDateString('en-CA')
  460. const endOfLastYear = new Date(currentDate.getFullYear() - 1, 11, 31).toLocaleDateString('en-CA')
  461. this.start_time = startOfLastYear
  462. this.end_time = endOfLastYear
  463. this.getData()
  464. break
  465. case 5:
  466. // 第一季度的起始日期和结束日期
  467. const startOfFirstQuarter = new Date(currentDate.getFullYear(), 0, 1).toLocaleDateString('en-CA')
  468. const endOfFirstQuarter = new Date(currentDate.getFullYear(), 2, 31).toLocaleDateString('en-CA')
  469. this.start_time = startOfFirstQuarter
  470. this.end_time = endOfFirstQuarter
  471. this.getData()
  472. break
  473. case 6:
  474. // 第二季度的起始日期和结束日期
  475. const startOfSecondQuarter = new Date(currentDate.getFullYear(), 3, 1).toLocaleDateString('en-CA')
  476. const endOfSecondQuarter = new Date(currentDate.getFullYear(), 5, 30).toLocaleDateString('en-CA')
  477. this.start_time = startOfSecondQuarter
  478. this.end_time = endOfSecondQuarter
  479. this.getData()
  480. break
  481. case 7:
  482. // 第三季度的起始日期和结束日期
  483. const startOfThirdQuarter = new Date(currentDate.getFullYear(), 6, 1).toLocaleDateString('en-CA')
  484. const endOfThirdQuarter = new Date(currentDate.getFullYear(), 8, 30).toLocaleDateString('en-CA')
  485. this.start_time = startOfThirdQuarter
  486. this.end_time = endOfThirdQuarter
  487. this.getData()
  488. break
  489. case 8:
  490. // 第四季度的起始日期和结束日期
  491. const startOfFourthQuarter = new Date(currentDate.getFullYear(), 9, 1).toLocaleDateString('en-CA')
  492. const endOfFourthQuarter = new Date(currentDate.getFullYear(), 11, 31).toLocaleDateString('en-CA')
  493. this.start_time = startOfFourthQuarter
  494. this.end_time = endOfFourthQuarter
  495. this.getData()
  496. break
  497. case 9:
  498. this.start_time = ''
  499. this.end_time = ''
  500. break
  501. }
  502. },
  503. changeItemTwo(val) {
  504. const currentDate = new Date()
  505. switch (val) {
  506. case 1:
  507. const startOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1).toLocaleDateString('en-CA')
  508. const endOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0).toLocaleDateString('en-CA')
  509. this.start_time_one = startOfMonth
  510. this.end_time_one = endOfMonth
  511. // this.getDataTwo()
  512. break
  513. case 2:
  514. // 上月的起始日期和结束日期
  515. const startOfLastMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, 1).toLocaleDateString('en-CA')
  516. const endOfLastMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 0).toLocaleDateString('en-CA')
  517. this.start_time_one = startOfLastMonth
  518. this.end_time_one = endOfLastMonth
  519. // this.getDataTwo()
  520. break
  521. case 3:
  522. // 今年的起始日期和结束日期
  523. const startOfYear = new Date(currentDate.getFullYear(), 0, 1).toLocaleDateString('en-CA')
  524. const endOfYear = new Date(currentDate.getFullYear(), 11, 31).toLocaleDateString('en-CA')
  525. this.start_time_one = startOfYear
  526. this.end_time_one = endOfYear
  527. // this.getDataTwo()
  528. break
  529. case 4:
  530. // 上一年的起始日期和结束日期
  531. const startOfLastYear = new Date(currentDate.getFullYear() - 1, 0, 1).toLocaleDateString('en-CA')
  532. const endOfLastYear = new Date(currentDate.getFullYear() - 1, 11, 31).toLocaleDateString('en-CA')
  533. this.start_time_one = startOfLastYear
  534. this.end_time_one = endOfLastYear
  535. // this.getDataTwo()
  536. break
  537. case 5:
  538. // 第一季度的起始日期和结束日期
  539. const startOfFirstQuarter = new Date(currentDate.getFullYear(), 0, 1).toLocaleDateString('en-CA')
  540. const endOfFirstQuarter = new Date(currentDate.getFullYear(), 2, 31).toLocaleDateString('en-CA')
  541. this.start_time_one = startOfFirstQuarter
  542. this.end_time_one = endOfFirstQuarter
  543. // this.getDataTwo()
  544. break
  545. case 6:
  546. // 第二季度的起始日期和结束日期
  547. const startOfSecondQuarter = new Date(currentDate.getFullYear(), 3, 1).toLocaleDateString('en-CA')
  548. const endOfSecondQuarter = new Date(currentDate.getFullYear(), 5, 30).toLocaleDateString('en-CA')
  549. this.start_time_one = startOfSecondQuarter
  550. this.end_time_one = endOfSecondQuarter
  551. // this.getDataTwo()
  552. break
  553. case 7:
  554. // 第三季度的起始日期和结束日期
  555. const startOfThirdQuarter = new Date(currentDate.getFullYear(), 6, 1).toLocaleDateString('en-CA')
  556. const endOfThirdQuarter = new Date(currentDate.getFullYear(), 8, 30).toLocaleDateString('en-CA')
  557. this.start_time_one = startOfThirdQuarter
  558. this.end_time_one = endOfThirdQuarter
  559. // this.getDataTwo()
  560. break
  561. case 8:
  562. // 第四季度的起始日期和结束日期
  563. const startOfFourthQuarter = new Date(currentDate.getFullYear(), 9, 1).toLocaleDateString('en-CA')
  564. const endOfFourthQuarter = new Date(currentDate.getFullYear(), 11, 31).toLocaleDateString('en-CA')
  565. this.start_time_one = startOfFourthQuarter
  566. this.end_time_one = endOfFourthQuarter
  567. // this.getDataTwo()
  568. break
  569. case 9:
  570. this.start_time_one = ''
  571. this.end_time_one = ''
  572. break
  573. }
  574. },
  575. getSummaries(param) {
  576. const { columns, data } = param
  577. const sums = []
  578. columns.forEach((column, index) => {
  579. if (index === 0) {
  580. sums[index] = '总价'
  581. return
  582. }
  583. const values = data.map(item => Number(item[column.property]))
  584. if (!values.every(value => isNaN(value))) {
  585. sums[index] = values.reduce((prev, curr) => {
  586. const value = Number(curr)
  587. if (!isNaN(value)) {
  588. return prev + curr
  589. } else {
  590. return prev
  591. }
  592. }, 0)
  593. sums[index] += ' 元'
  594. } else {
  595. sums[index] = 'N/A'
  596. }
  597. })
  598. return sums
  599. },
  600. handleClick(row) {
  601. console.log(row)
  602. if(row.name == "不达标值患者"){
  603. this.statistics_type = 1
  604. }else if(row.name == "达标值患者"){
  605. this.statistics_type = 3
  606. }else {
  607. this.statistics_type = 2
  608. }
  609. this.getDataTwo()
  610. }
  611. }
  612. }
  613. </script>
  614. <style lang="scss" scoped>
  615. .content_top {
  616. display: flex;
  617. justify-content: space-around;
  618. color: #1e5feb;
  619. }
  620. </style>