血透系统pad前端

DialysisAdviceTable.vue 20KB

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