weight.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  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" id="outcome-indicators-query">
  7. <person-info :patient="patientInfo"></person-info>
  8. <person-nav activeName="weight" :patientID="patientID"></person-nav>
  9. <div class="cell clearfix">
  10. <label class="title">
  11. <span class="name">日期查询</span> :
  12. </label>
  13. <el-date-picker
  14. v-model="listQuery.start_time"
  15. prefix-icon="el-icon-date"
  16. @change="changeTime"
  17. :editable="false"
  18. style="width: 196px;"
  19. type="date"
  20. placeholder="选择日期时间"
  21. align="right"
  22. format="yyyy-MM-dd"
  23. value-format="yyyy-MM-dd"
  24. ></el-date-picker>
  25. <span class>-</span>
  26. <el-date-picker
  27. v-model="listQuery.end_time"
  28. prefix-icon="el-icon-date"
  29. @change="changeTime"
  30. :editable="false"
  31. style="width: 196px;"
  32. type="date"
  33. placeholder="选择日期时间"
  34. align="right"
  35. format="yyyy-MM-dd"
  36. value-format="yyyy-MM-dd"
  37. ></el-date-picker>
  38. </div>
  39. <div class="cell clearfix">
  40. <label class="title">
  41. <span class="name">曲线图</span> :
  42. </label>
  43. <div class="time">
  44. <ul class>
  45. <li
  46. :class="item.value==diagramType?'active':''"
  47. @click="selectDiagramType( item.value)"
  48. v-for="item in diagramTypeOptions"
  49. :key="item.value"
  50. >{{item.label}}</li>
  51. </ul>
  52. </div>
  53. </div>
  54. <div class="cqd-dataTitle">统计图</div>
  55. <el-row :gutter="32">
  56. <el-col :xs="24" :sm="24" :lg="24">
  57. <div class="chart-wrapper">
  58. <line-chart title="曲线图(Kg)" :options="CompletionOptions" />
  59. </div>
  60. </el-col>
  61. </el-row>
  62. <div style="height:20px">&nbsp;</div>
  63. <div class="cqd-dataTitle">统计表</div>
  64. <el-table
  65. ref="multipleTable"
  66. :data="tableData"
  67. border
  68. fit
  69. highlight-current-row
  70. style="width: 100%;margin-top: 10px;"
  71. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  72. >
  73. <el-table-column label="透析日期" min-width="80" property="schedule_date" align="center">
  74. <template slot-scope="scope"><span>{{getTime(scope.row.schedule_date, '{y}{m}{d}')}}</span></template>
  75. </el-table-column>
  76. <el-table-column label="干体重" min-width="80" property="assessment_before_dislysis" align="center">
  77. <template slot-scope="scope"><span>{{scope.row.assessment_before_dislysis?scope.row.assessment_before_dislysis.dry_weight + 'Kg':'--'}}</span></template>
  78. </el-table-column>
  79. <el-table-column label="透前称重" min-width="80" property="assessment_before_dislysis" align="center">
  80. <template slot-scope="scope"><span>{{scope.row.assessment_before_dislysis?scope.row.assessment_before_dislysis.weight_before + 'Kg':'--'}}</span></template>
  81. </el-table-column>
  82. <el-table-column label="体重增加" min-width="80" property="assessment_before_dislysis" align="center">
  83. <template slot-scope="scope"><span>{{scope.row.assessment_before_dislysis?scope.row.assessment_before_dislysis.weight_before - scope.row.assessment_before_dislysis.dry_weight + 'Kg':'--'}}</span></template>
  84. </el-table-column>
  85. <el-table-column label="透后称重" min-width="80" property="assessment_after_dislysis" align="center">
  86. <template slot-scope="scope"><span>{{scope.row.assessment_after_dislysis?scope.row.assessment_after_dislysis.weight_after+ 'Kg':'--'}}</span></template>
  87. </el-table-column>
  88. </el-table>
  89. <!-- <pagi-nation title="分页"></pagi-nation> -->
  90. <el-pagination
  91. align="right"
  92. @size-change="handleSizeChange"
  93. @current-change="handleCurrentChange"
  94. :current-page="listQuery.pate"
  95. :page-sizes="[10, 20, 50, 100]"
  96. :page-size="10"
  97. background
  98. style="margin-top:20px;"
  99. layout="total, sizes, prev, pager, next, jumper"
  100. :total="total"
  101. ></el-pagination>
  102. </div>
  103. </div>
  104. </template>
  105. <script>
  106. import { GetPersonWeightData } from "@/api/qcd";
  107. import {jsGetAge, uParseTime} from "@/utils/tools";
  108. import personNav from './components/personNav'
  109. import personInfo from './components/personInfo'
  110. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  111. import LineChart from "../../components/LineChart";
  112. export default {
  113. name: "totalAnalysis",
  114. data() {
  115. return {
  116. crumbs:[
  117. {path:false, name:'科室质控'},
  118. {path:false, name:'患者分析'},
  119. {path:false, name:'统计'},
  120. {path:false, name:'体重'},
  121. ],
  122. total: 0,
  123. patientMap:{},
  124. listQuery: {
  125. start_time: "",
  126. end_time: "",
  127. page: 1,
  128. limit: 10,
  129. },
  130. CompletionOptions:{
  131. xAxis:[],
  132. legend:[],
  133. series:[],
  134. },
  135. tableData: [],
  136. pieData:[],
  137. patientInfo:null,
  138. patientID:0,
  139. diagramType:1,
  140. diagramTypeOptions: [
  141. { value: 1, label: "体重变化趋势", },
  142. { value: 2, label: "体重增加", }
  143. ],
  144. };
  145. },
  146. created() {
  147. var patientID = this.$route.query && this.$route.query.id;
  148. if(typeof(patientID) == 'undefined' || !patientID || patientID<=0) {
  149. this.$message.error('参数错误,无法请求');
  150. return false;
  151. }
  152. patientID = parseInt(patientID);
  153. this.patientID = patientID;
  154. this.listQuery.patient_id = patientID;
  155. var nowDate = new Date();
  156. var nowYear = nowDate.getFullYear();
  157. var nowMonth = nowDate.getMonth() + 1;
  158. var nowDay = nowDate.getDate();
  159. this.listQuery.end_time =
  160. nowYear +
  161. "-" +
  162. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  163. "-" +
  164. (nowDay < 10 ? "0" + nowDay : nowDay);
  165. nowDate.setMonth(nowDate.getMonth() - 3);
  166. nowYear = nowDate.getFullYear();
  167. nowMonth = nowDate.getMonth() + 1;
  168. nowDay = nowDate.getDate();
  169. this.listQuery.start_time =
  170. nowYear +
  171. "-" +
  172. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  173. "-" +
  174. (nowDay < 10 ? "0" + nowDay : nowDay);
  175. this.getList();
  176. },
  177. methods: {
  178. getList() {
  179. GetPersonWeightData(this.listQuery).then(response => {
  180. if (response.data.state == 0) {
  181. this.$message.error(response.data.msg);
  182. return false;
  183. } else {
  184. this.tableData = [];
  185. this.total = response.data.data.total;
  186. this.patientInfo = response.data.data.patient;
  187. var weight = response.data.data.weight;
  188. for (const index in weight) {
  189. this.tableData.push(weight[index]);
  190. }
  191. var pieData = response.data.data.pie;
  192. for (const index in pieData) {
  193. this.pieData.push(pieData[index]);
  194. }
  195. }
  196. });
  197. },
  198. changeTime() {
  199. this.getList();
  200. },
  201. onSearch(){
  202. this.getList();
  203. },
  204. changeModel() {
  205. this.getList();
  206. },
  207. handleSizeChange(val) {
  208. this.listQuery.limit = val;
  209. this.getList();
  210. },
  211. handleCurrentChange(val) {
  212. this.listQuery.page = val;
  213. this.getList();
  214. },
  215. getTime(value, temp) {
  216. if (value != undefined) {
  217. return uParseTime(value, temp)
  218. }
  219. return ""
  220. },
  221. getProjectName(id) {
  222. return (id in this.projectOptions) ? this.projectOptions[id].project_name:'';
  223. },
  224. getPatientName(id) {
  225. return (id in this.patientMap) ? this.patientMap[id].name:'';
  226. },
  227. getPatientLapseto(lapseto) {
  228. if(lapseto==1) {
  229. return '留治';
  230. }else if(lapseto == 2) {
  231. return '转出';
  232. }
  233. return '--';
  234. },
  235. getPatientSource(srouce){
  236. if(srouce==1) {
  237. return '门诊';
  238. }else if(srouce == 2) {
  239. return '住院';
  240. }
  241. return '其他';
  242. },
  243. getPatientGender(gender) {
  244. if (gender == 1) {
  245. return '男';
  246. } else if(gender == 2) {
  247. return '女';
  248. }
  249. return '';
  250. },
  251. tranAge(birthday) {
  252. var birth = uParseTime(birthday, '{y}-{m}-{d}');
  253. return jsGetAge(birth, '-');
  254. },
  255. getPatientDialysisNo(id) {
  256. return (id in this.patientMap) ? this.patientMap[id].dialysis_no:'';
  257. },
  258. getItemVulue(project_id, item_id, row) {
  259. var key = project_id + '_' + item_id;
  260. return (typeof(row.items) !== 'undefined' && (key in row.items)) ? row.items[key].inspect_value:'';
  261. },
  262. renderheader(h, { column, $index }) {
  263. return h('span', {}, [
  264. h('span', {}, column.label.split('//')[0]),
  265. h('br'),
  266. h('span', {}, column.label.split('//')[1])
  267. ])
  268. },
  269. selectDiagramType(type) {
  270. this.diagramType = type;
  271. this.listQuery.diagram_type = type;
  272. // this.getList();
  273. },
  274. drawPie(){
  275. this.CompletionOptions = {
  276. xAxis:[],
  277. legend:[],
  278. series:[],
  279. };
  280. if(this.diagramType !== 1 && this.diagramType !== 2) {
  281. return false;
  282. }
  283. if (this.diagramType == 1) {
  284. this.CompletionOptions.legend = ['透前称重', '透后称重', '干体重'];
  285. this.CompletionOptions.series = [
  286. { name:'透前称重', type:'line', data:[] },
  287. { name:'透后称重', type:'line', data:[] },
  288. { name:'干体重', type:'line', data:[] },
  289. ];
  290. }else {
  291. this.CompletionOptions.legend = ['体重增加'];
  292. this.CompletionOptions.series = [
  293. // { name:'透前体重', type:'line', data:[] },
  294. { name:'体重增加', type:'line', data:[] },
  295. // { name:'干体重', type:'line', data:[] },
  296. ];
  297. }
  298. for (const index in this.pieData) {
  299. var dateDay = uParseTime(this.pieData[index].schedule_date, '{y}-{m}-{d}');
  300. if (this.diagramType == 1) {
  301. this.CompletionOptions.xAxis.push(dateDay);
  302. if (this.pieData[index].assessment_after_dislysis) {
  303. this.CompletionOptions.series[1].data.push(this.pieData[index].assessment_after_dislysis.weight_after);
  304. } else {
  305. this.CompletionOptions.series[1].data.push(0);
  306. }
  307. if (this.pieData[index].assessment_before_dislysis) {
  308. this.CompletionOptions.series[0].data.push(this.pieData[index].assessment_before_dislysis.weight_before);
  309. this.CompletionOptions.series[2].data.push(this.pieData[index].assessment_before_dislysis.dry_weight);
  310. } else {
  311. this.CompletionOptions.series[0].data.push(0);
  312. this.CompletionOptions.series[2].data.push(0);
  313. }
  314. } else {
  315. this.CompletionOptions.xAxis.push(dateDay);
  316. if (this.pieData[index].assessment_before_dislysis) {
  317. var weightTem = this.pieData[index].assessment_before_dislysis.weight_before - this.pieData[index].assessment_before_dislysis.dry_weight;
  318. // this.CompletionOptions.series[0].data.push(this.pieData[index].assessment_before_dislysis.weight_before);
  319. this.CompletionOptions.series[0].data.push(weightTem);
  320. // this.CompletionOptions.series[2].data.push(this.pieData[index].assessment_before_dislysis.dry_weight);
  321. } else {
  322. this.CompletionOptions.series[0].data.push(0);
  323. }
  324. }
  325. }
  326. },
  327. },
  328. components: {
  329. personNav,
  330. BreadCrumb,
  331. personInfo,
  332. LineChart
  333. },
  334. watch:{
  335. "diagramType":function(){
  336. this.drawPie();
  337. },
  338. "pieData":function (){
  339. this.drawPie();
  340. },
  341. }
  342. };
  343. </script>
  344. <style>
  345. #oictable ::-webkit-scrollbar {
  346. height: 15px;
  347. }
  348. #outcome-indicators-query .el-form-item {
  349. margin-bottom: 0px !important;
  350. }
  351. </style>
  352. <style rel="stylesheet/scss" lang="scss" scoped>
  353. .app-container {
  354. // margin: 20px;
  355. font-size: 15px;
  356. .filter-container {
  357. padding-bottom: 5px;
  358. }
  359. .cqd-dataTitle{
  360. color: #303133;
  361. font-size: 14px;
  362. border-bottom: 2px #E4E7ED solid;
  363. height: 36px;
  364. line-height: 36px;
  365. margin: 0 0 25px 0;
  366. position: relative;
  367. }
  368. .cqd-dataTitle::before {
  369. position: absolute;
  370. left: 0;
  371. bottom: -2px;
  372. content: "";
  373. width: 42px;
  374. height: 2px;
  375. background: #409eff;
  376. }
  377. .search-component {
  378. width: 500px;
  379. .searchBox {
  380. width: 300px;
  381. height: 36px;
  382. line-height: 36px;
  383. padding-left: 15px;
  384. border: 1px #dcdfe6 solid;
  385. border-right: none;
  386. outline: none;
  387. float: left;
  388. border-radius: 6px 0 0 6px;
  389. font-size: 14px;
  390. color: #333;
  391. background: #fff;
  392. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  393. }
  394. .searchBtn {
  395. background-color: #409eff;
  396. color: #fff;
  397. font-size: 15px;
  398. text-align: center;
  399. height: 36px;
  400. line-height: 36px;
  401. float: left;
  402. outline: none;
  403. width: 70px;
  404. border: none;
  405. border-radius: 0 6px 6px 0;
  406. font-family: "Microsoft Yahei";
  407. cursor: pointer;
  408. }
  409. }
  410. .amount {
  411. font-weight: normal;
  412. padding: 10px 0 0 0;
  413. color: #606266;
  414. font-size: 14px;
  415. span {
  416. color: #ef2525;
  417. font-family: "Arial";
  418. padding: 0 2px;
  419. }
  420. }
  421. }
  422. </style>