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

personal.vue 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. <template>
  2. <div class="page_personal">
  3. <div class="cell clearfix">
  4. <el-form :inline="true">
  5. <el-form-item label>
  6. <el-autocomplete
  7. class="checkSearch"
  8. popper-class="my-autocomplete"
  9. v-model="search_value"
  10. :fetch-suggestions="querySearchAsync"
  11. :trigger-on-focus="false"
  12. placeholder="请输入病人名字"
  13. @select="handleSelect"
  14. style="width:160px;"
  15. >
  16. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  17. <template slot-scope="{ item }">
  18. <div class="name">{{ item.name }}</div>
  19. </template>
  20. </el-autocomplete>
  21. </el-form-item>
  22. </el-form>
  23. <el-select v-model="query.project_id" placeholder="请选择" style="width:120px;margin-right:10px"
  24. @change="changeProject">
  25. <el-option
  26. v-for="item in project_columns"
  27. :key="item.project_id"
  28. :label="item.project_name"
  29. :value="item.project_id"
  30. ></el-option>
  31. </el-select>
  32. <el-select
  33. v-model="query.item_id"
  34. placeholder="请选择"
  35. style="width:120px;margin-right:10px"
  36. @change="changeItem"
  37. >
  38. <el-option
  39. v-for="item in item_columns"
  40. :key="item.id"
  41. :label="item.item_name"
  42. :value="item.id"
  43. ></el-option>
  44. </el-select>
  45. <!--<el-select v-model="query.range_value" placeholder="请选择" style="width:120px;margin-right:20px"-->
  46. <!--@change="changeRangeValue">-->
  47. <!--<el-option-->
  48. <!--v-for="item in range_value_columns"-->
  49. <!--:key="item"-->
  50. <!--:label="item"-->
  51. <!--:value="item"-->
  52. <!--&gt;</el-option>-->
  53. <!--</el-select>-->
  54. <label class="title">
  55. <span class="name">日期查询</span> :
  56. </label>
  57. <el-date-picker
  58. v-model="query.start_time"
  59. prefix-icon="el-icon-date"
  60. @change="changeTime"
  61. :editable="false"
  62. style="width: 150px;"
  63. type="date"
  64. placeholder="选择日期时间"
  65. align="right"
  66. format="yyyy-MM-dd"
  67. value-format="yyyy-MM-dd"
  68. ></el-date-picker>
  69. <span class>-</span>
  70. <el-date-picker
  71. v-model="query.end_time"
  72. prefix-icon="el-icon-date"
  73. @change="changeEndTime"
  74. :editable="false"
  75. style="width: 150px;"
  76. type="date"
  77. placeholder="选择日期时间"
  78. align="right"
  79. format="yyyy-MM-dd"
  80. value-format="yyyy-MM-dd"
  81. ></el-date-picker>
  82. </div>
  83. <el-container>
  84. <div style="width:160px">
  85. <div class="tableTitle">患者列表</div>
  86. <el-table ref="table" :data="patientsData" border style="width: 100%;" height="500" :row-style="{ color: '#303133' }"
  87. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  88. highlight-current-row
  89. @current-change="handleChange">
  90. <el-table-column prop="dialysis_no" label="透析号" width="70">
  91. <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
  92. </el-table-column>
  93. <el-table-column prop="name" label="姓名" width="90">
  94. <template slot-scope="scope">{{ scope.row.name }}</template>
  95. </el-table-column>
  96. </el-table>
  97. </div>
  98. <div style="padding-left:10px;flex:1">
  99. <div class="tableTitle" style="magrin-bottom:0;">统计图<span style="font-weight:normal">&nbsp;&nbsp;(当前患者:{{patient_name}})</span></div>
  100. <div>
  101. <line-chart :options="options"></line-chart>
  102. </div>
  103. <div class="tableTitle">指标趋势</div>
  104. <div>
  105. <div>
  106. <line-chart :options="options2"></line-chart>
  107. </div>
  108. </div>
  109. <div></div>
  110. </div>
  111. </el-container>
  112. </div>
  113. </template>
  114. <script>
  115. import echarts from 'echarts'
  116. import LineChart from '../../components/LineChart'
  117. import {
  118. GetInspectionIndexChart,
  119. GetInspectionIndexInit,
  120. GetInspectionIndexTable,
  121. GetPatientInspectionIndexBarChart,
  122. GetPatientInspectionIndexChart,
  123. GetRangeValue,
  124. GetDefalutPatient
  125. } from '@/api/common/statistics'
  126. import { uParseTime } from '@/utils/tools'
  127. import { getCurrentOrgPatients } from '@/api/common/common'
  128. import { PostSearch } from '@/api/patient'
  129. export default {
  130. components: {
  131. LineChart
  132. },
  133. data() {
  134. return {
  135. percent:[],
  136. pickerOptions: {
  137. disabledDate(time) {
  138. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 2)).getTime() - 24 * 3600 * 1000
  139. return time.getTime() > Date.now() || time.getTime() < threeMonths
  140. }
  141. },
  142. patient_name:'',
  143. item_name: '',
  144. search_value: '',
  145. query: {
  146. patient_id: '',
  147. start_time: '',
  148. end_time: '',
  149. limit: 20,
  150. page: 1,
  151. project_id: '',
  152. item_id: '',
  153. range_type: '',
  154. range_value: ''
  155. },
  156. project_columns: [],
  157. item_columns: [],
  158. range_value_columns: [],
  159. all_inspection_reference: [],
  160. patientsData: [],
  161. value: '请选项',
  162. tableData: [],
  163. options: {
  164. title: {
  165. text: 'ECharts 入门示例'
  166. },
  167. tooltip: {},
  168. legend: {
  169. data: [''],
  170. left: 0
  171. },
  172. xAxis: {
  173. data: []
  174. },
  175. yAxis: {
  176. axisLabel: {
  177. formatter: '{value} %'
  178. },
  179. show: false
  180. },
  181. series: [
  182. {
  183. name: '',
  184. type: 'bar',
  185. data: [],
  186. barWidth: 30,
  187. label: {
  188. normal: {
  189. show: true,
  190. position: 'top',
  191. formatter: (params) => {
  192. if(this.percent.length > 0){
  193. let str = ''
  194. str = params.data + '('+ this.percent[params.dataIndex] +'%)'
  195. return str
  196. }else{
  197. let str = ''
  198. str = params.data
  199. return str
  200. }
  201. }
  202. }
  203. },
  204. //配置样式
  205. itemStyle: {
  206. //通常情况下:
  207. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  208. normal: {
  209. color: function(params) {
  210. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  211. var colorList = [
  212. ['#A9E0F3', '#9FBDFC'],
  213. ['#FFD7C0', '#FF9994']
  214. ]
  215. var index = params.dataIndex
  216. if (params.dataIndex >= colorList.length) {
  217. index = params.dataIndex % colorList.length
  218. }
  219. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  220. { offset: 0, color: colorList[index][0] },
  221. // { offset: 0.5, color: colorList[index][1] },
  222. { offset: 1, color: colorList[index][1] }
  223. ])
  224. },
  225. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  226. },
  227. //鼠标悬停时:
  228. emphasis: {
  229. shadowBlur: 10,
  230. shadowOffsetX: 0,
  231. shadowColor: 'rgba(0, 0, 0, 0.5)'
  232. }
  233. }
  234. }
  235. ]
  236. },
  237. options2: {
  238. title: {
  239. text: 'ECharts 入门示例'
  240. },
  241. tooltip: {},
  242. legend: {
  243. data: ['次数'],
  244. left: 0
  245. },
  246. xAxis: {
  247. data: [],
  248. axisLine: {
  249. lineStyle: {
  250. color: '#FF0000',
  251. width: 8 //这里是为了突出显示加上的
  252. }
  253. },
  254. axisLabel: {
  255. interval: 0,
  256. formatter: function(value) {
  257. var ret = '' //拼接加\n返回的类目项
  258. var maxLength = 8 //每项显示文字个数
  259. var valLength = value.length //X轴类目项的文字个数
  260. var rowN = Math.ceil(valLength / maxLength) //类目项需要换行的行数
  261. if (rowN > 1) {
  262. //如果类目项的文字大于3,
  263. for (var i = 0; i < rowN; i++) {
  264. var temp = '' //每次截取的字符串
  265. var start = i * maxLength //开始截取的位置
  266. var end = start + maxLength //结束截取的位置
  267. //这里也可以加一个是否是最后一行的判断,但是不加也没有影响,那就不加吧
  268. temp = value.substring(start, end) + '\n'
  269. ret += temp //凭借最终的字符串
  270. }
  271. return ret
  272. } else {
  273. return value
  274. }
  275. }
  276. }
  277. },
  278. yAxis: {
  279. axisLabel: {
  280. formatter: '{value} %'
  281. },
  282. show: false,
  283. axisLine: {
  284. lineStyle: {
  285. color: '#00FF00',
  286. width: 8 //这里是为了突出显示加上的
  287. }
  288. }
  289. },
  290. series: [
  291. {
  292. name: '',
  293. type: 'line',
  294. data: [],
  295. barWidth: 30,
  296. label: {
  297. normal: {
  298. show: true,
  299. position: 'top',
  300. formatter: '{c}'
  301. }
  302. },
  303. //配置样式
  304. itemStyle: {
  305. //通常情况下:
  306. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  307. normal: {
  308. color: function(params) {
  309. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  310. var colorList = [
  311. ["#A9E0F3", "#9FBDFC"],
  312. ["#FFD7C0", "#FF9994"],
  313. ["#D7C3FD", "#B3A8F7"],
  314. ];
  315. var index = params.dataIndex
  316. if (params.dataIndex >= colorList.length) {
  317. index = params.dataIndex % colorList.length
  318. }
  319. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  320. { offset: 0, color: colorList[index][0] },
  321. // { offset: 0.5, color: colorList[index][1] },
  322. { offset: 1, color: colorList[index][1] }
  323. ])
  324. },
  325. lineStyle:{
  326. color:'#409eff' //改变折线颜色
  327. },
  328. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  329. },
  330. //鼠标悬停时:
  331. emphasis: {
  332. shadowBlur: 10,
  333. shadowOffsetX: 0,
  334. shadowColor: 'rgba(0, 0, 0, 0.5)'
  335. }
  336. }
  337. }
  338. ],
  339. dataZoom: [
  340. {
  341. // Y轴固定,让内容滚动
  342. type: 'slider',
  343. show: false,
  344. xAxisIndex: [0],
  345. start: 1,
  346. end: 20, // 设置X轴刻度之间的间隔(根据数据量来调整)
  347. zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
  348. },
  349. {
  350. type: 'inside',
  351. xAxisIndex: [0],
  352. start: 1,
  353. end: 20,
  354. zoomLock: true // 锁定区域禁止缩放
  355. }
  356. ]
  357. }
  358. }
  359. },
  360. methods: {
  361. handleChange(val){
  362. this.query.patient_id = val.id
  363. this.query.page = 1
  364. this.patient_name = val.name
  365. this.GetPatientInspectionIndexBarChart(this.query)
  366. this.GetPatientInspectionIndexChart(this.query)
  367. },
  368. handleSelect(val) {
  369. this.query.patient_id = val.id
  370. this.query.page = 1
  371. this.patient_name = val.name
  372. this.GetPatientInspectionIndexBarChart(this.query)
  373. this.GetPatientInspectionIndexChart(this.query)
  374. for (let i = 0; i< this.patientsData.length; i++){
  375. if(this.patientsData[i].id == val.id){
  376. this.$refs.table.setCurrentRow(this.patientsData[i])
  377. }
  378. }
  379. },
  380. querySearchAsync(keyword, cb) {
  381. let key = ''
  382. if (keyword != undefined) {
  383. key = keyword
  384. }
  385. let searchArray = []
  386. PostSearch(key).then(response => {
  387. if (response.data.state == 1) {
  388. searchArray = response.data.data.patient
  389. cb(searchArray)
  390. } else {
  391. cb([])
  392. }
  393. })
  394. },
  395. getCurrentOrgPatients() {
  396. getCurrentOrgPatients().then(response => {
  397. if (response.data.state == 1) {
  398. var patients = response.data.data.patients
  399. this.patientsData = patients
  400. GetDefalutPatient()
  401. .then(rs => {
  402. var resp = rs.data
  403. if (resp.state == 1) {
  404. this.query.patient_id =resp.data.patient.id
  405. this.patient_name = resp.data.patient.name
  406. for (let i = 0; i< this.patientsData.length; i++){
  407. if(this.patientsData[i].id == resp.data.patient.id){
  408. this.$refs.table.setCurrentRow(this.patientsData[i])
  409. }
  410. }
  411. this.GetInspectionIndexInit()
  412. } else {
  413. }
  414. })
  415. .catch(error => {
  416. })
  417. }
  418. })
  419. },
  420. changeProject(val) {
  421. this.query.page = 1
  422. let item_inspection_reference = []
  423. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  424. if (this.all_inspection_reference[i].project_id == val) {
  425. item_inspection_reference.push(this.all_inspection_reference[i])
  426. }
  427. }
  428. this.item_columns = item_inspection_reference
  429. var projectInfo = this.getPojectInfo(this.item_columns[0].project_id, this.item_columns[0].item_id)
  430. this.query.project_id = projectInfo.project_id
  431. this.query.item_id = projectInfo.item_id
  432. this.item_name = projectInfo.item_name
  433. this.query.range_type = projectInfo.range_type
  434. this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.item_id)
  435. }, changeItem(val) {
  436. this.query.page = 1
  437. this.query.item_id = val
  438. var projectInfo = this.getPojectInfo(this.query.project_id, val)
  439. this.item_name = projectInfo.item_name
  440. this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.item_id)
  441. }, changeRangeValue(val) {
  442. this.query.range_value = val
  443. this.query.page = 1
  444. // this.GetInspectionIndexTable(this.query)
  445. }, GetInspectionIndexInit() {
  446. GetInspectionIndexInit()
  447. .then(rs => {
  448. var resp = rs.data
  449. if (resp.state == 1) {
  450. let project = []
  451. let item = []
  452. this.all_inspection_reference = resp.data.references
  453. for(let i = 0; i < this.all_inspection_reference.length; i++){
  454. if(this.all_inspection_reference[i].org_id == 0){
  455. this.all_inspection_reference[i].item_id = this.all_inspection_reference[i].id
  456. }
  457. }
  458. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  459. project.push(this.all_inspection_reference[i])
  460. }
  461. var obj = {}
  462. //去重复
  463. project = project.reduce((cur, next) => {
  464. obj[next.project_id] ? '' : (obj[next.project_id] = true && cur.push(next))
  465. return cur
  466. }, [])
  467. this.project_columns = project
  468. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  469. if (this.all_inspection_reference[i].project_id == this.project_columns[0].project_id) {
  470. item.push(this.all_inspection_reference[i])
  471. }
  472. }
  473. this.item_columns = item
  474. this.item_name = item[0].item_name
  475. var projectInfo = this.getPojectInfo(this.project_columns[0].project_id, this.item_columns[0].item_id)
  476. this.query.project_id = projectInfo.project_id
  477. this.query.item_id = projectInfo.item_id
  478. this.query.range_type = projectInfo.range_type
  479. this.GetRangeValue(projectInfo.range_type, projectInfo.project_id, projectInfo.item_id)
  480. } else {
  481. this.$message.error(resp.msg)
  482. }
  483. })
  484. .catch(error => {
  485. })
  486. },
  487. getPojectInfo(project_id, item_id) {
  488. for (let i = 0; i < this.all_inspection_reference.length; i++) {
  489. if (this.all_inspection_reference[i].project_id == project_id && this.all_inspection_reference[i].id == item_id) {
  490. return this.all_inspection_reference[i]
  491. }
  492. }
  493. return null
  494. }, changeTime(val) {
  495. var time = this.getTimestamp(val) - this.getTimestamp(this.query.end_time)
  496. if (time > 0) {
  497. this.$message.error('结束时间不能小于开始时间')
  498. } else {
  499. // this.getDialysisList()
  500. this.query.page = 1
  501. this.GetInspectionIndexChart(this.query)
  502. this.GetInspectionIndexTable(this.query)
  503. }
  504. },
  505. changeEndTime(val) {
  506. var time =
  507. this.getTimestamp(val) - this.getTimestamp(this.query.start_time)
  508. if (time < 0) {
  509. this.$message.error('结束时间不能小于开始时间')
  510. } else {
  511. this.query.page = 1
  512. this.GetInspectionIndexChart(this.query)
  513. this.GetInspectionIndexTable(this.query)
  514. }
  515. }, GetRangeValue(range_type, project_id, id) {
  516. let params = {
  517. range_type: range_type,
  518. project_id: project_id,
  519. item_id: id
  520. }
  521. GetRangeValue(params)
  522. .then(rs => {
  523. var resp = rs.data
  524. if (resp.state == 1) {
  525. if (range_type == 1) {
  526. this.range_value_columns = []
  527. this.range_value_columns.push('全部')
  528. this.range_value_columns.push('小于' + resp.data.range_vaule[0])
  529. this.range_value_columns.push(resp.data.range_vaule[0] + '~' + resp.data.range_vaule[1])
  530. this.range_value_columns.push('大于' + resp.data.range_vaule[1])
  531. this.query.range_value = '全部'
  532. } else {
  533. this.range_value_columns = []
  534. this.range_value_columns.push('全部')
  535. for (let i = 0; i < resp.data.range_vaule.length; i++) {
  536. this.range_value_columns.push(resp.data.range_vaule[i])
  537. }
  538. this.query.range_value = '全部'
  539. }
  540. this.GetPatientInspectionIndexBarChart(this.query)
  541. this.GetPatientInspectionIndexChart(this.query)
  542. } else {
  543. this.$message.error(resp.msg)
  544. }
  545. }
  546. )
  547. .catch(error => {
  548. })
  549. },
  550. GetPatientInspectionIndexBarChart(params) {
  551. this.options.xAxis.data = []
  552. this.options.series[0].data = []
  553. GetPatientInspectionIndexBarChart(params)
  554. .then(rs => {
  555. var resp = rs.data
  556. if (resp.state == 1) {
  557. for (let i = 0; i < resp.data.data.length; i++) {
  558. this.options.xAxis.data.push(resp.data.data[i].name)
  559. this.options.series[0].data.push(resp.data.data[i].total)
  560. this.percent.push(resp.data.data[i].ratio)
  561. }
  562. } else {
  563. this.$toast({
  564. message: resp.msg
  565. })
  566. }
  567. })
  568. .catch(error => {
  569. })
  570. },
  571. GetPatientInspectionIndexChart(params) {
  572. this.options2.xAxis.data = []
  573. this.options2.series[0].data = []
  574. GetPatientInspectionIndexChart(params)
  575. .then(rs => {
  576. var resp = rs.data
  577. if (resp.state == 1) {
  578. for (let i = 0; i < resp.data.data.length; i++) {
  579. this.options2.xAxis.data.push(resp.data.data[i].date)
  580. this.options2.series[0].data.push(resp.data.data[i].value)
  581. }
  582. this.getArrLength(this.options2.xAxis.data)
  583. } else {
  584. }
  585. })
  586. .catch(error => {
  587. })
  588. }, getTimestamp(time) {
  589. // 把时间日期转成时间戳
  590. return new Date(time).getTime() / 1000;
  591. },
  592. getArrLength(result){
  593. if(result.length > 10){
  594. var dataZoom_end = (10/result.length)*100;
  595. this.options2.dataZoom[0].end = dataZoom_end
  596. }else{
  597. var dataZoom_end = 100;
  598. this.options2.dataZoom[0].end = dataZoom_end
  599. }
  600. }
  601. }, created() {
  602. var date = new Date()
  603. var year = date.getFullYear() //获取完整的年份(4位)
  604. var month = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1).toString() : date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  605. var day = date.getDate() < 10 ? '0' + date.getDate().toString() : date.getDate() //获取当前日(1-31)
  606. var last_month = date.getMonth() < 10 ? '0' + date.getMonth().toString() : date.getMonth() //获取当前月份(0-11,0代表1月)
  607. this.query.end_time = year + '-' + month + '-' + day
  608. this.query.start_time = year + '-' + last_month + '-' + day
  609. this.getCurrentOrgPatients()
  610. }
  611. }
  612. </script>
  613. <style lang="scss" scoped>
  614. .tableTitle {
  615. font-size: 16px;
  616. color: #000;
  617. font-weight: bold;
  618. margin-bottom: 10px;
  619. }
  620. </style>
  621. <style lang="scss">
  622. .page_personal {
  623. .cell {
  624. text-align: center;
  625. }
  626. .el-button--medium {
  627. padding: 10px 8px;
  628. }
  629. .el-form-item {
  630. margin-bottom: 0;
  631. }
  632. }
  633. </style>