processIndicators.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478
  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 == dialysisAge ? 'active' : ''"
  41. @click="selectdialysisAges(item.value)"
  42. v-for="item in dialysisAgeOptions"
  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.project_id"
  69. placeholder="请选择"
  70. @change="changeModel()"
  71. >
  72. <el-option label="全部" value=""></el-option>
  73. <el-option
  74. v-for="item in projectOptions"
  75. :key="item.project_id"
  76. :label="item.project_name"
  77. :value="item.project_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. <pie-chart title="" :options="CompletionOptions" />
  86. </div>
  87. </el-col>
  88. </el-row>
  89. <div style="height:20px">&nbsp;</div>
  90. <div class="cqd-dataTitle">统计表</div>
  91. <el-table
  92. ref="multipleTable"
  93. :data="tableData"
  94. :span-method="mergeSpan"
  95. border
  96. fit
  97. highlight-current-row
  98. style="width: 100%;margin-top: 10px;"
  99. :row-style="{ color: '#303133' }"
  100. :header-cell-style="{
  101. backgroundColor: 'rgb(245, 247, 250)',
  102. color: '#606266'
  103. }"
  104. >
  105. <el-table-column
  106. label="透析号"
  107. min-width="80"
  108. property="patient_id"
  109. align="center"
  110. >
  111. <template slot-scope="scope"
  112. ><span>{{
  113. getPatientDialysisNo(scope.row.patient_id)
  114. }}</span></template
  115. >
  116. </el-table-column>
  117. <el-table-column
  118. label="姓名"
  119. min-width="80"
  120. property="patient_id"
  121. align="center"
  122. >
  123. <template slot-scope="scope"
  124. ><span>{{ getPatientName(scope.row.patient_id) }}</span></template
  125. >
  126. </el-table-column>
  127. <el-table-column
  128. label="检查项目"
  129. min-width="80"
  130. property="project_id"
  131. align="center"
  132. >
  133. <template slot-scope="scope"
  134. ><span>{{ getProjectName(scope.row.project_id) }}</span></template
  135. >
  136. </el-table-column>
  137. <el-table-column
  138. label="检查日期"
  139. min-width="80"
  140. property="inspect_date"
  141. align="center"
  142. >
  143. <template slot-scope="scope"
  144. ><span>{{
  145. getTime(scope.row.inspect_date, "{y}{m}{d}")
  146. }}</span></template
  147. >
  148. </el-table-column>
  149. </el-table>
  150. <!-- <pagi-nation title="分页"></pagi-nation> -->
  151. <el-pagination
  152. align="right"
  153. @size-change="handleSizeChange"
  154. @current-change="handleCurrentChange"
  155. :current-page="listQuery.pate"
  156. :page-sizes="[10, 20, 50, 100]"
  157. :page-size="10"
  158. background
  159. style="margin-top:20px;"
  160. layout="total, sizes, prev, pager, next, jumper"
  161. :total="total"
  162. ></el-pagination>
  163. </div>
  164. </div>
  165. </template>
  166. <script>
  167. import { GetProcessIndicatorsData } from "@/api/qcd";
  168. import PieChart from "./components/PieChart";
  169. import { uParseTime } from "@/utils/tools";
  170. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  171. export default {
  172. name: "dialysisTotal",
  173. data() {
  174. return {
  175. crumbs: [
  176. { path: false, name: "科室质控" },
  177. { path: "/qcd/processindicators", name: "过程指标" }
  178. ],
  179. total: 0,
  180. projectOptions: {},
  181. patientMap: {},
  182. CompletionOptions: {
  183. legend: [],
  184. series: []
  185. },
  186. listQuery: {
  187. start_time: "",
  188. end_time: "",
  189. page: 1,
  190. limit: 10,
  191. lapseto: 0,
  192. project_id: "",
  193. dialysis_age: 0
  194. },
  195. tableData: [],
  196. tableRowData: [],
  197. lapsetoType: 0,
  198. lapsetoState: [
  199. { value: 0, label: "全部", source: 0, lapseto: 0 },
  200. { value: 1, label: "转出", source: 0, lapseto: 2 },
  201. { value: 2, label: "留治", source: 0, lapseto: 1 }
  202. ],
  203. dialysisAge: 0,
  204. dialysisAgeOptions: [
  205. { value: 0, label: "全部" },
  206. { value: 1, label: "大于三个月" },
  207. { value: 2, label: "小于三个月" }
  208. ]
  209. };
  210. },
  211. created() {
  212. var nowDate = new Date();
  213. var nowYear = nowDate.getFullYear();
  214. var nowMonth = nowDate.getMonth() + 1;
  215. var nowDay = nowDate.getDate();
  216. this.listQuery.end_time =
  217. nowYear +
  218. "-" +
  219. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  220. "-" +
  221. (nowDay < 10 ? "0" + nowDay : nowDay);
  222. nowDate.setMonth(nowDate.getMonth() - 3);
  223. nowYear = nowDate.getFullYear();
  224. nowMonth = nowDate.getMonth() + 1;
  225. nowDay = nowDate.getDate();
  226. this.listQuery.start_time =
  227. nowYear +
  228. "-" +
  229. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  230. "-" +
  231. (nowDay < 10 ? "0" + nowDay : nowDay);
  232. this.getList();
  233. },
  234. methods: {
  235. getList() {
  236. GetProcessIndicatorsData(this.listQuery).then(response => {
  237. if (response.data.state == 0) {
  238. this.$message.error(response.data.msg);
  239. return false;
  240. } else {
  241. this.tableData = [];
  242. this.tableRowData = [];
  243. this.total = response.data.data.total;
  244. var unfinishedcount = response.data.data.unfinishedcount;
  245. var finishedcount = this.total - unfinishedcount;
  246. this.CompletionOptions = {
  247. legend: [],
  248. series: []
  249. };
  250. this.CompletionOptions.legend.push("定时完成人次");
  251. this.CompletionOptions.series.push({
  252. value: finishedcount,
  253. name: "定时完成人次"
  254. });
  255. this.CompletionOptions.legend.push("未时完成人次");
  256. this.CompletionOptions.series.push({
  257. value: unfinishedcount,
  258. name: "未时完成人次"
  259. });
  260. var references = response.data.data.references;
  261. for (const index in references) {
  262. if (references[index].project_id in this.projectOptions) {
  263. continue;
  264. }
  265. this.$set(
  266. this.projectOptions,
  267. references[index].project_id,
  268. references[index]
  269. );
  270. }
  271. var patients = response.data.data.patients;
  272. for (const index in patients) {
  273. if (patients[index].id in this.patientMap) {
  274. continue;
  275. }
  276. this.$set(this.patientMap, patients[index].id, patients[index]);
  277. }
  278. var temInspections = {};
  279. var inspections = response.data.data.inspections;
  280. for (const index in inspections) {
  281. var key =
  282. inspections[index].inspect_date +
  283. "_" +
  284. inspections[index].patient_id;
  285. if (!(key in temInspections)) {
  286. temInspections[key] = {};
  287. }
  288. if (inspections[index].project_id in temInspections[key]) {
  289. continue;
  290. }
  291. temInspections[key][inspections[index].project_id] =
  292. inspections[index];
  293. }
  294. var rowIndex = 0;
  295. var childIndex = 0;
  296. for (const key in temInspections) {
  297. this.tableRowData.push(1);
  298. var parentIndex = rowIndex;
  299. childIndex = 0;
  300. for (const child in temInspections[key]) {
  301. this.tableData.push(temInspections[key][child]);
  302. if (childIndex > 0) {
  303. this.tableRowData[parentIndex] += 1;
  304. this.tableRowData.push(0);
  305. }
  306. childIndex++;
  307. rowIndex++;
  308. }
  309. }
  310. }
  311. });
  312. },
  313. changeTime() {
  314. this.getList();
  315. },
  316. changeEndTime(val) {
  317. var time =
  318. this.getTimestamp(val) - this.getTimestamp(this.listQuery.start_time);
  319. if (time < 0) {
  320. this.$message.error("结束时间不能小于开始时间");
  321. this.listQuery.end_time = "";
  322. } else {
  323. this.getList();
  324. }
  325. },
  326. getTimestamp(time) {
  327. // 把时间日期转成时间戳
  328. return new Date(time).getTime() / 1000;
  329. },
  330. selectLapseTo(lapseto) {
  331. this.lapsetoType = lapseto;
  332. this.listQuery.lapseto = lapseto;
  333. this.getList();
  334. },
  335. selectdialysisAges(type) {
  336. this.dialysisAge = type;
  337. this.listQuery.dialysis_age = type;
  338. this.getList();
  339. },
  340. changeModel() {
  341. this.getList();
  342. },
  343. handleSizeChange(val) {
  344. this.listQuery.limit = val;
  345. this.getList();
  346. },
  347. handleCurrentChange(val) {
  348. this.listQuery.page = val;
  349. this.getList();
  350. },
  351. getTime(value, temp) {
  352. if (value != undefined) {
  353. return uParseTime(value, temp);
  354. }
  355. return "";
  356. },
  357. getProjectName(id) {
  358. return id in this.projectOptions
  359. ? this.projectOptions[id].project_name
  360. : "";
  361. },
  362. getPatientName(id) {
  363. return id in this.patientMap ? this.patientMap[id].name : "";
  364. },
  365. getPatientDialysisNo(id) {
  366. return id in this.patientMap ? this.patientMap[id].dialysis_no : "";
  367. },
  368. mergeSpan({ row, column, rowIndex, columnIndex }) {
  369. if (columnIndex === 0 || columnIndex === 1 || columnIndex === 3) {
  370. const _row = this.tableRowData[rowIndex];
  371. const _col = _row > 0 ? 1 : 0;
  372. return {
  373. rowspan: _row,
  374. colspan: _col
  375. };
  376. }
  377. }
  378. },
  379. components: {
  380. PieChart,
  381. BreadCrumb
  382. }
  383. };
  384. </script>
  385. <style rel="stylesheet/scss" lang="scss" scoped>
  386. .app-container {
  387. // margin: 20px;
  388. font-size: 15px;
  389. .filter-container {
  390. padding-bottom: 5px;
  391. }
  392. .cqd-dataTitle {
  393. color: #303133;
  394. font-size: 14px;
  395. border-bottom: 2px #e4e7ed solid;
  396. height: 36px;
  397. line-height: 36px;
  398. margin: 0 0 25px 0;
  399. position: relative;
  400. }
  401. .cqd-dataTitle::before {
  402. position: absolute;
  403. left: 0;
  404. bottom: -2px;
  405. content: "";
  406. width: 42px;
  407. height: 2px;
  408. background: #409eff;
  409. }
  410. .search-component {
  411. width: 500px;
  412. .searchBox {
  413. width: 300px;
  414. height: 36px;
  415. line-height: 36px;
  416. padding-left: 15px;
  417. border: 1px #dcdfe6 solid;
  418. border-right: none;
  419. outline: none;
  420. float: left;
  421. border-radius: 6px 0 0 6px;
  422. font-size: 14px;
  423. color: #333;
  424. background: #fff;
  425. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  426. }
  427. .searchBtn {
  428. background-color: #409eff;
  429. color: #fff;
  430. font-size: 15px;
  431. text-align: center;
  432. height: 36px;
  433. line-height: 36px;
  434. float: left;
  435. outline: none;
  436. width: 70px;
  437. border: none;
  438. border-radius: 0 6px 6px 0;
  439. font-family: "Microsoft Yahei";
  440. cursor: pointer;
  441. }
  442. }
  443. .amount {
  444. font-weight: normal;
  445. padding: 10px 0 0 0;
  446. color: #606266;
  447. font-size: 14px;
  448. span {
  449. color: #ef2525;
  450. font-family: "Arial";
  451. padding: 0 2px;
  452. }
  453. }
  454. }
  455. </style>
  456. <style>
  457. .el-table td,
  458. .el-table th.is-leaf,
  459. .el-table--border,
  460. .el-table--group {
  461. border-color: #d0d3da;
  462. }
  463. .el-table--border::after,
  464. .el-table--group::after,
  465. .el-table::before {
  466. background-color: #d0d3da;
  467. }
  468. </style>