time.vue 26KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. </div>
  6. <div class="app-container">
  7. <el-tabs v-model="activeName" @tab-click="handleClick">
  8. <el-tab-pane label="按时间分组" name="first"></el-tab-pane>
  9. <el-tab-pane label="按项目分组" name="second"></el-tab-pane>
  10. </el-tabs>
  11. <div class="cell clearfix">
  12. <!-- <el-select v-model="lapseto" placeholder="请选择" style="width:120px;margin-right:10px" @change="changeLapseto">
  13. <el-option
  14. v-for="item in options"
  15. :key="item.value"
  16. :label="item.label"
  17. :value="item.value"
  18. ></el-option>
  19. </el-select> -->
  20. <el-select v-model="type" placeholder="请选择" @change="chooseType" style="margin-right:10px">
  21. <el-option
  22. v-for="item in options1"
  23. :key="item.value"
  24. :label="item.label"
  25. :value="item.value"
  26. ></el-option>
  27. </el-select>
  28. <div v-if="type == '自定义'">
  29. <label class="title">
  30. <span class="name">日期查询</span> :
  31. </label>
  32. <el-date-picker
  33. v-model="listQuery.start_time"
  34. prefix-icon="el-icon-date"
  35. @change="changeTime"
  36. :editable="false"
  37. style="width: 196px;"
  38. type="date"
  39. placeholder="选择日期时间"
  40. align="right"
  41. format="yyyy-MM-dd"
  42. value-format="yyyy-MM-dd"
  43. ></el-date-picker>
  44. <span class>-</span>
  45. <el-date-picker
  46. v-model="listQuery.end_time"
  47. prefix-icon="el-icon-date"
  48. @change="changeEndTime"
  49. :editable="false"
  50. style="width: 196px;"
  51. type="date"
  52. placeholder="选择日期时间"
  53. align="right"
  54. format="yyyy-MM-dd"
  55. value-format="yyyy-MM-dd"
  56. ></el-date-picker>
  57. </div>
  58. </div>
  59. <div class="cell clearfix">
  60. <div class="time newLi" v-if="type == '按季度统计对比'">
  61. <ul class>
  62. <li
  63. :class="item.state == quarterType ? 'active' : ''"
  64. @click="chooseQuarter(item.state)"
  65. v-for="item in quarter"
  66. :key="item.value"
  67. >{{ item.label }}
  68. </li>
  69. </ul>
  70. </div>
  71. <div class="time newLi" v-if="type == '按月份统计对比'">
  72. <ul class>
  73. <li
  74. :class="item.state == monthType ? 'active' : ''"
  75. @click="chooseMonth(item.state)"
  76. v-for="item in month"
  77. :key="item.value"
  78. >{{ item.label }}
  79. </li>
  80. </ul>
  81. </div>
  82. </div>
  83. <div class="cell clearfix">
  84. <label class="title"> <span class="name">转归状态</span> : </label>
  85. <div class="time">
  86. <ul class>
  87. <li
  88. :class="item.lapseto == lapseto ? 'active' : ''"
  89. @click="changeLapseto(item.lapseto)"
  90. v-for="item in lapsetoState"
  91. :key="item.value"
  92. >
  93. {{ item.label }}
  94. </li>
  95. </ul>
  96. </div>
  97. </div>
  98. <div class="cell clearfix">
  99. <label class="title"> <span class="name">患者来源</span> : </label>
  100. <div class="time">
  101. <ul class>
  102. <li
  103. :class="item.source == originType ? 'active' : ''"
  104. @click="selectOrigin(item.source)"
  105. v-for="item in originState"
  106. :key="item.value"
  107. >
  108. {{ item.label }}
  109. </li>
  110. </ul>
  111. </div>
  112. </div>
  113. <div class="cell clearfix">
  114. <p class="chartTitle">统计图</p>
  115. </div>
  116. <div class="cell clearfix">
  117. <p class="point"></p>
  118. <p class="pointTitle">达标率</p>
  119. </div>
  120. <div v-loading="isLoading">
  121. <line-chart :options="chart"></line-chart>
  122. </div>
  123. <div class="cell clearfix">
  124. <p class="point"></p>
  125. <p class="pointTitle">指标正常范围值</p>
  126. </div>
  127. <div class="cell clearfix newDisplay">
  128. <span v-for="(item,index) in normData" :key="index" class="index">
  129. <span v-if="item.is_status == 1">{{ item.item_name }}</span>
  130. <span v-if="item.is_status == 0 && item.inspection_major == 0 && item.inspection_minor == -1">收缩压</span>
  131. <span v-if="item.is_status == 0 && item.inspection_major == 0 && item.inspection_minor == -2">舒张压</span>
  132. <span v-if="item.range_type == 1 && item.is_status == 1">({{ item.min_range }}-{{ item.large_range }})</span>
  133. <span v-if="item.range_type == 2 && item.is_status == 1">({{ item.range_value }})</span>
  134. <span v-if="item.range_type == 0 && item.is_status == 0">({{ item.min_range }}-{{ item.large_range }})</span>
  135. </span>
  136. </div>
  137. </div>
  138. </div>
  139. </template>
  140. <script>
  141. const moment = require('moment')
  142. import echarts from 'echarts'
  143. import LineChart from '../../qcd/components/LineChart'
  144. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  145. import { getFirstQuarter, getNormData } from '@/api/common/common'
  146. export default {
  147. components: {
  148. LineChart,
  149. BreadCrumb
  150. },
  151. data() {
  152. return {
  153. pickerOptions: {
  154. disabledDate(time) {
  155. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000
  156. return time.getTime() > Date.now() || time.getTime() < threeMonths
  157. }
  158. },
  159. isLoading: false,
  160. sortOne: 0,
  161. sortTwo: 0,
  162. modetype: 0,
  163. startime: '',
  164. endtime: '',
  165. activeName: 'first',
  166. modesData: {
  167. xAxis: [],
  168. series: []
  169. }, lapsetoType: 0,
  170. lapsetoState: [
  171. { value: 0, label: '全部', source: 0, lapseto: 0 },
  172. { value: 1, label: '转出', source: 0, lapseto: 2 },
  173. { value: 2, label: '留治', source: 0, lapseto: 1 }
  174. ],
  175. originType:0,
  176. originState: [
  177. { value: 0, label: '全部', source: 0},
  178. { value: 2, label: '住院', source: 2},
  179. { value: 1, label: '门诊', source: 1}
  180. ],
  181. crumbs: [
  182. { path: false, name: '质控管理' },
  183. { path: false, name: '科室质控达标统计' },
  184. { path: false, name: '按时间分组' }
  185. ],
  186. normData: [],
  187. newArrData: [],
  188. listQuery: {
  189. start_time: '',
  190. end_time: '',
  191. page: 1,
  192. limit: 10
  193. },
  194. lapseto: 0,
  195. options: [
  196. {
  197. value: 0,
  198. label: '全部'
  199. },
  200. {
  201. value: 1,
  202. label: '留治'
  203. },
  204. {
  205. value: 2,
  206. label: '转出'
  207. }
  208. ],
  209. value: '请选项',
  210. options1: [
  211. {
  212. value: '按季度统计对比',
  213. label: '按季度统计对比'
  214. },
  215. {
  216. value: '按月份统计对比',
  217. label: '按月份统计对比'
  218. },
  219. {
  220. value: '自定义',
  221. label: '自定义'
  222. }
  223. ],
  224. type: '按季度统计对比',
  225. quarter: [
  226. { value: 0, label: '第一季度', state: 0 },
  227. { value: 1, label: '第二季度', state: 1 },
  228. { value: 2, label: '第三季度', state: 2 },
  229. { value: 3, label: '第四季度', state: 3 }
  230. ],
  231. quarterType: 0,
  232. month: [
  233. { value: 0, label: '一月', state: 0 },
  234. { value: 1, label: '二月', state: 1 },
  235. { value: 2, label: '三月', state: 2 },
  236. { value: 3, label: '四月', state: 3 },
  237. { value: 4, label: '五月', state: 4 },
  238. { value: 5, label: '六月', state: 5 },
  239. { value: 6, label: '七月', state: 6 },
  240. { value: 7, label: '八月', state: 7 },
  241. { value: 8, label: '九月', state: 8 },
  242. { value: 9, label: '十月', state: 9 },
  243. { value: 10, label: '十一月', state: 10 },
  244. { value: 11, label: '十二月', state: 11 }
  245. ],
  246. monthType: 0,
  247. chart: {
  248. // title: {
  249. // text: "ECharts 入门示例"
  250. // },
  251. tooltip: {},
  252. // legend: {
  253. // data: ["达标率"],
  254. // left: 0
  255. // },
  256. xAxis: {
  257. data: []
  258. },
  259. yAxis: {
  260. axisLabel: {
  261. formatter: '{value}%'
  262. },
  263. show: false
  264. },
  265. series: [
  266. {
  267. name: '达标率',
  268. type: 'bar',
  269. data: [],
  270. barWidth: 30,
  271. label: {
  272. normal: {
  273. show: true,
  274. position: 'top',
  275. formatter: '{c}%'
  276. }
  277. },
  278. //配置样式
  279. itemStyle: {
  280. //通常情况下:
  281. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  282. normal: {
  283. color: function(params) {
  284. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  285. var colorList = [
  286. ['#A9E0F3', '#9FBDFC'],
  287. ['#A9E0F3', '#9FBDFC'],
  288. ['#A9E0F3', '#9FBDFC'],
  289. ['#FFD7C0', '#FF9994'],
  290. ['#FFD7C0', '#FF9994'],
  291. ['#FFD7C0', '#FF9994'],
  292. ['#D7C3FD', '#B3A8F7'],
  293. ['#D7C3FD', '#B3A8F7'],
  294. ['#D7C3FD', '#B3A8F7']
  295. ]
  296. var index = params.dataIndex
  297. if (params.dataIndex >= colorList.length) {
  298. index = params.dataIndex % colorList.length
  299. }
  300. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  301. { offset: 0, color: colorList[index][0] },
  302. // { offset: 0.5, color: colorList[index][1] },
  303. { offset: 1, color: colorList[index][1] }
  304. ])
  305. },
  306. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  307. },
  308. //鼠标悬停时:
  309. emphasis: {
  310. shadowBlur: 10,
  311. shadowOffsetX: 0,
  312. shadowColor: 'rgba(0, 0, 0, 0.2)'
  313. }
  314. }
  315. }
  316. ],
  317. dataZoom: [
  318. {
  319. // Y轴固定,让内容滚动
  320. type: 'slider',
  321. show: false,
  322. xAxisIndex: [0],
  323. start: 1,
  324. end: 20, // 设置X轴刻度之间的间隔(根据数据量来调整)
  325. zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
  326. },
  327. {
  328. type: 'inside',
  329. xAxisIndex: [0],
  330. start: 1,
  331. end: 20,
  332. zoomLock: true // 锁定区域禁止缩放
  333. }
  334. ]
  335. },
  336. syslarge: 0,
  337. sysmin: 0,
  338. dialarge: 0,
  339. diamin: 0
  340. }
  341. },
  342. methods: {
  343. handleClick() {
  344. if (this.activeName == 'second') {
  345. this.$router.push({ path: '/qcd/officesControlAnalysis/project' })
  346. }
  347. },
  348. changeTime(val) {
  349. var time = this.getTimestamp(val) - this.getTimestamp(this.listQuery.end_time)
  350. if (time > 0) {
  351. this.$message.error('结束时间不能小于开始时间')
  352. this.listQuery.start_time = ''
  353. } else {
  354. this.getlist()
  355. }
  356. },
  357. changeLapseto(val) {
  358. if (val == 0) {
  359. this.lapseto = 0
  360. this.getlist()
  361. }
  362. if (val == 1) {
  363. this.lapseto = 1
  364. this.getlist()
  365. }
  366. if (val == 2) {
  367. this.lapseto = 2
  368. this.getlist()
  369. }
  370. },
  371. changeEndTime(val) {
  372. var time =
  373. this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time)
  374. if (time < 0) {
  375. this.$message.error('结束时间不能小于开始时间')
  376. this.listQuery.end_time = ''
  377. } else {
  378. this.getlist()
  379. }
  380. },
  381. getTimestamp(time) {
  382. // 把时间日期转成时间戳
  383. return new Date(time).getTime() / 1000
  384. },
  385. selectLapseTo(state) {
  386. this.lapsetoType = state
  387. this.getlist()
  388. // this.listQuery.state = state
  389. },selectOrigin(state) {
  390. this.originType = state
  391. // this.listQuery.state = state
  392. this.getlist()
  393. },
  394. chooseType(val) {
  395. this.modesData.series = []
  396. this.modesData.xAxis = []
  397. this.type = val
  398. if (val == '按月份统计对比') {
  399. this.modetype = 1
  400. this.monthType = 0
  401. this.getlist()
  402. }
  403. if (val == '按季度统计对比') {
  404. this.modetype = 0
  405. this.getlist()
  406. }
  407. if (val == '自定义') {
  408. this.modetype = 2
  409. }
  410. },
  411. chooseQuarter(quarter) {
  412. this.quarterType = quarter
  413. //第一季度
  414. if (quarter === 0) {
  415. this.modetype = 0
  416. this.getlist()
  417. return false
  418. }
  419. //第二季度
  420. if (quarter === 1) {
  421. this.modetype = 0
  422. this.getlist()
  423. return false
  424. }
  425. //第三季度
  426. if (quarter === 2) {
  427. this.modetype = 0
  428. this.getlist()
  429. return false
  430. }
  431. //第四季度
  432. if (quarter === 3) {
  433. this.modetype = 0
  434. this.getlist()
  435. return false
  436. }
  437. },
  438. chooseMonth(month) {
  439. //1月
  440. if (month == 0) {
  441. this.modetype = 1
  442. this.monthType = month
  443. this.getlist()
  444. return false
  445. }
  446. //2月
  447. if (month == 1) {
  448. this.modetype = 1
  449. this.monthType = month
  450. this.getlist()
  451. return false
  452. }
  453. //
  454. //3月
  455. if (month == 2) {
  456. this.modetype = 1
  457. this.monthType = month
  458. this.getlist()
  459. return false
  460. }
  461. //4月
  462. if (month == 3) {
  463. this.modetype = 1
  464. this.monthType = month
  465. this.getlist()
  466. return false
  467. }
  468. //5月
  469. if (month == 4) {
  470. this.modetype = 1
  471. this.monthType = month
  472. this.getlist()
  473. return false
  474. }
  475. //6月
  476. if (month == 5) {
  477. this.modetype = 1
  478. this.monthType = month
  479. this.getlist()
  480. return false
  481. }
  482. //7月
  483. if (month == 6) {
  484. this.monthType = month
  485. this.modetype = 1
  486. this.getlist()
  487. return false
  488. }
  489. //8月
  490. if (month == 7) {
  491. this.monthType = month
  492. this.modetype = 1
  493. this.getlist()
  494. return false
  495. }
  496. //9月
  497. if (month == 8) {
  498. this.monthType = month
  499. this.modetype = 1
  500. this.getlist()
  501. return false
  502. }
  503. //10月
  504. if (month == 9) {
  505. this.monthType = month
  506. this.modetype = 1
  507. this.getlist()
  508. return false
  509. }
  510. //11月
  511. if (month == 10) {
  512. this.monthType = month
  513. this.modetype = 1
  514. this.getlist()
  515. return false
  516. }
  517. //12月
  518. if (month == 11) {
  519. this.monthType = month
  520. this.modetype = 1
  521. this.getlist()
  522. return false
  523. }
  524. },
  525. getNormData() {
  526. getNormData().then(response => {
  527. if (response.data.state === 1) {
  528. var newArr = []
  529. var normdata = response.data.data.normdata
  530. newArr = normdata
  531. // console.log("指标正常范围",normdata)
  532. var bloodpressure = response.data.data.bloodPressure
  533. console.log('bloodPressure', bloodpressure)
  534. for (let i = 0; i < bloodpressure.length; i++) {
  535. if (bloodpressure[i].inspection_major == 0 && bloodpressure[i].inspection_minor == -1 && bloodpressure[i].is_status == 0) {
  536. bloodpressure[i].item_name = '收缩压'
  537. this.sortOne = bloodpressure[i].sort
  538. this.syslarge = parseInt(bloodpressure[i].large_range)
  539. this.sysmin = parseInt(bloodpressure[i].min_range)
  540. }
  541. if (bloodpressure[i].inspection_major == 0 && bloodpressure[i].inspection_minor == -2 && bloodpressure[i].is_status == 0) {
  542. bloodpressure[i].item_name = '舒张压'
  543. this.sortTwo = bloodpressure[i].sort
  544. this.dialarge = parseInt(bloodpressure[i].large_range)
  545. this.diamin = parseInt(bloodpressure[i].min_range)
  546. }
  547. }
  548. // console.log("血压数据",bloodpressure)
  549. bloodpressure.map(item => {
  550. newArr.push(item)
  551. })
  552. var newarr = newArr.sort((a, b) => {
  553. return a.sort - b.sort
  554. })
  555. // console.log("normdata",newarr)
  556. this.normData = newarr
  557. this.getlist()
  558. }
  559. })
  560. },
  561. //第一季度
  562. getlist() {
  563. this.modesData.series = []
  564. this.modesData.xAxis = []
  565. //本月的开始时间
  566. //第一季度
  567. if (this.modetype == 0 && this.quarterType == 0) {
  568. this.startime = moment().startOf('year').format('YYYY-MM-DD')
  569. this.endtime = moment().month(2).endOf('month').format('YYYY-MM-DD')
  570. }
  571. //第二季度
  572. if (this.modetype == 0 && this.quarterType == 1) {
  573. this.startime = moment().month(3).startOf('month').format('YYYY-MM-DD')
  574. this.endtime = moment().month(5).endOf('month').format('YYYY-MM-DD')
  575. }
  576. //第三季度
  577. if (this.modetype == 0 && this.quarterType == 2) {
  578. this.startime = moment().month(6).startOf('month').format('YYYY-MM-DD')
  579. this.endtime = moment().month(8).endOf('month').format('YYYY-MM-DD')
  580. }
  581. //第四季度
  582. if (this.modetype == 0 && this.quarterType == 3) {
  583. this.startime = moment().month(9).startOf('month').format('YYYY-MM-DD')
  584. this.endtime = moment().month(11).endOf('month').format('YYYY-MM-DD')
  585. }
  586. //1月
  587. if (this.modetype == 1 && this.monthType == 0) {
  588. this.startime = moment().month(0).startOf('month').format('YYYY-MM-DD')
  589. this.endtime = moment().month(0).endOf('month').format('YYYY-MM-DD')
  590. }
  591. //2 月
  592. if (this.modetype == 1 && this.monthType == 1) {
  593. this.startime = moment().month(1).startOf('month').format('YYYY-MM-DD')
  594. this.endtime = moment().month(1).endOf('month').format('YYYY-MM-DD')
  595. }
  596. //3 月
  597. if (this.modetype == 1 && this.monthType == 2) {
  598. this.startime = moment().month(2).startOf('month').format('YYYY-MM-DD')
  599. this.endtime = moment().month(2).endOf('month').format('YYYY-MM-DD')
  600. }
  601. //4月
  602. if (this.modetype == 1 && this.monthType == 3) {
  603. this.startime = moment().month(3).startOf('month').format('YYYY-MM-DD')
  604. this.endtime = moment().month(3).endOf('month').format('YYYY-MM-DD')
  605. }
  606. //5月
  607. if (this.modetype == 1 && this.monthType == 4) {
  608. this.startime = moment().month(4).startOf('month').format('YYYY-MM-DD')
  609. this.endtime = moment().month(4).endOf('month').format('YYYY-MM-DD')
  610. }
  611. //6月
  612. if (this.modetype == 1 && this.monthType == 5) {
  613. this.startime = moment().month(5).startOf('month').format('YYYY-MM-DD')
  614. this.endtime = moment().month(5).endOf('month').format('YYYY-MM-DD')
  615. }
  616. //7月
  617. if (this.modetype == 1 && this.monthType == 6) {
  618. this.startime = moment().month(6).startOf('month').format('YYYY-MM-DD')
  619. this.endtime = moment().month(6).endOf('month').format('YYYY-MM-DD')
  620. }
  621. //8月
  622. if (this.modetype == 1 && this.monthType == 7) {
  623. this.startime = moment().month(7).startOf('month').format('YYYY-MM-DD')
  624. this.endtime = moment().month(7).endOf('month').format('YYYY-MM-DD')
  625. }
  626. //9月
  627. if (this.modetype == 1 && this.monthType == 8) {
  628. this.startime = moment().month(8).startOf('month').format('YYYY-MM-DD')
  629. this.endtime = moment().month(8).endOf('month').format('YYYY-MM-DD')
  630. }
  631. //10月
  632. if (this.modetype == 1 && this.monthType == 9) {
  633. this.startime = moment().month(9).startOf('month').format('YYYY-MM-DD')
  634. this.endtime = moment().month(9).endOf('month').format('YYYY-MM-DD')
  635. }
  636. //11月
  637. if (this.modetype == 1 && this.monthType == 10) {
  638. this.startime = moment().month(10).startOf('month').format('YYYY-MM-DD')
  639. this.endtime = moment().month(10).endOf('month').format('YYYY-MM-DD')
  640. }
  641. //12月
  642. if (this.modetype == 1 && this.monthType == 11) {
  643. this.startime = moment().month(11).startOf('month').format('YYYY-MM-DD')
  644. this.endtime = moment().month(11).endOf('month').format('YYYY-MM-DD')
  645. }
  646. if (this.modetype == 2) {
  647. this.startime = this.listQuery.start_time
  648. this.endtime = this.listQuery.end_time
  649. }
  650. const params = {
  651. lapseto: this.lapseto,
  652. startime: this.startime,
  653. endtime: this.endtime,
  654. origin:this.originType,
  655. }
  656. this.isLoading = true
  657. getFirstQuarter(params).then(response => {
  658. if (response.data.state === 1) {
  659. this.isLoading = false
  660. var count = response.data.data.count
  661. var countwo = response.data.data.countwo
  662. var systolicTotal = response.data.data.systolicTotal
  663. var sysstandTotal = 0
  664. var systolic = response.data.data.systolic
  665. var sysarr = []
  666. for (let i = 0; i < systolic.length; i++) {
  667. if (systolic[i].systolic_blood_pressure >= this.sysmin && systolic[i].systolic_blood_pressure <= this.syslarge) {
  668. sysarr.push(systolic[i])
  669. }
  670. }
  671. sysstandTotal = sysarr.length
  672. var diastotal = response.data.data.diastotal
  673. var diasstandtotal = 0
  674. var diastolic = response.data.data.diastolic
  675. var diaArr = []
  676. for (let i = 0; i < diastolic.length; i++) {
  677. if (diastolic[i].diastolic_blood_pressure >= this.diamin && diastolic[i].diastolic_blood_pressure <= this.dialarge) {
  678. diaArr.push(diastolic[i])
  679. }
  680. }
  681. diasstandtotal = diaArr.length
  682. var normData = response.data.data.normData
  683. var newArr = [
  684. { item_id: 0, Total: 0, Count: 0, sort: 0 },
  685. { item_id: 0, Total: 0, Count: 0, sort: 0 }
  686. ]
  687. for (let i = 0; i < newArr.length; i++) {
  688. if (sysstandTotal == 0) {
  689. newArr[0].Total = 1
  690. newArr[0].Count = sysstandTotal
  691. newArr[0].sort = this.sortOne
  692. } else {
  693. newArr[0].Total = systolicTotal
  694. newArr[0].Count = sysstandTotal
  695. newArr[0].sort = this.sortOne
  696. }
  697. if (diasstandtotal == 0) {
  698. newArr[1].Total = 1
  699. newArr[1].Count = diasstandtotal
  700. newArr[1].sort = this.sortTwo
  701. } else {
  702. newArr[1].Total = diastotal
  703. newArr[1].Count = diasstandtotal
  704. newArr[1].sort = this.sortTwo
  705. }
  706. }
  707. countwo.map(item => {
  708. count.push(item)
  709. })
  710. //获取已经配置的数据
  711. var arr = []
  712. for (let i = 0; i < count.length; i++) {
  713. for (let j = 0; j < normData.length; j++) {
  714. if (count[i].item_id == normData[j].inspection_minor) {
  715. arr.push(count[i])
  716. }
  717. }
  718. }
  719. console.log("count23322322332",count)
  720. console.log("normdate23233323",normData)
  721. var arrtwo = this.arrayDate(count, normData)
  722. console.log("23323332323232323223",arrtwo)
  723. for (let i = 0; i < arrtwo.length; i++) {
  724. this.$set(arrtwo[i], 'Count', 0)
  725. }
  726. for (let i = 0; i < arrtwo.length; i++) {
  727. this.$set(arrtwo[i], 'Total', 1)
  728. }
  729. arrtwo.map(item => {
  730. arr.push(item)
  731. })
  732. newArr.map(item => {
  733. arr.push(item)
  734. })
  735. arr.sort(this.compare('sort'))
  736. console.log("wwowwoowwowo",this.normData)
  737. console.log("arr23323323332",arr)
  738. for (const key in this.normData) {
  739. this.modesData.xAxis.push(this.normData[key].item_name)
  740. if (key in arr) {
  741. this.modesData.series.push(((parseInt(arr[key].Count) / parseInt(arr[key].Total)) * 100).toFixed(1))
  742. } else {
  743. this.modesData.series.push(0)
  744. }
  745. }
  746. this.chart.series[0].data = this.modesData.series
  747. this.chart.xAxis.data = this.modesData.xAxis
  748. this.getArrLength(this.chart.xAxis.data)
  749. } else {
  750. this.isLoading = false
  751. }
  752. })
  753. },
  754. compare(property) {
  755. return function(a, b) {
  756. var value1 = a[property]
  757. var value2 = b[property]
  758. return value1 - value2
  759. }
  760. },
  761. arrayDate(array1, array2) {
  762. var array1 = array1
  763. var array2 = array2
  764. var result = []
  765. for (var i = 0; i < array2.length; i++) {
  766. var obj = array2[i]
  767. var num = obj.inspection_minor //staff_id 就是要对比的key
  768. var isExist = false
  769. for (var j = 0; j < array1.length; j++) {
  770. var aj = array1[j]
  771. var n = aj.item_id
  772. if (n == num) {
  773. isExist = true
  774. break
  775. }
  776. }
  777. if (!isExist) {
  778. result.push(obj)
  779. }
  780. }
  781. return result
  782. },
  783. getArrLength(result) {
  784. if (result.length > 10) {
  785. var dataZoom_end = (10 / result.length) * 100
  786. this.chart.dataZoom[0].end = dataZoom_end
  787. } else {
  788. var dataZoom_end = 100
  789. this.chart.dataZoom[0].end = dataZoom_end
  790. }
  791. }
  792. },
  793. created() {
  794. //获取指标正常范围值
  795. this.getNormData()
  796. // this.getFirstQuarter(this.lapseto,firstQuarterStart,firstQuarterEnd)
  797. }
  798. }
  799. </script>
  800. <style lang="scss" scoped>
  801. .newLi {
  802. li {
  803. background: #f5f5f6;
  804. }
  805. }
  806. .chartTitle {
  807. font-size: 16px;
  808. font-weight: bold;
  809. color: #000000;
  810. }
  811. .point {
  812. width: 13px;
  813. height: 13px;
  814. background: linear-gradient(
  815. 0deg,
  816. rgba(169, 224, 243, 1),
  817. rgba(159, 189, 252, 1)
  818. );
  819. border-radius: 7px;
  820. margin-right: 8px;
  821. }
  822. .pointTitle {
  823. font-size: 13px;
  824. }
  825. .index {
  826. color: #a09ba3;
  827. font-size: 13px;
  828. margin-right: 36px;
  829. margin-bottom: 20px;
  830. }
  831. .newDisplay {
  832. flex-wrap: wrap;
  833. padding-left: 20px;
  834. }
  835. </style>