血透系统pad前端

DialysisAdviceTable.vue 19KB

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