DoctorAdviceDialog.vue 51KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426
  1. <template>
  2. <div class="doctor-advice-box">
  3. <el-dialog
  4. :title="title"
  5. :visible.sync="isVisibility"
  6. width="1010px"
  7. @close="resetDialog"
  8. :modal-append-to-body="false"
  9. >
  10. <div class="txsj" v-show="showAdvicePanel">
  11. <el-button round @click="openGroupFrom" :loading="deleLoading"
  12. >
  13. 新增医嘱
  14. </el-button>
  15. <el-button round @click="openGroupFrom" :loading="deleLoading"
  16. disabled>新增医嘱
  17. </el-button>
  18. <el-button v-if="currentRow != null" round
  19. @click="execAdvice" :loading="deleLoading">执行医嘱
  20. </el-button>
  21. <el-button v-else disabled round @click="execAdvice" :loading="deleLoading">执行医嘱</el-button>
  22. <el-button v-if="currentRow != null" round
  23. @click="checkAdvice" :loading="deleLoading">医嘱核对
  24. </el-button>
  25. <el-button v-else disabled round @click="checkAdvice" :loading="deleLoading">医嘱核对</el-button>
  26. <el-button
  27. v-if="groupSelectRow != null"
  28. round @click="openEditGroupAdvice" :loading="deleLoading">修改医嘱
  29. </el-button>
  30. <el-button v-else disabled round @click="openEditGroupAdvice" :loading="deleLoading">修改医嘱</el-button>
  31. <el-button
  32. v-if="groupSelectRow != null"
  33. round @click="openDeleteGroupAdvice" :loading="deleLoading">删除医嘱
  34. </el-button>
  35. <el-button v-else disabled round @click="openDeleteGroupAdvice" :loading="deleLoading">删除医嘱</el-button>
  36. <!--<el-button round @click="openNewChild" :loading="deleLoading">新增子药</el-button>-->
  37. </div>
  38. <!-- 医嘱列表 -->
  39. <!--&lt;!&ndash;:header-cell-style="{ backgroundColor: 'rgb(64, 158, 255)', color: 'white'}"&ndash;&gt;@current-change="selectRow"-->
  40. <el-table :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)'}" :data="doctor_advices" border
  41. style="width: 100%" v-show="showAdvicePanel"
  42. ref="advices_list" :row-class-name="tableRowClassName" :span-method="mergeSpan"
  43. @row-click="cellMouseEnter" :cell-class-name="adviceNameShow" :modal-append-to-body="false"
  44. >
  45. <el-table-column prop="date" label="开嘱医生" align="center" min-width="26px">
  46. <template slot-scope="scope">
  47. <span v-if="isShowStartTime(scope.$index, scope.row)">{{getXuserName(scope.row.advice_doctor)}}</span>
  48. </template>
  49. </el-table-column>
  50. <el-table-column prop="start_time" label="开始时间" align="center" min-width="35px">
  51. <template slot-scope="scope">
  52. <span v-if="isShowStartTime(scope.$index, scope.row)">{{scope.row.start_time | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
  53. </template>
  54. </el-table-column>
  55. <el-table-column prop="advice_name" min-width="50px" label="医嘱内容" align="center"
  56. >
  57. <template slot-scope="scope">
  58. <el-dropdown trigger="click" v-if="scope.row.parent_id == 0 ">
  59. <span class="el-dropdown-link">{{getAdviceContent(scope.row,1)}}<i
  60. class="el-icon-arrow-down el-icon--right"></i></span>
  61. <el-dropdown-menu slot="dropdown">
  62. <el-dropdown-item @click.native="openEdit(scope.$index, scope.row)">修改医嘱</el-dropdown-item>
  63. <el-dropdown-item @click.native="openDelete(scope.$index, scope.row)">删除医嘱</el-dropdown-item>
  64. <el-dropdown-item @click.native="openNewChildTwo(scope.$index, scope.row)">新增子药</el-dropdown-item>
  65. </el-dropdown-menu>
  66. </el-dropdown>
  67. <el-dropdown trigger="click" v-if="scope.row.parent_id > 0 ">
  68. <span class="el-dropdown-link">&emsp;{{getAdviceContent(scope.row,2)}}<i
  69. class="el-icon-arrow-down el-icon--right"></i></span>
  70. <el-dropdown-menu slot="dropdown">
  71. <el-dropdown-item
  72. @click.native="openEdit(scope.$index, scope.row)">修改子药
  73. </el-dropdown-item>
  74. <el-dropdown-item
  75. @click.native="openDelete(scope.$index, scope.row)">删除子药
  76. </el-dropdown-item>
  77. </el-dropdown-menu>
  78. </el-dropdown>
  79. </template>
  80. </el-table-column>
  81. <!--<el-table-column prop="advice_name" min-width="50px" label="医嘱内容" align="center"-->
  82. <!--v-else>-->
  83. <!--<template slot-scope="scope">-->
  84. <!--<span v-if="scope.row.parent_id == 0 " class="el-dropdown-link">{{getAdviceContent(scope.row,1)}}</span>-->
  85. <!--<span v-if="scope.row.parent_id > 0 "-->
  86. <!--class="el-dropdown-link">&emsp;{{getAdviceContent(scope.row,2)}}</span>-->
  87. <!--</template>-->
  88. <!--</el-table-column>-->
  89. <el-table-column prop="execution_time" align="center" min-width="30px" label="执行时间">
  90. <template slot-scope="scope">
  91. <span v-if="scope.row.execution_time!=0">{{scope.row.start_time | parseTime('{m}-{d} {h}:{i}')}}</span>
  92. <span v-else></span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column prop="execution_staff" align="center" min-width="30px" label="执行护士">
  96. <template slot-scope="scope">
  97. <span v-if="scope.row.parent_id==0">{{getXuserName(scope.row.execution_staff)}}</span>
  98. <span v-else></span>
  99. </template>
  100. </el-table-column>
  101. <el-table-column v-if="template_id != 6" prop="checker" min-width="30px" align="center" label="核对人员">
  102. <template slot-scope="scope">
  103. <span v-if="scope.row.parent_id==0">{{getXuserName(scope.row.checker)}}</span>
  104. <span v-else></span>
  105. </template>
  106. </el-table-column>
  107. </el-table>
  108. <!-- 医嘱列表 end -->
  109. <!-- 医嘱表单 -->
  110. <el-form ref="form" :model="form" label-width="100px" v-show="showAdviceForm">
  111. <el-row :gutter="20">
  112. <!--<el-col :span="8">-->
  113. <!--<el-form-item label="医嘱类型:">-->
  114. <!--<el-input value="临时" disabled></el-input>-->
  115. <!--</el-form-item>-->
  116. <!--</el-col>-->
  117. <!--<el-col :span="8">-->
  118. <!--<el-form-item label="医嘱时间:">-->
  119. <!--<el-input v-model="form.advice_date" readonly></el-input>-->
  120. <!--&lt;!&ndash; <el-date-picker type="date" placeholder="选择日期" v-model="form.date1" style="width: 100%;"></el-date-picker> &ndash;&gt;-->
  121. <!--</el-form-item>-->
  122. <!--</el-col>-->
  123. <el-col :span="8">
  124. <el-form-item label="开始时间:">
  125. <el-date-picker format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm" type="datetime" :disabled="form.parent_id==0?false:true"
  126. placeholder="选择日期" v-model="form.start_time" style="width: 100%;"></el-date-picker>
  127. </el-form-item>
  128. </el-col>
  129. <el-col :span="8">
  130. <el-form-item label="医嘱名称:">
  131. <el-input v-model="form.advice_name"></el-input>
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="8">
  135. <el-form-item label="药品规格:">
  136. <el-input v-model="form.advice_desc" style="width: 40%;"></el-input>
  137. <el-select v-model="form.drug_spec_unit" style="width: 56%;" filterable placeholder="选择">
  138. <el-option v-for="item in unitsOption" :key="item.id" :label="item.name " :value="item.name">
  139. </el-option>
  140. </el-select>
  141. </el-form-item>
  142. </el-col>
  143. </el-row>
  144. <el-row :gutter="20">
  145. <el-col :span="8">
  146. <el-form-item label="开药数量:">
  147. <el-input v-model="form.prescribing_number" style="width: 40%;"></el-input>
  148. <el-select v-model="form.prescribing_number_unit" style="width: 56%;" filterable placeholder="选择">
  149. <el-option v-for="item in unitsOption" :key="item.id" :label="item.name " :value="item.name">
  150. </el-option>
  151. </el-select>
  152. <!-- <el-input v-model="form.prescribing_number_unit" style="width: 40%;"></el-input> -->
  153. </el-form-item>
  154. </el-col>
  155. <el-col :span="8">
  156. <el-form-item label="单次用量:">
  157. <el-input v-model="form.single_dose" style="width: 40%;"></el-input>
  158. <el-select v-model="form.single_dose_unit" style="width: 56%;" filterable placeholder="选择">
  159. <el-option v-for="item in unitsOption" :key="item.id" :label="item.name " :value="item.name">
  160. </el-option>
  161. </el-select>
  162. <!-- <el-input v-model="form.single_dose_unit" style="width: 40%;"></el-input> -->
  163. </el-form-item>
  164. </el-col>
  165. <el-col :span="8">
  166. <el-form-item label="给药途径:">
  167. <el-select v-model="form.delivery_way" :disabled="form.parent_id==0?false:true" filterable
  168. placeholder="请选择(输入可搜索)">
  169. <el-option v-for="item in deliveryWayOptions" :key="item.id" :label="item.name " :value="item.name">
  170. </el-option>
  171. </el-select>
  172. </el-form-item>
  173. </el-col>
  174. </el-row>
  175. <el-row :gutter="20">
  176. <el-col :span="8">
  177. <el-form-item label="执行频率:">
  178. <el-select v-model="form.execution_frequency" :disabled="form.parent_id==0?false:true" filterable
  179. placeholder="请选择(输入可搜索)">
  180. <el-option v-for="item in executionFrequencyOptions" :key="item.id" :label="item.name "
  181. :value="item.name">
  182. </el-option>
  183. </el-select>
  184. </el-form-item>
  185. </el-col>
  186. </el-row>
  187. </el-form>
  188. <div slot="footer" class="dialog-footer" v-show="showAdviceForm">
  189. <el-button @click="hideForm">取 消</el-button>
  190. <el-button type="primary" v-if="form.id==0" @click="submitAdvice" :loading="loading">保 存</el-button>
  191. <el-button type="primary" v-else @click="submitEditAdvice" :loading="loading">保 存</el-button>
  192. </div>
  193. <!-- 医嘱表单 end -->
  194. </el-dialog>
  195. <el-dialog
  196. title="选择执行时间"
  197. :visible.sync="execTimeDialogVisible"
  198. width="400px"
  199. @close="closeTimePanel"
  200. :show-close="isClose"
  201. :close-on-click-modal="isClose"
  202. :close-on-press-escape="isClose"
  203. :modal-append-to-body="false"
  204. >
  205. <el-date-picker
  206. v-model="execTime"
  207. format="yyyy-MM-dd HH:mm:00"
  208. value-format="yyyy-MM-dd HH:mm:00"
  209. type="datetime"
  210. placeholder="选择执行时间"
  211. style="width:100%"
  212. >
  213. </el-date-picker>
  214. <span slot="footer" class="dialog-footer">
  215. <el-button @click="closeTimePanel" :loading="exceLoading">取 消</el-button>
  216. <el-button type="primary" @click="submitExce" :loading="exceLoading">保 存</el-button>
  217. </span>
  218. </el-dialog>
  219. <add-group-advice :adviceTemplates="adviceTemplates" :executionFrequencyOptions="executionFrequencyOptions"
  220. :unitsOption="unitsOption" :deliveryWayOptions="deliveryWayOptions"
  221. :adviceTemplateMaps="adviceTemplateMaps" :patientID="patient.id" :adviceTableData="doctor_advices"
  222. :recordDate="record_date" ref="addGroupForm"></add-group-advice>
  223. <edit-group-advice :adviceTemplates="adviceTemplates" :executionFrequencyOptions="executionFrequencyOptions"
  224. :unitsOption="unitsOption" :deliveryWayOptions="deliveryWayOptions"
  225. :adviceTemplateMaps="adviceTemplateMaps" :patientID="patient.id"
  226. :adviceTableData="doctor_advices" :recordDate="record_date"
  227. ref="editGroupForm" v-on:add-new-order="addNewOrder"
  228. :admin_users="admin_users"></edit-group-advice>
  229. </div>
  230. </template>
  231. <script>
  232. import AddGroupAdvice from './adviceDialog/AddGroupAdvice'
  233. import EditGroupAdvice from './adviceDialog/EditGroupAdvice'
  234. import { uParseTime } from '@/utils/tools'
  235. import {
  236. CheckDoctorAdvice,
  237. CreateDoctorAdvice,
  238. DeleteDoctorAdvice,
  239. DeleteGroupAdvice,
  240. EditDoctorAdvice,
  241. ExecDoctorAdvice,
  242. getAdviceConfig
  243. } from '@/api/advice'
  244. import { getDataConfig } from '@/utils/data'
  245. export default {
  246. name: 'DoctorAdviceDialog',
  247. props: {
  248. dialysis_order: {
  249. // 透析记录
  250. type: Object,
  251. default: () => {
  252. return { id: 0 }
  253. }
  254. },
  255. patient: {
  256. // 患者信息
  257. type: Object,
  258. default: () => {
  259. return { id: 0 }
  260. }
  261. },
  262. doctor_advices: {
  263. type: Array
  264. },
  265. admin_users: { // 系统用户列表
  266. type: Array,
  267. default: () => {
  268. return []
  269. }
  270. }
  271. },
  272. data() {
  273. return {
  274. tempArr: [],
  275. execTimeDialogVisible: false,
  276. currentBoxClass: 'current-box-class',
  277. isClose: false,
  278. isShow: false,
  279. loading: false,
  280. sameRowArr: [],
  281. hoverOrderArr: [],
  282. isVisibility: false,
  283. record_date: '',
  284. template_id: 0,
  285. deleLoading: false,
  286. exceLoading: false,
  287. execTime: '',
  288. current_group_index: -1,
  289. title: '临时医嘱',
  290. showAdviceForm: false,
  291. showAdvicePanel: true,
  292. showNameForm: false,
  293. showGroupForm: false,
  294. showTemplateForm: false,
  295. current_template_id: -1,
  296. adviceTemplates: [],
  297. adviceTemplateMaps: {},
  298. deliveryWayOptions: [],
  299. executionFrequencyOptions: [],
  300. unitsOption: [],
  301. // admin_users: [],
  302. templateRules: {
  303. id: [{ required: true, message: '请选择医嘱模板' }]
  304. },
  305. nameRules: {
  306. advice_name: [{ required: true, message: '请填写医嘱内容' }]
  307. },
  308. form: {
  309. id: 0,
  310. advice_type: 2,
  311. advice_date: '',
  312. start_time: '',
  313. advice_name: '',
  314. advice_desc: '',
  315. single_dose: '',
  316. single_dose_unit: '',
  317. prescribing_number: '',
  318. prescribing_number_unit: '',
  319. delivery_way: '',
  320. execution_frequency: '',
  321. advice_doctor: '',
  322. remark: '',
  323. parent_id: 0
  324. },
  325. nameForm: {
  326. advice_name: '',
  327. single_dose: '',
  328. single_dose_unit: '',
  329. drug_spec: '',
  330. drug_spec_unit: '',
  331. prescribing_number: '',
  332. prescribing_number_unit: '',
  333. delivery_way: '',
  334. execution_frequency: '',
  335. isEdit: 0,
  336. index: 0
  337. },
  338. groupForm: {
  339. advice_type: 2,
  340. advice_date: '',
  341. start_time: '',
  342. adviceNames: [],
  343. advice_doctor: '',
  344. remark: '',
  345. parent_id: 0
  346. },
  347. adviceList: [],
  348. currentIndex: -1,
  349. currentRow: null,
  350. groupSelectRow: null,
  351. templateForm: { id: '' }
  352. }
  353. },
  354. watch: {
  355. 'assessment_after_dislysis.id': function() {
  356. if (this.assessment_after_dislysis.id > 0) {
  357. for (var index in this.form) {
  358. this.form[index] = this.assessment_after_dislysis[index]
  359. }
  360. }
  361. },
  362. 'dialysis_order.id': function() {
  363. this.form['dialysis_order_id'] = this.dialysis_order.id
  364. },
  365. 'doctor_advices': function() {
  366. this.handleSpanTempArr()
  367. this.hoverOrderArr = []
  368. this.handleStyle()
  369. }
  370. },
  371. methods: {
  372. // isPermission () {
  373. // if(this.$store.getters.xt_user.user.user_type == 3 ) {
  374. // return false
  375. // } else {
  376. // return true
  377. // }
  378. // },
  379. adviceNameShow({ row, column, rowIndex, columnIndex }) {
  380. if (columnIndex == 2) {
  381. return 'dialysisadvicenamedisplay'
  382. } else {
  383. return ''
  384. }
  385. },
  386. submitEditAdvice() {
  387. if (this.form.advice_name.length == 0) {
  388. this.$message.error('请填写医嘱名称')
  389. return
  390. }
  391. if (this.form.start_time.length == 0) {
  392. this.$message.error('请选择开始时间')
  393. return
  394. }
  395. if (!(this.patient.id > 0)) {
  396. this.$message.error('没有选择患者')
  397. return false
  398. }
  399. console.log(this.form)
  400. let mode = "2"
  401. if(this.form.advice_doctor != this.$store.getters.xt_user.user.id){
  402. mode = "3"
  403. }
  404. EditDoctorAdvice(this.patient.id, this.form.id, this.form,mode).then(response => {
  405. if (response.data.state == 0) {
  406. this.$message.error(response.data.msg)
  407. return false
  408. } else {
  409. this.$notify({
  410. title: '成功',
  411. message: '修改医嘱成功',
  412. type: 'success',
  413. duration: 2000
  414. })
  415. this.showAdviceForm = false
  416. this.showAdvicePanel = true
  417. var advice = response.data.data.advice
  418. this.doctor_advices[this.currentIndex].drug_spec = advice.drug_spec
  419. this.doctor_advices[this.currentIndex].drug_spec_unit = advice.drug_spec_unit
  420. this.doctor_advices[this.currentIndex].start_time = advice.start_time
  421. this.doctor_advices[this.currentIndex].advice_name = advice.advice_name
  422. this.doctor_advices[this.currentIndex].advice_desc = advice.advice_desc
  423. this.doctor_advices[this.currentIndex].single_dose = advice.single_dose
  424. this.doctor_advices[this.currentIndex].single_dose_unit = advice.single_dose_unit
  425. this.doctor_advices[this.currentIndex].delivery_way = advice.delivery_way
  426. this.doctor_advices[this.currentIndex].execution_frequency = advice.execution_frequency
  427. this.doctor_advices[this.currentIndex].prescribing_number = advice.prescribing_number
  428. this.doctor_advices[this.currentIndex].prescribing_number_unit = advice.prescribing_number_unit
  429. this.doctor_advices[this.currentIndex].advice_doctor = advice.advice_doctor
  430. this.doctor_advices[this.currentIndex].remark = advice.remark
  431. this.currentIndex = -1
  432. return false
  433. }
  434. })
  435. },
  436. // submitGroupAdvice() {
  437. // if (this.groupForm.start_time.length == 0) {
  438. // this.$message.error('请选择开始时间')
  439. // return
  440. // }
  441. // CreateGroupAdvice(this.patient.id, this.groupForm).then(response => {
  442. // if (response.data.state == 0) {
  443. // this.$message.error(response.data.msg)
  444. // return false
  445. // } else {
  446. // this.$notify({
  447. // title: '成功',
  448. // message: '新增成功',
  449. // type: 'success',
  450. // duration: 2000
  451. // })
  452. // this.currentIndex = -1
  453. // this.currentRow = null
  454. // this.setCurrent()
  455. // this.hideGroupForm()
  456. // for (const index in response.data.data.advices) {
  457. // this.doctor_advices.unshift(response.data.data.advices[index])
  458. // }
  459. // this.groupForm = {
  460. // advice_type: 2,
  461. // advice_date: '',
  462. // start_time: '',
  463. // adviceNames: [],
  464. // advice_doctor: '',
  465. // remark: '',
  466. // parent_id: 0
  467. // }
  468. // return false
  469. // }
  470. // })
  471. // },
  472. // submitTempForm() {
  473. // var _this = this
  474. // if (this.templateForm.id.length == 0) {
  475. // this.$message.error('请选择医嘱模板')
  476. // return
  477. // }
  478. // if (_this.templateForm.id in _this.adviceTemplateMaps) {
  479. // var mapid = _this.templateForm.id
  480. // for (const index in _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate) {
  481. // var item = {
  482. // advice_name: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_name,
  483. // single_dose: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose,
  484. // single_dose_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose_unit,
  485. // drug_spec: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
  486. // drug_spec_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
  487. // prescribing_number: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number,
  488. // prescribing_number_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number_unit,
  489. // delivery_way: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].delivery_way,
  490. // execution_frequency: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
  491. // isEdit: 0,
  492. // index: 0
  493. // }
  494. // _this.groupForm.adviceNames.push(item)
  495. // }
  496. // }
  497. // this.title = '新增医嘱'
  498. // this.showTemplateForm = false
  499. // this.showGroupForm = true
  500. // },
  501. openAdviceTemplate() {
  502. this.templateForm = { id: '' }
  503. this.title = '选择医嘱模板'
  504. this.showTemplateForm = true
  505. this.showGroupForm = false
  506. },
  507. submitNameForm() {
  508. if (this.nameForm.advice_name.length == 0) {
  509. this.$message.error('请填写医嘱名称')
  510. return
  511. }
  512. if (this.nameForm.isEdit) {
  513. this.groupForm.adviceNames[this.nameForm.index].advice_name = this.nameForm.advice_name
  514. this.groupForm.adviceNames[this.nameForm.index].single_dose = this.nameForm.single_dose
  515. this.groupForm.adviceNames[this.nameForm.index].single_dose_unit = this.nameForm.single_dose_unit
  516. this.groupForm.adviceNames[this.nameForm.index].drug_spec = this.nameForm.drug_spec
  517. this.groupForm.adviceNames[this.nameForm.index].drug_spec_unit = this.nameForm.drug_spec_unit
  518. this.groupForm.adviceNames[this.nameForm.index].prescribing_number = this.nameForm.prescribing_number
  519. this.groupForm.adviceNames[this.nameForm.index].prescribing_number_unit = this.nameForm.prescribing_number_unit
  520. this.groupForm.adviceNames[this.nameForm.index].delivery_way = this.nameForm.delivery_way
  521. this.groupForm.adviceNames[this.nameForm.index].execution_frequency = this.nameForm.execution_frequency
  522. } else {
  523. this.groupForm.adviceNames.push(this.nameForm)
  524. }
  525. this.title = '新增医嘱'
  526. this.showNameForm = false
  527. this.showGroupForm = true
  528. },
  529. groupClassName({ row, rowIndex }) {
  530. row.index = rowIndex
  531. },
  532. selectGroupAdvice(row) {
  533. this.groupSelectRow = row
  534. },
  535. openDeleteGroupAdvice() {
  536. if (this.groupSelectRow === null) {
  537. this.$message.error('未选择要删除的医嘱内容')
  538. return
  539. }
  540. this.DeleteGroupAdvice(this.groupSelectRow.groupno)
  541. // this.$confirm('确认删除些条医嘱内容?', '删除医嘱内容', {
  542. // confirmButtonText: '确定',
  543. // cancelButtonText: '取消',
  544. // type: 'warning'
  545. // }).then(() => {
  546. // this.groupForm.adviceNames.splice(this.groupSelectRow.index, 1);
  547. // }).catch(() => {
  548. // });
  549. },
  550. openAdviceName(isEdit) {
  551. if (isEdit) {
  552. if (this.groupSelectRow === null) {
  553. this.$message.error('未选择要修改的医嘱内容')
  554. return
  555. }
  556. this.nameForm = {
  557. advice_name: this.groupSelectRow.advice_name,
  558. single_dose: this.groupSelectRow.single_dose,
  559. single_dose_unit: this.groupSelectRow.single_dose_unit,
  560. drug_spec: this.groupSelectRow.drug_spec,
  561. drug_spec_unit: this.groupSelectRow.drug_spec_unit,
  562. prescribing_number: this.groupSelectRow.prescribing_number,
  563. prescribing_number_unit: this.groupSelectRow.prescribing_number_unit,
  564. delivery_way: this.groupSelectRow.delivery_way,
  565. execution_frequency: this.groupSelectRow.execution_frequency,
  566. isEdit: 1,
  567. index: this.groupSelectRow.index
  568. }
  569. } else {
  570. this.nameForm = {
  571. advice_name: '',
  572. single_dose: '',
  573. single_dose_unit: '',
  574. drug_spec: '',
  575. drug_spec_unit: '',
  576. prescribing_number: '',
  577. prescribing_number_unit: '',
  578. delivery_way: '',
  579. execution_frequency: '',
  580. isEdit: 0,
  581. index: 0
  582. }
  583. }
  584. this.title = '新增医嘱内容'
  585. this.showNameForm = true
  586. this.showGroupForm = false
  587. },
  588. tableRowClassName({ row, rowIndex }) {
  589. // if (row.stop_state == 1 || row.execution_state == 1) {
  590. // return 'stoped-row';
  591. // }
  592. // return 'success-rows'
  593. row.index = rowIndex
  594. const arr = this.hoverOrderArr
  595. for (let i = 0; i < arr.length; i++) {
  596. if (rowIndex == arr[i]) {
  597. return 'success-row'
  598. }
  599. }
  600. },
  601. changeAdviceName(key) {
  602. if (key in this.adviceTemplateMaps) {
  603. this.form.advice_name = this.adviceTemplateMaps[key].advice_name
  604. this.form.advice_desc = this.adviceTemplateMaps[key].advice_desc
  605. this.form.single_dose_unit = this.adviceTemplateMaps[key].single_dose_unit
  606. this.form.single_dose = this.adviceTemplateMaps[key].single_dose + ''
  607. this.form.prescribing_number_unit = this.adviceTemplateMaps[key].prescribing_number_unit
  608. this.form.prescribing_number = this.adviceTemplateMaps[key].prescribing_number + ''
  609. this.form.delivery_way = this.adviceTemplateMaps[key].delivery_way
  610. this.form.execution_frequency = this.adviceTemplateMaps[key].execution_frequency
  611. }
  612. },
  613. submitExce() {
  614. if (this.currentRow == null) {
  615. this.$message.error('请先选择要执行的医嘱!')
  616. return false
  617. }
  618. if (this.execTime.length == 0) {
  619. this.$message.error('请选择执行时间!')
  620. return false
  621. }
  622. var execTime = Math.round(new Date(this.execTime).getTime() / 1000)
  623. if (execTime < this.currentRow.start_time) {
  624. this.$message.error('执行医嘱不能在开始之前!')
  625. return false
  626. }
  627. this.exceLoading = true
  628. let mode = "6"
  629. ExecDoctorAdvice(this.patient.id, this.currentRow.id, this.execTime,mode).then(response => {
  630. if (response.data.state == 0) {
  631. this.$message.error(response.data.msg)
  632. this.exceLoading = false
  633. return false
  634. } else {
  635. this.$notify({
  636. title: '成功',
  637. message: '执行医嘱成功',
  638. type: 'success',
  639. duration: 2000
  640. })
  641. var exid = response.data.data.advice.id
  642. if (response.data.data.advice.parent_id > 0) {
  643. exid = response.data.data.advice.parent_id
  644. }
  645. // if (this.currentRow.parent_id > 0) {
  646. // exid = this.currentRow.parent_id;
  647. // }
  648. this.currentRow.execution_state = 1
  649. this.currentRow.execution_staff = response.data.data.advice.execution_staff
  650. this.currentRow.execution_time = response.data.data.advice.execution_time
  651. var alen = this.doctor_advices.length
  652. for (var index in this.doctor_advices) {
  653. if (this.doctor_advices[index].id == exid || this.doctor_advices[index].parent_id == exid) {
  654. this.doctor_advices[index].execution_state = 1
  655. this.doctor_advices[index].execution_staff = response.data.data.advice.execution_staff
  656. this.doctor_advices[index].execution_time = response.data.data.advice.execution_time
  657. // this.doctor_advices[index].checker = response.data.data.advice.checker;
  658. break
  659. }
  660. }
  661. this.execTimeDialogVisible = false
  662. return false
  663. }
  664. }).catch(() => {
  665. this.exceLoading = false
  666. })
  667. },
  668. submitAdvice() {
  669. if (this.form.advice_name.length == 0) {
  670. this.$message.error('请填写医嘱名称')
  671. return
  672. }
  673. if (this.form.start_time.length == 0) {
  674. this.$message.error('请选择开始时间')
  675. return
  676. }
  677. if (!(this.patient.id > 0)) {
  678. this.$message.error('没有选择患者')
  679. return false
  680. }
  681. let mode ="1"
  682. CreateDoctorAdvice(this.patient.id, this.form,mode).then(response => {
  683. this.loading = false
  684. if (response.data.state == 0) {
  685. this.$message.error(response.data.msg)
  686. return false
  687. } else {
  688. this.$notify({
  689. title: '成功',
  690. message: '新增医嘱成功',
  691. type: 'success',
  692. duration: 2000
  693. })
  694. this.currentIndex = -1
  695. this.currentRow = null
  696. this.setCurrent()
  697. this.hideForm()
  698. if (this.form.parent_id > 0) {
  699. var spliceIndex = -1
  700. for (let index = this.doctor_advices.length - 1; ; index--) {
  701. if (this.doctor_advices[index].parent_id === this.form.parent_id) {
  702. spliceIndex = index
  703. break
  704. } else if (this.doctor_advices[index].id === this.form.parent_id) {
  705. spliceIndex = index
  706. break
  707. }
  708. }
  709. if (spliceIndex > -1) {
  710. spliceIndex += 1
  711. if (spliceIndex === this.doctor_advices.length) {
  712. this.doctor_advices.push(response.data.data.advice)
  713. } else {
  714. var swapData = this.doctor_advices.splice(spliceIndex)
  715. this.doctor_advices.push(response.data.data.advice)
  716. for (var index in swapData) {
  717. this.doctor_advices.push(swapData[index])// = this.doctor_advices.concat(swapData);
  718. }
  719. }
  720. }
  721. } else {
  722. this.doctor_advices.unshift(response.data.data.advice)
  723. }
  724. // this.$emit("new_create", response.data.data.advice);
  725. return false
  726. }
  727. }).catch(v => {
  728. this.loading = false
  729. })
  730. }, openNewChildTwo(index, row) {
  731. this.currentRow = row
  732. if (this.currentRow == null) {
  733. this.$message.error('请先选择要新增子药的医嘱!')
  734. return false
  735. }
  736. if (this.currentRow.stop_state == 1 || this.currentRow.execution_state == 1) {
  737. this.$message.error('所选医嘱已停止或执行')
  738. return false
  739. }
  740. this.title = '新增子药'
  741. this.showAdviceForm = true
  742. this.showAdvicePanel = false
  743. this.form = {
  744. id: 0,
  745. advice_type: 2,
  746. advice_date: this.record_date,
  747. start_time: uParseTime(
  748. this.currentRow.start_time,
  749. '{y}-{m}-{d} {h}:{i}'
  750. ),
  751. advice_name: '',
  752. drug_spec: '',
  753. drug_spec_unit: '',
  754. single_dose: '',
  755. single_dose_unit: '',
  756. prescribing_number: '',
  757. prescribing_number_unit: '',
  758. delivery_way: this.currentRow.delivery_way,
  759. execution_frequency: this.currentRow.execution_frequency,
  760. advice_doctor: '',
  761. remark: '',
  762. parent_id: this.currentRow.id
  763. }
  764. },
  765. openNewChild() {
  766. if (this.currentRow == null) {
  767. this.$message.error('请先选择要新增子药的医嘱!')
  768. return false
  769. }
  770. if (this.currentRow.stop_state == 1 || this.currentRow.execution_state == 1) {
  771. this.$message.error('所选医嘱已停止或执行')
  772. return false
  773. }
  774. this.title = '新增子药'
  775. this.showAdviceForm = true
  776. this.showAdvicePanel = false
  777. this.form = {
  778. id: 0,
  779. advice_type: 2,
  780. advice_date: this.record_date,
  781. start_time: uParseTime(
  782. this.currentRow.start_time,
  783. '{y}-{m}-{d} {h}:{i}'
  784. ),
  785. advice_name: '',
  786. drug_spec: '',
  787. drug_spec_unit: '',
  788. single_dose: '',
  789. single_dose_unit: '',
  790. prescribing_number: '',
  791. prescribing_number_unit: '',
  792. delivery_way: this.currentRow.delivery_way,
  793. execution_frequency: this.currentRow.execution_frequency,
  794. advice_doctor: '',
  795. remark: '',
  796. parent_id: this.currentRow.id
  797. }
  798. },
  799. openEdit(index, row) {
  800. if (row.stop_state == 1 || row.execution_state == 1) {
  801. this.$message.error('所选医嘱已停止或执行')
  802. return false
  803. }
  804. this.title = row.parent_id > 0 ? '编辑子药' : '编辑医嘱'
  805. this.showAdviceForm = true
  806. this.showAdvicePanel = false
  807. this.currentIndex = index
  808. this.form = {
  809. id: row.id,
  810. advice_type: 2,
  811. advice_date: uParseTime(
  812. row.advice_date,
  813. '{y}-{m}-{d}'
  814. ),
  815. start_time: uParseTime(
  816. row.start_time,
  817. '{y}-{m}-{d} {h}:{i}'
  818. ),
  819. advice_desc: row.advice_desc,
  820. advice_name: row.advice_name,
  821. drug_spec: row.drug_spec != 0 ? '' + row.drug_spec : '',
  822. drug_spec_unit: row.drug_spec_unit,
  823. single_dose: row.single_dose != 0 ? '' + row.single_dose : '',
  824. single_dose_unit: row.single_dose_unit,
  825. prescribing_number: row.prescribing_number != 0 ? '' + row.prescribing_number : '',
  826. prescribing_number_unit: row.prescribing_number_unit,
  827. delivery_way: row.delivery_way,
  828. execution_frequency: row.execution_frequency,
  829. advice_doctor: row.advice_doctor,
  830. remark: row.remark,
  831. parent_id: row.parent_id
  832. }
  833. },
  834. openEditGroupAdvice() {
  835. if (this.groupSelectRow === null) {
  836. this.$message.error('未选择要修改的医嘱内容')
  837. return
  838. }
  839. this.$refs.editGroupForm.open(this.groupSelectRow.groupno)
  840. },
  841. openGroupFrom() {
  842. this.$refs.addGroupForm.open()
  843. // this.title="新增医嘱";
  844. // this.showGroupForm = true;
  845. // this.showAdviceForm = false;
  846. // this.showAdvicePanel = false;
  847. // this.$refs.advices_list.setCurrentRow(null);
  848. // this.currentIndex = -1;
  849. // this.currentRow = null;
  850. // this.groupForm.advice_date = this.record_date;
  851. // this.form = {
  852. // id: 0,
  853. // advice_type: 2,
  854. // advice_date: this.record_date,
  855. // start_time: "",
  856. // advice_name: "",
  857. // advice_desc: "",
  858. // single_dose: "",
  859. // single_dose_unit: "",
  860. // prescribing_number: "",
  861. // prescribing_number_unit: "",
  862. // delivery_way: "",
  863. // execution_frequency: "",
  864. // advice_doctor: "",
  865. // remark: "",
  866. // parent_id: 0
  867. // };
  868. },
  869. checkAdvice() {
  870. console.log(this.$store.getters.xt_user)
  871. if (this.currentRow == null) {
  872. this.$message.error('请先选择要核对的医嘱!')
  873. return false
  874. }
  875. if (this.currentRow.check_state == 1) {
  876. this.$message.error('所选医嘱已核对')
  877. return false
  878. }
  879. if (this.currentRow.execution_staff > 0 && this.currentRow.execution_staff == this.$store.getters.xt_user.user.id) {
  880. this.$message.error('核对与执行不能是同一人')
  881. return false
  882. }
  883. this.$confirm('确认提交核对?', '医嘱核对', {
  884. confirmButtonText: '确定',
  885. cancelButtonText: '取消',
  886. closeOnClickModal: false,
  887. type: 'warning'
  888. }).then(() => {
  889. this.deleLoading = true
  890. let mode = "7"
  891. CheckDoctorAdvice(this.patient.id, this.currentRow.id,mode).then(response => {
  892. if (response.data.state == 0) {
  893. this.$message.error(response.data.msg)
  894. this.deleLoading = false
  895. return false
  896. } else {
  897. this.$notify({
  898. title: '成功',
  899. message: '核对成功',
  900. type: 'success',
  901. duration: 2000
  902. })
  903. var exid = response.data.data.advice.id
  904. if (response.data.data.advice.parent_id > 0) {
  905. exid = response.data.data.advice.parent_id
  906. }
  907. // if (this.currentRow.parent_id > 0) {
  908. // exid = this.currentRow.parent_id;
  909. // }
  910. this.currentRow.check_state = 1
  911. this.currentRow.check_time = response.data.data.advice.check_time
  912. this.currentRow.checker = response.data.data.advice.checker
  913. var alen = this.doctor_advices.length
  914. for (var index in this.doctor_advices) {
  915. if (this.doctor_advices[index].id == exid || this.doctor_advices[index].parent_id == exid) {
  916. this.doctor_advices[index].check_state = 1
  917. this.doctor_advices[index].check_time = response.data.data.advice.check_time
  918. this.doctor_advices[index].checker = response.data.data.advice.checker
  919. // break;
  920. }
  921. }
  922. this.deleLoading = false
  923. }
  924. })
  925. }).catch(() => {
  926. this.deleLoading = false
  927. })
  928. },
  929. execAdvice() {
  930. if (this.currentRow == null) {
  931. this.$message.error('请先选择要执行的医嘱!')
  932. return false
  933. }
  934. if (this.currentRow.stop_state == 1 || this.currentRow.execution_state == 1) {
  935. this.$message.error('所选医嘱已停止或执行')
  936. return false
  937. }
  938. if (this.currentRow.checker > 0 && this.currentRow.checker == this.$store.getters.xt_user.user.id) {
  939. this.$message.error('核对与执行不能是同一人')
  940. return false
  941. }
  942. this.execTimeDialogVisible = true
  943. this.deleLoading = true
  944. },
  945. DeleteGroupAdvice(groupno) {
  946. this.$confirm('确认删除这组医嘱?', '医嘱删除', {
  947. confirmButtonText: '确定',
  948. cancelButtonText: '取消',
  949. type: 'warning'
  950. }).then(() => {
  951. let mode ="4"
  952. if(this.currentRow.advice_doctor != this.$store.getters.xt_user.user.id){
  953. mode = "5"
  954. }
  955. DeleteGroupAdvice(groupno,mode).then(response => {
  956. if (response.data.state == 0) {
  957. this.$message.error(response.data.msg)
  958. return false
  959. } else {
  960. this.$notify({
  961. title: '成功',
  962. message: '医嘱已经删除',
  963. type: 'success',
  964. duration: 2000
  965. })
  966. var alen = this.doctor_advices.length
  967. for (let index = alen - 1; index >= 0; index--) {
  968. if (this.doctor_advices[index].groupno === groupno) {
  969. this.doctor_advices.splice(index, 1)
  970. }
  971. }
  972. }
  973. })
  974. }).catch(() => {
  975. })
  976. this.handleSpanTempArr()
  977. },
  978. openDelete(index, row) {
  979. this.currentRow = row
  980. this.$confirm('确认删除此条医嘱?', '医嘱删除', {
  981. confirmButtonText: '确定',
  982. cancelButtonText: '取消',
  983. closeOnClickModal: false,
  984. type: 'warning'
  985. }).then(() => {
  986. this.deleLoading = true
  987. let mode = "4"
  988. DeleteDoctorAdvice(this.currentRow.id,mode).then(response => {
  989. this.deleLoading = false
  990. if (response.data.state == 0) {
  991. this.$message.error(response.data.msg)
  992. return false
  993. } else {
  994. this.$notify({
  995. title: '成功',
  996. message: '医嘱已经删除',
  997. type: 'success',
  998. duration: 2000
  999. })
  1000. this.deleteResetData(this.currentRow)
  1001. this.currentRow = null
  1002. this.setCurrent()
  1003. }
  1004. })
  1005. }).catch(() => {
  1006. this.deleLoading = false
  1007. })
  1008. },
  1009. deleteAdvice() {
  1010. if (this.currentRow == null) {
  1011. this.$message.error('请先选择要删除的医嘱!')
  1012. return false
  1013. }
  1014. this.$confirm('确认删除此条医嘱?', '医嘱删除', {
  1015. confirmButtonText: '确定',
  1016. cancelButtonText: '取消',
  1017. closeOnClickModal: false,
  1018. type: 'warning'
  1019. }).then(() => {
  1020. this.deleLoading = true
  1021. let mode ="4"
  1022. DeleteDoctorAdvice(this.currentRow.id,mode).then(response => {
  1023. this.deleLoading = false
  1024. if (response.data.state == 0) {
  1025. this.$message.error(response.data.msg)
  1026. return false
  1027. } else {
  1028. this.$notify({
  1029. title: '成功',
  1030. message: '医嘱已经删除',
  1031. type: 'success',
  1032. duration: 2000
  1033. })
  1034. this.deleteResetData(this.currentRow)
  1035. this.currentRow = null
  1036. this.setCurrent()
  1037. }
  1038. })
  1039. }).catch(() => {
  1040. this.deleLoading = false
  1041. })
  1042. },
  1043. deleteResetData(row) {
  1044. if (row.parent_id > 0) {
  1045. for (var index in this.doctor_advices) {
  1046. if (this.doctor_advices[index].id == row.id) {
  1047. this.doctor_advices.splice(index, 1)
  1048. break
  1049. }
  1050. }
  1051. } else {
  1052. var spliceIndex = -1
  1053. var splitNums = 0
  1054. for (var index in this.doctor_advices) {
  1055. if (this.doctor_advices[index].id == row.id) {
  1056. spliceIndex = index
  1057. splitNums++
  1058. } else if (this.doctor_advices[index].parent_id == row.id) {
  1059. splitNums++
  1060. }
  1061. }
  1062. this.doctor_advices.splice(spliceIndex, splitNums)
  1063. }
  1064. },
  1065. selectRow(row) {
  1066. this.currentRow = row
  1067. },
  1068. getAdviceConfig() {
  1069. getAdviceConfig().then(response => {
  1070. if (response.data.state == 1) {
  1071. this.deliveryWayOptions = response.data.data.drugways === null ? [] : response.data.data.drugways
  1072. this.executionFrequencyOptions = response.data.data.efs === null ? [] : response.data.data.efs
  1073. this.adviceTemplates = response.data.data.advice_templates === null ? [] : response.data.data.advice_templates
  1074. var templateLen = this.adviceTemplates.length
  1075. for (let index = 0; index < templateLen; index++) {
  1076. if (!this.adviceTemplates[index].DoctorAdviceTemplate) {
  1077. continue
  1078. }
  1079. var DoctorAdviceTemplate = this.adviceTemplates[index].DoctorAdviceTemplate
  1080. for (let i = 0; i < DoctorAdviceTemplate.length; i++) {
  1081. DoctorAdviceTemplate[i].selection = false
  1082. }
  1083. var item = this.adviceTemplates[index]
  1084. item.DoctorAdviceTemplate = []
  1085. var datMap = {}
  1086. for (const key in DoctorAdviceTemplate) {
  1087. if (DoctorAdviceTemplate[key].parent_id == 0) {
  1088. datMap[DoctorAdviceTemplate[key].id] = DoctorAdviceTemplate[key]
  1089. }
  1090. }
  1091. for (const key in DoctorAdviceTemplate) {
  1092. if (DoctorAdviceTemplate[key].parent_id in datMap) {
  1093. if ('children' in datMap[DoctorAdviceTemplate[key].parent_id]) {
  1094. datMap[DoctorAdviceTemplate[key].parent_id].children.push(DoctorAdviceTemplate[key])
  1095. } else {
  1096. datMap[DoctorAdviceTemplate[key].parent_id].children = []
  1097. datMap[DoctorAdviceTemplate[key].parent_id].children.push(DoctorAdviceTemplate[key])
  1098. }
  1099. }
  1100. }
  1101. for (const key in datMap) {
  1102. item.DoctorAdviceTemplate.push(datMap[key])
  1103. }
  1104. this.$set(this.adviceTemplateMaps, this.adviceTemplates[index].id, item)
  1105. }
  1106. }
  1107. })
  1108. this.handleSpanTempArr()
  1109. this.handleStyle()
  1110. },
  1111. getXuserName(id) {
  1112. if (id <= 0) {
  1113. return ''
  1114. }
  1115. var name = ''
  1116. if (
  1117. this.admin_users == null ||
  1118. typeof this.admin_users.length === 'undefined'
  1119. ) {
  1120. return name
  1121. }
  1122. var leng = this.admin_users.length
  1123. if (leng == 0) {
  1124. return name
  1125. }
  1126. for (let index = 0; index < leng; index++) {
  1127. if (this.admin_users[index].id == id) {
  1128. name = this.admin_users[index].name
  1129. break
  1130. }
  1131. }
  1132. return name
  1133. }, addNewOrder() {
  1134. this.$refs.addGroupForm.open()
  1135. },
  1136. show() {
  1137. this.isVisibility = true
  1138. },
  1139. hide() {
  1140. this.isVisibility = false
  1141. },
  1142. hideForm() {
  1143. this.title = '临时医嘱'
  1144. this.showGroupForm = false
  1145. this.showAdviceForm = false
  1146. this.showAdvicePanel = true
  1147. },
  1148. hideNameForm() {
  1149. this.title = '新增医嘱'
  1150. this.showGroupForm = true
  1151. this.showNameForm = false
  1152. },
  1153. hideTemplateForm() {
  1154. this.title = '新增医嘱'
  1155. this.showGroupForm = true
  1156. this.showTemplateForm = false
  1157. },
  1158. hideGroupForm() {
  1159. this.title = '临时医嘱'
  1160. this.showAdviceForm = false
  1161. this.showGroupForm = false
  1162. this.showAdvicePanel = true
  1163. },
  1164. resetDialog() {
  1165. this.hoverOrderArr = []
  1166. this.title = '临时医嘱'
  1167. this.showAdviceForm = false
  1168. this.showGroupForm = false
  1169. this.showAdvicePanel = true
  1170. this.currentRow = null
  1171. this.groupSelectRow = null
  1172. this.setCurrent()
  1173. },
  1174. closeTimePanel() {
  1175. this.execTimeDialogVisible = false
  1176. this.deleLoading = false
  1177. this.exceLoading = false
  1178. this.execTime = ''
  1179. },
  1180. setCurrent(row) {
  1181. this.$refs.advices_list.setCurrentRow(row)
  1182. },
  1183. isShowStartTime(index, row) {
  1184. if (row.parent_id > 0) {
  1185. return false
  1186. } else if (index > 0 && row.groupno > 0 && row.groupno == this.doctor_advices[index - 1].groupno) {
  1187. return false
  1188. }
  1189. return true
  1190. }, mergeSpan({ row, column, rowIndex, columnIndex }) {
  1191. if (columnIndex != 2) {
  1192. const _row = this.tempArr[rowIndex]
  1193. const _col = _row > 0 ? 1 : 0
  1194. return {
  1195. rowspan: _row,
  1196. colspan: _col
  1197. }
  1198. }
  1199. }, handleSpanTempArr() {
  1200. this.tempArr = []
  1201. for (let i = 0; i < this.doctor_advices.length; i++) {
  1202. if (i === 0) {
  1203. this.tempArr.push(1)
  1204. this.pos = 0
  1205. } else {
  1206. // 判断当前元素与上一个元素是否相同
  1207. if (this.doctor_advices[i].groupno === this.doctor_advices[i - 1].groupno) {
  1208. this.tempArr[this.pos] += 1
  1209. this.tempArr.push(0)
  1210. } else {
  1211. this.tempArr.push(1)
  1212. this.pos = i
  1213. }
  1214. }
  1215. }
  1216. }, cellMouseEnter: function(row, column, event) {
  1217. this.currentRow = row
  1218. this.groupSelectRow = row
  1219. this.sameRowArr.forEach((arr, i) => {
  1220. if (arr.indexOf(row.index) != -1) {
  1221. this.hoverOrderArr = arr
  1222. }
  1223. })
  1224. }, cellMouseLeave: function(row, column, cell, event) {
  1225. this.hoverOrderArr = []
  1226. }, handleStyle() {
  1227. let sameRowArr = [], sIdx = 0
  1228. this.doctor_advices.forEach((item, index) => {
  1229. item.index = index
  1230. if (index === 0) {
  1231. sameRowArr.push([index])
  1232. } else {
  1233. if (item.groupno === this.doctor_advices[index - 1].groupno) {
  1234. sameRowArr[sIdx].push(index)
  1235. } else {
  1236. sIdx = sIdx + 1
  1237. sameRowArr.push([index])
  1238. }
  1239. }
  1240. })
  1241. this.sameRowArr = sameRowArr
  1242. }, getAdviceContent(row, isChild) {
  1243. let tempSingleDoseDesc = ''
  1244. let tempDrugSpecDesc = ''
  1245. let tempPrescribingNumberDesc = ''
  1246. if (row.prescribing_number) {
  1247. tempPrescribingNumberDesc = row.prescribing_number + '' + row.prescribing_number_unit
  1248. }
  1249. if (row.single_dose) {
  1250. if (this.template_id != 6) {
  1251. tempSingleDoseDesc = ' 单次用量 ' + ' ' + row.single_dose + '' + row.single_dose_unit
  1252. } else {
  1253. tempSingleDoseDesc = row.single_dose + '' + row.single_dose_unit
  1254. }
  1255. }
  1256. if (row.advice_desc) {
  1257. tempDrugSpecDesc = '(' + row.advice_desc + row.drug_spec_unit + ')'
  1258. }
  1259. if (isChild == 1) { // 不是子药
  1260. return row.advice_name + tempDrugSpecDesc + ' ' + tempPrescribingNumberDesc + tempSingleDoseDesc + ' ' + row.delivery_way + ' ' + row.execution_frequency
  1261. } else { // 是子药
  1262. return row.advice_name + tempDrugSpecDesc + ' ' + tempPrescribingNumberDesc + tempSingleDoseDesc
  1263. }
  1264. }
  1265. },
  1266. created() {
  1267. var date = this.$route.query && this.$route.query.date
  1268. this.record_date = uParseTime(date, '{y}-{m}-{d}')
  1269. this.form.advice_date = this.record_date
  1270. this.getAdviceConfig()
  1271. this.unitsOption = getDataConfig('hemodialysis', 'units')
  1272. this.template_id = this.$store.getters.xt_user.template_info.template_id
  1273. },
  1274. components: {
  1275. AddGroupAdvice,
  1276. EditGroupAdvice
  1277. }
  1278. }
  1279. </script>
  1280. <style>
  1281. @import "../../../../../static/css/table_row.css";
  1282. .txsj {
  1283. text-align: center;
  1284. margin-bottom: 20px;
  1285. }
  1286. .dialysisadvicenamedisplay .cell {
  1287. float: left;
  1288. text-align: left;
  1289. }
  1290. </style>
  1291. <!--<style scoped>-->
  1292. <!--.txsj{-->
  1293. <!--text-align: center;-->
  1294. <!--margin-bottom: 20px;-->
  1295. <!--}-->
  1296. <!--</style>-->
  1297. <!--<style rel="stylesheet/scss" lang="scss" >-->
  1298. <!--.row-class-active {-->
  1299. <!--background: #badcff;-->
  1300. <!--}-->
  1301. <!--.doctor-advice-box .current-box-class .current-row>td{-->
  1302. <!--background: #6fb5fa;-->
  1303. <!--color:#fff;-->
  1304. <!--}-->
  1305. <!--.doctor-advice-box .current-box-class .current-row:hover>td{-->
  1306. <!--background: #6fb5fa;-->
  1307. <!--}-->
  1308. <!--// .doctor-advice-box .current-box-class .stoped-row>td{-->
  1309. <!--// background: #c9c9c9;-->
  1310. <!--// color:#000;-->
  1311. <!--// }-->
  1312. <!--// .doctor-advice-box .current-box-class .stoped-row:hover>td{-->
  1313. <!--// background: #c9c9c9;-->
  1314. <!--// }-->
  1315. <!--</style>-->