血透系统pad前端

OrdersDialog.vue 53KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537
  1. <template>
  2. <div>
  3. <div class="Dialog" v-show="index==0" style="width: 11.8rem;">
  4. <div class="DialogTit">
  5. <span class="iconfont" @click="$emit('orderDialog')">&#xe6e9;</span>
  6. <h1 class="name">临时医嘱</h1>
  7. <span class="success">&nbsp;</span>
  8. </div>
  9. <div class="yzNav" style="width:100%;">
  10. <span
  11. @click="openNewAdvice"
  12. :class="{ forbid: this.$store.getters.user.user.user_type == 3 }"
  13. >新增</span>
  14. <span
  15. v-if="isShowExce"
  16. @click="execAdvice"
  17. :class="{ forbid: (current_advice&& current_advice.parent_id > 0)||(this.$store.getters.user.user.user_type == 2 && !isPremission) }"
  18. >执行</span>
  19. <span
  20. id="fontSize"
  21. v-if="isShowMofifyExce"
  22. @click="modifyExecAdvice"
  23. :class="{ forbid: (current_advice&& current_advice.parent_id > 0) }"
  24. >修改执行</span>
  25. <span
  26. v-if="template_id != 6"
  27. @click="checkAdvice"
  28. :class="{ forbid: (current_advice&& current_advice.parent_id > 0) || (this.$store.getters.user.user.user_type == 2 && !isPremission) }"
  29. >核对</span>
  30. <span
  31. id="fontSize"
  32. @click="openNewChild"
  33. :class="{ forbid: current_advice == null || current_advice.parent_id > 0 || currentAdvices.length != 1 || this.$store.getters.user.user.user_type == 3 }"
  34. >添加子药</span>
  35. <span
  36. v-if="currentSubAdvices.length <= 0"
  37. @click="modifyAdviceAction"
  38. :class="{ forbid: current_group_index < 0 || currentAdvices.length != 1 || current_select_object== 2 }"
  39. >修改</span>
  40. <span
  41. v-if="currentSubAdvices.length <= 0"
  42. @click="deleteAdviceAction"
  43. :class="{ forbid: current_group_index < 0 || currentAdvices.length <= 0 }"
  44. >删除</span>
  45. <span id="fontSize" :class="{ forbid:this.$store.getters.user.user.user_type == 3}" v-if="currentSubAdvices.length > 0" @click="modifySubdviceAction">修改子医嘱</span>
  46. <span id="fontSize" :class="{ forbid:this.$store.getters.user.user.user_type == 3}" v-if="currentSubAdvices.length > 0" @click="deleteSubAdviceAction">删除子医嘱</span>
  47. </div>
  48. <div class="DialogContent choose" id="dialogTop" style="height:6.5rem;">
  49. <div class="content clearfix">
  50. <div class="orderTable">
  51. <table class="table">
  52. <tr @click="cancelAdviceSelect">
  53. <th width="8%">开嘱医生</th>
  54. <th width="12%">开始时间</th>
  55. <th width="52%">医嘱内容</th>
  56. <th width="12%">执行时间</th>
  57. <th width="8%">执行护士</th>
  58. <th v-if="template_id != 6" width="8%">核对人员</th>
  59. </tr>
  60. <template v-for="(group, group_index) in advice_groups">
  61. <tr
  62. v-for="(advice, advice_index) in group.advices"
  63. :key="advice.id"
  64. :class="{ 'row-class-active': current_group_index == group_index && current_advice_index < 0 }"
  65. >
  66. <td
  67. v-if="advice_index == 0"
  68. :rowspan="group.advices.length"
  69. @click="selectGroupAdviceAction(group_index, -1, null,group)"
  70. >
  71. <span v-if="advice.parent_id==0">{{getXuserName(advice.advice_doctor)}}</span>
  72. <span v-else></span>
  73. </td>
  74. <td
  75. v-if="advice_index == 0"
  76. :rowspan="group.advices.length"
  77. @click="selectGroupAdviceAction(group_index, -1, null,group)"
  78. >
  79. <span>{{uParseTime(advice.start_time, '{m}-{d} {h}:{i}')}}</span>
  80. </td>
  81. <td
  82. :class="{ 'advice_content': advice.parent_id == 0, 'subadvice_content': advice.parent_id > 0, 'td-active':current_group_index == group_index && advice.is_selected == 1 }"
  83. @click="selectAdviceAction(group_index, advice_index, advice)"
  84. >
  85. <div class="txt">
  86. <span>{{advice.advice_name }}</span>
  87. <span v-if="advice.advice_desc">({{ advice.advice_desc }}{{advice.drug_spec_unit}})</span>
  88. <span v-if="advice.prescribing_number">&nbsp;&nbsp;{{advice.prescribing_number}}{{advice.prescribing_number_unit}}</span>
  89. <span v-if="advice.single_dose && template_id == 6" >{{advice.single_dose}}{{advice.single_dose_unit}}</span>
  90. <span v-if="advice.single_dose && template_id != 6" >单次用量{{advice.single_dose}}{{advice.single_dose_unit}}</span>
  91. <span v-if="advice.parent_id == 0">{{advice.delivery_way}}</span>
  92. <span v-if="advice.parent_id == 0">{{advice.execution_frequency}}</span>
  93. <span
  94. v-if="advice.parent_id == 0 && advice.remark.length > 0"
  95. >({{advice.remark}})</span>
  96. </div>
  97. </td>
  98. <td
  99. :class="{'td-active':current_group_index == group_index && advice.is_selected == 1}"
  100. @click="selectAdviceAction(group_index,advice_index, advice)"
  101. >{{uParseTime(advice.execution_time, '{m}-{d} {h}:{i}')}}</td>
  102. <td
  103. :class="{'td-active':current_group_index == group_index && advice.is_selected == 1}"
  104. @click="selectAdviceAction(group_index,advice_index, advice)"
  105. > {{getXuserName(advice.execution_staff)}}
  106. </td>
  107. <td v-if="template_id != 6"
  108. :class="{'td-active':current_group_index == group_index && advice.is_selected == 1}"
  109. @click="selectAdviceAction(group_index,advice_index, advice)"
  110. >{{getXuserName(advice.checker)}}</td>
  111. </tr>
  112. </template>
  113. </table>
  114. </div>
  115. <!-- <el-table
  116. :data="tableData"
  117. border
  118. style="width: 100%">
  119. <el-table-column fixed prop="date" label="开嘱医生" width="180" align="center">
  120. <template slot-scope="scope">
  121. {{getXuserName(scope.row.advice_doctor)}}
  122. </template>
  123. </el-table-column>
  124. <el-table-column prop="name" label="开始时间" width="180" align="center">
  125. <template slot-scope="scope">
  126. {{uParseTime(scope.row.start_time, '{m}-{d} {h}:{i}')}}
  127. </template>
  128. </el-table-column>
  129. <el-table-column prop="address" label="医嘱内容" align="center">
  130. <template slot-scope="scope">
  131. <span>{{scope.row.advice_name }}</span>
  132. <span
  133. v-if="scope.row.advice_desc"
  134. >({{ scope.row.advice_desc }}{{scope.row.drug_spec_unit}})</span>
  135. <span
  136. v-if="scope.row.prescribing_number"
  137. >&nbsp;&nbsp;{{scope.row.prescribing_number}}{{scope.row.prescribing_number_unit}})</span>
  138. <span
  139. v-if="scope.row.single_dose && template_id != 6"
  140. >单次用量{{scope.row.single_dose}}{{scope.row.single_dose_unit}}</span>
  141. <span v-if="scope.row.parent_id == 0">{{scope.row.delivery_way}}</span>
  142. <span v-if="scope.row.parent_id == 0">{{scope.row.execution_frequency}}</span>
  143. <span
  144. v-if="scope.row.parent_id == 0 && scope.row.remark.length > 0"
  145. >({{scope.row.remark}})</span>
  146. </template>
  147. </el-table-column>
  148. <el-table-column prop="address" label="执行时间" align="center">
  149. <template slot-scope="scope">
  150. {{uParseTime(scope.row.execution_time, '{m}-{d} {h}:{i}')}}
  151. </template>
  152. </el-table-column>
  153. <el-table-column prop="address" label="执行护士" align="center">
  154. <template slot-scope="scope">
  155. {{getXuserName(scope.row.checker)}}
  156. </template>
  157. </el-table-column>
  158. </el-table>-->
  159. </div>
  160. </div>
  161. </div>
  162. <add-new-order-dialog
  163. v-show="index==1&&isShowDialog"
  164. @back-action="index = 0"
  165. :patient_id="patient.id"
  166. :drug_spec_unit_options="unitsOption"
  167. :delivery_way_options="deliveryWayOptions"
  168. :execution_frequency_options="executionFrequencyOptions"
  169. :single_dose_unit_options="unitsOption"
  170. :prescribing_number_unit_options="unitsOption"
  171. :advice_templates="adviceTemplates"
  172. @did-create-advices="didCreateAdvices"
  173. ></add-new-order-dialog>
  174. <advice-form
  175. ref="subdrug_form"
  176. @back="index = 0"
  177. @did-create-subdrug="didAddSubdrug"
  178. :single_dose_unit_options="unitsOption"
  179. :prescribing_number_unit_options="unitsOption"
  180. :drug_spec_unit_options="unitsOption"
  181. ></advice-form>
  182. <modify-advice-form
  183. ref="modify_advice_form"
  184. @back="index = 0"
  185. @did-modify="didModifyAdvice"
  186. :drug_spec_unit_options="unitsOption"
  187. :delivery_way_options="deliveryWayOptions"
  188. :execution_frequency_options="executionFrequencyOptions"
  189. :single_dose_unit_options="unitsOption"
  190. :prescribing_number_unit_options="unitsOption"
  191. ></modify-advice-form>
  192. <modify-advice-group-dialog
  193. ref="modify_advice_group"
  194. @back="index = 0"
  195. :patient_id="patient.id"
  196. :delivery_way_options="deliveryWayOptions"
  197. :execution_frequency_options="executionFrequencyOptions"
  198. :single_dose_unit_options="unitsOption"
  199. :drug_spec_unit_options="unitsOption"
  200. :prescribing_number_unit_options="unitsOption"
  201. :advice_templates="adviceTemplates"
  202. @did-create-advices="didCreateAdvices"
  203. ></modify-advice-group-dialog>
  204. <mt-datetime-picker
  205. ref="exec_time"
  206. type="datetime"
  207. @confirm="handleExecTime"
  208. v-model="nowExecTime"
  209. ></mt-datetime-picker>
  210. <mt-datetime-picker
  211. ref="mofify_exec_time"
  212. type="datetime"
  213. @confirm="handleModifyExecTime"
  214. v-model="nowExecTime"
  215. ></mt-datetime-picker>
  216. </div>
  217. </template>
  218. <script>
  219. import {Dialog, Toast} from 'vant'
  220. import {
  221. CheckDoctorAdvice,
  222. CreateDoctorAdvice,
  223. DeleteDoctorAdviceNew,
  224. DeleteSubDoctorAdvice,
  225. EditDoctorAdvice,
  226. ExecDoctorAdvice,
  227. getAdviceConfig,
  228. ModifyExecDoctorAdvice
  229. } from '@/api/advice'
  230. import {uParseTime} from '@/utils/tools'
  231. import CheckBoxSubMenu from './subMenu/checkBoxSubMenu'
  232. import {getDataConfig} from '@/utils/data'
  233. import AddNewOrderDialog from './new_order/AddNewOrders'
  234. import AdviceForm from './new_order/order_form'
  235. import ModifyAdviceForm from './modify_order/modify_order_form'
  236. import ModifyAdviceGroupDialog from './modify_order/ModifyAdviceGroup'
  237. export default {
  238. name: 'OrdersDialog',
  239. components: {
  240. CheckBoxSubMenu,
  241. AddNewOrderDialog,
  242. AdviceForm,
  243. ModifyAdviceForm,
  244. ModifyAdviceGroupDialog,
  245. },
  246. props: {
  247. advice_groups: {
  248. type: Array,
  249. default: () => {
  250. return []
  251. }
  252. },
  253. patient_prop: {
  254. type: Object
  255. },
  256. advice_list_prop: {
  257. type: Array
  258. },
  259. admin_users_prop: {
  260. type: Array
  261. },
  262. special_premission:{
  263. type: Array
  264. }
  265. },
  266. data () {
  267. return {
  268. isShowDialog: true,
  269. template_id: 0,
  270. isShowExce: true,
  271. isShowMofifyExce: false,
  272. title: '临时医嘱',
  273. index: 0,
  274. doctor: '',
  275. adviceTemplates: [],
  276. drugOptions: {},
  277. deliveryWayOptions: [],
  278. executionFrequencyOptions: [],
  279. unitsOption: [],
  280. unitsObj: [],
  281. record_date: '',
  282. nowExecTime: new Date(),
  283. patient: {
  284. id: 0
  285. },
  286. admin_users: [],
  287. adviceList: [],
  288. parent_id: 0,
  289. current_select_object: -1,
  290. current_group_index: -1,
  291. current_advice_index: -1,
  292. current_advice: null,
  293. currentAdviceIdsStr: '',
  294. currentAdvices: [],
  295. currentSubAdvices: [],
  296. isPremission:false,
  297. }
  298. },
  299. created () {
  300. this.template_id = this.$store.getters.user.template_info.template_id
  301. var date = this.$route.query && this.$route.query.date
  302. date *= 1000
  303. var newDate = new Date(date)
  304. var y = newDate.getFullYear()
  305. var m = newDate.getMonth() + 1
  306. var d = newDate.getDate()
  307. if (isNaN(y) || isNaN(m) || isNaN(d)) {
  308. newDate = new Date()
  309. y = newDate.getFullYear()
  310. m = newDate.getMonth() + 1
  311. d = newDate.getDate()
  312. }
  313. this.record_date =
  314. y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)
  315. this.patient = this.patient_prop
  316. this.adviceList = this.advice_list_prop
  317. this.admin_users = this.admin_users_prop
  318. this.doctor = this.$store.getters.user.user.user_name
  319. this.getAdviceConfig()
  320. this.unitsOption = getDataConfig('hemodialysis', 'units')
  321. for (var index in this.unitsOption) {
  322. this.unitsObj[this.unitsOption[index].id] = this.unitsOption[index]
  323. }
  324. for (let i = 0; i < this.special_premission.length; i++) {
  325. if (this.$store.getters.user.user.id == this.special_premission[i].admin_user_id) {
  326. this.isPremission = true
  327. }
  328. }
  329. },
  330. watch: {
  331. 'advice_groups': function () {
  332. },
  333. 'currentAdvices': function (currentAdvices) {
  334. if (currentAdvices.length == 0) {
  335. this.isShowExce = true
  336. this.isShowMofifyExce = false
  337. } else {
  338. let a = 0
  339. for (let i = 0; i < currentAdvices.length; i++) {
  340. if (currentAdvices[i].execution_state == 1) {
  341. a = a + 1
  342. }
  343. }
  344. if (a == currentAdvices.length) {
  345. this.isShowExce = false
  346. this.isShowMofifyExce = true
  347. }else{
  348. this.isShowExce = true
  349. this.isShowMofifyExce = false
  350. }
  351. }
  352. }
  353. },
  354. methods: {
  355. modifyExecAdvice: function () {
  356. // if(!this.isPremission){
  357. // Toast.fail('你没有权限修改医嘱!')
  358. // }else{
  359. this.nowExecTime = new Date(this.currentAdvices[0].start_time * 1000)
  360. this.$refs.mofify_exec_time.open()
  361. // }
  362. },
  363. didCreateAdvices: function (advices) {
  364. if (advices.length == 0) {
  365. return
  366. }
  367. for (let i = 0; i < advices.length; i++) {
  368. advices[i]['is_selected'] = 0
  369. }
  370. var new_group = Object.assign(
  371. {},
  372. {
  373. group_no: 0,
  374. start_time: 0,
  375. advices: []
  376. }
  377. )
  378. new_group.group_no = advices[0].groupno
  379. new_group.start_time = advices[0].start_time
  380. new_group.advices.push(...advices)
  381. var insertIndex = -1
  382. for (let index = 0; index < this.advice_groups.length; index++) {
  383. const group = this.advice_groups[index]
  384. if (group.start_time < new_group.start_time) {
  385. insertIndex = index
  386. break
  387. }
  388. }
  389. if (insertIndex < 0) {
  390. this.advice_groups.push(new_group)
  391. } else {
  392. this.advice_groups.splice(insertIndex, 0, new_group)
  393. }
  394. this.index = 0
  395. this.advice_groups.sort((a, b) => a.start_time - b.start_time)
  396. },
  397. didModifyAdvice: function (advice) {
  398. Toast.loading({forbidClick: true, duration: 0})
  399. EditDoctorAdvice(advice.id, {
  400. advice_name: advice.title,
  401. advice_desc: advice.advice_desc,
  402. remark: advice.remark,
  403. start_time: advice.start_time,
  404. drug_spec: String(advice.drug_spec),
  405. drug_spec_unit: advice.drug_spec_unit,
  406. delivery_way: advice.delivery_way,
  407. execution_frequency: advice.execution_frequency,
  408. single_dose: String(advice.single_dose),
  409. single_dose_unit: advice.single_dose_unit,
  410. prescribing_number: String(advice.prescribing_number),
  411. prescribing_number_unit: advice.prescribing_number_unit
  412. })
  413. .then(rs => {
  414. if (rs.data.state == 1) {
  415. var resp_advice = rs.data.data.advice
  416. if(!rs.data.data.isChange){
  417. var group = this.advice_groups[this.current_group_index]
  418. for (let index = 0; index < group.advices.length; index++) {
  419. const advice = group.advices[index]
  420. if (advice.id == resp_advice.id) {
  421. advice.advice_name = resp_advice.advice_name
  422. advice.advice_desc = resp_advice.advice_desc
  423. advice.remark = resp_advice.remark;
  424. advice.start_time = resp_advice.start_time;
  425. advice.drug_spec = resp_advice.drug_spec;
  426. (advice.drug_spec_unit = resp_advice.drug_spec_unit),
  427. (advice.delivery_way = resp_advice.delivery_way),
  428. (advice.execution_frequency =
  429. resp_advice.execution_frequency),
  430. (advice.single_dose = resp_advice.single_dose),
  431. (advice.single_dose_unit = resp_advice.single_dose_unit),
  432. (advice.prescribing_number = resp_advice.prescribing_number),
  433. (advice.prescribing_number_unit =
  434. resp_advice.prescribing_number_unit)
  435. break
  436. }
  437. }
  438. }else{
  439. // var group = this.advice_groups[this.current_group_index]
  440. //先删除旧数据,再插入新数据
  441. var adviceArr = this.advice_groups[this.current_group_index].advices
  442. for (let y = resp_advice.length - 1; y >= 0; y--) {
  443. for (let i = adviceArr.length - 1; i >= 0; i--) {
  444. if (adviceArr[i].id == resp_advice[y].id || adviceArr[i].parent_id == resp_advice[y].id) {
  445. adviceArr.splice(i, 1)
  446. }
  447. }
  448. }
  449. var newAdvice = {}
  450. newAdvice['advices'] = resp_advice
  451. newAdvice['group_no'] = resp_advice[0].groupno
  452. this.advice_groups.push(newAdvice)
  453. }
  454. this.currentAdvices = []
  455. this.currentSubAdvices = []
  456. for (let i = 0; i < this.advice_groups.length; i++) {
  457. for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
  458. var advices = this.advice_groups[i].advices[y]
  459. advices.is_selected = 0
  460. }
  461. }
  462. console.log(this.advice_groups)
  463. this.advice_groups.sort((a, b) => a.advices[0].start_time - b.advices[0].start_time)
  464. this.$refs.modify_advice_form.dismiss()
  465. Toast.clear()
  466. this.index = 0
  467. } else {
  468. Toast.fail(rs.data.msg)
  469. }
  470. })
  471. .catch(err => {
  472. Toast.fail(err)
  473. })
  474. },
  475. uParseTime (time, format) {
  476. if (time == 0) {
  477. return ''
  478. }
  479. return uParseTime(time, format)
  480. },
  481. getXuserName (id) {
  482. if (id <= 0) {
  483. return ''
  484. }
  485. var name = ''
  486. if (
  487. this.admin_users == null ||
  488. typeof this.admin_users.length == 'undefined'
  489. ) {
  490. return name
  491. }
  492. var leng = this.admin_users.length
  493. if (leng == 0) {
  494. return name
  495. }
  496. for (let index = 0; index < leng; index++) {
  497. if (this.admin_users[index].id == id) {
  498. name = this.admin_users[index].name
  499. break
  500. }
  501. }
  502. return name
  503. },
  504. didAddSubdrug: function (subdrug) {
  505. Toast.loading({forbidClick: true, duration: 0})
  506. CreateDoctorAdvice(this.patient.id, {
  507. parent_id: subdrug.parent_id,
  508. advice_type: 2,
  509. advice_date: subdrug.record_time,
  510. start_time: subdrug.start_time,
  511. advice_name: subdrug.title,
  512. advice_desc: subdrug.advice_desc,
  513. drug_spec: String(subdrug.drug_spec),
  514. drug_spec_unit: subdrug.drug_spec_unit,
  515. single_dose: String(subdrug.single_dose),
  516. single_dose_unit: subdrug.single_dose_unit,
  517. prescribing_number: String(subdrug.prescribing_number),
  518. prescribing_number_unit: subdrug.prescribing_number_unit
  519. // delivery_way: subdrug.delivery_way,
  520. // execution_frequency: subdrug.execution_frequency
  521. })
  522. .then(response => {
  523. if (response.data.state == 0) {
  524. Toast.fail(response.data.msg)
  525. return false
  526. } else {
  527. Toast.success('添加成功')
  528. var resp_advice = response.data.data.advice
  529. var group_index = this.current_group_index
  530. var adviceArr = this.advice_groups[this.current_group_index].advices
  531. for (let i = 0; i < adviceArr.length; i++) {
  532. if (adviceArr[i].id == this.currentAdvices[0].id && adviceArr[i].is_selected == 1) {
  533. var advice_index = i
  534. }
  535. }
  536. var group = this.advice_groups[group_index]
  537. var insert_index = -1
  538. var last_child_index = -1
  539. for (
  540. let index = advice_index + 1;
  541. index < group.advices.length;
  542. index++
  543. ) {
  544. const advice = group.advices[index]
  545. if (resp_advice.parent_id != advice.parent_id) {
  546. insert_index = index
  547. break
  548. } else {
  549. last_child_index = index
  550. }
  551. }
  552. if (insert_index < 0) {
  553. if (last_child_index < 0) {
  554. group.advices.splice(advice_index + 1, 0, resp_advice)
  555. } else {
  556. group.advices.splice(last_child_index + 1, 0, resp_advice)
  557. }
  558. } else {
  559. group.advices.splice(insert_index, 0, resp_advice)
  560. }
  561. this.cancelAdviceSelect()
  562. this.$refs.subdrug_form.dismiss()
  563. this.index = 0
  564. // this.$emit("new_create", response.data.data.advice);
  565. this.currentAdvices = []
  566. this.currentSubAdvices = []
  567. for (let i = 0; i < this.advice_groups.length; i++) {
  568. for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
  569. var advices = this.advice_groups[i].advices[y]
  570. advices.is_selected = 0
  571. }
  572. }
  573. return false
  574. }
  575. })
  576. .catch(err => {
  577. Toast.fail(err)
  578. })
  579. },
  580. getAdviceConfig () {
  581. getAdviceConfig().then(response => {
  582. if (response.data.state == 1) {
  583. this.deliveryWayOptions =
  584. response.data.data.drugways === null
  585. ? []
  586. : response.data.data.drugways
  587. this.executionFrequencyOptions =
  588. response.data.data.efs === null ? [] : response.data.data.efs
  589. this.adviceTemplates =
  590. response.data.data.advice_templates === null
  591. ? []
  592. : response.data.data.advice_templates
  593. }
  594. })
  595. },handleModifyExecTime(time){
  596. var exceTime = this.handleTime(time)
  597. var currentAdviceIdArr = []
  598. var exceParams = null
  599. for (let i = 0; i < this.currentAdvices.length; i++) {
  600. if ( this.currentAdvices[i].execution_state == 1) {
  601. currentAdviceIdArr.push(this.currentAdvices[i].id)
  602. }
  603. }
  604. this.currentAdviceIdsStr = currentAdviceIdArr.join(',')
  605. if (this.current_select_object == 1) {
  606. exceParams = {
  607. groupno: 0,
  608. advice_id: this.currentAdviceIdsStr,
  609. execution_time: exceTime
  610. }
  611. } else {
  612. var group = this.advice_groups[this.current_group_index]
  613. exceParams = {
  614. groupno: group.group_no <= 0 ? 0 : group.group_no,
  615. advice_id: group.group_no <= 0 ? group.advices[0].id : 0,
  616. execution_time: exceTime
  617. }
  618. }
  619. ModifyExecDoctorAdvice(exceParams)
  620. .then(response => {
  621. if (response.data.state == 0) {
  622. Toast.fail(response.data.msg)
  623. return false
  624. } else {
  625. Toast.success('执行成功!')
  626. var advice = response.data.data.advice
  627. if (this.current_select_object == 1) {
  628. var ids = this.currentAdviceIdsStr.split(',')
  629. var adviceArr = this.advice_groups[this.current_group_index].advices
  630. for (let i = 0; i < adviceArr.length; i++) {
  631. for (let a = 0; a < ids.length; a++) {
  632. if ((adviceArr[i].execution_state == 1 && adviceArr[i].id == ids[a]) || (adviceArr[i].execution_state == 1 && adviceArr[i].parent_id == ids[a])) {
  633. adviceArr[i].execution_time = advice.execution_time
  634. }
  635. }
  636. }
  637. } else {
  638. for (let index = 0; index < group.advices.length; index++) {
  639. const adv = group.advices[index]
  640. if (adv.execution_state == 1) {
  641. adv.execution_time = advice.execution_time
  642. }
  643. }
  644. }
  645. }
  646. })
  647. .catch(err => {
  648. Toast.fail(err)
  649. return false
  650. })
  651. },
  652. handleExecTime (time) {
  653. var exceTime = this.handleTime(time)
  654. var exceParams = null
  655. if (this.current_select_object == 1) {
  656. exceParams = {
  657. groupno: 0,
  658. advice_id: this.currentAdviceIdsStr,
  659. execution_time: exceTime
  660. }
  661. } else {
  662. var group = this.advice_groups[this.current_group_index]
  663. exceParams = {
  664. groupno: group.group_no <= 0 ? 0 : group.group_no,
  665. advice_id: group.group_no <= 0 ? group.advices[0].id : 0,
  666. execution_time: exceTime
  667. }
  668. }
  669. Toast.loading({forbidClick: true, duration: 0})
  670. ExecDoctorAdvice(exceParams)
  671. .then(response => {
  672. if (response.data.state == 0) {
  673. Toast.fail(response.data.msg)
  674. return false
  675. } else {
  676. Toast.success('执行成功!')
  677. var advice = response.data.data.advice
  678. if (this.current_select_object == 1) {
  679. var ids = this.currentAdviceIdsStr.split(',')
  680. var adviceArr = this.advice_groups[this.current_group_index].advices
  681. for (let i = 0; i < adviceArr.length; i++) {
  682. for (let a = 0; a < ids.length; a++) {
  683. if ((adviceArr[i].execution_state == 2 && adviceArr[i].id == ids[a]) || (adviceArr[i].execution_state == 2 && adviceArr[i].parent_id == ids[a])) {
  684. adviceArr[i].execution_staff = advice.execution_staff
  685. adviceArr[i].execution_time = advice.execution_time
  686. adviceArr[i].execution_state = advice.execution_state
  687. }
  688. }
  689. }
  690. } else {
  691. for (let index = 0; index < group.advices.length; index++) {
  692. const adv = group.advices[index]
  693. if (adv.execution_state == 2) {
  694. adv.execution_staff = advice.execution_staff
  695. adv.execution_time = advice.execution_time
  696. adv.execution_state = advice.execution_state
  697. }
  698. }
  699. }
  700. }
  701. })
  702. .catch(err => {
  703. Toast.fail(err)
  704. return false
  705. })
  706. },
  707. handleTime (time) {
  708. var year = time.getFullYear()
  709. var month = time.getMonth() + 1
  710. var day = time.getDate()
  711. var hour = time.getHours()
  712. var minute = time.getMinutes()
  713. if (month < 10) {
  714. month = '0' + month
  715. }
  716. if (day < 10) {
  717. day = '0' + day
  718. }
  719. if (hour < 10) {
  720. hour = '0' + hour
  721. }
  722. if (minute < 10) {
  723. minute = '0' + minute
  724. }
  725. return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':00'
  726. }, deleteSubAdviceAction: function () {
  727. if (this.currentSubAdvices.length <= 0) {
  728. return
  729. }
  730. Dialog.confirm({
  731. title: '删除医嘱',
  732. message: '确认删除医嘱吗?'
  733. }).then(() => {
  734. Toast.loading({forbidClick: true, duration: 0})
  735. DeleteSubDoctorAdvice(this.currentSubAdvices[0].id)
  736. .then(rs => {
  737. if (rs.data.state == 1) {
  738. Toast.success('删除成功')
  739. var adviceArr = this.advice_groups[this.current_group_index].advices
  740. for (let i = adviceArr.length - 1; i >= 0; i--) {
  741. if (adviceArr[i].id == this.currentSubAdvices[0].id) {
  742. adviceArr.splice(i, 1)
  743. }
  744. }
  745. this.currentSubAdvices = []
  746. this.currentAdvices = []
  747. for (let i = 0; i < this.advice_groups.length; i++) {
  748. for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
  749. var advices = this.advice_groups[i].advices[y]
  750. advices.is_selected = 0
  751. }
  752. }
  753. } else {
  754. Toast.fail(rs.data.msg)
  755. }
  756. })
  757. .catch(err => {
  758. Toast.fail(err)
  759. })
  760. })
  761. },
  762. deleteAdviceAction: function () {
  763. if (this.current_select_object == 1) {
  764. if (this.currentAdvices.length <= 0) {
  765. return
  766. }
  767. Dialog.confirm({
  768. title: '删除医嘱',
  769. message: '确认删除医嘱吗?'
  770. }).then(() => {
  771. Toast.loading({forbidClick: true, duration: 0})
  772. var group_no = 0
  773. var advice_id = this.currentAdvices.join(',')
  774. var ids = []
  775. for (let i = 0; i < this.currentAdvices.length; i++) {
  776. ids.push(this.currentAdvices[i].id)
  777. }
  778. advice_id = ids.join(',')
  779. DeleteDoctorAdviceNew(group_no, advice_id)
  780. .then(rs => {
  781. if (rs.data.state == 1) {
  782. Toast.success('删除成功')
  783. var adviceArr = this.advice_groups[this.current_group_index].advices
  784. for (let y = ids.length - 1; y >= 0; y--) {
  785. for (let i = adviceArr.length - 1; i >= 0; i--) {
  786. if (adviceArr[i].id == ids[y] || adviceArr[i].parent_id == ids[y]) {
  787. adviceArr.splice(i, 1)
  788. }
  789. }
  790. }
  791. this.currentSubAdvices = []
  792. this.currentAdvices = []
  793. for (let i = 0; i < this.advice_groups.length; i++) {
  794. for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
  795. var advices = this.advice_groups[i].advices[y]
  796. advices.is_selected = 0
  797. }
  798. }
  799. } else {
  800. Toast.fail(rs.data.msg)
  801. }
  802. })
  803. .catch(err => {
  804. Toast.fail(err)
  805. })
  806. })
  807. } else {
  808. if (this.current_group_index < 0) {
  809. return
  810. }
  811. var group = this.advice_groups[this.current_group_index]
  812. Dialog.confirm({
  813. title: '删除医嘱',
  814. message: '确认删除这组医嘱吗?'
  815. }).then(() => {
  816. Toast.loading({forbidClick: true, duration: 0})
  817. var group_no = group.group_no <= 0 ? 0 : group.group_no
  818. var advice_id = 0
  819. if (group.group_no <= 0) {
  820. advice_id = group.advices[0].id
  821. } else if (this.current_advice != null) {
  822. group_no = 0
  823. advice_id = this.current_advice.id
  824. }
  825. DeleteDoctorAdviceNew(group_no, advice_id)
  826. .then(rs => {
  827. if (rs.data.state == 1) {
  828. Toast.success('删除成功')
  829. // if (group.group_no <= 0) {
  830. // this.advice_groups.splice(this.current_group_index, 1);
  831. // } else {
  832. if (this.current_advice_index >= 0) {
  833. // if (group.advices.length <= 1) {
  834. // this.advice_groups.splice(this.current_group_index, 1);
  835. // } else {
  836. var advice = group.advices[this.current_advice_index]
  837. if (advice.parent_id > 0) {
  838. group.advices.splice(this.current_advice_index, 1)
  839. } else {
  840. var child_count = 0
  841. for (
  842. let index = this.current_advice_index + 1;
  843. index < group.advices.length;
  844. index++
  845. ) {
  846. const adv = group.advices[index]
  847. if (adv.parent_id == advice.id) {
  848. child_count++
  849. }
  850. }
  851. group.advices.splice(
  852. this.current_advice_index,
  853. child_count + 1
  854. )
  855. }
  856. if (group.advices.length == 0) {
  857. this.advice_groups.splice(this.current_group_index, 1)
  858. }
  859. // }
  860. } else {
  861. this.advice_groups.splice(this.current_group_index, 1)
  862. }
  863. // }
  864. this.cancelAdviceSelect()
  865. } else {
  866. Toast.fail(rs.data.msg)
  867. }
  868. })
  869. .catch(err => {
  870. Toast.fail(err)
  871. })
  872. })
  873. }
  874. },
  875. checkAdvice () {
  876. if (this.$store.getters.user.user.user_type == 2 && !this.isPremission){
  877. return
  878. }
  879. if (this.currentAdvices.length <= 0) {
  880. return
  881. }
  882. if (this.current_select_object == 1) {
  883. var isCheck = true
  884. var adviceArr = this.advice_groups[this.current_group_index].advices
  885. for (let i = 0; i < adviceArr.length; i++) {
  886. if (adviceArr[i].check_state == 0 && adviceArr[i].is_selected == 1) {
  887. isCheck = false
  888. }
  889. }
  890. if (isCheck) {
  891. Toast.fail('所选医嘱已核对')
  892. return false
  893. }
  894. for (let i = 0; i < adviceArr.length; i++) {
  895. if (adviceArr[i].is_selected == 1 && adviceArr[i].execution_staff > 0 && adviceArr[i].execution_staff == this.$store.getters.user.user.id) {
  896. Toast.fail('核对与执行不能是同一人')
  897. return false
  898. }
  899. }
  900. var currentAdviceIdArr = []
  901. for (let i = 0; i < adviceArr.length; i++) {
  902. if (adviceArr[i].is_selected == 1) {
  903. currentAdviceIdArr.push(adviceArr[i].id)
  904. }
  905. }
  906. this.currentAdviceIdsStr = currentAdviceIdArr.join(',')
  907. } else {
  908. if (!(this.current_group_index >= 0 && this.current_advice_index < 0)) {
  909. return
  910. }
  911. var isCheck = true
  912. var group_top_advice = this.advice_groups[this.current_group_index]
  913. .advices[0]
  914. var adviceArr = this.advice_groups[this.current_group_index].advices
  915. var advice = null
  916. for (let i = 0; i < adviceArr.length; i++) {
  917. if (adviceArr[i].check_state == 0) {
  918. isCheck = false
  919. }
  920. }
  921. if (isCheck) {
  922. Toast.fail('所选医嘱已核对')
  923. return false
  924. }
  925. for (let i = 0; i < adviceArr.length; i++) {
  926. if (adviceArr[i].is_selected == 1 && adviceArr[i].execution_staff > 0 && adviceArr[i].execution_staff == this.$store.getters.user.user.id) {
  927. Toast.fail('核对与执行不能是同一人')
  928. return false
  929. }
  930. }
  931. // if (
  932. // group_top_advice.execution_staff > 0 &&
  933. // group_top_advice.execution_staff == this.$store.getters.user.user.id
  934. // ) {
  935. // Toast.fail('核对与执行不能是同一人')
  936. // return false
  937. // }
  938. }
  939. Dialog.confirm({
  940. title: '医嘱核对',
  941. message: '确认提交核对?'
  942. }).then(() => {
  943. var params = null
  944. Toast.loading({forbidClick: true, duration: 0})
  945. if (this.current_select_object == 1) {
  946. params = {
  947. groupno: 0,
  948. advice_id: this.currentAdviceIdsStr
  949. }
  950. } else {
  951. var group = this.advice_groups[this.current_group_index]
  952. params = {
  953. groupno: group.group_no <= 0 ? 0 : group.group_no,
  954. advice_id: group.group_no <= 0 ? group.advices[0].id : 0
  955. }
  956. }
  957. CheckDoctorAdvice(params)
  958. .then(response => {
  959. if (response.data.state == 0) {
  960. Toast.fail('你没有权限核对医嘱!')
  961. return false
  962. } else {
  963. Toast.success('核对成功!')
  964. var advice = response.data.data.advice
  965. if (this.current_select_object == 1) {
  966. var ids = this.currentAdviceIdsStr.split(',')
  967. var adviceArr = this.advice_groups[this.current_group_index].advices
  968. for (let i = 0; i < adviceArr.length; i++) {
  969. for (let a = 0; a < ids.length; a++) {
  970. if ((adviceArr[i].check_state == 0 && adviceArr[i].id == ids[a]) || (adviceArr[i].check_state == 0 && adviceArr[i].parent_id == ids[a])) {
  971. adviceArr[i].checker = advice.checker
  972. adviceArr[i].check_time = advice.check_time
  973. adviceArr[i].check_state = advice.check_state
  974. }
  975. }
  976. }
  977. } else {
  978. for (let index = 0; index < group.advices.length; index++) {
  979. const adv = group.advices[index]
  980. adv.checker = advice.checker
  981. adv.check_time = advice.check_time
  982. adv.check_state = advice.check_state
  983. }
  984. }
  985. }
  986. })
  987. .catch(err => {
  988. Toast.fail(err)
  989. })
  990. })
  991. // .catch(err => {
  992. // Toast.fail(err);
  993. // });
  994. },
  995. execAdvice () {
  996. if (this.$store.getters.user.user.user_type == 2 && !this.isPremission){
  997. return
  998. }
  999. if (this.currentAdvices.length <= 0) {
  1000. return
  1001. }
  1002. if (this.current_select_object == 1) {
  1003. var isExecution = true
  1004. var adviceArr = this.advice_groups[this.current_group_index].advices
  1005. for (let i = 0; i < adviceArr.length; i++) {
  1006. if (adviceArr[i].execution_state == 2 && adviceArr[i].is_selected == 1) {
  1007. isExecution = false
  1008. }
  1009. }
  1010. if (isExecution) {
  1011. Toast.fail('所选医嘱已停止或执行')
  1012. return false
  1013. }
  1014. for (let i = 0; i < adviceArr.length; i++) {
  1015. if (adviceArr[i].is_selected == 1 && adviceArr[i].checker > 0 && adviceArr[i].checker == this.$store.getters.user.user.id) {
  1016. Toast.fail('核对与执行不能是同一人')
  1017. return false
  1018. }
  1019. }
  1020. var currentAdviceIdArr = []
  1021. for (let i = 0; i < adviceArr.length; i++) {
  1022. if (adviceArr[i].is_selected == 1) {
  1023. currentAdviceIdArr.push(adviceArr[i].id)
  1024. }
  1025. }
  1026. this.currentAdviceIdsStr = currentAdviceIdArr.join(',')
  1027. this.nowExecTime = new Date(adviceArr[0].start_time * 1000)
  1028. } else {
  1029. if (!(this.current_group_index >= 0 && this.current_advice_index < 0)) {
  1030. return
  1031. }
  1032. var isExecution = true
  1033. var group_top_advice = this.advice_groups[this.current_group_index]
  1034. .advices[0]
  1035. var adviceArr = this.advice_groups[this.current_group_index].advices
  1036. for (let i = 0; i < adviceArr.length; i++) {
  1037. if (adviceArr[i].is_selected == 1 && adviceArr[i].execution_state == 2) {
  1038. isExecution = false
  1039. }
  1040. }
  1041. if (isExecution) {
  1042. Toast.fail('所选医嘱已停止或执行')
  1043. return false
  1044. }
  1045. for (let i = 0; i < adviceArr.length; i++) {
  1046. if (adviceArr[i].is_selected == 1 && adviceArr[i].checker > 0 && adviceArr[i].checker == this.$store.getters.user.user.id) {
  1047. Toast.fail('核对与执行不能是同一人')
  1048. return false
  1049. }
  1050. }
  1051. this.nowExecTime = new Date(group_top_advice.start_time * 1000)
  1052. }
  1053. this.$refs.exec_time.open()
  1054. },
  1055. openNewChild () {
  1056. if (this.$store.getters.user.user.user_type == 3) {
  1057. Toast.fail('你没有权限添加子药!')
  1058. return
  1059. }
  1060. if (this.current_advice == null){
  1061. return
  1062. }
  1063. if (this.currentAdvices.length == 0) {0
  1064. return false
  1065. }
  1066. this.current_advice = this.currentAdvices[0]
  1067. if (
  1068. this.current_advice.stop_state == 1 ||
  1069. this.current_advice.execution_state == 1 ||
  1070. this.current_advice.check_state == 1
  1071. ) {
  1072. Toast.fail('所选医嘱已停止或执行或核对')
  1073. return false
  1074. }
  1075. this.index = 2
  1076. var start_time = uParseTime(
  1077. this.current_advice.start_time,
  1078. '{y}-{m}-{d} {h}:{i}'
  1079. )
  1080. this.$refs.subdrug_form.showWithNewSubDrug(
  1081. this.current_advice.id,
  1082. this.record_date,
  1083. start_time,
  1084. this.current_advice.delivery_way,
  1085. this.current_advice.execution_frequency
  1086. )
  1087. return
  1088. },
  1089. openNewAdvice () {
  1090. if (this.$store.getters.user.user.user_type == 3) {
  1091. Toast.fail('你没有权限新增医嘱!')
  1092. return
  1093. }
  1094. this.currentAdvices = []
  1095. this.currentSubAdvices = []
  1096. for (let i = 0; i < this.advice_groups.length; i++) {
  1097. for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
  1098. var advices = this.advice_groups[i].advices[y]
  1099. advices.is_selected = 0
  1100. }
  1101. }
  1102. this.index = 1
  1103. this.current_group_index = -1
  1104. this.current_advice_index = -1
  1105. this.current_advice = null
  1106. }, modifySubdviceAction: function () {
  1107. if (this.currentSubAdvices.length <= 0) {
  1108. return
  1109. }
  1110. if (this.current_advice_index >= 0) {
  1111. this.index = 3
  1112. var advice = this.currentSubAdvices[0]
  1113. this.$refs.modify_advice_form.showWithModify({
  1114. id: advice.id,
  1115. parent_id: advice.parent_id,
  1116. title: advice.advice_name,
  1117. advice_desc: advice.advice_desc,
  1118. remark: advice.remark,
  1119. drug_spec: advice.drug_spec,
  1120. drug_spec_unit: advice.drug_spec_unit,
  1121. delivery_way: advice.delivery_way,
  1122. execution_frequency: advice.execution_frequency,
  1123. single_dose: advice.single_dose,
  1124. single_dose_unit: advice.single_dose_unit,
  1125. prescribing_number: advice.prescribing_number,
  1126. prescribing_number_unit: advice.prescribing_number_unit
  1127. })
  1128. }
  1129. },
  1130. modifyAdviceAction: function () {
  1131. if (this.currentAdvices.length != 1 || this.current_select_object == 2){
  1132. return
  1133. }
  1134. if (this.current_group_index < 0) {
  1135. return
  1136. }
  1137. var group = this.advice_groups[this.current_group_index]
  1138. if (this.current_advice_index >= 0) {
  1139. this.index = 3
  1140. var advice = this.currentAdvices[0]
  1141. this.$refs.modify_advice_form.showWithModify({
  1142. id: advice.id,
  1143. parent_id: advice.parent_id,
  1144. title: advice.advice_name,
  1145. advice_desc: advice.advice_desc,
  1146. remark: advice.remark,
  1147. start_time: advice.start_time,
  1148. drug_spec: advice.drug_spec,
  1149. drug_spec_unit: advice.drug_spec_unit,
  1150. delivery_way: advice.delivery_way,
  1151. execution_frequency: advice.execution_frequency,
  1152. single_dose: advice.single_dose,
  1153. single_dose_unit: advice.single_dose_unit,
  1154. prescribing_number: advice.prescribing_number,
  1155. prescribing_number_unit: advice.prescribing_number_unit
  1156. })
  1157. } else {
  1158. if (group.group_no <= 0) {
  1159. this.index = 3
  1160. var advice = group.advices[0]
  1161. this.$refs.modify_advice_form.showWithModify({
  1162. id: advice.id,
  1163. parent_id: advice.parent_id,
  1164. title: advice.advice_name,
  1165. advice_desc: advice.advice_desc,
  1166. remark: advice.remark,
  1167. drug_spec: advice.drug_spec,
  1168. drug_spec_unit: advice.drug_spec_unit,
  1169. delivery_way: advice.delivery_way,
  1170. execution_frequency: advice.execution_frequency,
  1171. single_dose: advice.single_dose,
  1172. single_dose_unit: advice.single_dose_unit,
  1173. prescribing_number: advice.prescribing_number,
  1174. prescribing_number_unit: advice.prescribing_number_unit
  1175. })
  1176. } else {
  1177. this.index = 4
  1178. this.$refs.modify_advice_group.show(group.group_no, group.advices)
  1179. }
  1180. }
  1181. },
  1182. cancelAdviceSelect: function () {
  1183. this.current_group_index = -1
  1184. this.current_advice_index = -1
  1185. this.current_advice = null
  1186. },
  1187. selectAdviceAction: function (group_index, advice_index, advice) {
  1188. console.log(this.current_group_index)
  1189. console.log(group_index)
  1190. console.log(advice.parent_id)
  1191. if ((this.current_group_index != -1 && this.current_group_index != group_index) || advice.parent_id > 0) { //选择其他组,将原来的组选择状态清除
  1192. this.currentAdvices = []
  1193. this.currentSubAdvices = []
  1194. for (let i = 0; i < this.advice_groups.length; i++) {
  1195. for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
  1196. var advices = this.advice_groups[i].advices[y]
  1197. advices.is_selected = 0
  1198. }
  1199. }
  1200. }
  1201. for (let i = 0; i < this.advice_groups.length; i++) { //选择子医嘱,将已经选择的医嘱选择状态清除
  1202. for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
  1203. var advices = this.advice_groups[i].advices[y]
  1204. if (advices.parent_id > 0) {
  1205. advices.is_selected = 0
  1206. }
  1207. }
  1208. }
  1209. for (let i = 0; i < this.advice_groups.length; i++) { //设置选择状态
  1210. for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
  1211. var advices = this.advice_groups[i].advices[y]
  1212. if (advices.id == advice.id) {
  1213. if (advice.is_selected == 1) {
  1214. advice.is_selected = 0
  1215. for (let a = this.currentAdvices.length - 1; a >= 0; a--) {
  1216. if (this.currentAdvices[a].id == advice.id) {
  1217. this.currentAdvices.splice(a, 1)
  1218. }
  1219. }
  1220. } else {
  1221. advice.is_selected = 1
  1222. if (advice.parent_id == 0) {
  1223. this.currentAdvices.push(advice)
  1224. }
  1225. }
  1226. }
  1227. }
  1228. }
  1229. if (advice.parent_id == 0) {
  1230. this.currentSubAdvices = []
  1231. } else {
  1232. this.currentSubAdvices.push(advice)
  1233. }
  1234. this.current_select_object = 1 //单条医嘱
  1235. this.current_group_index = group_index
  1236. this.current_advice_index = advice_index
  1237. this.current_advice = advice
  1238. }, selectGroupAdviceAction: function (group_index, advice_index, advice, group) {
  1239. if (this.current_group_index != -1 && this.current_group_index != group_index) { //选择其他组,将原来的组选择状态清除
  1240. this.currentAdvices = []
  1241. this.currentSubAdvices = []
  1242. for (let i = 0; i < this.advice_groups.length; i++) {
  1243. for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
  1244. var advices = this.advice_groups[i].advices[y]
  1245. advices.is_selected = 0
  1246. }
  1247. }
  1248. }
  1249. for (let i = 0; i < this.advice_groups.length; i++) { //选择子医嘱,将已经选择的医嘱选择状态清除
  1250. for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
  1251. var advices = this.advice_groups[i].advices[y]
  1252. if (advices.parent_id > 0) {
  1253. advices.is_selected = 0
  1254. }
  1255. }
  1256. }
  1257. this.currentAdvices = []
  1258. for (let i = 0; i < this.advice_groups.length; i++) {
  1259. for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
  1260. var advices = this.advice_groups[i].advices[y]
  1261. if (advices.groupno == group.group_no) {
  1262. advices.is_selected = 1
  1263. this.currentAdvices.push(advices)
  1264. }
  1265. }
  1266. }
  1267. this.current_select_object = 2 //单组医嘱
  1268. this.current_group_index = group_index
  1269. this.current_advice_index = advice_index
  1270. this.current_advice = advice
  1271. }
  1272. }
  1273. }
  1274. </script>
  1275. <style style="stylesheet/scss" lang="scss" scoped>
  1276. #dialogTop{
  1277. @media only screen and (max-width: 415px){
  1278. height: 13.8rem !important;
  1279. }
  1280. }
  1281. .DialogContent {
  1282. .content {
  1283. .yzNav {
  1284. position: fixed;
  1285. top: 0.16rem;
  1286. }
  1287. }
  1288. }
  1289. .orderTable{
  1290. width: 100%;
  1291. }
  1292. .table {
  1293. width: 1200px;
  1294. @media only screen and (max-width: 415px) {
  1295. width: 850px;
  1296. }
  1297. @media only screen and (min-width: 415px) and (max-width: 767px) {
  1298. width: 1000px;
  1299. }
  1300. tr {
  1301. th {
  1302. background: $main-color;
  1303. color: #fff;
  1304. height: 1.2rem;
  1305. line-height: 1.2rem;
  1306. }
  1307. td {
  1308. line-height: 0.6rem;
  1309. .txt {
  1310. // float: left;
  1311. padding: 0 10px 0 10px;
  1312. // width: 75%;
  1313. text-align: left;
  1314. }
  1315. .ico {
  1316. float: right;
  1317. width: 60px;
  1318. text-align: right;
  1319. padding-right: 3px;
  1320. }
  1321. .iconfont {
  1322. font-size: 20px;
  1323. padding: 0 2px;
  1324. color: #7b8a97;
  1325. }
  1326. .handle {
  1327. color: #409eff;
  1328. // padding: 0 7px;
  1329. }
  1330. }
  1331. .advice_content {
  1332. // background: #eff6fc;
  1333. }
  1334. .subadvice_content {
  1335. // background: #fafcfe;
  1336. padding-left: 20px;
  1337. }
  1338. .td-active {
  1339. background: #badcff !important;
  1340. }
  1341. }
  1342. .row-class-active {
  1343. td {
  1344. background: #badcff;
  1345. }
  1346. }
  1347. }
  1348. .content {
  1349. .cell {
  1350. float: left;
  1351. width: 3.42rem;
  1352. margin: 0.35rem 0.3rem 0 0.4rem;
  1353. label {
  1354. display: block;
  1355. height: 0.55rem;
  1356. line-height: 0.55rem;
  1357. color: $pgh-color;
  1358. }
  1359. select {
  1360. width: 100%;
  1361. padding: 0.2rem 0;
  1362. border: 1px $border-color solid;
  1363. border-radius: 2px;
  1364. padding-left: 5px;
  1365. }
  1366. .inputBox {
  1367. border: 1px $border-color solid;
  1368. border-radius: 2px;
  1369. padding: 0.18rem 0;
  1370. padding-left: 5px;
  1371. }
  1372. .textarea {
  1373. width: 100%;
  1374. height: 1.22rem;
  1375. border: 1px $border-color solid;
  1376. border-radius: 2px;
  1377. padding-left: 5px;
  1378. }
  1379. }
  1380. .width {
  1381. width: 90%;
  1382. @include box-sizing;
  1383. margin-top: 1rem;
  1384. label {
  1385. display: inline-block;
  1386. }
  1387. button {
  1388. background: $main-color;
  1389. color: #fff;
  1390. border-radius: 6px;
  1391. width: 3rem;
  1392. height: 0.9rem;
  1393. line-height: 0.9rem;
  1394. text-align: center;
  1395. margin: 0 0.1rem 0.6rem 0.1rem;
  1396. border: 1px $main-color solid;
  1397. &.smt-danger {
  1398. background: #fff;
  1399. color: $main-color;
  1400. }
  1401. }
  1402. }
  1403. .center {
  1404. text-align: center;
  1405. }
  1406. }
  1407. .yzNav {
  1408. display: flex;
  1409. flex-wrap: wrap;
  1410. span {
  1411. width: 15%;
  1412. @media only screen and (max-width: 415px) {
  1413. padding: 0;
  1414. }
  1415. // @media only screen and (min-width: 666px) and (max-width: 737px) {
  1416. // width: 16% !important;
  1417. // }
  1418. }
  1419. }
  1420. #fontSize{
  1421. font-size: 0.34rem;
  1422. }
  1423. </style>