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

CheckPersonal.vue 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. <template>
  2. <div class="page_checkPersonal">
  3. <div class="cell clearfix">
  4. <el-form :inline="true" :model="listQuery">
  5. <el-form-item label>
  6. <!-- <el-input v-model.trim="listQuery.search" placeholder="姓名/透析号" style="width:150px"></el-input>
  7. <el-button type="primary" @click="onSearch" icon="el-icon-search">搜索</el-button> -->
  8. <el-autocomplete
  9. class="checkSearch"
  10. popper-class="my-autocomplete"
  11. v-model.trim="listQuery.search"
  12. :fetch-suggestions="querySearchAsync"
  13. :trigger-on-focus="false"
  14. placeholder="输入病人透析号/姓名"
  15. @select="handleSelect"
  16. >
  17. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  18. <template slot-scope="{ item }">
  19. <div class="name">{{ item.name }}</div>
  20. </template>
  21. </el-autocomplete>
  22. </el-form-item>
  23. </el-form>
  24. <label class="title">
  25. <span class="name">日期查询</span> :
  26. </label>
  27. <el-date-picker
  28. v-model="listQuery.start_time"
  29. prefix-icon="el-icon-date"
  30. @change="changeTime"
  31. :editable="false"
  32. style="width: 196px;"
  33. type="date"
  34. placeholder="选择日期时间"
  35. align="right"
  36. format="yyyy-MM-dd"
  37. value-format="yyyy-MM-dd"
  38. :picker-options="pickerOptions"
  39. ></el-date-picker>
  40. <span class>-</span>
  41. <el-date-picker
  42. v-model="listQuery.end_time"
  43. prefix-icon="el-icon-date"
  44. @change="changeEndTime"
  45. :editable="false"
  46. style="width: 196px;"
  47. type="date"
  48. placeholder="选择日期时间"
  49. align="right"
  50. format="yyyy-MM-dd"
  51. value-format="yyyy-MM-dd"
  52. :picker-options="pickerOptions"
  53. ></el-date-picker>
  54. </div>
  55. <el-container>
  56. <div style="width:150px">
  57. <div class="tableTitle">患者列表</div>
  58. <el-table :data="patientsData" border style="width: 100%;"
  59. height="500" :row-style="{ color: '#303133' }"
  60. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  61. highlight-current-row
  62. ref="singleTable"
  63. @current-change="handleChange"
  64. >
  65. <el-table-column prop="dialysis_no" label="透析号" width="80">
  66. <template slot-scope="scope">{{scope.row.dialysis_no}}</template>
  67. </el-table-column>
  68. <el-table-column prop="name" label="姓名" width="80">
  69. <template slot-scope="scope">{{ scope.row.name }}</template>
  70. </el-table-column>
  71. </el-table>
  72. </div>
  73. <div style="padding-left:10px;flex:1">
  74. <div class="tableTitle">统计图</div>
  75. <div>
  76. <line-chart :options="chart"></line-chart>
  77. </div>
  78. </div>
  79. </el-container>
  80. </div>
  81. </template>
  82. <script>
  83. import { PostSearch} from '@/api/patient'
  84. import echarts from "echarts";
  85. import LineChart from "../../components/LineChart";
  86. import { getCurrentOrgPatients,getInspectionTotalCount,getInspectionDetailById,getSearchPatientInfo } from "@/api/common/common";
  87. export default {
  88. components: {
  89. LineChart
  90. },
  91. data() {
  92. return {
  93. patient_id:0,
  94. listQuery: {
  95. start_time: "",
  96. end_time: "",
  97. page: 1,
  98. limit: 10
  99. },
  100. value: "请选项",
  101. patientsData:[],
  102. tableData:[],
  103. chart: {
  104. tooltip: {},
  105. // legend: {
  106. // data: ["次数"],
  107. // left: 0
  108. // },
  109. xAxis: {
  110. data: []
  111. },
  112. yAxis: {
  113. axisLabel: {
  114. formatter: "{value} %"
  115. },
  116. show: false
  117. },
  118. series: [
  119. {
  120. name: "次数",
  121. type: "bar",
  122. data: [],
  123. barWidth: 30,
  124. label: {
  125. normal: {
  126. show: true,
  127. position: "top",
  128. formatter: (params) => {
  129. if(this.obj.length > 0){
  130. let str = ''
  131. str = params.data +'次' + '\n(参考值'+ this.obj[params.dataIndex] +'次)'
  132. return str
  133. }else{
  134. let str = ''
  135. str = params.data+'次'
  136. return str
  137. }
  138. }
  139. }
  140. },
  141. //配置样式
  142. itemStyle: {
  143. //通常情况下:
  144. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  145. normal: {
  146. color: function(params) {
  147. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  148. var colorList = [
  149. ["#A9E0F3", "#9FBDFC"],
  150. ["#A9E0F3", "#9FBDFC"],
  151. ["#A9E0F3", "#9FBDFC"],
  152. ["#FFD7C0", "#FF9994"],
  153. ["#FFD7C0", "#FF9994"],
  154. ["#FFD7C0", "#FF9994"],
  155. ["#D7C3FD", "#B3A8F7"],
  156. ["#D7C3FD", "#B3A8F7"],
  157. ["#D7C3FD", "#B3A8F7"]
  158. ];
  159. var index = params.dataIndex;
  160. if (params.dataIndex >= colorList.length) {
  161. index = params.dataIndex % colorList.length;
  162. }
  163. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  164. { offset: 0, color: colorList[index][0] },
  165. // { offset: 0.5, color: colorList[index][1] },
  166. { offset: 1, color: colorList[index][1] }
  167. ]);
  168. },
  169. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  170. },
  171. //鼠标悬停时:
  172. emphasis: {
  173. shadowBlur: 10,
  174. shadowOffsetX: 0,
  175. shadowColor: "rgba(0, 0, 0, 0.5)"
  176. }
  177. }
  178. }
  179. ],
  180. dataZoom: [
  181. {
  182. // Y轴固定,让内容滚动
  183. type: 'slider',
  184. show: false,
  185. xAxisIndex: [0],
  186. start: 1,
  187. end: 20, // 设置X轴刻度之间的间隔(根据数据量来调整)
  188. zoomLock: true // 锁定区域禁止缩放(鼠标滚动会缩放,所以禁止)
  189. },
  190. {
  191. type: 'inside',
  192. xAxisIndex: [0],
  193. start: 1,
  194. end: 20,
  195. zoomLock: true // 锁定区域禁止缩放
  196. }
  197. ]
  198. },
  199. pickerOptions: {
  200. disabledDate(time) {
  201. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
  202. return time.getTime() > Date.now() || time.getTime() < threeMonths;;
  203. }
  204. },
  205. modesData: {
  206. xAxis: [],
  207. series: []
  208. },
  209. obj:[],
  210. patient_id:0,
  211. };
  212. },
  213. methods: {
  214. changeTime(val) {
  215. var time = this.getTimestamp(val) - this.getTimestamp(this.listQuery.end_time);
  216. if (time > 0) {
  217. this.$message.error("结束时间不能小于开始时间");
  218. this.listQuery.start_time = "";
  219. } else {
  220. this.getInspectionTotalCount()
  221. }
  222. },
  223. changeEndTime(val) {
  224. var time =
  225. this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
  226. if (time < 0) {
  227. this.$message.error("结束时间不能小于开始时间");
  228. this.listQuery.end_time = "";
  229. } else {
  230. this.getInspectionTotalCount()
  231. }
  232. },
  233. getTimestamp(time) {
  234. // 把时间日期转成时间戳
  235. return new Date(time).getTime() / 1000;
  236. },
  237. getCurrentOrgPatients(){
  238. getCurrentOrgPatients().then(response=>{
  239. var patients = response.data.data.patients
  240. for(let i=0;i<patients.length;i++){
  241. this.$refs.singleTable.setCurrentRow(patients[0])
  242. this.patient_id = patients[0].id
  243. }
  244. this.patientsData = patients
  245. //获取检验检查项目
  246. this.getInspectionTotalCount()
  247. })
  248. },
  249. getInspectionTotalCount(){
  250. this.modesData.series = []
  251. this.modesData.xAxis = []
  252. getInspectionTotalCount(this.listQuery.start_time,this.listQuery.end_time,this.patient_id).then(response=>{
  253. if(response.data.state === 1){
  254. var Inspection = response.data.data.Inspection
  255. this.tableData = Inspection
  256. var counts = response.data.data.counts
  257. var arr = []
  258. for(let i=0;i<Inspection.length;i++){
  259. for(let j=0;j<counts.length;j++){
  260. if(Inspection[i].inspection_major == counts[j].ProjectId){
  261. arr.push(counts[j])
  262. }
  263. }
  264. }
  265. // var arrtwo = this.arrayDate(counts,this.normData)
  266. var hash = {};
  267. var i = 0;
  268. var res = [];
  269. arr.forEach(function(item) {
  270. var ProjectName = item.ProjectName;
  271. hash[ProjectName] ? res[hash[ProjectName] - 1].Count.push(item.Count) : hash[ProjectName] = ++i && res.push({
  272. Count: [item.Count],
  273. ProjectName: ProjectName,
  274. ProjectId: item.ProjectId,
  275. Sort:item.Sort,
  276. })
  277. });
  278. res.map(item => {
  279. item.Count = eval(item.Count.join('+'))
  280. })
  281. let arr1 = []
  282. this.tableData.map(it => {
  283. arr1.push(it.project_name)
  284. })
  285. arr1.forEach((item,index)=>{
  286. if(!(res[index] && item ==res[index].ProjectName)){
  287. res.splice(index,0,{Count:0, ProjectName: item, Sort: index+1})
  288. }
  289.           })
  290. res.map(item => {
  291. this.modesData.series.push(parseInt(item.Count));
  292. })
  293. // console.log("this=====",this.tableData)
  294. for (const key in this.tableData) {
  295. this.modesData.xAxis.push(this.tableData[key].project_name);
  296. let time = new Date(this.listQuery.end_time) - new Date(this.listQuery.start_time)
  297. let day = parseInt(time / (1000 * 60 * 60 * 24))
  298. this.obj.push(Math.round(day / this.tableData[key].inspection_frequency))
  299. }
  300. this.chart.series[0].data = this.modesData.series
  301. this.chart.xAxis.data = this.modesData.xAxis
  302. this.getArrLength(this.chart.xAxis.data)
  303. }
  304. })
  305. },
  306. //获取单个病人数据
  307. handleChange(val){
  308. this.modesData.series = []
  309. this.modesData.xAxis = []
  310. getInspectionDetailById(val.id,this.listQuery.start_time,this.listQuery.end_time).then(response=>{
  311. if(response.data.state === 1){
  312. var patientdetail = response.data.data.patientdetail
  313. // console.log("patientdetail",patientdetail)
  314. var arr=[]
  315. for(let i=0;i<this.tableData.length;i++){
  316. for(let j=0;j<patientdetail.length;j++){
  317. if(this.tableData[i].inspection_major == patientdetail[j].ProjectId){
  318. arr.push(patientdetail[j])
  319. }
  320. }
  321. }
  322. // console.log('arr',arr)
  323. var hash = {};
  324. var i = 0;
  325. var res = [];
  326. arr.forEach(function(item) {
  327. var ProjectName = item.ProjectName;
  328. hash[ProjectName] ? res[hash[ProjectName] - 1].Count.push(item.Count) : hash[ProjectName] = ++i && res.push({
  329. Count: [item.Count],
  330. ProjectName: ProjectName,
  331. ProjectId: item.ProjectId,
  332. Sort:item.Sort,
  333. })
  334. });
  335. res.map(item => {
  336. item.Count = eval(item.Count.join('+'))
  337. })
  338. let arr1 = []
  339. this.tableData.map(it => {
  340. arr1.push(it.project_name)
  341. })
  342. arr1.forEach((item,index)=>{
  343. if(!(res[index] && item ==res[index].ProjectName)){
  344. res.splice(index,0,{Count:0, ProjectName: item, Sort: index+1})
  345. }
  346.           })
  347. res.map(item => {
  348. this.modesData.series.push(parseInt(item.Count));
  349. })
  350. // console.log("this=====",this.tableData)
  351. for (const key in this.tableData) {
  352. this.modesData.xAxis.push(this.tableData[key].project_name);
  353. let time = new Date(this.listQuery.end_time) - new Date(this.listQuery.start_time)
  354. let day = parseInt(time / (1000 * 60 * 60 * 24))
  355. this.obj.push(Math.round(day / this.tableData[key].inspection_frequency))
  356. }
  357. this.chart.series[0].data = this.modesData.series
  358. this.chart.xAxis.data = this.modesData.xAxis
  359. this.getArrLength(this.chart.xAxis.data)
  360. // for(let i=0;i<this.tableData.length;i++){
  361. // for(let j=0;j<patientdetail.length;j++){
  362. // if(this.tableData[i].inspection_major == patientdetail[j].ProjectId){
  363. // arr.push(patientdetail[j])
  364. // }
  365. // }
  366. // }
  367. // let time = new Date(this.listQuery.end_time) - new Date(this.listQuery.start_time)
  368. // let day = parseInt(time / (1000 * 60 * 60 * 24))
  369. // console.log("tabledata",this.tableData)
  370. // for (const key in this.tableData) {
  371. // this.modesData.xAxis.push(this.tableData[key].project_name);
  372. // if (key in arr) {
  373. // this.modesData.series.push(parseInt(arr[key].Count));
  374. // this.obj.push(Math.round(day / arr[key].InspectionFrequency))
  375. // } else {
  376. // this.modesData.series.push(0);
  377. // this.obj.push(0)
  378. // }
  379. // }
  380. // this.chart.series[0].data = this.modesData.series
  381. // this.chart.xAxis.data = this.modesData.xAxis
  382. // this.getArrLength(this.chart.xAxis.data)
  383. }
  384. })
  385. },
  386. //搜索功能
  387. onSearch(){
  388. this.modesData.series = []
  389. this.modesData.xAxis = []
  390. getSearchPatientInfo(this.patient_id,this.listQuery.start_time,this.listQuery.end_time).then(response=>{
  391. if(response.data.state === 1){
  392. var PatientsInfo = response.data.data.PatientsInfo
  393. // console.log("patientsInfo",PatientsInfo)
  394. var arr = []
  395. for(let i=0;i<this.tableData.length;i++){
  396. for(let j=0;j<PatientsInfo.length;j++){
  397. if(this.tableData[i].inspection_major == PatientsInfo[j].ProjectId){
  398. arr.push(PatientsInfo[j])
  399. }
  400. }
  401. }
  402. // console.log('arr',arr)
  403. var hash = {};
  404. var i = 0;
  405. var res = [];
  406. arr.forEach(function(item) {
  407. var ProjectName = item.ProjectName;
  408. hash[ProjectName] ? res[hash[ProjectName] - 1].Count.push(item.Count) : hash[ProjectName] = ++i && res.push({
  409. Count: [item.Count],
  410. ProjectName: ProjectName,
  411. ProjectId: item.ProjectId,
  412. Sort:item.Sort,
  413. })
  414. });
  415. res.map(item => {
  416. item.Count = eval(item.Count.join('+'))
  417. })
  418. let arr1 = []
  419. this.tableData.map(it => {
  420. arr1.push(it.project_name)
  421. })
  422. arr1.forEach((item,index)=>{
  423. if(!(res[index] && item ==res[index].ProjectName)){
  424. res.splice(index,0,{Count:0, ProjectName: item, Sort: index+1})
  425. }
  426.           })
  427. res.map(item => {
  428. this.modesData.series.push(parseInt(item.Count));
  429. })
  430. // console.log("this=====",this.tableData)
  431. for (const key in this.tableData) {
  432. this.modesData.xAxis.push(this.tableData[key].project_name);
  433. let time = new Date(this.listQuery.end_time) - new Date(this.listQuery.start_time)
  434. let day = parseInt(time / (1000 * 60 * 60 * 24))
  435. this.obj.push(Math.round(day / this.tableData[key].inspection_frequency))
  436. }
  437. this.chart.series[0].data = this.modesData.series
  438. this.chart.xAxis.data = this.modesData.xAxis
  439. this.getArrLength(this.chart.xAxis.data)
  440. }
  441. })
  442. },
  443. arrayDate(array1,array2){
  444. var array1 = array1;
  445. var array2 = this.tableData;
  446. var result = [];
  447. for(var i = 0; i < array2.length; i++){
  448. var obj = array2[i];
  449. var num = obj.inspection_major; //staff_id 就是要对比的key
  450. var isExist = false;
  451. for(var j = 0; j < array1.length; j++){
  452. var aj = array1[j];
  453. var n = aj.ProjectId;
  454. if(n == num){
  455. isExist = true;
  456. break;
  457. }
  458. }
  459. if(!isExist){
  460. result.push(obj);
  461. }
  462. }
  463. return result;
  464. },
  465. querySearchAsync(keyword, cb) {
  466. let key = ''
  467. if (keyword != undefined) {
  468. key = keyword
  469. }
  470. let searchArray = []
  471. PostSearch(key).then(response => {
  472. if (response.data.state == 1) {
  473. searchArray = response.data.data.patient
  474. // console.log("searchArray",searchArray)
  475. cb(searchArray)
  476. } else {
  477. cb([])
  478. }
  479. })
  480. },
  481. handleSelect(val) {
  482. // console.log("val",val)
  483. this.listQuery.search = val.name
  484. this.patient_id = val.id
  485. this.onSearch()
  486. },
  487. getArrLength(result){
  488. if(result.length > 10){
  489. var dataZoom_end = (10/result.length)*100;
  490. this.chart.dataZoom[0].end = dataZoom_end
  491. }else{
  492. var dataZoom_end = 100;
  493. this.chart.dataZoom[0].end = dataZoom_end
  494. }
  495. }
  496. },
  497. created(){
  498. var nowDate = new Date();
  499. var nowYear = nowDate.getFullYear();
  500. var nowMonth = nowDate.getMonth() + 1;
  501. var nowDay = nowDate.getDate();
  502. this.listQuery.end_time =
  503. nowYear +
  504. "-" +
  505. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  506. "-" +
  507. (nowDay < 10 ? "0" + nowDay : nowDay);
  508. nowDate.setMonth(nowDate.getMonth() - 3);
  509. nowYear = nowDate.getFullYear();
  510. nowMonth = nowDate.getMonth() + 1;
  511. nowDay = nowDate.getDate();
  512. this.listQuery.start_time =
  513. nowYear +
  514. "-" +
  515. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  516. "-" +
  517. (nowDay < 10 ? "0" + nowDay : nowDay);
  518. //获取该机构下的所有患者
  519. this.getCurrentOrgPatients()
  520. }
  521. };
  522. </script>
  523. <style lang="scss" scoped>
  524. .tableTitle {
  525. font-size: 16px;
  526. color: #000;
  527. font-weight: bold;
  528. margin-bottom: 10px;
  529. }
  530. </style>
  531. <style lang="scss">
  532. .page_checkPersonal {
  533. .cell {
  534. text-align: center;
  535. }
  536. }
  537. </style>