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

plateletsall.vue 22KB

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