DialysisAdviceTable.vue 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  1. <template>
  2. <div class="mainBox">
  3. <van-sticky>
  4. <div class="floatLeft">
  5. <i class="iconfont icon-zuojiantou jiantou" @click="$router.go(-1)"></i>
  6. <span class="titleName">透析医嘱</span>
  7. </div>
  8. </van-sticky>
  9. <div class="choice">
  10. <ul>
  11. <el-popover placement="bottom" trigger="click" v-model="show_patient_type_selector">
  12. <li slot="reference">
  13. {{ patient_types[patient_selected].text }}
  14. <span class="iconfont">&#xe74a;</span>
  15. </li>
  16. <div class="popover-demo-content">
  17. <ul>
  18. <li
  19. v-for="type in patient_types"
  20. :key="type.value"
  21. @click="handlePaitentType(type.value)"
  22. :class="advice_type_selected == type.value ? 'tick' : ''"
  23. >{{ type.text }}</li>
  24. </ul>
  25. </div>
  26. </el-popover>
  27. <el-popover placement="bottom" trigger="click" v-model="show_zone_selector">
  28. <li slot="reference">
  29. {{ zones[zone_selected].text }}
  30. <span class="iconfont">&#xe74a;</span>
  31. </li>
  32. <div class="popover-demo-content">
  33. <ul>
  34. <li
  35. v-for="(zone, index) in zones"
  36. :key="zone.value"
  37. @click="handleZoneChange(index)"
  38. :class="zone_selected == index ? 'tick' : ''"
  39. >{{ zone.text }}</li>
  40. </ul>
  41. </div>
  42. </el-popover>
  43. <el-popover placement="bottom" trigger="click" v-model="show_sch_type_selector">
  44. <li slot="reference">
  45. {{ schedule_types[schedule_type_selected].text }}
  46. <span class="iconfont">&#xe74a;</span>
  47. </li>
  48. <div class="popover-demo-content">
  49. <ul>
  50. <li
  51. v-for="scheduleType in schedule_types"
  52. :key="scheduleType.value"
  53. @click="handletimeType(scheduleType.value)"
  54. :class="
  55. schedule_type_selected == scheduleType.value ? 'tick' : ''
  56. "
  57. >{{ scheduleType.text }}</li>
  58. </ul>
  59. </div>
  60. </el-popover>
  61. <!--<el-popover placement="bottom" trigger="click" v-model="show_advice_type_selector">-->
  62. <!--<li slot="reference">{{advice_types[advice_type_selected].text}}<span class="iconfont">&#xe74a;</span></li>-->
  63. <!--<div class="popover-demo-content">-->
  64. <!--<ul>-->
  65. <!--<li v-for="type in advice_types" :key="type.value" @click="handleAdviceType(type.value)" :class="advice_type_selected == type.value ? 'tick' : ''" >{{type.text}}</li>-->
  66. <!--</ul>-->
  67. <!--</div>-->
  68. <!--</el-popover>-->
  69. <li @click="openPicker()">
  70. {{ selected_date_str }}
  71. <span class="iconfont">&#xe74a;</span>
  72. </li>
  73. </ul>
  74. </div>
  75. <div style="width:100%;overflow:hildden;overflow-x:auto;" class="DialysisAdvice">
  76. <div class="blueBorder"></div>
  77. <table class="table dialysisTable">
  78. <tr>
  79. <th width="40px">姓名</th>
  80. <th width="40px">透析号</th>
  81. <!-- <th width="50px">类型</th> -->
  82. <th width="50px">开始时间</th>
  83. <th width="60px">医嘱内容</th>
  84. <th width="50px">执行时间</th>
  85. <th width="80px">执行护士</th>
  86. <th width="80px">校对护士</th>
  87. <th width="50px">校对时间</th>
  88. <th width="60px">开嘱医生</th>
  89. <th width="50px">开嘱时间</th>
  90. </tr>
  91. <template v-for="(schedules, zone_name, index) in filtedScheduals">
  92. <tr :key="index">
  93. <td>{{ zone_name }}</td>
  94. <!-- <td></td> -->
  95. <td></td>
  96. <td></td>
  97. <td></td>
  98. <td></td>
  99. <td></td>
  100. <td></td>
  101. <td></td>
  102. <td></td>
  103. <td></td>
  104. </tr>
  105. <template v-for="schedule in schedules">
  106. <template v-for="(group, group_index) in schedule.new_advice">
  107. <tr v-for="(advice, advice_index) in group.advices" @click="clickfunction(schedule)">
  108. <td
  109. v-if="advice_index == 0"
  110. :rowspan="group.advices.length"
  111. style="color:#409eff;"
  112. >{{ advice.parent_id == 0 ? schedule.patient.name : "" }}</td>
  113. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  114. {{
  115. advice.parent_id == 0 ? schedule.patient.dialysis_no : ""
  116. }}
  117. </td>
  118. <!-- <td
  119. v-if="advice_index == 0"
  120. :rowspan="group.advices.length"
  121. >{{ getAdaviceType(advice.advice_type, advice.parent_id) }}</td>-->
  122. <td v-if="advice_index == 0" :rowspan="group.advices.length">
  123. {{
  124. advice.parent_id == 0
  125. ? parseTime(advice.start_time, "{h}:{i}")
  126. : ""
  127. }}
  128. </td>
  129. <td
  130. :class="
  131. advice.parent_id == 0
  132. ? 'advice_content'
  133. : 'subadvice_content'
  134. "
  135. >
  136. <span>{{ advice.advice_name }}</span>
  137. <span>{{ advice.advice_desc }}{{ advice.drug_spec_unit }}</span>
  138. <span v-if="advice.prescribing_number">
  139. {{ advice.prescribing_number
  140. }}{{ advice.prescribing_number_unit }}
  141. </span>
  142. <span v-if="advice.single_dose">
  143. 单次用量 {{ advice.single_dose
  144. }}{{ advice.single_dose_unit }}
  145. </span>
  146. <span>{{ advice.delivery_way }}</span>
  147. <span>{{ advice.execution_frequency }}</span>
  148. <span
  149. v-if="advice.parent_id == 0 && advice.remark.length > 0"
  150. >({{ advice.remark }})</span>
  151. </td>
  152. <td>{{ parseTime(advice.execution_time, "{h}:{i}") }}</td>
  153. <td>{{ getName(advice.execution_staff) }}</td>
  154. <td>{{ getName(advice.checker) }}</td>
  155. <td>{{ parseTime(advice.check_time, "{h}:{i}") }}</td>
  156. <td>{{ getName(advice.advice_doctor) }}</td>
  157. <td>{{ parseTime(advice.created_time, "{h}:{i}") }}</td>
  158. </tr>
  159. </template>
  160. </template>
  161. </template>
  162. </table>
  163. <div class="NoData" v-show="zones.length <= 1">
  164. <img style="margin-top: 50px; margin-bottom: 50px" src="@/assets/login/data.jpg" alt />
  165. </div>
  166. <!-- <el-table :data="date" border style="width: 100%">
  167. <el-table-column fixed prop="date" label="姓名" width="100" align="center">
  168. <template slot-scope="scope">
  169. {{ scope.row.advice_name }}
  170. </template>
  171. </el-table-column>
  172. <el-table-column prop="name" label="透析号" width="100" align="center"></el-table-column>
  173. <el-table-column prop="province" label="期效" width="100" align="center"></el-table-column>
  174. <el-table-column prop="city" label="开始时间" width="100" align="center"></el-table-column>
  175. <el-table-column prop="address" label="医嘱内容" width="200" align="center"></el-table-column>
  176. <el-table-column prop="zip" label="执行时间" width="100" align="center"></el-table-column>
  177. <el-table-column prop="zip" label="执行护士" width="150" align="center"></el-table-column>
  178. <el-table-column prop="zip" label="校对护士" width="200" align="center"></el-table-column>
  179. <el-table-column prop="zip" label="校对时间" width="200" align="center"></el-table-column>
  180. <el-table-column prop="zip" label="开嘱医生" width="200" align="center"></el-table-column>
  181. <el-table-column prop="zip" label="开嘱时间" width="200" align="center"></el-table-column>
  182. </el-table>-->
  183. </div>
  184. <mt-datetime-picker
  185. v-model="selected_date"
  186. type="date"
  187. ref="picker"
  188. year-format="{value} "
  189. month-format="{value} "
  190. date-format="{value} "
  191. @confirm="requestSchedualDoctors"
  192. ></mt-datetime-picker>
  193. </div>
  194. </template>
  195. <script>
  196. import SideBar from "@/pages/layout/SideBar";
  197. import { parseTime } from "@/utils";
  198. import { getSchedualDoctors } from "@/api/advice";
  199. export default {
  200. name: "DialysisAdviceTable",
  201. components: {
  202. SideBar
  203. },
  204. data() {
  205. return {
  206. selected_date: new Date(),
  207. admin_user: [],
  208. show_sch_type_selector: false,
  209. schedule_type_selected: 0,
  210. schedule_types: [
  211. { value: 0, text: "全部班次" },
  212. { value: 1, text: "上午" },
  213. { value: 2, text: "下午" },
  214. { value: 3, text: "晚上" }
  215. ],
  216. show_zone_selector: false,
  217. zone_selected: 0,
  218. show_patient_type_selector: false,
  219. zones: [{ value: 0, text: "全部分区", select: true }],
  220. show_advice_type_selector: false,
  221. advice_type_selected: 0,
  222. advice_types: [
  223. { value: 0, text: "全部医嘱" },
  224. { value: 1, text: "长期医嘱" },
  225. { value: 3, text: "临时医嘱" }
  226. ],
  227. patient_types: [
  228. { value: 0, text: "全部病人" },
  229. { value: 1, text: "我的病人" },
  230. { value: 2, text: "未执行病人" }
  231. ],
  232. patient_selected: 0,
  233. scheduleMap: {}
  234. };
  235. },
  236. computed: {
  237. selected_date_str: function() {
  238. return parseTime(this.selected_date, "{y}-{m}-{d}");
  239. },
  240. filtedScheduals: function() {
  241. var scheduleMap = new Object();
  242. if (this.zone_selected == 0) {
  243. for (const key in this.scheduleMap) {
  244. scheduleMap[key] = this.scheduleMap[key];
  245. }
  246. } else {
  247. var zone_name = this.zones[this.zone_selected].text;
  248. scheduleMap[zone_name] = this.scheduleMap[zone_name];
  249. }
  250. if (this.schedule_type_selected != 0) {
  251. var _scheduleMap = {};
  252. for (const key in scheduleMap) {
  253. var origin_schedules = scheduleMap[key];
  254. var schedules = [];
  255. for (let index = 0; index < origin_schedules.length; index++) {
  256. const schedule = origin_schedules[index];
  257. if (schedule.schedule_type == this.schedule_type_selected) {
  258. schedules.push(schedule);
  259. }
  260. }
  261. if (schedules.length > 0) {
  262. _scheduleMap[key] = schedules;
  263. }
  264. }
  265. scheduleMap = _scheduleMap;
  266. }
  267. for (var key in scheduleMap) {
  268. let mapArr = scheduleMap[key];
  269. for (let i = 0; i < mapArr.length; i++) {
  270. mapArr[i]["new_advice"] = [];
  271. }
  272. }
  273. for (var key in scheduleMap) {
  274. let mapArr = scheduleMap[key];
  275. for (let i = 0; i < mapArr.length; i++) {
  276. var maps = mapArr[i];
  277. var resp_advices = maps.doctor_advice;
  278. if (resp_advices.length > 0) {
  279. var newGroupObject = function() {
  280. return Object.assign(
  281. {},
  282. {
  283. group_no: 0,
  284. advices: []
  285. }
  286. );
  287. };
  288. var initGroupBlock = function(group, advice) {
  289. group.group_no = advice.groupno;
  290. };
  291. var advice_groups = [];
  292. var group = newGroupObject();
  293. for (let index = 0; index < resp_advices.length; index++) {
  294. const advice = resp_advices[index];
  295. if (advice.groupno == 0) {
  296. // 老版本的医嘱
  297. if (advice.parent_id > 0) {
  298. if (advice_groups.length > 0) {
  299. var parent_group = advice_groups[advice_groups.length - 1];
  300. if (parent_group.advices.length > 0) {
  301. if (parent_group.advices[0].id == advice.parent_id) {
  302. parent_group.advices.push(advice);
  303. }
  304. }
  305. }
  306. continue;
  307. } else {
  308. if (group.group_no > 0) {
  309. advice_groups.push(group);
  310. group = newGroupObject();
  311. }
  312. initGroupBlock(group, advice);
  313. group.advices.push(advice);
  314. advice_groups.push(group);
  315. group = newGroupObject();
  316. continue;
  317. }
  318. } else {
  319. if (group.group_no > 0 && group.group_no != advice.groupno) {
  320. advice_groups.push(group);
  321. group = newGroupObject();
  322. }
  323. if (group.group_no == 0) {
  324. initGroupBlock(group, advice);
  325. }
  326. if (group.group_no == advice.groupno) {
  327. group.advices.push(advice);
  328. }
  329. }
  330. }
  331. if (group.group_no > 0) {
  332. // 上述的算法会导致最后一组没有加到advice_groups,这里要手动加
  333. advice_groups.push(group);
  334. }
  335. advice_groups = advice_groups;
  336. } else {
  337. advice_groups = [];
  338. }
  339. maps.new_advice = advice_groups;
  340. }
  341. }
  342. return scheduleMap;
  343. }
  344. },
  345. created() {
  346. this.requestSchedualDoctors();
  347. },
  348. methods: {
  349. // getNumber: function (advice,schedule) {
  350. // if (advice.parent_id == 0 ) {
  351. // if(advice.dialysis_order && advice.dialysis_order.device_number && advice.dialysis_order.device_number.number.length > 0){
  352. // return advice.dialysis_order.device_number.number
  353. // }else{
  354. // return schedule.device_number.number
  355. // }
  356. // }
  357. //
  358. // },
  359. clickfunction: function(val) {
  360. this.$router.push({
  361. path: "/details",
  362. query: {
  363. patient_id: val.patient.id,
  364. date: this.selected_date.getTime() / 1000,
  365. patient_name: val.patient.name
  366. }
  367. });
  368. },
  369. handlePaitentType: function(index) {
  370. this.patient_selected = index;
  371. this.show_patient_type_selector = false;
  372. this.requestSchedualDoctors();
  373. },
  374. openPicker() {
  375. this.$refs.picker.open();
  376. },
  377. getAdaviceType(type, parent_id) {
  378. if (parent_id == 0) {
  379. if (type == 1) {
  380. return "长嘱";
  381. } else if (type == 2) {
  382. return "临嘱";
  383. } else if (type == 3) {
  384. return "临嘱";
  385. }
  386. }
  387. },
  388. getName(val) {
  389. for (let i = 0; i < this.admin_user.length; i++) {
  390. if (this.admin_user[i].id == val) {
  391. return this.admin_user[i].name;
  392. }
  393. }
  394. },
  395. handletimeType: function(index) {
  396. this.schedule_type_selected = index;
  397. this.show_sch_type_selector = false;
  398. },
  399. handleAdviceType: function(index) {
  400. this.advice_type_selected = index;
  401. this.show_advice_type_selector = false;
  402. this.requestSchedualDoctors();
  403. },
  404. handleZoneChange: function(index) {
  405. this.zone_selected = index;
  406. this.show_zone_selector = false;
  407. },
  408. parseTime: function(time, layout) {
  409. if (time == 0) {
  410. return "";
  411. }
  412. return parseTime(time, layout);
  413. },
  414. requestSchedualDoctors() {
  415. getSchedualDoctors({
  416. date: this.selected_date_str,
  417. patient_type: this.patient_selected,
  418. advice_type: 2
  419. }).then(rs => {
  420. var resp = rs.data;
  421. if (resp.state == 1) {
  422. this.admin_user = resp.data.adminUser;
  423. var schedules = resp.data.scheduals;
  424. for (let i = 0; i < schedules.length; i++) {
  425. schedules[i].dialysis_no = parseInt(
  426. schedules[i].patient.dialysis_no
  427. );
  428. }
  429. console.log("schedules", schedules);
  430. var arr = [];
  431. for (let j = 0; j < schedules.length; j++) {
  432. arr.push(schedules[j].dialysis_no);
  433. }
  434. arr.sort(function(a, b) {
  435. return a - b;
  436. });
  437. console.log("arr", arr);
  438. var arrTwo = [];
  439. for (let i = 0; i < arr.length; i++) {
  440. for (let j = 0; j < schedules.length; j++) {
  441. if (arr[i] == schedules[j].dialysis_no) {
  442. arrTwo.push(schedules[j]);
  443. }
  444. }
  445. }
  446. arrTwo.map((item, index) => {
  447. // console.log(item);
  448. // item.doctor_advice.map((items, i) => {
  449. // console.log(items);
  450. // });
  451. item.doctor_advice.sort(this.compare("start_time"));
  452. });
  453. console.log("arrTwo", arrTwo);
  454. const res = new Map();
  455. let a = arrTwo.filter(
  456. a => !res.has(a.dialysis_no) && res.set(a.dialysis_no, 1)
  457. );
  458. console.log("a", a);
  459. schedules = a;
  460. var zoneMap = {};
  461. var scheduleMap = {};
  462. for (let index = 0; index < schedules.length; index++) {
  463. const schedule = schedules[index];
  464. if (schedule.doctor_advice.length == 0) {
  465. continue;
  466. }
  467. if (scheduleMap[schedule.device_number.zone.name] == null) {
  468. scheduleMap[schedule.device_number.zone.name] = [];
  469. }
  470. scheduleMap[schedule.device_number.zone.name].push(schedule);
  471. if (zoneMap[schedule.device_number.zone.name] == null) {
  472. zoneMap[schedule.device_number.zone.name] =
  473. schedule.device_number.zone;
  474. }
  475. }
  476. var zones = [];
  477. zones.push({ value: 0, text: "全部分区" });
  478. for (var zoneName in zoneMap) {
  479. zones.push({ value: zoneMap[zoneName].id, text: zoneName });
  480. }
  481. zones = zones.sort(function(a, b) {
  482. return a.value > b.value;
  483. });
  484. this.zones = zones;
  485. this.scheduleMap = scheduleMap;
  486. } else {
  487. this.$toast({
  488. message: resp.msg
  489. });
  490. }
  491. });
  492. },
  493. adviceDesc(advice) {},
  494. compare(property) {
  495. return function(a, b) {
  496. var value1 = a[property];
  497. var value2 = b[property];
  498. return value1 - value2;
  499. };
  500. }
  501. }
  502. };
  503. </script>
  504. <style style="stylesheet/scss" lang="scss" scoped>
  505. .top {
  506. .hospital {
  507. width: 2rem;
  508. }
  509. .TopTitle {
  510. font-size: 0.36rem;
  511. color: $title-color;
  512. font-weight: normal;
  513. }
  514. padding: 0.3rem 0.3rem;
  515. @include display-flex;
  516. @include align-items-center;
  517. @include text-align;
  518. @include justify-content-between;
  519. border-bottom: 1px #e5e5e5 solid;
  520. .title {
  521. font-size: 0.3rem;
  522. font-weight: bold;
  523. color: $pgh-color;
  524. }
  525. .iconfont {
  526. font-size: 0.4rem;
  527. color: #a8b3ba;
  528. }
  529. }
  530. .search {
  531. background: #ebf1f7;
  532. border-radius: 30px;
  533. padding: 0 0.3rem;
  534. height: 0.6rem;
  535. line-height: 0.6rem;
  536. color: #a8b3ba;
  537. .iconfont {
  538. color: #a8b3ba;
  539. font-size: 0.28rem;
  540. }
  541. .searchInput {
  542. font-size: 0.28rem;
  543. border: none;
  544. outline: none;
  545. background: #ebf1f7;
  546. }
  547. }
  548. .floatLeft {
  549. padding-left: 0.3rem;
  550. height: 1rem;
  551. display: flex;
  552. align-items: center;
  553. color: #fff;
  554. font-size: 0.6rem;
  555. background: #258ffc;
  556. .titleName {
  557. font-size: 0.6rem;
  558. }
  559. .icons {
  560. font-size: 0.8rem;
  561. }
  562. .jiantou {
  563. font-size: 0.8rem;
  564. color: #fff;
  565. padding-right: 4rem;
  566. }
  567. }
  568. .choice {
  569. border-bottom: 1px #e5e5e5 solid;
  570. position: fixed;
  571. top: 28px;
  572. right: 0;
  573. z-index: 66;
  574. left: 0;
  575. background: #258ffc;
  576. // @media only screen and (max-width: 415px) {
  577. // top: 38px !important;
  578. // }
  579. @media only screen and (min-width: 416px) and (max-width: 767px) {
  580. top: 38px !important;
  581. }
  582. @media only screen and (min-width: 768px) {
  583. top: 48px !important;
  584. }
  585. ul {
  586. @include display-flex;
  587. @include align-items-center;
  588. @include text-align;
  589. @include justify-content-between;
  590. width: 94%;
  591. margin: 0 auto;
  592. font-size: 0.32rem;
  593. // color: $pgh-color;
  594. color: #fff;
  595. li {
  596. @include display-flex;
  597. @include align-items-center;
  598. @include text-align;
  599. @include justify-content-between;
  600. padding: 0.3rem 0;
  601. font-size: 0.45rem;
  602. .iconfont {
  603. margin: 0 0.1rem;
  604. color: #fff;
  605. }
  606. .line {
  607. background: #a8b3ba;
  608. width: 0.2rem;
  609. height: 1px;
  610. margin: 0 0.2rem;
  611. display: inline-block;
  612. }
  613. }
  614. }
  615. }
  616. .DialysisAdvice {
  617. padding-top: 36px;
  618. // background: #fff;
  619. min-height: calc(100vh - 2px);
  620. // @media only screen and (max-width: 812px) {
  621. // padding-top: 70px !important;
  622. // }
  623. @media only screen and (min-width: 768px) {
  624. padding-top: 60px !important;
  625. }
  626. @media only screen and (min-width: 415px) and (max-width: 767px) {
  627. padding-top: 46px;
  628. }
  629. // @media only screen and (min-width: 813px) and (max-width: 1024px) {
  630. // padding-top: 118px !important;
  631. // }
  632. }
  633. .advice_content {
  634. text-align: left;
  635. padding-left: 5px;
  636. padding-right: 5px;
  637. // background: #eff6fc;
  638. }
  639. .subadvice_content {
  640. text-align: left;
  641. padding-left: 25px;
  642. padding-right: 5px;
  643. // background: #fafcfe;
  644. }
  645. .dialysisTable {
  646. @media only screen and (max-width: 450px) {
  647. width: 800px;
  648. //
  649. }
  650. }
  651. </style>
  652. <style lang="scss">
  653. // .el-table {
  654. // margin-top: 64px;
  655. // }
  656. .el-table td {
  657. padding: 0;
  658. }
  659. .el-table th {
  660. padding: 6px 0;
  661. }
  662. </style>