patientComplianceDetails.vue 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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_patientComplianceDetails">
  8. <div class="cell clearfix" style="margin:0">
  9. <el-form :inline="true" :model="listQuery">
  10. </el-form>
  11. </div>
  12. <el-container>
  13. <div style="width:150px">
  14. <div class="tableTitle">患者列表</div>
  15. <el-table :data="patientsData" border style="width: 100%;" height="500" highlight-current-row @current-change="handleChange">
  16. <el-table-column prop="name" label="透析号" width="80">
  17. <template slot-scope="scope">
  18. {{scope.row.dialysis_no}}
  19. </template>
  20. </el-table-column>
  21. <el-table-column prop="date" label="透析号" width="70">
  22. <template slot-scope="scope">
  23. {{scope.row.name }}
  24. </template>
  25. </el-table-column>
  26. </el-table>
  27. </div>
  28. <div class="containerRight" style="flex:1;overflow: hidden">
  29. <div class="cell clearfix">
  30. <label class="title" style="text-align:left">
  31. <span class="name">统计方式</span> :
  32. </label>
  33. <div class="time">
  34. <ul class>
  35. <li
  36. :class="item.state == monthType ? 'active' : ''"
  37. @click="chooseMonth(item.state)"
  38. v-for="item in month"
  39. :key="item.value"
  40. >{{ item.label }}</li>
  41. </ul>
  42. </div>
  43. <label class="title">
  44. <span class="name">日期查询</span> :
  45. </label>
  46. <el-date-picker
  47. v-model="listQuery.start_time"
  48. prefix-icon="el-icon-date"
  49. @change="changeTime"
  50. :editable="false"
  51. type="date"
  52. style="max-width:160px"
  53. placeholder="选择日期时间"
  54. align="right"
  55. format="yyyy-MM-dd"
  56. value-format="yyyy-MM-dd"
  57. :picker-options="pickerOptions"
  58. ></el-date-picker>
  59. <span class>-</span>
  60. <el-date-picker
  61. v-model="listQuery.end_time"
  62. prefix-icon="el-icon-date"
  63. @change="changeEndTime"
  64. :editable="false"
  65. type="date"
  66. style="max-width:160px"
  67. placeholder="选择日期时间"
  68. align="right"
  69. format="yyyy-MM-dd"
  70. value-format="yyyy-MM-dd"
  71. :picker-options="pickerOptions"
  72. ></el-date-picker>
  73. </div>
  74. <div class="tableTitle">指标监控</div>
  75. <div style="width:100%;overflow-x:auto">
  76. <div class="qualityBox">
  77. <div
  78. class="qualityOne"
  79. v-for="(item,index) in normData"
  80. :key="index"
  81. :class="quality == index ? 'active' : ''"
  82. @click="clickQuality(index,item.inspection_minor)"
  83. >
  84. <p>{{ item.item_name }}</p>
  85. <span v-if="isTrue == 1"><i class="iconfont icon-gou gou"></i></span>
  86. <span v-if="isTrue == 0"><i class="iconfont icon-gantanhao gth"></i></span>
  87. </div>
  88. </div>
  89. </div>
  90. <div class="tableTitle">指标趋势</div>
  91. <div>
  92. <line-chart :options="chart"></line-chart>
  93. </div>
  94. </div>
  95. </el-container>
  96. </div>
  97. </div>
  98. </div>
  99. </template>
  100. <script>
  101. const moment = require('moment')
  102. import echarts from "echarts";
  103. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  104. import LineChart from "../qcd/components/LineChart";
  105. import { uParseTime } from "@/utils/tools";
  106. import { getCurrentOrgPatients,GetQualityControl,getNormData,getPatientComplianceDetail } from "@/api/common/common"
  107. export default {
  108. components: {
  109. LineChart,
  110. BreadCrumb
  111. },
  112. data() {
  113. return {
  114. isTrue:0,
  115. crumbs: [
  116. { path: false, name: "质控管理" },
  117. { path: false, name: "患者达标详情" }
  118. ],
  119. patientsData:[],
  120. normData:[],
  121. startime:0,
  122. endtime:0,
  123. listQuery: {
  124. start_time: "",
  125. end_time: "",
  126. page: 1,
  127. limit: 10
  128. },
  129. item_id:0,
  130. month: [
  131. { value: 0, label: "本月", state: 0 },
  132. { value: 1, label: "近三个月", state: 1 },
  133. { value: 2, label: "近半年", state: 2 },
  134. { value: 3, label: "近一年", state: 3 }
  135. ],
  136. modesData: {
  137. xAxis: [],
  138. series: []
  139. },
  140. pickerOptions: {
  141. disabledDate(time) {
  142. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear()-1)).getTime() - 24 * 3600 * 1000;
  143. return time.getTime() > Date.now() || time.getTime() < threeMonths;;
  144. }
  145. },
  146. patientid:0,
  147. monthType: 0,
  148. arr: ["钙", "磷", "钙萨达撒所多", "磷", "钙", "磷", "钙", "磷"],
  149. quality: 0,
  150. chart: {
  151. title: {
  152. text: "ECharts 入门示例"
  153. },
  154. tooltip: {},
  155. legend: {
  156. data: ["次数"],
  157. left: 0
  158. },
  159. xAxis: {
  160. data: []
  161. },
  162. yAxis: {
  163. axisLabel: {
  164. formatter: "{value} %"
  165. },
  166. show: false
  167. },
  168. series: [
  169. {
  170. name: "次数",
  171. type: "line",
  172. data: [],
  173. barWidth: 30,
  174. label: {
  175. normal: {
  176. show: true,
  177. position: "top",
  178. formatter: "{c}g/L"
  179. }
  180. },
  181. //配置样式
  182. itemStyle: {
  183. //通常情况下:
  184. //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
  185. normal: {
  186. color: function(params) {
  187. //我这边就两个柱子,大体就两个柱子颜色渐变,所以数组只有两个值,多个颜色就多个值
  188. var colorList = [
  189. ["#A9E0F3", "#9FBDFC"],
  190. ["#A9E0F3", "#9FBDFC"],
  191. ["#A9E0F3", "#9FBDFC"],
  192. ["#FFD7C0", "#FF9994"],
  193. ["#FFD7C0", "#FF9994"],
  194. ["#FFD7C0", "#FF9994"],
  195. ["#D7C3FD", "#B3A8F7"],
  196. ["#D7C3FD", "#B3A8F7"],
  197. ["#D7C3FD", "#B3A8F7"]
  198. ];
  199. var index = params.dataIndex;
  200. if (params.dataIndex >= colorList.length) {
  201. index = params.dataIndex % colorList.length;
  202. }
  203. return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  204. { offset: 0, color: colorList[index][0] },
  205. // { offset: 0.5, color: colorList[index][1] },
  206. { offset: 1, color: colorList[index][1] }
  207. ]);
  208. },
  209. barBorderRadius: [5, 5, 0, 0] //柱状角成椭圆形
  210. },
  211. //鼠标悬停时:
  212. emphasis: {
  213. shadowBlur: 10,
  214. shadowOffsetX: 0,
  215. shadowColor: "rgba(0, 0, 0, 0.5)"
  216. }
  217. }
  218. }
  219. ]
  220. },
  221. inspect_date:0,
  222. monthActive:0,
  223. };
  224. },
  225. methods: {
  226. chooseMonth(month) {
  227. //一月
  228. if(month == 0){
  229. this.monthActive = 0
  230. const startDate = moment().subtract('month', 0).format('YYYY-MM') + '-01'
  231. const endDate = moment(new Date()).format('YYYY-MM-DD')
  232. var now = new Date()
  233. var nowMonth = now.getMonth(); //当前月
  234. var nowYear = now.getFullYear(); //当前年
  235. //本月的开始时间
  236. var monthStartDate = new Date(nowYear, nowMonth, 1);
  237. this.startime=Date.parse(monthStartDate)/1000;//s
  238. //本月的结束时间
  239. var monthEndDate = moment().endOf('month').format('YYYY-MM-DD HH:mm:ss');
  240. this.endtime =Date.parse(monthEndDate)/1000-1;//s
  241. this.getlistDetail()
  242. }
  243. //近三月
  244. if(month == 1){
  245. this.monthActive = 1
  246. const startDate = moment().subtract('month', 3).format('YYYY-MM-DD')
  247. this.startime = Date.parse(startDate)/1000
  248. const endDate = moment(new Date()).format('YYYY-MM-DD')
  249. this.endtime = Date.parse(endDate)/1000
  250. this.getlistDetail()
  251. }
  252. //近半年
  253. if(month == 2){
  254. this.monthActive = 2
  255. const startDate = moment().subtract('month', 6).format('YYYY-MM-DD')
  256. this.startime = Date.parse(startDate)/1000
  257. const endDate = moment(new Date()).format('YYYY-MM-DD')
  258. this.endtime = Date.parse(endDate)/1000
  259. this.getlistDetail()
  260. }
  261. //近一年
  262. if(month == 3){
  263. this.monthActive = 3
  264. const startDate = moment().subtract('month', 12).format('YYYY-MM-DD')
  265. this.startime = Date.parse(startDate)/1000
  266. const endDate = moment(new Date()).format('YYYY-MM-DD')
  267. this.endtime = Date.parse(endDate)/1000
  268. this.getlistDetail()
  269. }
  270. this.monthType = month;
  271. },
  272. clickQuality(index,itemid) {
  273. this.quality = index;
  274. this.item_id = itemid
  275. this.getlistDetail()
  276. },
  277. handleSizeChange(limit) {
  278. //this.limit = limit;
  279. //this.getConfigurationList();
  280. },
  281. handleCurrentChange(page) {
  282. //this.page = page;
  283. //this.getConfigurationList();
  284. },
  285. getTime(time) {
  286. return uParseTime(time, "{y}-{m}-{d}");
  287. },
  288. onSearch(){
  289. },
  290. changeTime(val){
  291. var time = this.getTimestamp(val) - this.getTimestamp(this.listQuery.end_time);
  292. if (time > 0) {
  293. this.$message.error("结束时间不能小于开始时间");
  294. this.listQuery.start_time = "";
  295. } else {
  296. this.startime = Date.parse(val)/1000;//s
  297. this.getlistDetail()
  298. }
  299. },
  300. changeEndTime(val){
  301. var time =
  302. this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
  303. if (time < 0) {
  304. this.$message.error("结束时间不能小于开始时间");
  305. this.listQuery.end_time = "";
  306. } else {
  307. this.endtime = Date.parse(val)/1000;//s
  308. this.getlistDetail()
  309. }
  310. },
  311. getTimestamp(time) {
  312. // 把时间日期转成时间戳
  313. return new Date(time).getTime() / 1000;
  314. },
  315. handleChange(val){
  316. this.patientid = val.id
  317. this.getlistDetail()
  318. },
  319. getCurrentOrgPatients(){
  320. getCurrentOrgPatients().then(response=>{
  321. if(response.data.state == 1){
  322. var patients = response.data.data.patients
  323. this.patientsData = patients
  324. }
  325. })
  326. },
  327. getNormData(){
  328. getNormData().then(response=>{
  329. var normdata = response.data.data.normdata
  330. for(let i=0;i<normdata.length;i++){
  331. this.item_id = normdata[0].inspection_minor
  332. }
  333. this.normData = normdata
  334. this.getlist()
  335. })
  336. },
  337. getlist(){
  338. this.modesData.series = []
  339. this.modesData.xAxis = []
  340. const startDate = moment().subtract('month', 0).format('YYYY-MM') + '-01'
  341. const endDate = moment(new Date()).format('YYYY-MM-DD')
  342. var now = new Date()
  343. var nowMonth = now.getMonth(); //当前月
  344. var nowYear = now.getFullYear(); //当前年
  345. //本月的开始时间
  346. var monthStartDate = new Date(nowYear, nowMonth, 1);
  347. this.startime=Date.parse(monthStartDate)/1000;//s
  348. //本月的结束时间
  349. var monthEndDate = moment().endOf('month').format('YYYY-MM-DD HH:mm:ss');
  350. this.endtime =Date.parse(monthEndDate)/1000-1;//s
  351. const params = {
  352. patientid:this.patientid,
  353. startime:this.startime,
  354. endtime:this.endtime,
  355. itemid:this.item_id,
  356. inspectdate:this.inspect_date,
  357. }
  358. GetQualityControl(params).then(response=>{
  359. if(response.data.state == 1){
  360. var list = response.data.data.list
  361. for(let i=0;i<list.length;i++){
  362. if(parseInt(list[i].inspect_value)>= parseInt(list[i].range_min) && parseInt(list[i].inspect_value)<= parseInt(list[i].range_max)){
  363. this.isTrue = 1
  364. }
  365. if(parseInt(list[i].inspect_value)< parseInt(list[i].range_min) || parseInt(list[i].inspect_value) > parseInt(list[i].range_max)){
  366. this.isTrue =0
  367. }
  368. this.modesData.xAxis.push(this.getTime(list[i].inspect_date));
  369. this.modesData.series.push(list[i].inspect_value)
  370. }
  371. this.chart.series[0].data = this.modesData.series
  372. this.chart.xAxis.data = this.modesData.xAxis
  373. }
  374. })
  375. },
  376. getlistDetail(){
  377. this.modesData.series = []
  378. this.modesData.xAxis = []
  379. const startDate = moment().subtract('month', 0).format('YYYY-MM') + '-01'
  380. const endDate = moment(new Date()).format('YYYY-MM-DD')
  381. if(this.monthActive == 0){
  382. var now = new Date()
  383. var nowMonth = now.getMonth(); //当前月
  384. var nowYear = now.getFullYear(); //当前年
  385. //本月的开始时间
  386. var monthStartDate = new Date(nowYear, nowMonth, 1);
  387. this.startime=Date.parse(monthStartDate)/1000;//s
  388. //本月的结束时间
  389. var monthEndDate = moment().endOf('month').format('YYYY-MM-DD HH:mm:ss');
  390. this.endtime =Date.parse(monthEndDate)/1000-1;//s
  391. }
  392. const params = {
  393. patientid:this.patientid,
  394. startime:this.startime,
  395. endtime:this.endtime,
  396. itemid:this.item_id,
  397. }
  398. console.log("params",params)
  399. getPatientComplianceDetail(params).then(response=>{
  400. if(response.data.state == 1){
  401. var list = response.data.data.list
  402. for(let i=0;i<list.length;i++){
  403. if(parseInt(list[i].inspect_value)>= parseInt(list[i].range_min) && parseInt(list[i].inspect_value)<= parseInt(list[i].range_max)){
  404. this.isTrue = 1
  405. }
  406. if(parseInt(list[i].inspect_value)< parseInt(list[i].range_min) || parseInt(list[i].inspect_value) > parseInt(list[i].range_max)){
  407. this.isTrue =0
  408. }
  409. this.modesData.xAxis.push(this.getTime(list[i].inspect_date));
  410. this.modesData.series.push(list[i].inspect_value)
  411. }
  412. this.chart.series[0].data = this.modesData.series
  413. this.chart.xAxis.data = this.modesData.xAxis
  414. }
  415. })
  416. }
  417. },
  418. created(){
  419. this.patientid = this.$route.query.patientid
  420. this.inspect_date = this.$route.query.date
  421. //获取指标项
  422. this.getNormData()
  423. //获取该机构下的所有患者
  424. this.getCurrentOrgPatients()
  425. }
  426. };
  427. </script>
  428. <style lang="scss" scoped>
  429. .containerRight {
  430. padding-left: 10px;
  431. }
  432. .tableTitle {
  433. font-size: 16px;
  434. color: #000;
  435. font-weight: bold;
  436. margin-bottom: 10px;
  437. margin-top: 8px;
  438. }
  439. .qualityBox {
  440. display: flex;
  441. flex-wrap: nowrap;
  442. min-width: 1800px;
  443. .qualityOne {
  444. width: 4.5rem;
  445. height: 4.5rem;
  446. border-radius: 0.3125rem;
  447. border: 1px solid rgba(229, 229, 229, 1);
  448. display: flex;
  449. align-items: center;
  450. flex-direction: column;
  451. margin-right: 0.875rem;
  452. cursor: pointer;
  453. // justify-content: space-around;
  454. .gth {
  455. color: #ff974a;
  456. font-size: 1.25rem;
  457. }
  458. .gou {
  459. color: #5cd924;
  460. font-size: 1.25rem;
  461. }
  462. p {
  463. width: 100%;
  464. margin-top: 1.25rem;
  465. margin-bottom: 0.625rem;
  466. font-weight: bold;
  467. color: #666666;
  468. font-size: 0.875rem;
  469. text-align: center;
  470. white-space: nowrap;
  471. overflow: hidden;
  472. text-overflow: ellipsis;
  473. }
  474. }
  475. .active {
  476. background: #5b98ff;
  477. p {
  478. color: #fff;
  479. }
  480. .gth {
  481. color: #fff;
  482. font-size: 1.25rem;
  483. }
  484. .gou {
  485. color: #fff;
  486. font-size: 1.25rem;
  487. }
  488. }
  489. }
  490. </style>
  491. <style lang="scss">
  492. .page_patientComplianceDetails {
  493. .cell {
  494. text-align: center;
  495. }
  496. .el-form-item {
  497. margin-bottom: 0;
  498. }
  499. }
  500. </style>