nextTableWeeks.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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. </template>
  84. </el-table-column>
  85. <el-table-column label="抗凝剂" min-width="100" align="center">
  86. <template slot-scope="scope">
  87. <span v-if="scope.row.prescription.anticoagulant === 1">无肝素</span>
  88. <span v-if="scope.row.prescription.anticoagulant === 2"
  89. >普通肝素</span
  90. >
  91. <span v-if="scope.row.prescription.anticoagulant === 3"
  92. >低分子肝素</span
  93. >
  94. <span v-if="scope.row.prescription.anticoagulant === 4"
  95. >阿加曲班</span
  96. >
  97. <span v-if="scope.row.prescription.anticoagulant === 5"
  98. >枸橼酸钠</span
  99. >
  100. <span v-if="scope.row.prescription.anticoagulant === 6"
  101. >低分子肝素钙</span
  102. >
  103. <span v-if="scope.row.prescription.anticoagulant === 7"
  104. >低分子肝素钠</span
  105. >
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="总量" min-width="100" align="center">
  109. <template slot-scope="scope">
  110. <span v-if="scope.row.prescription.anticoagulant == 1">{{
  111. scope.row.prescription.anticoagulant_zongliang
  112. ? scope.row.prescription.anticoagulant_zongliang + "mg"
  113. : ""
  114. }}</span>
  115. <span v-if="scope.row.prescription.anticoagulant == 2">{{
  116. scope.row.prescription.anticoagulant_zongliang
  117. ? scope.row.prescription.anticoagulant_zongliang + "iu"
  118. : ""
  119. }}</span>
  120. <span v-if="scope.row.prescription.anticoagulant == 3">{{
  121. scope.row.prescription.anticoagulant_zongliang
  122. ? scope.row.prescription.anticoagulant_zongliang + "iu"
  123. : ""
  124. }}</span>
  125. <span v-if="scope.row.prescription.anticoagulant == 4">{{
  126. scope.row.prescription.anticoagulant_zongliang
  127. ? scope.row.prescription.anticoagulant_zongliang + "mg"
  128. : ""
  129. }}</span>
  130. <span v-if="scope.row.prescription.anticoagulant == 5">{{
  131. scope.row.prescription.anticoagulant_zongliang
  132. ? scope.row.prescription.anticoagulant_zongliang + "mg"
  133. : ""
  134. }}</span>
  135. <span v-if="scope.row.prescription.anticoagulant == 6">{{
  136. scope.row.prescription.anticoagulant_zongliang
  137. ? scope.row.prescription.anticoagulant_zongliang + "iu"
  138. : ""
  139. }}</span>
  140. <span v-if="scope.row.prescription.anticoagulant == 7">{{
  141. scope.row.prescription.anticoagulant_zongliang
  142. ? scope.row.prescription.anticoagulant_zongliang + "iu"
  143. : ""
  144. }}</span>
  145. </template>
  146. </el-table-column>
  147. <el-table-column label="长期医嘱" min-width="440" align="center">
  148. <template slot-scope="scope">
  149. <span style="white-space: pre">{{
  150. getAdvice(scope.row.doctor_advice)
  151. }}</span>
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. </div>
  156. </template>
  157. <script>
  158. import { getNextScheduleWeekDay } from "@/api/schedule";
  159. import WeekItem from "./WeekItem";
  160. const moment = require('moment')
  161. export default {
  162. name: "tableWeeks",
  163. props: {
  164. weekTime: {
  165. type: String,
  166. default: "thisWeek"
  167. }
  168. },
  169. data() {
  170. return {
  171. weekArr: [
  172. { id: 1, name: "周一" },
  173. { id: 2, name: "周二" },
  174. { id: 3, name: "周三" },
  175. { id: 4, name: "周四" },
  176. { id: 5, name: "周五" },
  177. { id: 6, name: "周六" },
  178. { id: 7, name: "周日" }
  179. ],
  180. anticoagulants_confit: null,
  181. week_type: "1",
  182. week_time:0,
  183. weekTimes:[
  184. {id:0,name:"全部"},
  185. {id:1,name:"上午"},
  186. {id:2,name:"下午"},
  187. {id:3,name:"晚上"},
  188. ],
  189. weekTitle: ["", "", "", "", "", "", ""],
  190. weekData: {
  191. Monday: [],
  192. Tuesday: [],
  193. Wednesday: [],
  194. Thursday: [],
  195. Friday: [],
  196. Saturday: [],
  197. Sunday: []
  198. },
  199. scheduleData: [],
  200. modeOptions: null
  201. };
  202. },
  203. watch: {
  204. weekTime: function() {
  205. var theType = this.weekType(this.weekTime);
  206. this.getSchedules(theType);
  207. }
  208. },
  209. methods: {
  210. printAction() {
  211. this.$router.push({
  212. path: "/schedule/remind/print/next?week_type=" + this.week_type+"&week_time="+this.week_time
  213. });
  214. },
  215. compare(property) {
  216. return function (a, b) {
  217. var value1 = a[property];
  218. var value2 = b[property];
  219. return value1 - value2;
  220. }
  221. },
  222. getNextScheduleWeekDay() {
  223. const start = moment().weekday(1).format('YYYY-MM-DD'); //本周一
  224. const end = moment().weekday(7).format('YYYY-MM-DD')
  225. // console.log("start",moment(start).unix())
  226. // const params = {
  227. // start_time:moment().week(moment().week() + 1).startOf('week').unix(),
  228. // end_time:moment().week(moment().week() + 1).endOf('week').unix(),
  229. // week_type:this.week_type,
  230. // week_time:this.week_time,
  231. // }
  232. const params = {
  233. start_time:1609603200,
  234. end_time:1610208000,
  235. week_type:this.week_type,
  236. week_time:this.week_time,
  237. }
  238. getNextScheduleWeekDay(params).then(response => {
  239. this.scheduleData = [];
  240. if (response.data.state == 1) {
  241. var scheduleData = response.data.data.schedule;
  242. for(let i=0;i<scheduleData.length;i++){
  243. scheduleData[i].sort = scheduleData[i].number.sort
  244. }
  245. var arr = scheduleData.sort(this.compare('sort'))
  246. // console.log("元旦快乐",arr)
  247. this.scheduleData = arr
  248. } else {
  249. this.$message.error("网络错误");
  250. return false;
  251. }
  252. });
  253. },
  254. weekType(weekTime) {
  255. var theType = 2;
  256. switch (weekTime) {
  257. case "lastWeek":
  258. theType = 1;
  259. break;
  260. case "thisWeek":
  261. theType = 2;
  262. break;
  263. case "nextWeek":
  264. theType = 3;
  265. break;
  266. case "nextTwoWeek":
  267. theType = 4;
  268. break;
  269. default:
  270. theType = 2;
  271. break;
  272. }
  273. return theType;
  274. },
  275. weekPath(week) {
  276. var weekArr = {
  277. 1: "Monday",
  278. 2: "Tuesday",
  279. 3: "Wednesday",
  280. 4: "Thursday",
  281. 5: "Friday",
  282. 6: "Saturday",
  283. 7: "Sunday"
  284. };
  285. if (typeof weekArr[week] == "undefined") {
  286. return "";
  287. }
  288. return weekArr[week];
  289. },
  290. selectWeekType(type) {
  291. this.week_type = type;
  292. this.getNextScheduleWeekDay();
  293. },
  294. selectWeekTime(type){
  295. this.week_time = type
  296. this.getNextScheduleWeekDay()
  297. },
  298. getSchedulesType: function(type) {
  299. let type_name = "";
  300. switch (type) {
  301. case 1:
  302. type_name = "上午";
  303. break;
  304. case 2:
  305. type_name = "下午";
  306. break;
  307. case 3:
  308. type_name = "晚上";
  309. break;
  310. }
  311. return type_name;
  312. },
  313. getAdvice: function(doctor_advice) {
  314. if (doctor_advice != null) {
  315. let name = "";
  316. for (let i = 0; i < doctor_advice.length; i++) {
  317. let prescribing_number = "";
  318. let single_dose = "";
  319. let drug_spec = "";
  320. if (doctor_advice[i].prescribing_number > 0) {
  321. prescribing_number =
  322. doctor_advice[i].prescribing_number +
  323. doctor_advice[i].prescribing_number_unit;
  324. }
  325. if (doctor_advice[i].single_dose > 0) {
  326. single_dose =
  327. " 单次用量 " +
  328. doctor_advice[i].single_dose +
  329. doctor_advice[i].single_dose_unit;
  330. }
  331. if (doctor_advice[i].drug_spec > 0) {
  332. drug_spec =
  333. doctor_advice[i].drug_spec + doctor_advice[i].drug_spec_unit;
  334. }
  335. name =
  336. name +
  337. doctor_advice[i].advice_name +
  338. " " +
  339. drug_spec +
  340. " " +
  341. prescribing_number +
  342. " " +
  343. single_dose +
  344. " " +
  345. doctor_advice[i].delivery_way +
  346. " " +
  347. doctor_advice[i].execution_frequency +
  348. " " +
  349. doctor_advice[i].remark +
  350. "\n";
  351. if (doctor_advice[i].child.length > 0) {
  352. for (let a = 0; a < doctor_advice[i].child.length; a++) {
  353. if (doctor_advice[i].child[a].prescribing_number > 0) {
  354. doctor_advice[i].child[a]["presc"] =
  355. doctor_advice[i].child[a].prescribing_number +
  356. doctor_advice[i].child[a].prescribing_number_unit;
  357. } else {
  358. doctor_advice[i].child[a]["presc"] = "";
  359. }
  360. if (doctor_advice[i].child[a].single_dose > 0) {
  361. doctor_advice[i].child[a]["single"] =
  362. " " +
  363. " 单次用量 " +
  364. " " +
  365. doctor_advice[i].child[a].single_dose +
  366. doctor_advice[i].child[a].single_dose_unit;
  367. } else {
  368. doctor_advice[i].child[a]["single"] = "";
  369. }
  370. name =
  371. name +
  372. "▲" +
  373. doctor_advice[i].child[a].advice_name +
  374. "" +
  375. doctor_advice[i].child[a].advice_desc +
  376. doctor_advice[i].child[a].drug_spec_unit +
  377. doctor_advice[i].child[a].presc +
  378. doctor_advice[i].child[a].single +
  379. "\n";
  380. }
  381. }
  382. }
  383. return name;
  384. }
  385. }
  386. },
  387. components: {
  388. WeekItem
  389. },
  390. created() {
  391. this.modeOptions = this.$store.getters.treatment_mode;
  392. this.anticoagulants_confit = this.$store.getters.anticoagulants_confit;
  393. console.log("抗凝机", this.anticoagulants_confit);
  394. this.week_type = new Date().getDay();
  395. if (this.week_type == 0) {
  396. this.week_type = 7;
  397. }
  398. this.getNextScheduleWeekDay();
  399. }
  400. };
  401. </script>
  402. <style rel="stylesheet/css" lang="scss">
  403. .el-table td,
  404. .el-table th.is-leaf,
  405. .el-table--border,
  406. .el-table--group {
  407. border-color: #d0d3da;
  408. }
  409. .el-table--border::after,
  410. .el-table--group::after,
  411. .el-table::before {
  412. background-color: #d0d3da;
  413. }
  414. </style>