DoctorManagement.vue 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  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">
  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 == 3 && 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. } from "@/api/patient/patient";
  173. import { uParseTime } from "@/utils/tools";
  174. import { Dialog } from "vant";
  175. const moment = require("moment");
  176. export default {
  177. props: {
  178. active: Number
  179. },
  180. data() {
  181. return {
  182. docShow: false,
  183. loading: false,
  184. finished: false,
  185. newShow: false,
  186. newChildShow: false,
  187. typeShow: false,
  188. startShow: false,
  189. endShow: false,
  190. type: "全部",
  191. columns: ["全部", "长期医嘱", "临时医嘱"],
  192. startTime: "请选择",
  193. endTime: "请选择",
  194. minDate: new Date(1970, 0, 1),
  195. maxDate: new Date(2025, 10, 1),
  196. currentDate: new Date(),
  197. actions: [{ name: "全部删除" }],
  198. actions1: [{ name: "删除" }],
  199. actions2: [{ name: "删除" }],
  200. form: {
  201. type: 0,
  202. limit: 5,
  203. page: 1
  204. },
  205. total: "",
  206. showOne: true,
  207. showTwo: false,
  208. doctorAdvice: [],
  209. childList: [],
  210. patient_id: "",
  211. doctor: [],
  212. id: 0,
  213. index: 0,
  214. staff: 0,
  215. childId: 0,
  216. state: 0,
  217. list: []
  218. };
  219. },
  220. methods: {
  221. onCancel() {
  222. this.typeShow = false;
  223. },
  224. onConfirm(value) {
  225. this.form.page = 1;
  226. this.type = value;
  227. this.typeShow = false;
  228. this.doctorAdvice = [];
  229. this.getDoctorAdvices(
  230. this.patient_id,
  231. this.type,
  232. this.startTime,
  233. this.endTime,
  234. this.form.limit,
  235. this.form.page
  236. );
  237. this.onLoad();
  238. },
  239. getstartTime(value) {
  240. this.form.page = 1;
  241. let year = value.getFullYear();
  242. let month = value.getMonth() + 1;
  243. let day = value.getDate();
  244. if (month >= 1 && month <= 9) {
  245. month = `0${month}`;
  246. }
  247. if (day >= 1 && day <= 9) {
  248. day = `0${day}`;
  249. }
  250. this.startTime = `${year}-${month}-${day}`;
  251. this.doctorAdvice = [];
  252. this.getDoctorAdvices(
  253. this.patient_id,
  254. this.type,
  255. this.startTime,
  256. this.endTime,
  257. this.form.limit,
  258. this.form.page
  259. );
  260. this.startShow = false;
  261. this.onLoad();
  262. },
  263. getstartTime2(value) {
  264. this.form.page = 1;
  265. let year = value.getFullYear();
  266. let month = value.getMonth() + 1;
  267. let day = value.getDate();
  268. if (month >= 1 && month <= 9) {
  269. month = `0${month}`;
  270. }
  271. if (day >= 1 && day <= 9) {
  272. day = `0${day}`;
  273. }
  274. this.endTime = `${year}-${month}-${day}`;
  275. this.doctorAdvice = [];
  276. this.getDoctorAdvices(
  277. this.patient_id,
  278. this.type,
  279. this.startTime,
  280. this.endTime,
  281. this.form.limit,
  282. this.form.page
  283. );
  284. this.endShow = false;
  285. this.onLoad();
  286. },
  287. getDoctorAdvices(patientid) {
  288. if (this.type === "全部") {
  289. this.form.type = 0;
  290. }
  291. if (this.type === "长期医嘱") {
  292. this.form.type = 1;
  293. }
  294. if (this.type === "临时医嘱") {
  295. this.form.type = 3;
  296. }
  297. getDoctorAdvices(
  298. patientid,
  299. this.form.type,
  300. this.startTime,
  301. this.endTime,
  302. this.form.limit,
  303. this.form.page
  304. ).then(response => {
  305. if (response.data.state === 1) {
  306. var advice = response.data.data.advice;
  307. // console.log("advice", advice);
  308. var one = response.data.data.one;
  309. // console.log("one", one);
  310. var total = response.data.data.total;
  311. this.total = total;
  312. // console.log("total", total);
  313. let dataInfo = {};
  314. one.forEach((item, index) => {
  315. let { start_time } = item;
  316. if (!dataInfo[start_time]) {
  317. dataInfo[start_time] = {
  318. start_time,
  319. child: []
  320. };
  321. }
  322. });
  323. let list = Object.values(dataInfo);
  324. // console.log("list", list);
  325. list.map(item => {
  326. for (let i = 0; i < advice.length; i++) {
  327. if (
  328. item.start_time === advice[i].start_time &&
  329. advice[i].parent_id === 0
  330. ) {
  331. item.child.push(advice[i]);
  332. }
  333. }
  334. });
  335. let objarr = [];
  336. for (let i = 0; i < advice.length; i++) {
  337. if (advice[i].parent_id != 0) {
  338. objarr.push(advice[i]);
  339. }
  340. }
  341. this.childList = objarr;
  342. let arr = this.doctorAdvice;
  343. arr.push(...list.reverse());
  344. //console.log("arr", arr);
  345. this.doctorAdvice = arr;
  346. this.loading = false;
  347. }
  348. });
  349. },
  350. getPatientDetail(patientid) {
  351. getPatientDetail(patientid).then(response => {
  352. if (response.data.state === 1) {
  353. var patientDetail = response.data.data.patientDetail;
  354. if (patientDetail.blood_patients == 0) {
  355. this.showOne = false;
  356. this.showTwo = true;
  357. }
  358. if (patientDetail.blood_patients == 1) {
  359. this.showOne = true;
  360. this.showTwo = false;
  361. }
  362. this.patientName = patientDetail.name;
  363. }
  364. });
  365. },
  366. getTime(time) {
  367. // return uParseTime(time, "{y}-{m}-{d} {h}:{i}:{s}");
  368. return uParseTime(time, "{y}-{m}-{d}");
  369. },
  370. getTimes(time) {
  371. return uParseTime(time, "{h}:{i}");
  372. },
  373. onLoad() {
  374. setTimeout(() => {
  375. this.form.page++;
  376. // console.log("page", this.form.page);
  377. if (this.form.page <= Math.ceil(this.total / 5)) {
  378. this.getDoctorAdvices(
  379. this.patient_id,
  380. this.form.type,
  381. this.startTime,
  382. this.endTime,
  383. this.form.limit,
  384. this.form.page
  385. );
  386. } else {
  387. this.loading = false;
  388. this.finished = true;
  389. }
  390. }, 5000);
  391. },
  392. toDoctorAdviceDetail(id) {
  393. var patientid = this.$route.query.patientid;
  394. this.$router.push(
  395. "/alldoctoradvice?id=" +
  396. id +
  397. "&patientid=" +
  398. patientid +
  399. "&active=" +
  400. this.active
  401. );
  402. },
  403. getDoctor(id) {
  404. for (let i = 0; i < this.doctor.length; i++) {
  405. if ((this.doctor[i].admin_user_id = id)) {
  406. return this.doctor[i].name;
  407. }
  408. }
  409. },
  410. Delete(id, index, staff) {
  411. this.id = id;
  412. this.index = index;
  413. this.staff = staff;
  414. this.newShow = true;
  415. },
  416. // 长期
  417. DeleteOne(id) {
  418. alert(id);
  419. },
  420. DeleteChild(id, index, state) {
  421. this.id = id;
  422. this.index = index;
  423. this.state = state;
  424. this.newChildShow = true;
  425. },
  426. // 临时
  427. DeleteTemporary(id) {
  428. alert(id);
  429. },
  430. toDelete(val) {
  431. if (val.name == "全部删除") {
  432. this.DeleteManagement(this.id, this.index, this.staff);
  433. }
  434. },
  435. toChildDelete(val) {
  436. if (val.name == "删除") {
  437. this.DeleteChild(this.id, this.index, this.state);
  438. }
  439. },
  440. // 删除整组医嘱
  441. DeleteManagement(id, index, staff) {
  442. if (staff > 0) {
  443. this.$toast("医嘱已执行,无法删除");
  444. return false;
  445. }
  446. Dialog.confirm({
  447. title: "删除提示!",
  448. message: "确认删除该条信息吗?,删除后将无法恢复!"
  449. }).then(() => {
  450. DeleteManagement(id).then(response => {
  451. if (response.data.state === 1) {
  452. var msg = response.data.data.msg;
  453. this.doctorAdvice.splice(index, 1);
  454. this.newShow = false;
  455. }
  456. });
  457. });
  458. },
  459. DeleteChild(id, index, state) {
  460. if (state == 1) {
  461. this.$toast("医嘱已执行,无法删除");
  462. return false;
  463. }
  464. Dialog.confirm({
  465. title: "删除提示!",
  466. message: "确认删除该条信息吗?,删除后将无法恢复!"
  467. }).then(() => {
  468. DeleteChild(id).then(response => {
  469. if (response.data.state === 1) {
  470. var msg = response.data.data.msg;
  471. this.childList.splice(index, 1);
  472. this.newShow = false;
  473. }
  474. });
  475. });
  476. }
  477. },
  478. created() {
  479. var patientid = this.$route.query.patientid;
  480. this.getDoctorAdvices(patientid);
  481. this.getPatientDetail(patientid);
  482. this.patient_id = patientid;
  483. },
  484. watch: {
  485. $route(to, from) {
  486. var patientid = this.$route.query.patientid;
  487. }
  488. }
  489. };
  490. </script>
  491. <style lang="scss" scoped>
  492. .doctorManagement {
  493. height: 100%;
  494. overflow-y: auto;
  495. background: #fff;
  496. .toolBox {
  497. display: flex;
  498. height: 3.125rem;
  499. justify-content: space-around;
  500. align-items: center;
  501. .toolOne {
  502. width: 6.25rem;
  503. height: 1.875rem;
  504. background: rgba(246, 246, 246, 1);
  505. border-radius: 5px;
  506. text-align: center;
  507. font-size: 0.8125rem;
  508. color: #8d8d8d;
  509. display: flex;
  510. align-items: center;
  511. justify-content: space-around;
  512. }
  513. }
  514. .adviceBox {
  515. padding: 0 1.125rem;
  516. margin-bottom: 3.125rem;
  517. }
  518. .adviceOne {
  519. box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.1);
  520. padding-bottom: 0.625rem;
  521. }
  522. .adviceTitle {
  523. padding-top: 0.625rem;
  524. display: flex;
  525. align-items: center;
  526. justify-content: space-between;
  527. p {
  528. color: #000000;
  529. font-weight: bold;
  530. font-size: 0.9375rem;
  531. }
  532. }
  533. .ellipsis {
  534. font-size: 1.25rem;
  535. color: #cccccc;
  536. }
  537. .statOrderTitle {
  538. color: #5b98ff;
  539. font-size: 0.8125rem;
  540. font-weight: bold;
  541. margin: 0.625rem 0;
  542. }
  543. .longOrderTitle {
  544. color: #ff964a;
  545. font-size: 0.8125rem;
  546. font-weight: bold;
  547. margin: 0.625rem 0;
  548. }
  549. .orderContent {
  550. font-size: 0.875rem;
  551. color: rgba(49, 50, 52, 1);
  552. p {
  553. line-height: 1.125rem;
  554. }
  555. }
  556. .doctorBox {
  557. font-size: 0.75rem;
  558. color: rgba(152, 152, 152, 1);
  559. line-height: 1.125rem;
  560. display: flex;
  561. align-items: center;
  562. justify-content: space-between;
  563. margin-top: 0.625rem;
  564. }
  565. .all {
  566. font-size: 0.8125rem;
  567. color: #5b98ff;
  568. margin-top: 0.625rem;
  569. }
  570. .noimgBox {
  571. margin-top: 40%;
  572. img {
  573. width: 9.375rem;
  574. height: 9.375rem;
  575. margin: 0 auto;
  576. display: block;
  577. }
  578. }
  579. .add {
  580. position: fixed;
  581. bottom: 0;
  582. left: 0;
  583. width: 100%;
  584. height: 2.75rem;
  585. background: rgba(255, 255, 255, 1);
  586. box-shadow: 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
  587. display: flex;
  588. align-items: center;
  589. justify-content: space-around;
  590. font-size: 0.9375rem;
  591. color: #979798;
  592. .addIcon {
  593. color: #5b98ff;
  594. font-size: 1.25rem;
  595. margin-right: 0.25rem;
  596. }
  597. }
  598. .flexBox {
  599. display: flex;
  600. justify-content: space-between;
  601. }
  602. }
  603. ::-webkit-scrollbar {
  604. width: 0;
  605. }
  606. </style>