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

patientInspectionDetail.vue 19KB

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