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

albuminall.vue 22KB

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