dialysisTotal.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  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="cell clearfix">
  8. <label class="title"> <span class="name">日期查询</span> : </label>
  9. <el-date-picker
  10. v-model="listQuery.start_time"
  11. prefix-icon="el-icon-date"
  12. @change="changeTime"
  13. :editable="false"
  14. style="width: 196px;"
  15. type="date"
  16. placeholder="选择日期时间"
  17. align="right"
  18. format="yyyy-MM-dd"
  19. value-format="yyyy-MM-dd"
  20. ></el-date-picker>
  21. <span class>-</span>
  22. <el-date-picker
  23. v-model="listQuery.end_time"
  24. prefix-icon="el-icon-date"
  25. @change="changeEndTime"
  26. :editable="false"
  27. style="width: 196px;"
  28. type="date"
  29. placeholder="选择日期时间"
  30. align="right"
  31. format="yyyy-MM-dd"
  32. value-format="yyyy-MM-dd"
  33. ></el-date-picker>
  34. </div>
  35. <div class="cell clearfix">
  36. <label class="title"> <span class="name">统计方式</span> : </label>
  37. <div class="time">
  38. <ul class>
  39. <li
  40. :class="item.value == statisticalMethod ? 'active' : ''"
  41. @click="selectStatisticalMethod(item.value)"
  42. v-for="item in statisticalMethods"
  43. :key="item.value"
  44. >
  45. {{ item.label }}
  46. </li>
  47. </ul>
  48. </div>
  49. </div>
  50. <div class="cell clearfix">
  51. <label class="title"> <span class="name">转归状态</span> : </label>
  52. <div class="time">
  53. <ul class>
  54. <li
  55. :class="item.lapseto == lapsetoType ? 'active' : ''"
  56. @click="selectLapseTo(item.lapseto)"
  57. v-for="item in lapsetoState"
  58. :key="item.value"
  59. >
  60. {{ item.label }}
  61. </li>
  62. </ul>
  63. </div>
  64. </div>
  65. <div class="cell clearfix">
  66. <label class="title"> <span class="name">透析模式</span> : </label>
  67. <el-select
  68. v-model="listQuery.mode_id"
  69. placeholder="请选择"
  70. @change="changeModel()"
  71. >
  72. <el-option label="全部" value></el-option>
  73. <el-option
  74. v-for="item in modeOptions"
  75. :key="item.id"
  76. :label="item.name"
  77. :value="item.id"
  78. ></el-option>
  79. </el-select>
  80. </div>
  81. <div class="cqd-dataTitle">统计图</div>
  82. <el-row :gutter="32">
  83. <el-col :xs="24" :sm="24" :lg="24">
  84. <div class="chart-wrapper">
  85. <bar-chart
  86. :title="totitle + batotal + '人次'"
  87. :options="modesData"
  88. />
  89. </div>
  90. </el-col>
  91. </el-row>
  92. <div style="height:20px">&nbsp;</div>
  93. <div class="cqd-dataTitle">统计表</div>
  94. <el-table
  95. ref="multipleTable"
  96. :data="tableData"
  97. id="qcddt"
  98. border
  99. fit
  100. highlight-current-row
  101. style="width: 100%;margin-top: 10px;"
  102. :row-style="{ color: '#303133' }"
  103. :header-cell-style="{
  104. backgroundColor: 'rgb(245, 247, 250)',
  105. color: '#606266'
  106. }"
  107. >
  108. <el-table-column
  109. fixed
  110. label="日期"
  111. width="100"
  112. property="date"
  113. align="center"
  114. ></el-table-column>
  115. <el-table-column
  116. :label="modeItem.name"
  117. property="number"
  118. align="center"
  119. min-width="100"
  120. v-for="(modeItem, index) in activeModes"
  121. :key="index"
  122. >
  123. <template slot-scope="scope">
  124. {{
  125. scope.row.data[modeItem.id].number
  126. ? scope.row.data[modeItem.id].number
  127. : ""
  128. }}
  129. </template>
  130. </el-table-column>
  131. <el-table-column
  132. fixed="right"
  133. label="总数"
  134. width="80"
  135. property="total"
  136. align="center"
  137. ></el-table-column>
  138. </el-table>
  139. <!-- <pagi-nation title="分页"></pagi-nation> -->
  140. <el-pagination
  141. align="right"
  142. @size-change="handleSizeChange"
  143. @current-change="handleCurrentChange"
  144. :current-page="listQuery.pate"
  145. :page-sizes="[10, 20, 50, 100]"
  146. :page-size="10"
  147. background
  148. style="margin-top:20px;"
  149. layout="total, sizes, prev, pager, next, jumper"
  150. :total="total"
  151. ></el-pagination>
  152. </div>
  153. </div>
  154. </template>
  155. <script>
  156. import { getdialysistotaldata } from "@/api/qcd";
  157. import BarChart from "./components/BarChart";
  158. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  159. export default {
  160. name: "dialysisTotal",
  161. data() {
  162. return {
  163. crumbs: [
  164. { path: false, name: "科室质控" },
  165. { path: false, name: "透析总量" }
  166. ],
  167. total: 0,
  168. totitle: "全部",
  169. batotal: 0,
  170. modesData: {
  171. xAxis: [],
  172. series: []
  173. },
  174. listQuery: {
  175. start_time: "",
  176. end_time: "",
  177. page: 1,
  178. limit: 10,
  179. lapseto: 0,
  180. statistical_method: 0,
  181. mode_id: ""
  182. },
  183. modeOptions: {},
  184. tableData: [],
  185. statisticalMethod: 0,
  186. statisticalMethods: [
  187. { value: 0, label: "全部" },
  188. { value: 1, label: "开始透析" }
  189. // { value: 2, label: "排班" }
  190. ],
  191. lapsetoType: 0,
  192. lapsetoState: [
  193. { value: 0, label: "全部", source: 0, lapseto: 0 },
  194. { value: 1, label: "转出", source: 0, lapseto: 2 },
  195. { value: 2, label: "留治", source: 0, lapseto: 1 }
  196. ]
  197. };
  198. },
  199. created() {
  200. this.modeOptions = this.$store.getters.treatment_mode;
  201. var nowDate = new Date();
  202. var nowYear = nowDate.getFullYear();
  203. var nowMonth = nowDate.getMonth() + 1;
  204. var nowDay = nowDate.getDate();
  205. this.listQuery.end_time =
  206. nowYear +
  207. "-" +
  208. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  209. "-" +
  210. (nowDay < 10 ? "0" + nowDay : nowDay);
  211. nowDate.setMonth(nowDate.getMonth() - 3);
  212. nowYear = nowDate.getFullYear();
  213. nowMonth = nowDate.getMonth() + 1;
  214. nowDay = nowDate.getDate();
  215. this.listQuery.start_time =
  216. nowYear +
  217. "-" +
  218. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  219. "-" +
  220. (nowDay < 10 ? "0" + nowDay : nowDay);
  221. this.getList();
  222. },
  223. methods: {
  224. getList() {
  225. getdialysistotaldata(this.listQuery).then(response => {
  226. if (response.data.state == 0) {
  227. this.$message.error(response.data.msg);
  228. return false;
  229. } else {
  230. this.tableData = [];
  231. var dtd = response.data.data.dtd;
  232. var dd = {};
  233. for (const index in dtd) {
  234. if (!(dtd[index].date in dd)) {
  235. dd[dtd[index].date] = {};
  236. }
  237. if (
  238. !(dtd[index].mode_id in dd[dtd[index].date]) &&
  239. dtd[index].mode_id != "0"
  240. ) {
  241. dd[dtd[index].date][dtd[index].mode_id] = dtd[index];
  242. }
  243. }
  244. for (const key in dd) {
  245. var total = 0;
  246. for (const mkey in this.modeOptions) {
  247. if (mkey in dd[key]) {
  248. dd[key][mkey].mode = this.modeOptions[mkey].name;
  249. var number = parseInt(dd[key][mkey].number);
  250. if (isNaN(number) || number == 0) {
  251. dd[key][mkey].number = "";
  252. number = 0;
  253. }
  254. total += number;
  255. } else {
  256. dd[key][mkey] = {
  257. mode: this.modeOptions[mkey].name,
  258. mode_id: mkey,
  259. number: 0,
  260. date: key
  261. };
  262. }
  263. }
  264. this.tableData.push({ date: key, data: dd[key], total: total });
  265. }
  266. this.total = response.data.data.total;
  267. this.modesData = {
  268. xAxis: [],
  269. series: []
  270. };
  271. var ttd = response.data.data.ttd;
  272. var modeMap = {};
  273. var batotal = 0;
  274. for (const index in ttd) {
  275. if (ttd[index].mode_id == "0") {
  276. continue;
  277. }
  278. modeMap[ttd[index].mode_id] = ttd[index];
  279. }
  280. for (const key in this.modeOptions) {
  281. this.modesData.xAxis.push(this.modeOptions[key].name);
  282. if (key in modeMap) {
  283. this.modesData.series.push(parseInt(modeMap[key].number));
  284. batotal += parseInt(modeMap[key].number);
  285. } else {
  286. this.modesData.series.push(0);
  287. }
  288. }
  289. this.batotal = batotal;
  290. }
  291. });
  292. },
  293. changeTime(val) {
  294. var time =
  295. this.getTimestamp(val) - this.getTimestamp(this.listQuery.end_time);
  296. if (time > 0) {
  297. this.$message.error("结束时间不能小于开始时间");
  298. this.listQuery.start_time = "";
  299. } else {
  300. this.getList();
  301. }
  302. },
  303. changeEndTime(val) {
  304. var time =
  305. this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
  306. if (time < 0) {
  307. this.$message.error("结束时间不能小于开始时间");
  308. this.listQuery.end_time = "";
  309. } else {
  310. this.getList();
  311. }
  312. },
  313. getTimestamp(time) {
  314. // 把时间日期转成时间戳
  315. return new Date(time).getTime() / 1000;
  316. },
  317. selectStatisticalMethod(type) {
  318. this.statisticalMethod = type;
  319. this.listQuery.statistical_method = type;
  320. if (type == 1) {
  321. this.totitle = "总透析";
  322. } else if (type == 2) {
  323. this.totitle = "总排班";
  324. } else {
  325. this.totitle = "全部";
  326. }
  327. this.getList();
  328. },
  329. selectLapseTo(lapseto) {
  330. this.lapsetoType = lapseto;
  331. this.listQuery.lapseto = lapseto;
  332. this.getList();
  333. },
  334. changeModel() {
  335. this.getList();
  336. },
  337. handleSizeChange(val) {
  338. this.listQuery.limit = val;
  339. this.getList();
  340. },
  341. handleCurrentChange(val) {
  342. this.listQuery.page = val;
  343. this.getList();
  344. }
  345. },
  346. computed: {
  347. activeModes: function() {
  348. var modes = [];
  349. for (const key in this.modeOptions) {
  350. if (this.listQuery.mode_id == key || this.listQuery.mode_id == "") {
  351. modes.push(this.modeOptions[key]);
  352. }
  353. }
  354. return modes;
  355. }
  356. },
  357. components: {
  358. BarChart,
  359. BreadCrumb
  360. }
  361. };
  362. </script>
  363. <style>
  364. #qcddt ::-webkit-scrollbar {
  365. height: 15px;
  366. }
  367. </style>
  368. <style rel="stylesheet/scss" lang="scss" scoped>
  369. .app-container {
  370. // margin: 20px;
  371. font-size: 15px;
  372. .filter-container {
  373. padding-bottom: 5px;
  374. }
  375. .cqd-dataTitle {
  376. color: #303133;
  377. font-size: 14px;
  378. border-bottom: 2px #e4e7ed solid;
  379. height: 36px;
  380. line-height: 36px;
  381. margin: 0 0 25px 0;
  382. position: relative;
  383. }
  384. .cqd-dataTitle::before {
  385. position: absolute;
  386. left: 0;
  387. bottom: -2px;
  388. content: "";
  389. width: 42px;
  390. height: 2px;
  391. background: #409eff;
  392. }
  393. .search-component {
  394. width: 500px;
  395. .searchBox {
  396. width: 300px;
  397. height: 36px;
  398. line-height: 36px;
  399. padding-left: 15px;
  400. border: 1px #dcdfe6 solid;
  401. border-right: none;
  402. outline: none;
  403. float: left;
  404. border-radius: 6px 0 0 6px;
  405. font-size: 14px;
  406. color: #333;
  407. background: #fff;
  408. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  409. }
  410. .searchBtn {
  411. background-color: #409eff;
  412. color: #fff;
  413. font-size: 15px;
  414. text-align: center;
  415. height: 36px;
  416. line-height: 36px;
  417. float: left;
  418. outline: none;
  419. width: 70px;
  420. border: none;
  421. border-radius: 0 6px 6px 0;
  422. font-family: "Microsoft Yahei";
  423. cursor: pointer;
  424. }
  425. }
  426. .amount {
  427. font-weight: normal;
  428. padding: 10px 0 0 0;
  429. color: #606266;
  430. font-size: 14px;
  431. span {
  432. color: #ef2525;
  433. font-family: "Arial";
  434. padding: 0 2px;
  435. }
  436. }
  437. }
  438. </style>
  439. <style>
  440. .el-table td,
  441. .el-table th.is-leaf,
  442. .el-table--border,
  443. .el-table--group {
  444. border-color: #d0d3da;
  445. }
  446. .el-table--border::after,
  447. .el-table--group::after,
  448. .el-table::before {
  449. background-color: #d0d3da;
  450. }
  451. </style>