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

otherIndicatorsall.vue 22KB

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