weight.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530
  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. <analysis-nav activeName="weight"></analysis-nav>
  8. <div class="cell clearfix">
  9. <label class="title">
  10. <span class="name">日期查询</span> :
  11. </label>
  12. <el-date-picker
  13. v-model="listQuery.start_time"
  14. prefix-icon="el-icon-date"
  15. @change="changeTime"
  16. :editable="false"
  17. style="width: 196px;"
  18. type="date"
  19. placeholder="选择日期时间"
  20. align="right"
  21. format="yyyy-MM-dd"
  22. value-format="yyyy-MM-dd"
  23. ></el-date-picker>
  24. <span class>-</span>
  25. <el-date-picker
  26. v-model="listQuery.end_time"
  27. prefix-icon="el-icon-date"
  28. @change="changeTime"
  29. :editable="false"
  30. style="width: 196px;"
  31. type="date"
  32. placeholder="选择日期时间"
  33. align="right"
  34. format="yyyy-MM-dd"
  35. value-format="yyyy-MM-dd"
  36. ></el-date-picker>
  37. </div>
  38. <div class="cell clearfix">
  39. <label class="title">
  40. <span class="name">转归状态</span> :
  41. </label>
  42. <div class="time">
  43. <ul class>
  44. <li
  45. :class="item.lapseto==lapsetoType?'active':''"
  46. @click="selectLapseTo( item.lapseto)"
  47. v-for="item in lapsetoState"
  48. :key="item.value"
  49. >{{item.label}}</li>
  50. </ul>
  51. </div>
  52. </div>
  53. <div class="cell clearfix">
  54. <label class="title">
  55. <span class="name">年龄</span> :
  56. </label>
  57. <div class="time">
  58. <ul class>
  59. <li
  60. :class="item.age==ageType?'active':''"
  61. @click="selectAge( item.age)"
  62. v-for="item in ageOptions"
  63. :key="item.value"
  64. >{{item.label}}</li>
  65. </ul>
  66. </div>
  67. </div>
  68. <div class="cqd-dataTitle">统计图</div>
  69. <el-row :gutter="32">
  70. <el-col :xs="24" :sm="24" :lg="8">
  71. <div class="chart-wrapper">
  72. <pie-chart title="干体重(人次)" :options="CompletionOptions"/>
  73. </div>
  74. </el-col>
  75. <el-col :xs="24" :sm="24" :lg="8">
  76. <div class="chart-wrapper">
  77. <pie-chart title="体重增加(人次)" :options="WeightIncrOptions"/>
  78. </div>
  79. </el-col>
  80. <el-col :xs="24" :sm="24" :lg="8">
  81. <div class="chart-wrapper">
  82. <pie-chart title="透后称重(人次)" :options="WeightAfterOptions"/>
  83. </div>
  84. </el-col>
  85. </el-row>
  86. <div style="height:20px">&nbsp;</div>
  87. <div class="cqd-dataTitle">统计表</div>
  88. <el-table
  89. ref="multipleTable"
  90. :data="tableData"
  91. border
  92. fit
  93. highlight-current-row
  94. style="width: 100%;margin-top: 10px;"
  95. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}"
  96. >
  97. <el-table-column label="透析日期" min-width="80" property="schedule_date" align="center">
  98. <template slot-scope="scope"><span>{{getTime(scope.row.schedule_date, '{y}{m}{d}')}}</span></template>
  99. </el-table-column>
  100. <el-table-column label="透析号" min-width="100" property="patient" align="center">
  101. <template slot-scope="scope"><span>{{scope.row.patient.dialysis_no}}</span></template>
  102. </el-table-column>
  103. <el-table-column label="患者姓名" min-width="100" property="patient" align="center">
  104. <template slot-scope="scope"><span>{{scope.row.patient.name}}</span></template>
  105. </el-table-column>
  106. <el-table-column label="性别" min-width="80" property="patient" align="center">
  107. <template slot-scope="scope"><span>{{getPatientGender(scope.row.patient.gender)}}</span></template>
  108. </el-table-column>
  109. <el-table-column label="年龄" min-width="80" property="patient" align="center">
  110. <template slot-scope="scope"><span>{{tranAge(scope.row.patient.birthday)}}</span></template>
  111. </el-table-column>
  112. <el-table-column label="转归状态" min-width="80" property="patient" align="center">
  113. <template slot-scope="scope"><span>{{tranLapseto(scope.row.patient.lapseto)}}</span></template>
  114. </el-table-column>
  115. <el-table-column label="干体重" min-width="80" property="assessment_before_dislysis" align="center">
  116. <template slot-scope="scope"><span>{{scope.row.assessment_before_dislysis?scope.row.assessment_before_dislysis.dry_weight + 'Kg':'--'}}</span></template>
  117. </el-table-column>
  118. <el-table-column label="透前体重" min-width="80" property="assessment_before_dislysis" align="center">
  119. <template slot-scope="scope"><span>{{scope.row.assessment_before_dislysis?scope.row.assessment_before_dislysis.weight_before + 'Kg':'--'}}</span></template>
  120. </el-table-column>
  121. <el-table-column label="体重增加" min-width="80" property="assessment_before_dislysis" align="center">
  122. <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>
  123. </el-table-column>
  124. <el-table-column label="透后称重" min-width="80" property="assessment_after_dislysis" align="center">
  125. <template slot-scope="scope"><span>{{scope.row.assessment_after_dislysis?scope.row.assessment_after_dislysis.weight_after+ 'Kg':'--'}}</span></template>
  126. </el-table-column>
  127. <el-table-column label="统计" min-width="80" property="patient" align="center">
  128. <template slot-scope="scope">
  129. <el-tooltip class="item" effect="dark" content="统计" placement="top">
  130. <el-button type="primary" icon="el-icon-share" size="small" @click="OpenPage(scope.row.patient.id)"></el-button>
  131. </el-tooltip>
  132. </template>
  133. </el-table-column>
  134. </el-table>
  135. <!-- <pagi-nation title="分页"></pagi-nation> -->
  136. <el-pagination
  137. align="right"
  138. @size-change="handleSizeChange"
  139. @current-change="handleCurrentChange"
  140. :current-page="listQuery.pate"
  141. :page-sizes="[10, 20, 50, 100]"
  142. :page-size="10"
  143. background
  144. style="margin-top:20px;"
  145. layout="total, sizes, prev, pager, next, jumper"
  146. :total="total"
  147. ></el-pagination>
  148. </div>
  149. </div>
  150. </template>
  151. <script>
  152. import { GetPAWeightData } from "@/api/qcd";
  153. import PieChart from '../components/PieChart'
  154. import {jsGetAge, uParseTime} from "@/utils/tools";
  155. import analysisNav from './components/analysisNav'
  156. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  157. export default {
  158. name: "totalAnalysis",
  159. data() {
  160. return {
  161. crumbs:[
  162. {path:false, name:'科室质控'},
  163. {path:false, name:'患者分析'},
  164. {path:false, name:'体重分析'},
  165. ],
  166. total: 0,
  167. patientMap:{},
  168. listQuery: {
  169. start_time: "",
  170. end_time: "",
  171. page: 1,
  172. limit: 10,
  173. },
  174. CompletionOptions:{
  175. legend:[],
  176. series:[],
  177. },
  178. WeightIncrOptions:{
  179. legend:[],
  180. series:[],
  181. },
  182. WeightAfterOptions:{
  183. legend:[],
  184. series:[],
  185. },
  186. tableData: [],
  187. lapsetoType: 0,
  188. lapsetoState: [
  189. { value: 0, label: "全部", source: 0, lapseto: 0 },
  190. { value: 1, label: "转出", source: 0, lapseto: 2 },
  191. { value: 2, label: "留治", source: 0, lapseto: 1 }
  192. ],
  193. ageType: 0,
  194. ageOptions: [
  195. { value: 0, label: "全部", age: 0 },
  196. { value: 1, label: "20~30", age: 1 },
  197. { value: 2, label: "30~40", age: 2 },
  198. { value: 3, label: "40~50", age: 3 },
  199. { value: 4, label: "其他", age: 4 },
  200. ],
  201. };
  202. },
  203. created() {
  204. var nowDate = new Date();
  205. var nowYear = nowDate.getFullYear();
  206. var nowMonth = nowDate.getMonth() + 1;
  207. var nowDay = nowDate.getDate();
  208. this.listQuery.end_time =
  209. nowYear +
  210. "-" +
  211. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  212. "-" +
  213. (nowDay < 10 ? "0" + nowDay : nowDay);
  214. nowDate.setMonth(nowDate.getMonth() - 3);
  215. nowYear = nowDate.getFullYear();
  216. nowMonth = nowDate.getMonth() + 1;
  217. nowDay = nowDate.getDate();
  218. this.listQuery.start_time =
  219. nowYear +
  220. "-" +
  221. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  222. "-" +
  223. (nowDay < 10 ? "0" + nowDay : nowDay);
  224. this.getList();
  225. },
  226. methods: {
  227. OpenPage(id) {
  228. this.$router.push({ path: "/qcd/pa/person/weight?id="+id });
  229. },
  230. getList() {
  231. GetPAWeightData(this.listQuery).then(response => {
  232. if (response.data.state == 0) {
  233. this.$message.error(response.data.msg);
  234. return false;
  235. } else {
  236. this.tableData = [];
  237. this.total = response.data.data.total;
  238. var weights = response.data.data.weights;
  239. for (const index in weights) {
  240. this.tableData.push(weights[index]);
  241. }
  242. this.CompletionOptions = {
  243. legend:[],
  244. series:[],
  245. };
  246. var dryweightOptions = [
  247. { weight:1, name:'<40Kg' },
  248. { weight:2, name:'40~50Kg' },
  249. { weight:3, name:'50~60Kg' },
  250. { weight:4, name:'60~70Kg' },
  251. { weight:5, name:'>=70Kg' },
  252. ];
  253. var other = response.data.data.total;
  254. var dryweight = response.data.data.dryweight;
  255. var dryweightMap = {};
  256. for (const index in dryweight) {
  257. dryweightMap[dryweight[index].weight] = dryweight[index].count;
  258. other -= dryweight[index].count;
  259. }
  260. for (const index in dryweightOptions) {
  261. this.CompletionOptions.legend.push(dryweightOptions[index].name);
  262. if(dryweightOptions[index].weight in dryweightMap) {
  263. this.CompletionOptions.series.push({
  264. value:dryweightMap[dryweightOptions[index].weight],name:dryweightOptions[index].name
  265. });
  266. }else {
  267. this.CompletionOptions.series.push({
  268. value:0,name:dryweightOptions[index].name
  269. });
  270. }
  271. }
  272. if (other > 0) {
  273. this.CompletionOptions.legend.push('其他');
  274. this.CompletionOptions.series.push({
  275. value:other,name:'其他'
  276. });
  277. }
  278. this.WeightIncrOptions = {
  279. legend:[],
  280. series:[],
  281. };
  282. var weightOptions = [
  283. { weight:1, name:'<1Kg' },
  284. { weight:2, name:'1~2Kg' },
  285. { weight:3, name:'2~3Kg' },
  286. { weight:4, name:'3~4Kg' },
  287. { weight:5, name:'>=4Kg' },
  288. ];
  289. var other = response.data.data.total;
  290. var weightincrease = response.data.data.weightincrease;
  291. var weightincreaseMap = {};
  292. for (const index in weightincrease) {
  293. weightincreaseMap[weightincrease[index].weight] = weightincrease[index].count;
  294. other -= weightincrease[index].count;
  295. }
  296. for (const index in weightOptions) {
  297. this.WeightIncrOptions.legend.push(weightOptions[index].name);
  298. if(weightOptions[index].weight in weightincreaseMap) {
  299. this.WeightIncrOptions.series.push({
  300. value:weightincreaseMap[weightOptions[index].weight],name:weightOptions[index].name
  301. });
  302. }else {
  303. this.WeightIncrOptions.series.push({
  304. value:0,name:weightOptions[index].name
  305. });
  306. }
  307. }
  308. if (other > 0) {
  309. this.WeightIncrOptions.legend.push('其他');
  310. this.WeightIncrOptions.series.push({
  311. value:other,name:'其他'
  312. });
  313. }
  314. this.WeightAfterOptions = {
  315. legend:[],
  316. series:[],
  317. };
  318. var afterWeightOptions = [
  319. { weight:1, name:'<40Kg' },
  320. { weight:2, name:'40~50Kg' },
  321. { weight:3, name:'50~60Kg' },
  322. { weight:4, name:'60~70Kg' },
  323. { weight:5, name:'>=70Kg' },
  324. ];
  325. var other = response.data.data.total;
  326. var afterweight = response.data.data.afterweight;
  327. var afterweightMap = {};
  328. for (const index in afterweight) {
  329. afterweightMap[afterweight[index].weight] = afterweight[index].count;
  330. other -= afterweight[index].count;
  331. }
  332. for (const index in weightOptions) {
  333. this.WeightAfterOptions.legend.push(weightOptions[index].name);
  334. if(weightOptions[index].weight in afterweightMap) {
  335. this.WeightAfterOptions.series.push({
  336. value:afterweightMap[weightOptions[index].weight],name:weightOptions[index].name
  337. });
  338. }else {
  339. this.WeightAfterOptions.series.push({
  340. value:0,name:weightOptions[index].name
  341. });
  342. }
  343. }
  344. if (other > 0) {
  345. this.WeightAfterOptions.legend.push('其他');
  346. this.WeightAfterOptions.series.push({
  347. value:other,name:'其他'
  348. });
  349. }
  350. }
  351. });
  352. },
  353. changeTime() {
  354. this.getList();
  355. },
  356. changeModel() {
  357. this.getList();
  358. },
  359. handleSizeChange(val) {
  360. this.listQuery.limit = val;
  361. this.getList();
  362. },
  363. handleCurrentChange(val) {
  364. this.listQuery.page = val;
  365. this.getList();
  366. },
  367. selectLapseTo(lapseto) {
  368. this.lapsetoType = lapseto;
  369. this.listQuery.lapseto = lapseto;
  370. this.getList();
  371. },
  372. selectAge(age) {
  373. this.ageType = age;
  374. this.listQuery.age = age;
  375. this.getList();
  376. },
  377. getTime(value, temp) {
  378. if (value != undefined) {
  379. return uParseTime(value, temp)
  380. }
  381. return ""
  382. },
  383. getProjectName(id) {
  384. return (id in this.projectOptions) ? this.projectOptions[id].project_name:'';
  385. },
  386. getPatientName(id) {
  387. return (id in this.patientMap) ? this.patientMap[id].name:'';
  388. },
  389. tranLapseto(lapseto) {
  390. if (lapseto == 1) {
  391. return '留治';
  392. } else if(lapseto == 2) {
  393. return '转出';
  394. }
  395. return '';
  396. },
  397. getPatientGender(gender) {
  398. if (gender == 1) {
  399. return '男';
  400. } else if(gender == 2) {
  401. return '女';
  402. }
  403. return '';
  404. },
  405. tranAge(birthday) {
  406. var birth = uParseTime(birthday, '{y}-{m}-{d}');
  407. return jsGetAge(birth, '-');
  408. },
  409. getPatientDialysisNo(id) {
  410. return (id in this.patientMap) ? this.patientMap[id].dialysis_no:'';
  411. },
  412. getItemVulue(project_id, item_id, row) {
  413. var key = project_id + '_' + item_id;
  414. return (typeof(row.items) !== 'undefined' && (key in row.items)) ? row.items[key].inspect_value:'';
  415. },
  416. renderheader(h, { column, $index }) {
  417. return h('span', {}, [
  418. h('span', {}, column.label.split('//')[0]),
  419. h('br'),
  420. h('span', {}, column.label.split('//')[1])
  421. ])
  422. },
  423. },
  424. components: {
  425. analysisNav,
  426. PieChart,
  427. BreadCrumb
  428. }
  429. };
  430. </script>
  431. <style>
  432. #oictable ::-webkit-scrollbar {
  433. height: 15px;
  434. }
  435. #outcome-indicators-query .el-form-item {
  436. margin-bottom: 0px !important;
  437. }
  438. </style>
  439. <style rel="stylesheet/scss" lang="scss" scoped>
  440. .app-container {
  441. // margin: 20px;
  442. font-size: 15px;
  443. .filter-container {
  444. padding-bottom: 5px;
  445. }
  446. .cqd-dataTitle{
  447. color: #303133;
  448. font-size: 14px;
  449. border-bottom: 2px #E4E7ED solid;
  450. height: 36px;
  451. line-height: 36px;
  452. margin: 0 0 25px 0;
  453. position: relative;
  454. }
  455. .cqd-dataTitle::before {
  456. position: absolute;
  457. left: 0;
  458. bottom: -2px;
  459. content: "";
  460. width: 42px;
  461. height: 2px;
  462. background: #409eff;
  463. }
  464. .search-component {
  465. width: 500px;
  466. .searchBox {
  467. width: 300px;
  468. height: 36px;
  469. line-height: 36px;
  470. padding-left: 15px;
  471. border: 1px #dcdfe6 solid;
  472. border-right: none;
  473. outline: none;
  474. float: left;
  475. border-radius: 6px 0 0 6px;
  476. font-size: 14px;
  477. color: #333;
  478. background: #fff;
  479. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  480. }
  481. .searchBtn {
  482. background-color: #409eff;
  483. color: #fff;
  484. font-size: 15px;
  485. text-align: center;
  486. height: 36px;
  487. line-height: 36px;
  488. float: left;
  489. outline: none;
  490. width: 70px;
  491. border: none;
  492. border-radius: 0 6px 6px 0;
  493. font-family: "Microsoft Yahei";
  494. cursor: pointer;
  495. }
  496. }
  497. .amount {
  498. font-weight: normal;
  499. padding: 10px 0 0 0;
  500. color: #606266;
  501. font-size: 14px;
  502. span {
  503. color: #ef2525;
  504. font-family: "Arial";
  505. padding: 0 2px;
  506. }
  507. }
  508. }
  509. </style>