tableWeeks.vue 14KB

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