patientControlAnalysis.vue 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  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. <div class="page_patientControlAnalysis">
  8. <div class="cell clearfix">
  9. <el-form :inline="true" :model="listQuery">
  10. <el-form-item label>
  11. <el-autocomplete
  12. class="checkSearch"
  13. popper-class="my-autocomplete"
  14. v-model.trim="listQuery.search"
  15. :fetch-suggestions="querySearchAsync"
  16. :trigger-on-focus="false"
  17. placeholder="病人透析号/姓名"
  18. @select="handleSelect"
  19. >
  20. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  21. <template slot-scope="{ item }">
  22. <div class="name">{{ item.name }}</div>
  23. </template>
  24. </el-autocomplete>
  25. </el-form-item>
  26. </el-form>
  27. <!-- <el-select v-model="lapstor" placeholder="请选择" style="margin-right:20px;width:100px">
  28. <el-option
  29. v-for="item in options"
  30. :key="item.value"
  31. :label="item.label"
  32. :value="item.value"
  33. ></el-option>
  34. </el-select> -->
  35. <label class="title">
  36. <span class="name">日期查询</span> :
  37. </label>
  38. <el-date-picker
  39. v-model="listQuery.start_time"
  40. prefix-icon="el-icon-date"
  41. @change="changeTime"
  42. :editable="false"
  43. style="width: 196px;"
  44. type="date"
  45. placeholder="选择日期时间"
  46. align="right"
  47. format="yyyy-MM-dd"
  48. value-format="yyyy-MM-dd"
  49. ></el-date-picker>
  50. <span class>-</span>
  51. <el-date-picker
  52. v-model="listQuery.end_time"
  53. prefix-icon="el-icon-date"
  54. @change="changeEndTime"
  55. :editable="false"
  56. style="width: 196px;"
  57. type="date"
  58. placeholder="选择日期时间"
  59. align="right"
  60. format="yyyy-MM-dd"
  61. value-format="yyyy-MM-dd"
  62. ></el-date-picker>
  63. </div>
  64. <div class="cell clearfix">
  65. <p class="chartTitle">统计图</p>
  66. </div>
  67. <div class="cell clearfix">
  68. <p class="point"></p>
  69. <p class="pointTitle">指标正常范围值</p>
  70. </div>
  71. <div v-loading="isLoading">
  72. <line-chart :options="chart"></line-chart>
  73. </div>
  74. <div class="cell clearfix">
  75. <p class="chartTitle">统计表</p>
  76. </div>
  77. <div>
  78. <el-button type="primary" size="small" style="margin-bottom: 10px;" @click="toExportList">导出</el-button>
  79. <el-table :data="tableData" v-loading="isLoadingTwo" border style="width: 100%"
  80. :row-style="{ color: '#303133' }"
  81. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}">
  82. <el-table-column fixed prop="name" label="姓名" width="100"></el-table-column>
  83. <el-table-column label="透析号" width="80">
  84. <template slot-scope="scope">
  85. {{ scope.row.dialysis_no }}
  86. </template>
  87. </el-table-column>
  88. <el-table-column
  89. :label="modeItem.item_name"
  90. property="number"
  91. align="center"
  92. min-width="120"
  93. v-for="(modeItem, index) in normData"
  94. :key="index"
  95. >
  96. <template slot-scope="scope">
  97. <span
  98. v-if="scope.row.data[modeItem.item_name].range_type == 1 && scope.row.data[modeItem.item_name].inspect_value == ''">0</span>
  99. <span
  100. v-if="scope.row.data[modeItem.item_name].range_type == 1 && scope.row.data[modeItem.item_name].inspect_value !=''&& (parseInt(scope.row.data[modeItem.item_name].inspect_value) < parseInt(scope.row.data[modeItem.item_name].range_min))">
  101. <span>{{ scope.row.data[modeItem.item_name].inspect_value }}</span><span
  102. style="color:#5B98FF;margin-left:5px;">↓</span>
  103. </span>
  104. <span
  105. v-if="scope.row.data[modeItem.item_name].range_type == 1 && scope.row.data[modeItem.item_name].inspect_value !=''&& (parseInt(scope.row.data[modeItem.item_name].inspect_value) > parseInt(scope.row.data[modeItem.item_name].range_max))">
  106. <span>{{ scope.row.data[modeItem.item_name].inspect_value }}</span><span
  107. style="color:#F56C6C;margin-left:5px;">↑</span>
  108. </span>
  109. <span
  110. v-if="scope.row.data[modeItem.item_name].range_type == 1 && scope.row.data[modeItem.item_name].inspect_value !=''&& (parseInt(scope.row.data[modeItem.item_name].inspect_value) >= parseInt(scope.row.data[modeItem.item_name].range_min))&& (parseInt(scope.row.data[modeItem.item_name].inspect_value) <= parseInt(scope.row.data[modeItem.item_name].range_max)) ">{{ scope.row.data[modeItem.item_name].inspect_value }}</span>
  111. <span
  112. v-if="scope.row.data[modeItem.item_name].range_type == 2 && scope.row.data[modeItem.item_name].inspect_value !=''">
  113. <span
  114. v-if="scope.row.data[modeItem.item_name].range_value == scope.row.data[modeItem.item_name].inspect_value">
  115. <span
  116. style="color:#5B98FF;margin-left:5px;">{{ scope.row.data[modeItem.item_name].inspect_value }}</span>
  117. </span>
  118. <span
  119. v-if="scope.row.data[modeItem.item_name].range_value != scope.row.data[modeItem.item_name].inspect_value">
  120. <span
  121. style="color:#F56C6C;margin-left:5px;">{{ scope.row.data[modeItem.item_name].inspect_value }}</span>
  122. </span>
  123. </span>
  124. </template>
  125. </el-table-column>
  126. <el-table-column fixed="right" label="操作" width="100">
  127. <template slot-scope="scope">
  128. <el-button @click="handleClick(scope.row.patient_id,scope.row.inspect_date)" style="font-size:14px;"
  129. type="text" size="small">查看
  130. </el-button>
  131. </template>
  132. </el-table-column>
  133. </el-table>
  134. <el-pagination
  135. align="right"
  136. @size-change="handleSizeChange"
  137. @current-change="handleCurrentChange"
  138. :current-page="listQuery.page"
  139. :page-sizes="[10, 20, 50, 100,200,300,400,500,600]"
  140. :page-size="10"
  141. background
  142. style="margin-top:20px;"
  143. layout="total, sizes, prev, pager, next, jumper"
  144. :total="total"
  145. ></el-pagination>
  146. </div>
  147. </div>
  148. </div>
  149. </div>
  150. </template>
  151. <script>
  152. import { PostSearch } from '@/api/patient'
  153. import echarts from 'echarts'
  154. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  155. import LineChart from '../qcd/components/LineChart'
  156. import {
  157. getCartogramlist,
  158. getCurrentOrgPatients,
  159. getNormData,
  160. getPatientContorlAnalysis,
  161. getPatientsControl
  162. } from '@/api/common/common'
  163. export default {
  164. components: {
  165. LineChart,
  166. BreadCrumb
  167. },
  168. data() {
  169. return {
  170. pickerOptions: {
  171. disabledDate(time) {
  172. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000
  173. return time.getTime() > Date.now() || time.getTime() < threeMonths
  174. }
  175. },
  176. crumbs: [
  177. { path: false, name: '质控管理' },
  178. { path: false, name: '患者质控达标统计' }
  179. ],
  180. listQuery: {
  181. start_time: '',
  182. end_time: '',
  183. page: 1,
  184. limit: 10
  185. },
  186. isLoading: false,
  187. isLoadingTwo: false,
  188. // total:0,
  189. lapstor: 0,
  190. options: [
  191. {
  192. value: 0,
  193. label: '全部'
  194. },
  195. {
  196. value: 1,
  197. label: '留治'
  198. },
  199. {
  200. value: '2',
  201. label: '转出'
  202. }
  203. ],
  204. value: '',
  205. modesData: {
  206. xAxis: [],
  207. series: []
  208. },
  209. chart: {
  210. // title: {
  211. // text: "ECharts 入门示例"
  212. // },
  213. tooltip: {},
  214. // legend: {
  215. // data: ["次数"],
  216. // left: 0
  217. // },
  218. xAxis: {
  219. data: []
  220. },
  221. yAxis: {
  222. axisLabel: {
  223. formatter: '{value} %'
  224. },
  225. show: false
  226. },
  227. series: [
  228. {
  229. name: '',
  230. type: 'bar',
  231. data: [],
  232. barWidth: 30,
  233. label: {
  234. normal: {
  235. show: true,
  236. position: 'top',
  237. formatter: (params) => {
  238. if (this.obj.length > 0) {
  239. let str = ''
  240. str = '(' + this.obj[params.dataIndex] + '人' + ',' + params.data + '%' + ')'
  241. return str
  242. } else {
  243. let str = ''
  244. str = params.data + '%'
  245. return str
  246. }
  247. }
  248. }
  249. },
  250. //配置样式
  251. itemStyle: {
  252. //通常情况下:
  253. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  254. normal: {
  255. color: function(params) {
  256. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  257. var colorList = [
  258. ['#A9E0F3', '#9FBDFC'],
  259. ['#FFD7C0', '#FF9994']
  260. ]
  261. var index = params.dataIndex
  262. if (params.dataIndex >= colorList.length) {
  263. index = params.dataIndex % colorList.length
  264. }
  265. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  266. { offset: 0, color: colorList[index][0] },
  267. // { offset: 0.5, color: colorList[index][1] },
  268. { offset: 1, color: colorList[index][1] }
  269. ])
  270. },
  271. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  272. }
  273. //鼠标悬停时:
  274. // emphasis: {
  275. // shadowBlur: 10,
  276. // shadowOffsetX: 0,
  277. // shadowColor: "rgba(0, 0, 0, 0.2)"
  278. // }
  279. }
  280. }
  281. ]
  282. },
  283. patientsArr: [],
  284. tableData: [],
  285. normData: [],
  286. paitents: [],
  287. tableName: [],
  288. total: 0,
  289. obj: [],
  290. ObjectData: {},
  291. tablePatients: [],
  292. tableSort: [],
  293. dataName: [
  294. { id: 0, name: '达标' },
  295. { id: 1, name: '未达标' }
  296. ],
  297. dataCount: [
  298. { id: 0, count: 0 },
  299. { id: 1, count: 0 }
  300. ],
  301. patient_id: 0
  302. }
  303. },
  304. methods: {
  305. handleStartTimeChange(){
  306. this.getlist()
  307. }, handleEndTimeChange(){
  308. this.getlist()
  309. },
  310. handleSizeChange(limit) {
  311. this.tableData = []
  312. this.listQuery.limit = limit
  313. this.getlist()
  314. },
  315. handleCurrentChange(page) {
  316. this.tableData = []
  317. this.listQuery.page = page
  318. this.getlist()
  319. },
  320. changeTime(val) {
  321. var time = this.getTimestamp(val) - this.getTimestamp(this.listQuery.end_time)
  322. if (time > 0) {
  323. this.$message.error('结束时间不能小于开始时间')
  324. this.listQuery.start_time = ''
  325. } else {
  326. this.getlist()
  327. }
  328. },
  329. changeEndTime(val) {
  330. var time =
  331. this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time)
  332. if (time < 0) {
  333. this.$message.error('结束时间不能小于开始时间')
  334. this.listQuery.end_time = ''
  335. } else {
  336. this.getlist()
  337. }
  338. },
  339. getTimestamp(time) {
  340. // 把时间日期转成时间戳
  341. return new Date(time).getTime() / 1000
  342. },
  343. handleClick(patientid, inspectdate) {
  344. console.log("patient_id",patientid)
  345. console.log("inspectdate",inspectdate)
  346. // var id = 0
  347. // var dialysis_no = 0
  348. // for(let i=0;i<this.tablePatients.length;i++){
  349. // if(name == this.tablePatients[i].name){
  350. // id = this.tablePatients[i].patient_id
  351. // dialysis_no = this.tablePatients[i].dialysis_no
  352. // }
  353. // }
  354. this.$router.push({ path: '/qcd/patientComplianceDetails?patientid=' + patientid + '&date=' + inspectdate })
  355. },
  356. getDialysisNo(name) {
  357. for (let i = 0; i < this.tablePatients.length; i++) {
  358. if (name == this.tablePatients[i].name) {
  359. return this.tablePatients[i].dialysis_no
  360. }
  361. }
  362. },
  363. getNormData() {
  364. getNormData().then(response => {
  365. if (response.data.state == 1) {
  366. var normdata = response.data.data.normdata
  367. console.log('normdata', normdata)
  368. this.normData = normdata
  369. var a = []
  370. for (let i = 0; i < normdata.length; i++) {
  371. a.push(normdata[i])
  372. }
  373. // console.log("a",a)
  374. this.newArr = a
  375. var arr = this.arrayToObj(a)
  376. this.ObjectData = arr
  377. }
  378. })
  379. },
  380. onSearch() {
  381. const params = {
  382. lapstor: this.lapstor,
  383. patientid: this.patient_id,
  384. startime: this.listQuery.start_time,
  385. endtime: this.listQuery.end_time
  386. }
  387. console.log("param",params)
  388. this.isLoadingTwo = true
  389. getPatientContorlAnalysis(params).then(response => {
  390. if (response.data.state == 1) {
  391. this.isLoadingTwo = false
  392. var control = response.data.data.patientcontorDetail
  393. console.log("control",control)
  394. let dataInfo = {}
  395. control.forEach((item, index) => {
  396. let { inspect_date } = item
  397. if (!dataInfo[inspect_date]) {
  398. dataInfo[inspect_date] = {
  399. inspect_date,
  400. name: item.name,
  401. child: [],
  402. patient_id: item.patient_id,
  403. range_type: item.range_type,
  404. dialysis_no: item.dialysis_no
  405. }
  406. }
  407. })
  408. let list = Object.values(dataInfo)
  409. // console.log("list",list)
  410. list.map(item => {
  411. for (let i = 0; i < control.length; i++) {
  412. if (item.inspect_date == control[i].inspect_date && item.patient_id == control[i].patient_id) {
  413. item.child.push(control[i])
  414. }
  415. }
  416. })
  417. var newarrtwo = []
  418. list.map(item => {
  419. item.child.map(it => {
  420. newarrtwo.push(it)
  421. })
  422. })
  423. // 配置的才显示
  424. var arrthree = []
  425. for (let i = 0; i < newarrtwo.length; i++) {
  426. for (let j = 0; j < this.normData.length; j++) {
  427. if (newarrtwo[i].item_id == this.normData[j].inspection_minor) {
  428. arrthree.push(newarrtwo[i])
  429. }
  430. }
  431. }
  432. // console.log("arrthree",arrthree)
  433. var arrfour = this.arrayDate(arrthree, newarrtwo)
  434. arrfour.map(item => {
  435. item.item_name = ''
  436. arrthree.push(item)
  437. })
  438. var dd = {}
  439. for (const index in arrthree) {
  440. if (!(arrthree[index].inspect_date in dd)) {
  441. dd[arrthree[index].inspect_date] = {}
  442. }
  443. if (!(arrthree[index].item_name in dd[arrthree[index].inspect_date]) && arrthree[index].item_name != 0) {
  444. dd[arrthree[index].inspect_date][arrthree[index].item_name] = arrthree[index]
  445. }
  446. }
  447. this.tableData = []
  448. for (const key in dd) {
  449. for (const mkey in this.ObjectData) {
  450. if (!(this.ObjectData[mkey].item_name in dd[key])) {
  451. dd[key][this.ObjectData[mkey].item_name] = {
  452. item_name: this.ObjectData[mkey].item_name,
  453. name: mkey,
  454. inspect_value: 0,
  455. range_type: this.ObjectData[mkey].range_type
  456. }
  457. }
  458. }
  459. this.tableData.push({ name: key, data: dd[key] })
  460. }
  461. let dataInfotwo = {}
  462. control.forEach((item, index) => {
  463. let { inspect_date } = item
  464. if (!dataInfotwo[inspect_date]) {
  465. dataInfotwo[inspect_date] = {
  466. inspect_date,
  467. name: item.name,
  468. dialysis_no: item.dialysis_no,
  469. patient_id:item.patient_id,
  470. inspect_date:item.inspect_date,
  471. }
  472. }
  473. })
  474. let listtwo = Object.values(dataInfotwo)
  475. // console.log("listtwo",listtwo)
  476. listtwo.map(item => {
  477. this.tableData.map(it => {
  478. if (item.inspect_date == parseInt(it.name)) {
  479. it.name = item.name
  480. it.dialysis_no = item.dialysis_no
  481. it.patient_id = item.patient_id
  482. it.inspect_date = item.inspect_date
  483. }
  484. })
  485. })
  486. // let projectArr = []
  487. // this.newArr.map(item => {
  488. // projectArr.push(item.item_name)
  489. // })
  490. // this.tableData.map(item => {
  491. // let newarr = Object.values(item.data)
  492. // newarr.sort((a, b) => {
  493. // return projectArr.indexOf(a.item_name) - projectArr.indexOf(b.item_name)
  494. // })
  495. // item.data = newarr
  496. // })
  497. // for (let i = 0; i < this.patientsArr.length; i++) {
  498. // for (let j = 0; j < this.tableData.length; j++) {
  499. // if (this.patientsArr[i].name == this.tableData[j].name) {
  500. // this.tableData[j].dialysis_no = this.patientsArr[i].dialysis_no
  501. // this.tableData[j].patient_id = this.patientsArr[i].id
  502. // }
  503. // }
  504. // }
  505. } else {
  506. this.isLoadingTwo = false
  507. }
  508. })
  509. },
  510. getlist() {
  511. this.isLoadingTwo = true
  512. getPatientsControl(this.lapstor, this.listQuery.start_time, this.listQuery.end_time, this.listQuery.page, this.listQuery.limit).then(response => {
  513. if (response.data.state == 1) {
  514. this.isLoadingTwo = false
  515. var patients = response.data.data.patients
  516. this.tablePatients = patients
  517. // let dataInfothree = {}
  518. // patients.forEach((item, index) => {
  519. // let { inspect_date } = item
  520. // if (!dataInfothree[inspect_date]) {
  521. // dataInfothree[inspect_date] = {
  522. // inspect_date,
  523. // name: item.name,
  524. // child: [],
  525. // patient_id: item.patient_id,
  526. // }
  527. // }
  528. // })
  529. // let patientlist = Object.values(dataInfothree)
  530. // console.log("patientlist",patientlist)
  531. var total = response.data.data.total
  532. this.total = total
  533. var control = response.data.data.control
  534. var infectiousControl = response.data.data.infectiousControl
  535. infectiousControl.map(item => {
  536. control.push(item)
  537. })
  538. // var newPatinteArr = []
  539. // patientlist.map(item=>{
  540. // for(let i=0;i<control.length;i++){
  541. // if(item.inspect_date == control[i].inspect_date && item.patient_id == control[i].patient_id){
  542. // item.child.push(control[i])
  543. // }
  544. // }
  545. // })
  546. // console.log("patientlist",patientlist)
  547. var newArr = []
  548. // 分页
  549. for (let i = 0; i < control.length; i++) {
  550. for (let j = 0; j < patients.length; j++) {
  551. if (control[i].patient_id == patients[j].patient_id) {
  552. newArr.push(control[i])
  553. }
  554. }
  555. }
  556. console.log(newArr)
  557. let dataInfo = {}
  558. newArr.forEach((item, index) => {
  559. let { patient_id } = item
  560. if (!dataInfo[patient_id]) {
  561. dataInfo[patient_id] = {
  562. name: item.name,
  563. child: [],
  564. patient_id: item.patient_id,
  565. range_type: item.range_type
  566. }
  567. }
  568. })
  569. let list = Object.values(dataInfo)
  570. list.map(item => {
  571. for (let i = 0; i < newArr.length; i++) {
  572. if (item.patient_id == newArr[i].patient_id) {
  573. item.child.push(newArr[i])
  574. }
  575. }
  576. })
  577. var newarrtwo = []
  578. list.map(item => {
  579. item.child.map(it => {
  580. newarrtwo.push(it)
  581. })
  582. })
  583. console.log("list")
  584. console.log(list)
  585. console.log(newarrtwo)
  586. // 配置的才显示
  587. var arrthree = []
  588. for (let i = 0; i < newarrtwo.length; i++) {
  589. for (let j = 0; j < this.normData.length; j++) {
  590. if (newarrtwo[i].item_id == this.normData[j].inspection_minor) {
  591. arrthree.push(newarrtwo[i])
  592. }
  593. }
  594. }
  595. console.log('arrthree', arrthree)
  596. var arrfour = this.arrayDate(arrthree, newarrtwo)
  597. arrfour.map(item => {
  598. item.item_name = ''
  599. arrthree.push(item)
  600. })
  601. console.log("arrthree",arrthree)
  602. var dd = {}
  603. for (const index in arrthree) {
  604. if (!(arrthree[index].patient_id in dd)) {
  605. dd[arrthree[index].patient_id] = {}
  606. }
  607. if (!(arrthree[index].item_name in dd[arrthree[index].patient_id]) && arrthree[index].item_name != 0) {
  608. dd[arrthree[index].patient_id][arrthree[index].item_name] = arrthree[index]
  609. }
  610. }
  611. console.log("dad00000000000000",dd)
  612. let dataInfotwo = {}
  613. newArr.forEach((item, index) => {
  614. let { patient_id } = item
  615. if (!dataInfotwo[patient_id]) {
  616. dataInfotwo[patient_id] = {
  617. patient_id,
  618. name: item.name,
  619. inspect_value: item.inspect_value,
  620. id: item.id,
  621. }
  622. }
  623. })
  624. let listtwo = Object.values(dataInfotwo)
  625. for (const key in dd) {
  626. for (const mkey in this.ObjectData) {
  627. if (!(this.ObjectData[mkey].item_name in dd[key])) {
  628. dd[key][this.ObjectData[mkey].item_name] = {
  629. item_name: this.ObjectData[mkey].item_name,
  630. name: mkey,
  631. inspect_value: 0,
  632. range_type: this.ObjectData[mkey].range_type
  633. }
  634. }
  635. }
  636. this.tableData.push({ name: key, data: dd[key] })
  637. }
  638. listtwo.map(item => {
  639. this.tableData.map(it => {
  640. if (item.patient_id == parseInt(it.name)) {
  641. it.name = item.name
  642. it.id = item.id
  643. it.inspect_date = item.inspect_date
  644. }
  645. })
  646. })
  647. for (let i = 0; i < this.patientsArr.length; i++) {
  648. for (let j = 0; j < this.tableData.length; j++) {
  649. if (this.patientsArr[i].name == this.tableData[j].name) {
  650. this.tableData[j].dialysis_no = this.patientsArr[i].dialysis_no
  651. this.tableData[j].patient_id = this.patientsArr[i].id
  652. }
  653. }
  654. }
  655. }else{
  656. this.isLoadingTwo = false
  657. }
  658. })
  659. },
  660. arrayToObj(arr) {
  661. return Object.assign({}, arr)
  662. },
  663. arrayDate(array1, array2) {
  664. var array1 = array1
  665. var array2 = array2
  666. var result = []
  667. for (var i = 0; i < array2.length; i++) {
  668. var obj = array2[i]
  669. var num = obj.item_id //staff_id 就是要对比的key
  670. var isExist = false
  671. for (var j = 0; j < array1.length; j++) {
  672. var aj = array1[j]
  673. var n = aj.item_id
  674. if (n == num) {
  675. isExist = true
  676. break
  677. }
  678. }
  679. if (!isExist) {
  680. result.push(obj)
  681. }
  682. }
  683. return result
  684. },
  685. //统计柱状图
  686. getCartogramlist() {
  687. this.isLoading = true
  688. getCartogramlist(this.lapstor, this.listQuery.start_time, this.listQuery.end_time, this.limit, this.page).then(response => {
  689. if (response.data.state == 1) {
  690. this.isLoading = false
  691. var total = response.data.data.total
  692. var standtotal = response.data.data.standtotal
  693. var standtotalone = response.data.data.standtotalOne
  694. for (let i = 0; i < this.dataCount.length; i++) {
  695. this.dataCount[0].count = standtotal + standtotalone
  696. this.dataCount[1].count = total - standtotal - standtotalone
  697. this.obj.push(this.dataCount[i].count)
  698. }
  699. // console.log("dataCount",this.dataCount)
  700. for (let i = 0; i < this.dataName.length; i++) {
  701. this.modesData.xAxis.push(this.dataName[i].name)
  702. }
  703. for (let i = 0; i < this.dataCount.length; i++) {
  704. this.modesData.series.push(((this.dataCount[i].count / total) * 100).toFixed(1))
  705. }
  706. this.chart.series[0].data = this.modesData.series
  707. this.chart.xAxis.data = this.modesData.xAxis
  708. } else {
  709. this.isLoading = false
  710. }
  711. })
  712. },
  713. getCurrentOrgPatients() {
  714. getCurrentOrgPatients().then(response => {
  715. if (response.data.state == 1) {
  716. this.patientsArr = response.data.data.patients
  717. // console.log("病人",this.patientsArr)
  718. //获取列表数据
  719. this.getlist()
  720. }
  721. })
  722. },
  723. querySearchAsync(keyword, cb) {
  724. let key = ''
  725. if (keyword != undefined) {
  726. key = keyword
  727. }
  728. let searchArray = []
  729. PostSearch(key).then(response => {
  730. if (response.data.state == 1) {
  731. searchArray = response.data.data.patient
  732. cb(searchArray)
  733. } else {
  734. cb([])
  735. }
  736. })
  737. },
  738. handleSelect(val) {
  739. this.listQuery.search = val.name
  740. this.patient_id = val.id
  741. this.onSearch()
  742. },
  743. toExportList(){
  744. import("@/vendor/Export2Excel").then((excel) => {
  745. var arr =["序号","姓名","透析号"]
  746. if(this.normData!=null && this.normData.length>0){
  747. for(let i=0;i<this.normData.length;i++){
  748. arr.push(this.normData[i].item_name)
  749. }
  750. }
  751. if(this.tableData!=null && this.normData!=null && this.tableData.length>0&&this.normData.length>0){
  752. var newArr =[]
  753. for(let i=0;i<this.tableData.length;i++){
  754. var obj = {index:0,name:"",patient_id:0,dialysis_no:"",item_name:""}
  755. for(let j=0;j<this.normData.length;j++){
  756. obj.index = i+1
  757. obj.patient_id = this.tableData[i].patient_id
  758. obj.name = this.tableData[i].name
  759. obj.dialysis_no = this.tableData[i].dialysis_no
  760. obj[this.normData[j].item_name] = this.tableData[i].data[this.normData[j].item_name].inspect_value
  761. }
  762. newArr.push(obj)
  763. }
  764. }
  765. console.log("患者质控达标统计",newArr)
  766. const tHeader = arr
  767. var newList = ["index","name","dialysis_no"]
  768. if(this.normData!=null && this.normData.length>0){
  769. for(let i=0;i<this.normData.length;i++){
  770. newList.push(this.normData[i].item_name)
  771. }
  772. }
  773. var filterVal = []
  774. filterVal = newList
  775. const data = this.formatJson(filterVal, newArr);
  776. excel.export_json_to_excel({
  777. header: tHeader,
  778. data,
  779. filename: "患者质控达标统计",
  780. });
  781. this.downloadLoading = false;
  782. });
  783. },
  784. formatJson(filterVal, jsonData) {
  785. return jsonData.map((v) => filterVal.map((j) => v[j]));
  786. },
  787. },
  788. created() {
  789. var nowDate = new Date()
  790. var nowYear = nowDate.getFullYear()
  791. var nowMonth = nowDate.getMonth() + 1
  792. var nowDay = nowDate.getDate()
  793. this.listQuery.end_time =
  794. nowYear +
  795. '-' +
  796. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  797. '-' +
  798. (nowDay < 10 ? '0' + nowDay : nowDay)
  799. nowDate.setMonth(nowDate.getMonth() - 3)
  800. nowYear = nowDate.getFullYear()
  801. nowMonth = nowDate.getMonth() + 1
  802. nowDay = nowDate.getDate()
  803. this.listQuery.start_time =
  804. nowYear +
  805. '-' +
  806. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  807. '-' +
  808. (nowDay < 10 ? '0' + nowDay : nowDay)
  809. this.getCurrentOrgPatients()
  810. //获取系统指标
  811. this.getNormData()
  812. //获取统计图数据
  813. this.getCartogramlist()
  814. }
  815. }
  816. </script>
  817. <style lang="scss" scoped>
  818. .page_patientControlAnalysis {
  819. .pointTitle {
  820. font-size: 13px;
  821. }
  822. .chartTitle {
  823. font-size: 16px;
  824. font-weight: bold;
  825. color: #000000;
  826. }
  827. .point {
  828. width: 13px;
  829. height: 13px;
  830. background: linear-gradient(
  831. 0deg,
  832. rgba(169, 224, 243, 1),
  833. rgba(159, 189, 252, 1)
  834. );
  835. border-radius: 7px;
  836. margin-right: 8px;
  837. }
  838. .pointTitle {
  839. font-size: 13px;
  840. }
  841. }
  842. </style>
  843. <style lang="scss">
  844. .page_patientControlAnalysis {
  845. .el-form-item {
  846. margin-bottom: 0;
  847. }
  848. .cell {
  849. text-align: center;
  850. }
  851. ::-webkit-scrollbar {
  852. height: 15px !important;
  853. }
  854. }
  855. </style>