血透系统pad前端

ModifyAdviceGroup.vue 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <div v-if="visibility" v-loading="loading">
  3. <div class="Dialog" v-show="sub_dialog_key == 0">
  4. <div class="DialogTit">
  5. <div class="back" @click="backAction">
  6. <span class="iconfont">&#xe720;</span>返回
  7. </div>
  8. <h1 class="name">修改医嘱</h1>
  9. <span class="success" @click="backAction">完成</span>
  10. </div>
  11. <div class="DialogContent choose">
  12. <div class="content clearfix">
  13. <div class="yzNav newYzNav" style="width:100%;overflow-x:hidden">
  14. <span @click="newAdviceAction">新增内容</span>
  15. <span
  16. @click="modifyAction"
  17. :class="{ forbid: current_advice_index < 0 }"
  18. >修改内容</span
  19. >
  20. </div>
  21. <div class="newBox" style="overflow: hidden;">
  22. <div class="cell" style="margin-top: 0;">
  23. <label>医嘱类型</label>
  24. <el-input ref="advice_type" value="临时" disabled></el-input>
  25. </div>
  26. <div class="cell" style="margin-top: 0;">
  27. <label>开始时间</label>
  28. <el-input
  29. :value="start_time_str"
  30. readonly
  31. @focus="selectStartTimeAction"
  32. ></el-input>
  33. </div>
  34. <div class="cell" style="margin-top: 0;">
  35. <label>开嘱时间</label>
  36. <!-- <el-input readonly :value="record_date_str"></el-input> -->
  37. <span class="newSpan">{{ record_date_str }}</span>
  38. </div>
  39. <div class="cell" style="margin-top: 0;">
  40. <label>开嘱医生</label>
  41. <span class="newdoctorName">{{
  42. $store.getters.user.user.user_name
  43. }}</span>
  44. </div>
  45. </div>
  46. <div class="newModifyTable">
  47. <table class="table">
  48. <tr @click="cancelSelectAdvice">
  49. <th width="30%">医嘱内容</th>
  50. <th width="20%">药品规格</th>
  51. <th width="10%">开药数量</th>
  52. <th width="10%">单次用量</th>
  53. <th width="15%">给药途径</th>
  54. <th width="15%">执行频率</th>
  55. </tr>
  56. <tr
  57. v-for="(advice, index) in advices"
  58. :key="index"
  59. :class="{ 'row-class-active': index == current_advice_index }"
  60. @click="selectAdviceAction(index, advice)"
  61. >
  62. <td
  63. :class="{
  64. advice_name: advice.parent_id == 0,
  65. subdrug_name: advice.parent_id > 0
  66. }"
  67. >
  68. {{ advice.advice_name }}
  69. </td>
  70. <td>{{ advice.advice_desc }}{{ advice.drug_spec_unit }}</td>
  71. <td>
  72. {{ advice.prescribing_number
  73. }}{{ advice.prescribing_number_unit }}
  74. </td>
  75. <td>{{ advice.single_dose }} {{ advice.single_dose_unit }}</td>
  76. <td>{{ advice.parent_id == 0 ? advice.delivery_way : "" }}</td>
  77. <td>
  78. {{ advice.parent_id == 0 ? advice.execution_frequency : "" }}
  79. </td>
  80. </tr>
  81. </table>
  82. </div>
  83. </div>
  84. </div>
  85. </div>
  86. <modify-advice-form
  87. ref="modify_advice_form"
  88. @back="sub_dialog_key = 0"
  89. @did-modify="didModifyAdvice"
  90. :delivery_way_options="delivery_way_options"
  91. :execution_frequency_options="execution_frequency_options"
  92. :single_dose_unit_options="single_dose_unit_options"
  93. :prescribing_number_unit_options="prescribing_number_unit_options"
  94. :drug_spec_unit_options="drug_spec_unit_options"
  95. ></modify-advice-form>
  96. <mt-datetime-picker
  97. ref="start_time_picker"
  98. type="datetime"
  99. @confirm="didSelectStartTime"
  100. v-model="start_time"
  101. ></mt-datetime-picker>
  102. <add-new-order-dialog
  103. v-show="sub_dialog_key == 2"
  104. @back-action="sub_dialog_key = 0"
  105. :patient_id="patient_id"
  106. :group_no="group_no"
  107. :drug_spec_unit_options="drug_spec_unit_options"
  108. :delivery_way_options="delivery_way_options"
  109. :execution_frequency_options="execution_frequency_options"
  110. :single_dose_unit_options="single_dose_unit_options"
  111. :prescribing_number_unit_options="prescribing_number_unit_options"
  112. :advice_templates="advice_templates"
  113. @did-create-advices="didCreateAdvices"
  114. ></add-new-order-dialog>
  115. </div>
  116. </template>
  117. <script>
  118. import ModifyAdviceForm from "./modify_order_form";
  119. import { parseTime } from "@/utils";
  120. import { EditDoctorAdvice, modifyAdviceGroupStartTime } from "@/api/advice";
  121. import { Toast } from "vant";
  122. import AddNewOrderDialog from "../new_order/AddNewOrders";
  123. export default {
  124. name: "ModifyAdviceGroup",
  125. components: {
  126. ModifyAdviceForm,
  127. AddNewOrderDialog
  128. },
  129. props: {
  130. patient_id: {
  131. type: Number,
  132. default: 0
  133. },
  134. advice_templates: {
  135. type: Array,
  136. default: function() {
  137. return [];
  138. }
  139. },
  140. drug_spec_unit_options: {
  141. type: Array,
  142. default: function() {
  143. return [];
  144. }
  145. },
  146. delivery_way_options: {
  147. type: Array,
  148. default: function() {
  149. return [];
  150. }
  151. },
  152. execution_frequency_options: {
  153. type: Array,
  154. default: function() {
  155. return [];
  156. }
  157. },
  158. single_dose_unit_options: {
  159. type: Array,
  160. default: function() {
  161. return [];
  162. }
  163. },
  164. prescribing_number_unit_options: {
  165. type: Array,
  166. default: function() {
  167. return [];
  168. }
  169. },
  170. advice_templates: {
  171. type: Array,
  172. default: function() {
  173. return [];
  174. }
  175. }
  176. },
  177. data() {
  178. return {
  179. visibility: false,
  180. loading: false,
  181. sub_dialog_key: 0,
  182. record_date: new Date(),
  183. start_time: new Date(),
  184. // start_time_str: "",
  185. group_no: 0,
  186. advices: [],
  187. current_advice_index: -1,
  188. current_advice: null
  189. };
  190. },
  191. computed: {
  192. start_time_str: function() {
  193. if (this.start_time != null) {
  194. return parseTime(this.start_time, "{y}-{m}-{d} {h}:{i}") + ":00";
  195. }
  196. return "";
  197. },
  198. record_date_str: function() {
  199. if (this.record_date != null) {
  200. return parseTime(this.record_date, "{y}-{m}-{d} {h}:{i}");
  201. }
  202. return "";
  203. }
  204. },
  205. methods: {
  206. show: function(group_no, advices) {
  207. this.visibility = true;
  208. this.sub_dialog_key = 0;
  209. this.group_no = group_no;
  210. this.advices = advices;
  211. if (this.advices.length > 0) {
  212. this.start_time = new Date(this.advices[0].start_time * 1000);
  213. this.record_date = new Date(this.advices[0].created_time * 1000);
  214. }
  215. },
  216. backAction: function() {
  217. this.visibility = false;
  218. this.sub_dialog_key = 0;
  219. this.group_no = 0;
  220. this.advices = [];
  221. this.start_time = new Date();
  222. this.record_date = new Date();
  223. this.$emit("back");
  224. },
  225. selectStartTimeAction: function() {
  226. this.$refs.start_time_picker.open();
  227. },
  228. selectAdviceAction: function(index, advice) {
  229. this.current_advice_index = index;
  230. this.current_advice = advice;
  231. },
  232. cancelSelectAdvice: function() {
  233. this.current_advice_index = -1;
  234. this.current_advice = null;
  235. },
  236. modifyAction: function() {
  237. if (this.current_advice_index < 0) {
  238. return;
  239. }
  240. this.sub_dialog_key = 1;
  241. this.$refs.modify_advice_form.showWithModify({
  242. id: this.current_advice.id,
  243. parent_id: this.current_advice.parent_id,
  244. title: this.current_advice.advice_name,
  245. advice_desc: this.current_advice.advice_desc,
  246. drug_spec: this.current_advice.drug_spec,
  247. drug_spec_unit: this.current_advice.drug_spec_unit,
  248. delivery_way: this.current_advice.delivery_way,
  249. execution_frequency: this.current_advice.execution_frequency,
  250. single_dose: this.current_advice.single_dose,
  251. single_dose_unit: this.current_advice.single_dose_unit,
  252. prescribing_number: this.current_advice.prescribing_number,
  253. prescribing_number_unit: this.current_advice.prescribing_number_unit
  254. });
  255. },
  256. newAdviceAction: function() {
  257. this.cancelSelectAdvice();
  258. this.sub_dialog_key = 2;
  259. },
  260. didSelectStartTime: function(time) {
  261. // Toast.loading({ forbidClick: true, duration: 0 });
  262. console.log(this.start_time);
  263. this.loading = true;
  264. modifyAdviceGroupStartTime(
  265. this.group_no,
  266. parseTime(this.start_time, "{y}-{m}-{d} {h}:{i}") + ":00"
  267. )
  268. .then(rs => {
  269. if (rs.data.state == 1) {
  270. var new_start_time = rs.data.data.start_time;
  271. for (let index = 0; index < this.advices.length; index++) {
  272. const advice = this.advices[index];
  273. advice.start_time = new_start_time;
  274. }
  275. this.start_time = new Date(new_start_time * 1000);
  276. } else {
  277. Toast.fail(rs.data.msg);
  278. }
  279. this.loading = false;
  280. })
  281. .catch(err => {
  282. Toast.fail(err);
  283. this.loading = false;
  284. });
  285. },
  286. didModifyAdvice: function(advice) {
  287. this.loading = true;
  288. EditDoctorAdvice(advice.id, {
  289. advice_name: advice.title,
  290. advice_desc: advice.advice_desc,
  291. remark: advice.remark,
  292. drug_spec_unit: advice.drug_spec_unit,
  293. delivery_way: advice.delivery_way,
  294. execution_frequency: advice.execution_frequency,
  295. single_dose: String(advice.single_dose),
  296. single_dose_unit: advice.single_dose_unit,
  297. prescribing_number: String(advice.prescribing_number),
  298. prescribing_number_unit: advice.prescribing_number_unit,
  299. drug_spec_unit: advice.drug_spec_unit
  300. })
  301. .then(rs => {
  302. if (rs.data.state == 1) {
  303. var resp_advice = rs.data.data.advice;
  304. this.current_advice;
  305. this.current_advice.advice_name = resp_advice.advice_name;
  306. this.current_advice.advice_desc = resp_advice.advice_desc;
  307. this.current_advice.drug_spec_unit = resp_advice.drug_spec_unit;
  308. this.current_advice.remark = resp_advice.remark;
  309. (this.current_advice.delivery_way = resp_advice.delivery_way),
  310. (this.current_advice.execution_frequency =
  311. resp_advice.execution_frequency),
  312. (this.current_advice.single_dose = resp_advice.single_dose),
  313. (this.current_advice.single_dose_unit =
  314. resp_advice.single_dose_unit),
  315. (this.current_advice.prescribing_number =
  316. resp_advice.prescribing_number),
  317. (this.current_advice.prescribing_number_unit =
  318. resp_advice.prescribing_number_unit);
  319. this.sub_dialog_key = 0;
  320. this.$refs.modify_advice_form.dismiss();
  321. } else {
  322. Toast.fail(rs.data.msg);
  323. }
  324. this.loading = false;
  325. })
  326. .catch(err => {
  327. Toast.fail(err);
  328. this.loading = false;
  329. });
  330. },
  331. didCreateAdvices: function(advices) {
  332. this.advices.push(...advices);
  333. this.sub_dialog_key = 0;
  334. }
  335. }
  336. };
  337. </script>
  338. <style style="stylesheet/scss" lang="scss" scoped>
  339. .newYzNav {
  340. position: fixed;
  341. top: 1.5rem;
  342. }
  343. .newBox {
  344. position: fixed;
  345. top: 3.2rem;
  346. }
  347. .newModifyTable {
  348. width: 100%;
  349. margin-top: 5.2rem;
  350. @media only screen and (max-width: 767px) {
  351. margin-top: 5.8rem;
  352. }
  353. }
  354. .newSpan {
  355. font-size: 0.45rem;
  356. }
  357. .table {
  358. width: 1000px;
  359. margin-top: 0.2rem;
  360. tr {
  361. th {
  362. background: $main-color;
  363. color: #fff;
  364. height: 1.2rem;
  365. line-height: 1.2rem;
  366. }
  367. td {
  368. line-height: 0.8rem;
  369. }
  370. .advice_name {
  371. text-align: left;
  372. padding-left: 10px;
  373. padding-right: 10px;
  374. }
  375. .subdrug_name {
  376. text-align: left;
  377. padding-left: 30px;
  378. padding-right: 10px;
  379. }
  380. }
  381. }
  382. .content {
  383. .cell {
  384. float: left;
  385. width: 5rem;
  386. margin: 0.35rem 0.3rem 0.2rem 0.4rem;
  387. label {
  388. display: block;
  389. height: 0.6rem;
  390. line-height: 0.6rem;
  391. color: $pgh-color;
  392. font-size: 0.45rem;
  393. margin-bottom: 0.2rem;
  394. }
  395. .newdoctorName {
  396. font-size: 0.45rem;
  397. }
  398. select {
  399. width: 100%;
  400. padding: 0.2rem 0;
  401. border: 1px $border-color solid;
  402. border-radius: 2px;
  403. padding-left: 5px;
  404. }
  405. .inputBox {
  406. border: 1px $border-color solid;
  407. border-radius: 2px;
  408. padding: 0.18rem 0;
  409. padding-left: 5px;
  410. }
  411. .textarea {
  412. width: 100%;
  413. height: 1.22rem;
  414. border: 1px $border-color solid;
  415. border-radius: 2px;
  416. padding-left: 5px;
  417. }
  418. }
  419. .doctor-name {
  420. line-height: 0.7rem;
  421. font-size: 0.35rem;
  422. margin-left: 0.4rem;
  423. }
  424. .row-class-active > td {
  425. background: #badcff;
  426. // color: #fff;
  427. }
  428. }
  429. </style>