DoctorManagement.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. <template>
  2. <div class="doctorManagement">
  3. <div>
  4. <div class="toolBox">
  5. <div class="toolOne" @click="typeShow = true">
  6. <div style="display: flex;align-items: center;">
  7. {{ type }}
  8. <van-icon name="arrow-down" />
  9. </div>
  10. </div>
  11. <div class="toolOne" @click="startShow = true">
  12. <div style="display: flex;align-items: center;">
  13. {{ startTime }}
  14. <van-icon name="arrow-down" />
  15. </div>
  16. </div>
  17. <div class="toolOne" @click="endShow = true">
  18. <div style="display: flex;align-items: center;">
  19. {{ endTime }}
  20. <van-icon name="arrow-down" />
  21. </div>
  22. </div>
  23. </div>
  24. <div class="adviceBox" v-if="doctorAdvice.length > 0">
  25. <van-list
  26. v-model="loading"
  27. :finished="finished"
  28. @load="onLoad"
  29. finished-text="没有更多了"
  30. >
  31. <div class="adviceOne" v-for="(item,index) in this.doctorAdvice" :key="index" v-show="showOne">
  32. <div class="adviceTitle">
  33. <p>{{getTime(item.start_time)}}</p>
  34. <van-icon class="ellipsis" name="ellipsis" @click="Delete(item.start_time, index, item.child[0].execution_staff)" />
  35. </div>
  36. <div v-for="(it,i) in item.child.slice(0,3)" :key="i" @click="toDoctorAdviceDetail(item.start_time)">
  37. <div class="statOrder" v-if="it.advice_type == 1 && it.parent_id == 0">
  38. <div class="statOrderTitle">
  39. <span v-if="i<1">长期医嘱</span>
  40. <span v-if="i<1" style="margin-left:1rem">{{getTimes(it.start_time)}}</span>
  41. </div>
  42. <div class="orderContent">
  43. <p> {{ it.advice_name }} {{ it.advice_desc
  44. }}{{ it.drug_spec_unit }} {{ it.prescribing_number
  45. }}{{ it.prescribing_number_unit }} {{ it.single_dose
  46. }}{{ it.single_dose_unit }} {{ it.delivery_way }}
  47. {{ it.execution_frequency }}</p>
  48. <div v-for="(i, index) in childList" :key="index">
  49. <p v-if="i.parent_id == it.id">▲
  50. {{ i.advice_name }} {{ i.advice_desc
  51. }}{{ i.drug_spec_unit }} {{ i.prescribing_number
  52. }}{{ i.prescribing_number_unit }} {{ i.single_dose
  53. }}{{ i.single_dose_unit }}
  54. {{ i.delivery_way }}
  55. {{ i.execution_frequency }}
  56. </p>
  57. </div>
  58. <div class="doctorBox">
  59. <p>开嘱医生:{{ it.user_name }}</p>
  60. <p>执行护士:{{ getDoctor(it.execution_staff) }}</p>
  61. <p>核对护士:{{ getDoctor(it.checker) }}</p>
  62. </div>
  63. </div>
  64. </div>
  65. <div class="statOrder" v-if="it.advice_type !=1 && it.parent_id == 0">
  66. <div class="longOrderTitle">
  67. <span v-if="i<1">临时医嘱</span>
  68. <span v-if="i<1" style="margin-left:1rem">{{getTimes(it.start_time)}}</span>
  69. </div>
  70. <div class="orderContent" v-if="i<4">
  71. <p v-if="it.parent_id == 0">{{ it.advice_name }} {{ it.advice_desc
  72. }}{{ it.drug_spec_unit }} {{ it.prescribing_number
  73. }}{{ it.prescribing_number_unit }} {{ it.single_dose
  74. }}{{ it.single_dose_unit }} {{ it.delivery_way }}
  75. {{ it.execution_frequency }}</p>
  76. <div v-for="(i, index) in childList" :key="index">
  77. <p v-if="i.parent_id == it.id">▲ {{ i.advice_name }} {{ i.advice_desc
  78. }}{{ i.drug_spec_unit }} {{ i.prescribing_number
  79. }}{{ i.prescribing_number_unit }} {{ i.single_dose
  80. }}{{ i.single_dose_unit }}
  81. {{ i.delivery_way }}
  82. {{ i.execution_frequency }}</p>
  83. </div>
  84. </div>
  85. <div class="doctorBox">
  86. <p>开嘱医生:{{ it.user_name }}</p>
  87. <p>执行护士:{{ getDoctor(it.execution_staff) }}</p>
  88. <p>核对护士:{{ getDoctor(it.checker) }}</p>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="all" @click="toDoctorAdviceDetail(item.start_time)">全部</div>
  93. </div>
  94. </van-list>
  95. </div>
  96. <div class="noimgBox" v-else>
  97. <img src="../../../assets/images/none.png" alt />
  98. </div>
  99. </div>
  100. <!-- <div class="add">
  101. <div style="display: flex;align-items: center;">
  102. <van-icon class="addIcon" name="add" />新增
  103. </div>
  104. </div>-->
  105. <!-- 弹出层 -->
  106. <div>
  107. <van-popup
  108. v-model="typeShow"
  109. position="bottom"
  110. :style="{ height: '40%' }"
  111. >
  112. <van-picker
  113. show-toolbar
  114. :columns="columns"
  115. @cancel="onCancel"
  116. @confirm="onConfirm"
  117. />
  118. </van-popup>
  119. <van-popup
  120. v-model="startShow"
  121. position="bottom"
  122. :style="{ height: '40%' }"
  123. >
  124. <van-datetime-picker
  125. v-model="currentDate"
  126. type="date"
  127. :min-date="minDate"
  128. :max-date="maxDate"
  129. @confirm="getstartTime"
  130. @cancel="startShow = false"
  131. />
  132. </van-popup>
  133. <van-popup v-model="endShow" position="bottom" :style="{ height: '40%' }">
  134. <van-datetime-picker
  135. v-model="currentDate"
  136. type="date"
  137. :min-date="minDate"
  138. :max-date="maxDate"
  139. @confirm="getstartTime2"
  140. @cancel="endShow = false"
  141. />
  142. </van-popup>
  143. <van-action-sheet
  144. v-model="newShow"
  145. :actions="actions"
  146. cancel-text="取消"
  147. @cancel="onCancel"
  148. @select="toDelete"
  149. />
  150. <van-action-sheet
  151. v-model="newChildShow"
  152. :actions="actions1"
  153. cancel-text="取消"
  154. @cancel="onCancel"
  155. @select="toChildDelete"
  156. />
  157. <van-action-sheet
  158. v-model="newChildShow"
  159. :actions="actions2"
  160. cancel-text="取消"
  161. @cancel="onCancel"
  162. @select="toChildDelete"
  163. />
  164. </div>
  165. </div>
  166. </template>
  167. <script>
  168. import {
  169. getDoctorAdvices,
  170. getPatientDetail,
  171. DeleteManagement,
  172. getAllDoctor
  173. } from '@/api/patient/patient'
  174. import { uParseTime } from '@/utils/tools'
  175. import { Dialog } from 'vant'
  176. const moment = require('moment')
  177. export default {
  178. props: {
  179. active: Number
  180. },
  181. data () {
  182. return {
  183. docShow: false,
  184. loading: false,
  185. finished: false,
  186. newShow: false,
  187. newChildShow: false,
  188. typeShow: false,
  189. startShow: false,
  190. endShow: false,
  191. type: '全部',
  192. columns: ['全部', '长期医嘱', '临时医嘱'],
  193. startTime: '请选择',
  194. endTime: '请选择',
  195. minDate: new Date(1970, 0, 1),
  196. maxDate: new Date(2025, 10, 1),
  197. currentDate: new Date(),
  198. actions: [{ name: '查看全部' }, { name: '全部删除' }],
  199. actions1: [{ name: '删除' }],
  200. actions2: [{ name: '删除' }],
  201. form: {
  202. type: 0,
  203. limit: 5,
  204. page: 1
  205. },
  206. total: '',
  207. showOne: true,
  208. showTwo: false,
  209. doctorAdvice: [],
  210. childList: [],
  211. patient_id: '',
  212. doctor: [],
  213. id: 0,
  214. index: 0,
  215. staff: 0,
  216. childId: 0,
  217. state: 0,
  218. list: []
  219. }
  220. },
  221. methods: {
  222. onCancel () {
  223. this.typeShow = false
  224. },
  225. onConfirm (value) {
  226. this.form.page = 1
  227. this.type = value
  228. this.typeShow = false
  229. this.doctorAdvice = []
  230. this.getDoctorAdvices(
  231. this.patient_id,
  232. this.type,
  233. this.startTime,
  234. this.endTime,
  235. this.form.limit,
  236. this.form.page
  237. )
  238. this.onLoad()
  239. },
  240. getstartTime (value) {
  241. this.form.page = 1
  242. let year = value.getFullYear()
  243. let month = value.getMonth() + 1
  244. let day = value.getDate()
  245. if (month >= 1 && month <= 9) {
  246. month = `0${month}`
  247. }
  248. if (day >= 1 && day <= 9) {
  249. day = `0${day}`
  250. }
  251. this.startTime = `${year}-${month}-${day}`
  252. this.doctorAdvice = []
  253. this.getDoctorAdvices(
  254. this.patient_id,
  255. this.type,
  256. this.startTime,
  257. this.endTime,
  258. this.form.limit,
  259. this.form.page
  260. )
  261. this.startShow = false
  262. this.onLoad()
  263. },
  264. getstartTime2 (value) {
  265. this.form.page = 1
  266. let year = value.getFullYear()
  267. let month = value.getMonth() + 1
  268. let day = value.getDate()
  269. if (month >= 1 && month <= 9) {
  270. month = `0${month}`
  271. }
  272. if (day >= 1 && day <= 9) {
  273. day = `0${day}`
  274. }
  275. this.endTime = `${year}-${month}-${day}`
  276. this.doctorAdvice = []
  277. this.getDoctorAdvices(
  278. this.patient_id,
  279. this.type,
  280. this.startTime,
  281. this.endTime,
  282. this.form.limit,
  283. this.form.page
  284. )
  285. this.endShow = false
  286. this.onLoad()
  287. },
  288. getDoctorAdvices (patientid) {
  289. if (this.type === '全部') {
  290. this.form.type = 0
  291. }
  292. if (this.type === '长期医嘱') {
  293. this.form.type = 1
  294. }
  295. if (this.type === '临时医嘱') {
  296. this.form.type = 3
  297. }
  298. getDoctorAdvices(
  299. patientid,
  300. this.form.type,
  301. this.startTime,
  302. this.endTime,
  303. this.form.limit,
  304. this.form.page
  305. ).then(response => {
  306. if (response.data.state === 1) {
  307. var advice = response.data.data.advice
  308. // console.log("advice", advice);
  309. var one = response.data.data.one
  310. // console.log("one", one);
  311. var total = response.data.data.total
  312. this.total = total
  313. // console.log("total", total);
  314. let dataInfo = {}
  315. one.forEach((item, index) => {
  316. let { start_time } = item
  317. if (!dataInfo[start_time]) {
  318. dataInfo[start_time] = {
  319. start_time,
  320. child: []
  321. }
  322. }
  323. })
  324. let list = Object.values(dataInfo)
  325. // console.log("list", list);
  326. list.map(item => {
  327. for (let i = 0; i < advice.length; i++) {
  328. if (
  329. item.start_time === advice[i].start_time &&
  330. advice[i].parent_id === 0
  331. ) {
  332. item.child.push(advice[i])
  333. }
  334. }
  335. })
  336. let objarr = []
  337. for (let i = 0; i < advice.length; i++) {
  338. if (advice[i].parent_id != 0) {
  339. objarr.push(advice[i])
  340. }
  341. }
  342. this.childList = objarr
  343. let arr = this.doctorAdvice
  344. arr.push(...list.reverse())
  345. console.log('arr', arr)
  346. this.doctorAdvice = arr
  347. this.loading = false
  348. }
  349. })
  350. },
  351. getPatientDetail (patientid) {
  352. getPatientDetail(patientid).then(response => {
  353. if (response.data.state === 1) {
  354. var patientDetail = response.data.data.patientDetail
  355. console.log('patientDetail', patientDetail)
  356. if (patientDetail.blood_patients == 0) {
  357. this.doctorAdvice = []
  358. this.showOne = false
  359. this.showTwo = true
  360. }
  361. if (patientDetail.blood_patients == 1) {
  362. this.showOne = true
  363. this.showTwo = false
  364. }
  365. this.patientName = patientDetail.name
  366. }
  367. })
  368. },
  369. getTime (time) {
  370. // return uParseTime(time, "{y}-{m}-{d} {h}:{i}:{s}");
  371. return uParseTime(time, '{y}-{m}-{d}')
  372. },
  373. getTimes (time) {
  374. return uParseTime(time, '{h}:{i}')
  375. },
  376. getAllDoctor () {
  377. getAllDoctor().then(response => {
  378. if (response.data.state === 1) {
  379. var doctor = response.data.data.doctor
  380. console.log('doctor是', doctor)
  381. this.doctor = doctor
  382. }
  383. })
  384. },
  385. onLoad () {
  386. setTimeout(() => {
  387. this.form.page++
  388. // console.log("page", this.form.page);
  389. if (this.form.page <= Math.ceil(this.total / 5)) {
  390. this.getDoctorAdvices(
  391. this.patient_id,
  392. this.form.type,
  393. this.startTime,
  394. this.endTime,
  395. this.form.limit,
  396. this.form.page
  397. )
  398. } else {
  399. this.loading = false
  400. this.finished = true
  401. }
  402. }, 5000)
  403. },
  404. toDoctorAdviceDetail (id) {
  405. var patientid = this.$route.query.patientid
  406. this.$router.push(
  407. '/alldoctoradvice?id=' +
  408. id +
  409. '&patientid=' +
  410. patientid +
  411. '&active=' +
  412. this.active
  413. )
  414. },
  415. getDoctor (id) {
  416. for (let i = 0; i < this.doctor.length; i++) {
  417. if ((this.doctor[i].admin_user_id == id)) {
  418. return this.doctor[i].user_name
  419. }
  420. }
  421. },
  422. Delete (id, index, staff) {
  423. this.id = id
  424. this.index = index
  425. this.staff = staff
  426. this.newShow = true
  427. },
  428. // 长期
  429. DeleteOne (id) {
  430. alert(id)
  431. },
  432. DeleteChild (id, index, state) {
  433. this.id = id
  434. this.index = index
  435. this.state = state
  436. this.newChildShow = true
  437. },
  438. // 临时
  439. DeleteTemporary (id) {
  440. alert(id)
  441. },
  442. toDelete (val) {
  443. if (val.name == '查看全部') {
  444. var patientid = this.$route.query.patientid
  445. this.$router.push(
  446. '/alldoctoradvice?id=' +
  447. this.id +
  448. '&patientid=' +
  449. patientid +
  450. '&active=' +
  451. this.active
  452. )
  453. }
  454. if (val.name == '全部删除') {
  455. this.DeleteManagement(this.id, this.index, this.staff)
  456. }
  457. },
  458. toChildDelete (val) {
  459. if (val.name == '删除') {
  460. this.DeleteChild(this.id, this.index, this.state)
  461. }
  462. },
  463. // 删除整组医嘱
  464. DeleteManagement (id, index, staff) {
  465. if (staff > 0) {
  466. this.$toast('医嘱已执行,无法删除')
  467. return false
  468. }
  469. Dialog.confirm({
  470. title: '删除提示!',
  471. message: '确认删除该条信息吗?,删除后将无法恢复!'
  472. }).then(() => {
  473. DeleteManagement(id).then(response => {
  474. if (response.data.state === 1) {
  475. var msg = response.data.data.msg
  476. this.doctorAdvice.splice(index, 1)
  477. this.newShow = false
  478. }
  479. })
  480. })
  481. },
  482. DeleteChild (id, index, state) {
  483. if (state == 1) {
  484. this.$toast('医嘱已执行,无法删除')
  485. return false
  486. }
  487. Dialog.confirm({
  488. title: '删除提示!',
  489. message: '确认删除该条信息吗?,删除后将无法恢复!'
  490. }).then(() => {
  491. DeleteChild(id).then(response => {
  492. if (response.data.state === 1) {
  493. var msg = response.data.data.msg
  494. this.childList.splice(index, 1)
  495. this.newShow = false
  496. }
  497. })
  498. })
  499. }
  500. },
  501. created () {
  502. var patientid = this.$route.query.patientid
  503. this.getDoctorAdvices(patientid)
  504. this.getPatientDetail(patientid)
  505. this.patient_id = patientid
  506. localStorage.setItem('docActive', this.active)
  507. this.getAllDoctor()
  508. },
  509. watch: {
  510. $route (to, from) {
  511. var patientid = this.$route.query.patientid
  512. }
  513. }
  514. }
  515. </script>
  516. <style lang="scss" scoped>
  517. .doctorManagement {
  518. height: 100%;
  519. overflow-y: auto;
  520. background: #fff;
  521. .toolBox {
  522. display: flex;
  523. height: 3.125rem;
  524. justify-content: space-around;
  525. align-items: center;
  526. .toolOne {
  527. width: 6.25rem;
  528. height: 1.875rem;
  529. background: rgba(246, 246, 246, 1);
  530. border-radius: 5px;
  531. text-align: center;
  532. font-size: 0.8125rem;
  533. color: #8d8d8d;
  534. display: flex;
  535. align-items: center;
  536. justify-content: space-around;
  537. }
  538. }
  539. .adviceBox {
  540. padding: 0 1.125rem;
  541. margin-bottom: 3.125rem;
  542. }
  543. .adviceOne {
  544. box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
  545. padding-bottom: 0.625rem;
  546. }
  547. .adviceTitle {
  548. padding-top: 0.625rem;
  549. display: flex;
  550. align-items: center;
  551. justify-content: space-between;
  552. p {
  553. color: #000000;
  554. font-weight: bold;
  555. font-size: 0.9375rem;
  556. }
  557. }
  558. .ellipsis {
  559. font-size: 1.25rem;
  560. color: #cccccc;
  561. }
  562. .statOrderTitle {
  563. color: #5b98ff;
  564. font-size: 0.8125rem;
  565. font-weight: bold;
  566. margin: 0.625rem 0;
  567. }
  568. .longOrderTitle {
  569. color: #ff964a;
  570. font-size: 0.8125rem;
  571. font-weight: bold;
  572. margin: 0.625rem 0;
  573. }
  574. .orderContent {
  575. font-size: 0.875rem;
  576. color: rgba(49, 50, 52, 1);
  577. p {
  578. line-height: 1.125rem;
  579. }
  580. }
  581. .doctorBox {
  582. font-size: 0.75rem;
  583. color: rgba(152, 152, 152, 1);
  584. line-height: 1.125rem;
  585. display: flex;
  586. align-items: center;
  587. justify-content: space-between;
  588. margin-top: 0.625rem;
  589. }
  590. .all {
  591. font-size: 0.8125rem;
  592. color: #5b98ff;
  593. margin-top: 0.625rem;
  594. }
  595. .noimgBox {
  596. margin-top: 40%;
  597. img {
  598. width: 9.375rem;
  599. height: 9.375rem;
  600. margin: 0 auto;
  601. display: block;
  602. }
  603. }
  604. .add {
  605. position: fixed;
  606. bottom: 0;
  607. left: 0;
  608. width: 100%;
  609. height: 2.75rem;
  610. background: rgba(255, 255, 255, 1);
  611. box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
  612. display: flex;
  613. align-items: center;
  614. justify-content: space-around;
  615. font-size: 0.9375rem;
  616. color: #979798;
  617. .addIcon {
  618. color: #5b98ff;
  619. font-size: 1.25rem;
  620. margin-right: 0.25rem;
  621. }
  622. }
  623. .flexBox {
  624. display: flex;
  625. justify-content: space-between;
  626. }
  627. }
  628. ::-webkit-scrollbar {
  629. width: 0;
  630. }
  631. </style>