血透系统pad前端

DialysisAdviceTable.vue 18KB

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