nextTableWeeks.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431
  1. <template>
  2. <div>
  3. <div class="cell clearfix" style="float: right">
  4. <el-button
  5. style="float: right"
  6. size="small"
  7. icon="el-icon-printer"
  8. @click="printAction()"
  9. type="primary"
  10. >打印
  11. </el-button>
  12. </div>
  13. <div class="cell clearfix">
  14. <label class="title"> <span class="name">时间</span> : </label>
  15. <div class="time">
  16. <ul class>
  17. <li
  18. :class="item.id == week_type ? 'active' : ''"
  19. @click="selectWeekType(item.id)"
  20. v-for="item in weekArr"
  21. :key="item.id"
  22. >
  23. {{ item.name }}
  24. </li>
  25. </ul>
  26. </div>
  27. <div class="title"><span class="name">班 次</span> :</div>
  28. <div class="time">
  29. <ul class>
  30. <li
  31. :class="item.id == week_time ? 'active' : ''"
  32. @click="selectWeekTime(item.id)"
  33. v-for="item in weekTimes"
  34. :key="item.id"
  35. >
  36. {{ item.name }}
  37. </li>
  38. </ul>
  39. </div>
  40. </div>
  41. <el-table
  42. :row-style="{ color: '#303133' }"
  43. :data="scheduleData"
  44. border
  45. :header-cell-style="{
  46. backgroundColor: 'rgb(245, 247, 250)',
  47. color: '#606266'
  48. }"
  49. style="width: 100%"
  50. >
  51. <el-table-column label="姓名" min-width="100" align="center">
  52. <template slot-scope="scope">
  53. {{ scope.row.patient }}
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="分区" min-width="70" align="center">
  57. <template slot-scope="scope">
  58. {{ scope.row.zone.name }}
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="班次" min-width="70" align="center">
  62. <template slot-scope="scope">
  63. {{ getSchedulesType(scope.row.schedule_type) }}
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="机号" min-width="70" align="center">
  67. <template slot-scope="scope">
  68. {{ scope.row.number.number }}
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="透析模式" min-width="100" align="center">
  72. <template slot-scope="scope">
  73. {{
  74. scope.row.mode_id && modeOptions[scope.row.mode_id]
  75. ? modeOptions[scope.row.mode_id].name
  76. : ""
  77. }}
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="透析器/灌流器" min-width="100" align="center">
  81. <template slot-scope="scope">
  82. {{ scope.row.prescription.dialyzer_perfusion_apparatus }}
  83. {{scope.row.prescription.dialysis_dialyszers}} / {{scope.row.prescription.dialysis_irrigation}}
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="抗凝剂" min-width="100" align="center">
  87. <template slot-scope="scope">
  88. <span v-if="scope.row.prescription.anticoagulant === 1">无肝素</span>
  89. <span v-if="scope.row.prescription.anticoagulant === 2"
  90. >普通肝素</span
  91. >
  92. <span v-if="scope.row.prescription.anticoagulant === 3"
  93. >低分子肝素</span
  94. >
  95. <span v-if="scope.row.prescription.anticoagulant === 4"
  96. >阿加曲班</span
  97. >
  98. <span v-if="scope.row.prescription.anticoagulant === 5"
  99. >枸橼酸钠</span
  100. >
  101. <span v-if="scope.row.prescription.anticoagulant === 6"
  102. >低分子肝素钙</span
  103. >
  104. <span v-if="scope.row.prescription.anticoagulant === 7"
  105. >低分子肝素钠</span
  106. >
  107. </template>
  108. </el-table-column>
  109. <el-table-column label="总量" min-width="100" align="center">
  110. <template slot-scope="scope">
  111. <span v-if="scope.row.prescription.anticoagulant == 1">{{
  112. scope.row.prescription.anticoagulant_zongliang
  113. ? scope.row.prescription.anticoagulant_zongliang + "mg"
  114. : ""
  115. }}</span>
  116. <span v-if="scope.row.prescription.anticoagulant == 2">{{
  117. scope.row.prescription.anticoagulant_zongliang
  118. ? scope.row.prescription.anticoagulant_zongliang + "iu"
  119. : ""
  120. }}</span>
  121. <span v-if="scope.row.prescription.anticoagulant == 3">{{
  122. scope.row.prescription.anticoagulant_zongliang
  123. ? scope.row.prescription.anticoagulant_zongliang + "iu"
  124. : ""
  125. }}</span>
  126. <span v-if="scope.row.prescription.anticoagulant == 4">{{
  127. scope.row.prescription.anticoagulant_zongliang
  128. ? scope.row.prescription.anticoagulant_zongliang + "mg"
  129. : ""
  130. }}</span>
  131. <span v-if="scope.row.prescription.anticoagulant == 5">{{
  132. scope.row.prescription.anticoagulant_zongliang
  133. ? scope.row.prescription.anticoagulant_zongliang + "mg"
  134. : ""
  135. }}</span>
  136. <span v-if="scope.row.prescription.anticoagulant == 6">{{
  137. scope.row.prescription.anticoagulant_zongliang
  138. ? scope.row.prescription.anticoagulant_zongliang + "iu"
  139. : ""
  140. }}</span>
  141. <span v-if="scope.row.prescription.anticoagulant == 7">{{
  142. scope.row.prescription.anticoagulant_zongliang
  143. ? scope.row.prescription.anticoagulant_zongliang + "iu"
  144. : ""
  145. }}</span>
  146. </template>
  147. </el-table-column>
  148. <el-table-column label="长期医嘱" min-width="440" align="center">
  149. <template slot-scope="scope">
  150. <span style="white-space: pre">{{
  151. getAdvice(scope.row.doctor_advice)
  152. }}</span>
  153. </template>
  154. </el-table-column>
  155. </el-table>
  156. </div>
  157. </template>
  158. <script>
  159. import { getNextScheduleWeekDay } from "@/api/schedule";
  160. import WeekItem from "./WeekItem";
  161. const moment = require('moment')
  162. export default {
  163. name: "tableWeeks",
  164. props: {
  165. weekTime: {
  166. type: String,
  167. default: "thisWeek"
  168. }
  169. },
  170. data() {
  171. return {
  172. weekArr: [
  173. { id: 1, name: "周一" },
  174. { id: 2, name: "周二" },
  175. { id: 3, name: "周三" },
  176. { id: 4, name: "周四" },
  177. { id: 5, name: "周五" },
  178. { id: 6, name: "周六" },
  179. { id: 7, name: "周日" }
  180. ],
  181. anticoagulants_confit: null,
  182. week_type: "1",
  183. week_time:0,
  184. weekTimes:[
  185. {id:0,name:"全部"},
  186. {id:1,name:"上午"},
  187. {id:2,name:"下午"},
  188. {id:3,name:"晚上"},
  189. ],
  190. weekTitle: ["", "", "", "", "", "", ""],
  191. weekData: {
  192. Monday: [],
  193. Tuesday: [],
  194. Wednesday: [],
  195. Thursday: [],
  196. Friday: [],
  197. Saturday: [],
  198. Sunday: []
  199. },
  200. scheduleData: [],
  201. modeOptions: null
  202. };
  203. },
  204. watch: {
  205. weekTime: function() {
  206. var theType = this.weekType(this.weekTime);
  207. this.getSchedules(theType);
  208. }
  209. },
  210. methods: {
  211. printAction() {
  212. this.$router.push({
  213. path: "/schedule/remind/print/next?week_type=" + this.week_type+"&week_time="+this.week_time
  214. });
  215. },
  216. compare(property) {
  217. return function (a, b) {
  218. var value1 = a[property];
  219. var value2 = b[property];
  220. return value1 - value2;
  221. }
  222. },
  223. getNextScheduleWeekDay() {
  224. const params = {
  225. start_time:moment().week(moment().week() + 1).startOf('week').unix(),
  226. end_time:moment().week(moment().week() + 1).endOf('week').unix(),
  227. week_type:this.week_type,
  228. week_time:this.week_time,
  229. }
  230. getNextScheduleWeekDay(params).then(response => {
  231. this.scheduleData = [];
  232. if (response.data.state == 1) {
  233. var scheduleData = response.data.data.schedule;
  234. for(let i=0;i<scheduleData.length;i++){
  235. scheduleData[i].sort = scheduleData[i].number.sort
  236. }
  237. var arr = scheduleData.sort(this.compare('sort'))
  238. console.log("元旦快乐",arr)
  239. this.scheduleData = arr
  240. } else {
  241. this.$message.error("网络错误");
  242. return false;
  243. }
  244. });
  245. },
  246. weekType(weekTime) {
  247. var theType = 2;
  248. switch (weekTime) {
  249. case "lastWeek":
  250. theType = 1;
  251. break;
  252. case "thisWeek":
  253. theType = 2;
  254. break;
  255. case "nextWeek":
  256. theType = 3;
  257. break;
  258. case "nextTwoWeek":
  259. theType = 4;
  260. break;
  261. default:
  262. theType = 2;
  263. break;
  264. }
  265. return theType;
  266. },
  267. weekPath(week) {
  268. var weekArr = {
  269. 1: "Monday",
  270. 2: "Tuesday",
  271. 3: "Wednesday",
  272. 4: "Thursday",
  273. 5: "Friday",
  274. 6: "Saturday",
  275. 7: "Sunday"
  276. };
  277. if (typeof weekArr[week] == "undefined") {
  278. return "";
  279. }
  280. return weekArr[week];
  281. },
  282. selectWeekType(type) {
  283. this.week_type = type;
  284. // let params = {
  285. // week_type: this.week_type
  286. // };
  287. this.getNextScheduleWeekDay();
  288. },
  289. selectWeekTime(type){
  290. this.week_time = type
  291. this.getNextScheduleWeekDay()
  292. },
  293. getSchedulesType: function(type) {
  294. let type_name = "";
  295. switch (type) {
  296. case 1:
  297. type_name = "上午";
  298. break;
  299. case 2:
  300. type_name = "下午";
  301. break;
  302. case 3:
  303. type_name = "晚上";
  304. break;
  305. }
  306. return type_name;
  307. },
  308. getAdvice: function(doctor_advice) {
  309. if (doctor_advice != null) {
  310. let name = "";
  311. for (let i = 0; i < doctor_advice.length; i++) {
  312. let prescribing_number = "";
  313. let single_dose = "";
  314. let drug_spec = "";
  315. if (doctor_advice[i].prescribing_number > 0) {
  316. prescribing_number =
  317. doctor_advice[i].prescribing_number +
  318. doctor_advice[i].prescribing_number_unit;
  319. }
  320. if (doctor_advice[i].single_dose > 0) {
  321. single_dose =
  322. " 单次用量 " +
  323. doctor_advice[i].single_dose +
  324. doctor_advice[i].single_dose_unit;
  325. }
  326. if (doctor_advice[i].drug_spec > 0) {
  327. drug_spec =
  328. doctor_advice[i].drug_spec + doctor_advice[i].drug_spec_unit;
  329. }
  330. name =
  331. name +
  332. doctor_advice[i].advice_name +
  333. " " +
  334. drug_spec +
  335. " " +
  336. prescribing_number +
  337. " " +
  338. single_dose +
  339. " " +
  340. doctor_advice[i].delivery_way +
  341. " " +
  342. doctor_advice[i].execution_frequency +
  343. " " +
  344. doctor_advice[i].remark +
  345. "\n";
  346. if (doctor_advice[i].child.length > 0) {
  347. for (let a = 0; a < doctor_advice[i].child.length; a++) {
  348. if (doctor_advice[i].child[a].prescribing_number > 0) {
  349. doctor_advice[i].child[a]["presc"] =
  350. doctor_advice[i].child[a].prescribing_number +
  351. doctor_advice[i].child[a].prescribing_number_unit;
  352. } else {
  353. doctor_advice[i].child[a]["presc"] = "";
  354. }
  355. if (doctor_advice[i].child[a].single_dose > 0) {
  356. doctor_advice[i].child[a]["single"] =
  357. " " +
  358. " 单次用量 " +
  359. " " +
  360. doctor_advice[i].child[a].single_dose +
  361. doctor_advice[i].child[a].single_dose_unit;
  362. } else {
  363. doctor_advice[i].child[a]["single"] = "";
  364. }
  365. name =
  366. name +
  367. "▲" +
  368. doctor_advice[i].child[a].advice_name +
  369. "" +
  370. doctor_advice[i].child[a].advice_desc +
  371. doctor_advice[i].child[a].drug_spec_unit +
  372. doctor_advice[i].child[a].presc +
  373. doctor_advice[i].child[a].single +
  374. "\n";
  375. }
  376. }
  377. }
  378. return name;
  379. }
  380. }
  381. },
  382. components: {
  383. WeekItem
  384. },
  385. created() {
  386. this.modeOptions = this.$store.getters.treatment_mode;
  387. this.anticoagulants_confit = this.$store.getters.anticoagulants_confit;
  388. console.log("抗凝机", this.anticoagulants_confit);
  389. this.week_type = new Date().getDay();
  390. if (this.week_type == 0) {
  391. this.week_type = 7;
  392. }
  393. this.getNextScheduleWeekDay();
  394. }
  395. };
  396. </script>
  397. <style rel="stylesheet/css" lang="scss">
  398. .el-table td,
  399. .el-table th.is-leaf,
  400. .el-table--border,
  401. .el-table--group {
  402. border-color: #d0d3da;
  403. }
  404. .el-table--border::after,
  405. .el-table--group::after,
  406. .el-table::before {
  407. background-color: #d0d3da;
  408. }
  409. </style>