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

all_urr.vue 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  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="URR"
  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. </el-table-column>
  195. </el-table>
  196. <div slot="footer" class="dialog-footer">
  197. <el-button @click="detailVisibility = false">取消</el-button>
  198. <el-button type="primary" @click="detailVisibility = false">确定</el-button>
  199. </div>
  200. </el-dialog>
  201. </div>
  202. </template>
  203. <script>
  204. import * as echarts from 'echarts'
  205. import { GetAllQCStatistisData, GetQCStatistisData } from '../../../api/qcd'
  206. const moment = require('moment')
  207. export default {
  208. props: {
  209. width: {
  210. type: String,
  211. default: '100%'
  212. },
  213. height: {
  214. type: String,
  215. default: '400px'
  216. }
  217. },
  218. data() {
  219. return {
  220. statistics_types:[
  221. { value: 1, label: '不达标患者' },
  222. { value: 2, label: '未检查患者' },
  223. { value: 3, label: '达标患者' },
  224. ],
  225. sort_types:[
  226. { value: 1, label: '时间' },
  227. { value: 2, label: '患者' },
  228. ],
  229. detailVisibility:false,
  230. isClose:true,
  231. time_type: 1,
  232. time_type_two:1,
  233. times: [
  234. { value: 1, label: '本月' },
  235. { value: 2, label: '上月' },
  236. { value: 3, label: '今年' },
  237. { value: 4, label: '上一年' },
  238. { value: 5, label: '第一季度' },
  239. { value: 6, label: '第二季度' },
  240. { value: 7, label: '第三季度' },
  241. { value: 8, label: '第四季度' },
  242. { value: 9, label: '自定义' }
  243. ],
  244. time_month: '',
  245. start_time: new Date(new Date().getFullYear(), new Date().getMonth(), 1).toLocaleDateString('en-CA'),
  246. end_time: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).toLocaleDateString('en-CA'),
  247. start_time_one: new Date(new Date().getFullYear(), new Date().getMonth(), 1).toLocaleDateString('en-CA'),
  248. end_time_one: new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0).toLocaleDateString('en-CA'),
  249. input: '',
  250. myChart: {},
  251. pieData: [],
  252. pieName: [],
  253. reference:{},
  254. // myChartStyle:{float: "right", width: "100%", height: "400px"},
  255. tableData: [],
  256. statistics_type:1,
  257. sort_type:"",
  258. keyword:"",
  259. patientTableData:[],
  260. }
  261. },
  262. mounted() {
  263. this.getData()
  264. },
  265. methods: {
  266. exportAction(){
  267. let list = []
  268. for (let i = 0; i < this.patientTableData.length; i++) {
  269. let order = this.patientTableData[i]
  270. let name = order.name
  271. let value = order.inspect_value
  272. let inspect_date = order.date
  273. let obj = {
  274. '姓名': name,
  275. '数值': value,
  276. '日期': inspect_date,
  277. }
  278. list.push(obj)
  279. }
  280. import('@/vendor/Export2Excel').then(excel => {
  281. const tHeader = ['姓名', '数值', '日期']
  282. const filterVal = ['姓名', '数值', '日期']
  283. const data = this.formatJson(filterVal, list)
  284. excel.export_json_to_excel1({
  285. header: tHeader,
  286. data,
  287. filename: '明细',
  288. ref: this.$refs['table'].$el
  289. })
  290. })
  291. },
  292. formatJson(filterVal, jsonData) {
  293. return jsonData.map(v => filterVal.map(j => v[j]))
  294. },
  295. getDataTwo() {
  296. if(this.start_time_one.length == 0){
  297. this.$message.error("请选择开始时间")
  298. }
  299. if(this.end_time_one.length == 0){
  300. this.$message.error("请选择结束时间")
  301. }
  302. let params = {
  303. start_date: this.start_time_one,
  304. end_date: this.end_time_one,
  305. item_type:this.statistics_type,
  306. order_type:this.sort_type,
  307. keyword: this.keyword,
  308. type:3,
  309. }
  310. this.patientTableData = []
  311. GetAllQCStatistisData(params).then(response => {
  312. if (response.data.state == 1) {
  313. this.detailVisibility = true
  314. this.patientTableData = this.patientTableData.concat(response.data.data.list)
  315. } else {
  316. this.$message.error(response.data.msg)
  317. }
  318. })
  319. },
  320. getData() {
  321. if(this.start_time.length == 0){
  322. this.$message.error("请选择开始时间")
  323. }
  324. if(this.end_time.length == 0){
  325. this.$message.error("请选择结束时间")
  326. }
  327. let params = {
  328. start_date: this.start_time,
  329. end_date: this.end_time,
  330. type:3,
  331. }
  332. this.pieData = []
  333. this.tableData = []
  334. console.log("~~~~~~~~~~")
  335. GetQCStatistisData(params).then(response => {
  336. if (response.data.state == 1) {
  337. let objone = {
  338. value: response.data.data.unusual_total ,
  339. name: '不达标值患者',
  340. count:response.data.data.unusual_total,
  341. }
  342. this.pieData.push(objone)
  343. this.tableData.push(objone)
  344. let objtwo = {
  345. value: response.data.data.normal_total,
  346. name: '达标值患者',
  347. count:response.data.data.normal_total,
  348. }
  349. this.pieData.push(objtwo)
  350. this.tableData.push(objtwo)
  351. let objthree = {
  352. value: response.data.data.no_check_total ,
  353. name: '未检查患者',
  354. count:response.data.data.no_check_total,
  355. }
  356. this.pieData.push(objthree)
  357. this.tableData.push(objthree)
  358. let objfour = {
  359. value: response.data.data.patient_count,
  360. name: '合计',
  361. count:response.data.data.patient_count,
  362. }
  363. this.tableData.push(objfour)
  364. for (let i = 0; i < this.pieData.length; i++) {
  365. this.pieName[i] = this.pieData[i].name
  366. }
  367. this.myChart = echarts.init(document.getElementById('mychart'))
  368. window.addEventListener('resize', () => {
  369. this.myChart.resize()
  370. })
  371. const option = {
  372. legend: {
  373. // 图例
  374. data: this.pieName,
  375. left: '10%',
  376. top: '30%',
  377. orient: 'vertical'
  378. },
  379. color: ['#F74587', '#32D79B', '#6590FF'],
  380. title: {
  381. // 设置饼图标题,位置设为顶部居中
  382. // text: "国内院士前五省份图示",
  383. top: '0%',
  384. left: 'center'
  385. },
  386. series: [
  387. {
  388. type: 'pie',
  389. label: {
  390. normal : {
  391. formatter: '{b}:{c}: ({d}%)',
  392. textStyle : {
  393. fontWeight : 'normal',
  394. fontSize : 15,
  395. color : "black"
  396. }
  397. }
  398. // b代表名称,c代表对应值,d代表百分比"{b} : {d}% ({c})"
  399. },
  400. radius: '65%', //饼图半径
  401. data: this.pieData,
  402. itemStyle : {
  403. emphasis: {
  404. shadowBlur: 10,
  405. shadowOffsetX: 0,
  406. shadowColor: 'rgba(0, 0, 0, 0.5)'
  407. }
  408. }
  409. }
  410. ]
  411. }
  412. // console.log(this.seriesData);
  413. const optionFree = {
  414. series: [
  415. {
  416. data: this.seriesData,
  417. type: 'line',
  418. smooth: true
  419. }
  420. ]
  421. }
  422. this.myChart = echarts.init(document.getElementById('mychart'))
  423. this.myChart.setOption(option)
  424. } else {
  425. this.$message.error(response.data.msg)
  426. }
  427. })
  428. },
  429. changeItem(val) {
  430. const currentDate = new Date()
  431. switch (val) {
  432. case 1:
  433. const startOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1).toLocaleDateString('en-CA')
  434. const endOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0).toLocaleDateString('en-CA')
  435. this.start_time = startOfMonth
  436. this.end_time = endOfMonth
  437. this.getData()
  438. break
  439. case 2:
  440. // 上月的起始日期和结束日期
  441. const startOfLastMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, 1).toLocaleDateString('en-CA')
  442. const endOfLastMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 0).toLocaleDateString('en-CA')
  443. this.start_time = startOfLastMonth
  444. this.end_time = endOfLastMonth
  445. this.getData()
  446. break
  447. case 3:
  448. // 今年的起始日期和结束日期
  449. const startOfYear = new Date(currentDate.getFullYear(), 0, 1).toLocaleDateString('en-CA')
  450. const endOfYear = new Date(currentDate.getFullYear(), 11, 31).toLocaleDateString('en-CA')
  451. this.start_time = startOfYear
  452. this.end_time = endOfYear
  453. this.getData()
  454. break
  455. case 4:
  456. // 上一年的起始日期和结束日期
  457. const startOfLastYear = new Date(currentDate.getFullYear() - 1, 0, 1).toLocaleDateString('en-CA')
  458. const endOfLastYear = new Date(currentDate.getFullYear() - 1, 11, 31).toLocaleDateString('en-CA')
  459. this.start_time = startOfLastYear
  460. this.end_time = endOfLastYear
  461. this.getData()
  462. break
  463. case 5:
  464. // 第一季度的起始日期和结束日期
  465. const startOfFirstQuarter = new Date(currentDate.getFullYear(), 0, 1).toLocaleDateString('en-CA')
  466. const endOfFirstQuarter = new Date(currentDate.getFullYear(), 2, 31).toLocaleDateString('en-CA')
  467. this.start_time = startOfFirstQuarter
  468. this.end_time = endOfFirstQuarter
  469. this.getData()
  470. break
  471. case 6:
  472. // 第二季度的起始日期和结束日期
  473. const startOfSecondQuarter = new Date(currentDate.getFullYear(), 3, 1).toLocaleDateString('en-CA')
  474. const endOfSecondQuarter = new Date(currentDate.getFullYear(), 5, 30).toLocaleDateString('en-CA')
  475. this.start_time = startOfSecondQuarter
  476. this.end_time = endOfSecondQuarter
  477. this.getData()
  478. break
  479. case 7:
  480. // 第三季度的起始日期和结束日期
  481. const startOfThirdQuarter = new Date(currentDate.getFullYear(), 6, 1).toLocaleDateString('en-CA')
  482. const endOfThirdQuarter = new Date(currentDate.getFullYear(), 8, 30).toLocaleDateString('en-CA')
  483. this.start_time = startOfThirdQuarter
  484. this.end_time = endOfThirdQuarter
  485. this.getData()
  486. break
  487. case 8:
  488. // 第四季度的起始日期和结束日期
  489. const startOfFourthQuarter = new Date(currentDate.getFullYear(), 9, 1).toLocaleDateString('en-CA')
  490. const endOfFourthQuarter = new Date(currentDate.getFullYear(), 11, 31).toLocaleDateString('en-CA')
  491. this.start_time = startOfFourthQuarter
  492. this.end_time = endOfFourthQuarter
  493. this.getData()
  494. break
  495. case 9:
  496. this.start_time = ''
  497. this.end_time = ''
  498. break
  499. }
  500. },
  501. changeItemTwo(val) {
  502. const currentDate = new Date()
  503. switch (val) {
  504. case 1:
  505. const startOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 1).toLocaleDateString('en-CA')
  506. const endOfMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() + 1, 0).toLocaleDateString('en-CA')
  507. this.start_time_one = startOfMonth
  508. this.end_time_one = endOfMonth
  509. // this.getDataTwo()
  510. break
  511. case 2:
  512. // 上月的起始日期和结束日期
  513. const startOfLastMonth = new Date(currentDate.getFullYear(), currentDate.getMonth() - 1, 1).toLocaleDateString('en-CA')
  514. const endOfLastMonth = new Date(currentDate.getFullYear(), currentDate.getMonth(), 0).toLocaleDateString('en-CA')
  515. this.start_time_one = startOfLastMonth
  516. this.end_time_one = endOfLastMonth
  517. // this.getDataTwo()
  518. break
  519. case 3:
  520. // 今年的起始日期和结束日期
  521. const startOfYear = new Date(currentDate.getFullYear(), 0, 1).toLocaleDateString('en-CA')
  522. const endOfYear = new Date(currentDate.getFullYear(), 11, 31).toLocaleDateString('en-CA')
  523. this.start_time_one = startOfYear
  524. this.end_time_one = endOfYear
  525. // this.getDataTwo()
  526. break
  527. case 4:
  528. // 上一年的起始日期和结束日期
  529. const startOfLastYear = new Date(currentDate.getFullYear() - 1, 0, 1).toLocaleDateString('en-CA')
  530. const endOfLastYear = new Date(currentDate.getFullYear() - 1, 11, 31).toLocaleDateString('en-CA')
  531. this.start_time_one = startOfLastYear
  532. this.end_time_one = endOfLastYear
  533. // this.getDataTwo()
  534. break
  535. case 5:
  536. // 第一季度的起始日期和结束日期
  537. const startOfFirstQuarter = new Date(currentDate.getFullYear(), 0, 1).toLocaleDateString('en-CA')
  538. const endOfFirstQuarter = new Date(currentDate.getFullYear(), 2, 31).toLocaleDateString('en-CA')
  539. this.start_time_one = startOfFirstQuarter
  540. this.end_time_one = endOfFirstQuarter
  541. // this.getDataTwo()
  542. break
  543. case 6:
  544. // 第二季度的起始日期和结束日期
  545. const startOfSecondQuarter = new Date(currentDate.getFullYear(), 3, 1).toLocaleDateString('en-CA')
  546. const endOfSecondQuarter = new Date(currentDate.getFullYear(), 5, 30).toLocaleDateString('en-CA')
  547. this.start_time_one = startOfSecondQuarter
  548. this.end_time_one = endOfSecondQuarter
  549. // this.getDataTwo()
  550. break
  551. case 7:
  552. // 第三季度的起始日期和结束日期
  553. const startOfThirdQuarter = new Date(currentDate.getFullYear(), 6, 1).toLocaleDateString('en-CA')
  554. const endOfThirdQuarter = new Date(currentDate.getFullYear(), 8, 30).toLocaleDateString('en-CA')
  555. this.start_time_one = startOfThirdQuarter
  556. this.end_time_one = endOfThirdQuarter
  557. // this.getDataTwo()
  558. break
  559. case 8:
  560. // 第四季度的起始日期和结束日期
  561. const startOfFourthQuarter = new Date(currentDate.getFullYear(), 9, 1).toLocaleDateString('en-CA')
  562. const endOfFourthQuarter = new Date(currentDate.getFullYear(), 11, 31).toLocaleDateString('en-CA')
  563. this.start_time_one = startOfFourthQuarter
  564. this.end_time_one = endOfFourthQuarter
  565. // this.getDataTwo()
  566. break
  567. case 9:
  568. this.start_time_one = ''
  569. this.end_time_one = ''
  570. break
  571. }
  572. },
  573. getSummaries(param) {
  574. const { columns, data } = param
  575. const sums = []
  576. columns.forEach((column, index) => {
  577. if (index === 0) {
  578. sums[index] = '总价'
  579. return
  580. }
  581. const values = data.map(item => Number(item[column.property]))
  582. if (!values.every(value => isNaN(value))) {
  583. sums[index] = values.reduce((prev, curr) => {
  584. const value = Number(curr)
  585. if (!isNaN(value)) {
  586. return prev + curr
  587. } else {
  588. return prev
  589. }
  590. }, 0)
  591. sums[index] += ' 元'
  592. } else {
  593. sums[index] = 'N/A'
  594. }
  595. })
  596. return sums
  597. },
  598. handleClick(row) {
  599. console.log(row)
  600. if(row.name == "不达标值患者"){
  601. this.statistics_type = 1
  602. }else if(row.name == "达标值患者"){
  603. this.statistics_type = 3
  604. }else {
  605. this.statistics_type = 2
  606. }
  607. this.getDataTwo()
  608. }
  609. }
  610. }
  611. </script>
  612. <style lang="scss" scoped>
  613. .content_top {
  614. display: flex;
  615. justify-content: space-around;
  616. color: #1e5feb;
  617. }
  618. </style>