血透系统pad前端

ModifyAdviceGroup.vue 12KB

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