血透系统pad前端

DialysisAdviceTable.vue 19KB

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