DoctorAdviceDialog.vue 51KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413
  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. v-if="this.$store.getters.xt_user.user.user_type == 1 || this.$store.getters.xt_user.user.user_type == 2">
  13. 新增医嘱
  14. </el-button>
  15. <el-button round @click="openGroupFrom" :loading="deleLoading"
  16. v-if="this.$store.getters.xt_user.user.user_type == 3" disabled>新增医嘱
  17. </el-button>
  18. <el-button v-if="currentRow != null && this.$store.getters.xt_user.user.user_type == 3" 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 && this.$store.getters.xt_user.user.user_type == 3" 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&& (this.$store.getters.xt_user.user.user_type == 1 || this.$store.getters.xt_user.user.user_type == 2)"
  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&& (this.$store.getters.xt_user.user.user_type == 1 || this.$store.getters.xt_user.user.user_type == 2)"
  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. v-if="(this.$store.getters.xt_user.user.user_type == 1 || this.$store.getters.xt_user.user.user_type == 2)">
  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. EditDoctorAdvice(this.patient.id, this.form.id, this.form).then(response => {
  400. if (response.data.state == 0) {
  401. this.$message.error(response.data.msg)
  402. return false
  403. } else {
  404. this.$notify({
  405. title: '成功',
  406. message: '修改医嘱成功',
  407. type: 'success',
  408. duration: 2000
  409. })
  410. this.showAdviceForm = false
  411. this.showAdvicePanel = true
  412. var advice = response.data.data.advice
  413. this.doctor_advices[this.currentIndex].drug_spec = advice.drug_spec
  414. this.doctor_advices[this.currentIndex].drug_spec_unit = advice.drug_spec_unit
  415. this.doctor_advices[this.currentIndex].start_time = advice.start_time
  416. this.doctor_advices[this.currentIndex].advice_name = advice.advice_name
  417. this.doctor_advices[this.currentIndex].advice_desc = advice.advice_desc
  418. this.doctor_advices[this.currentIndex].single_dose = advice.single_dose
  419. this.doctor_advices[this.currentIndex].single_dose_unit = advice.single_dose_unit
  420. this.doctor_advices[this.currentIndex].delivery_way = advice.delivery_way
  421. this.doctor_advices[this.currentIndex].execution_frequency = advice.execution_frequency
  422. this.doctor_advices[this.currentIndex].prescribing_number = advice.prescribing_number
  423. this.doctor_advices[this.currentIndex].prescribing_number_unit = advice.prescribing_number_unit
  424. this.doctor_advices[this.currentIndex].advice_doctor = advice.advice_doctor
  425. this.doctor_advices[this.currentIndex].remark = advice.remark
  426. this.currentIndex = -1
  427. return false
  428. }
  429. })
  430. },
  431. // submitGroupAdvice() {
  432. // if (this.groupForm.start_time.length == 0) {
  433. // this.$message.error('请选择开始时间')
  434. // return
  435. // }
  436. // CreateGroupAdvice(this.patient.id, this.groupForm).then(response => {
  437. // if (response.data.state == 0) {
  438. // this.$message.error(response.data.msg)
  439. // return false
  440. // } else {
  441. // this.$notify({
  442. // title: '成功',
  443. // message: '新增成功',
  444. // type: 'success',
  445. // duration: 2000
  446. // })
  447. // this.currentIndex = -1
  448. // this.currentRow = null
  449. // this.setCurrent()
  450. // this.hideGroupForm()
  451. // for (const index in response.data.data.advices) {
  452. // this.doctor_advices.unshift(response.data.data.advices[index])
  453. // }
  454. // this.groupForm = {
  455. // advice_type: 2,
  456. // advice_date: '',
  457. // start_time: '',
  458. // adviceNames: [],
  459. // advice_doctor: '',
  460. // remark: '',
  461. // parent_id: 0
  462. // }
  463. // return false
  464. // }
  465. // })
  466. // },
  467. // submitTempForm() {
  468. // var _this = this
  469. // if (this.templateForm.id.length == 0) {
  470. // this.$message.error('请选择医嘱模板')
  471. // return
  472. // }
  473. // if (_this.templateForm.id in _this.adviceTemplateMaps) {
  474. // var mapid = _this.templateForm.id
  475. // for (const index in _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate) {
  476. // var item = {
  477. // advice_name: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].advice_name,
  478. // single_dose: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose,
  479. // single_dose_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].single_dose_unit,
  480. // drug_spec: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec,
  481. // drug_spec_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].drug_spec_unit,
  482. // prescribing_number: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number,
  483. // prescribing_number_unit: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].prescribing_number_unit,
  484. // delivery_way: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].delivery_way,
  485. // execution_frequency: _this.adviceTemplateMaps[mapid].DoctorAdviceTemplate[index].execution_frequency,
  486. // isEdit: 0,
  487. // index: 0
  488. // }
  489. // _this.groupForm.adviceNames.push(item)
  490. // }
  491. // }
  492. // this.title = '新增医嘱'
  493. // this.showTemplateForm = false
  494. // this.showGroupForm = true
  495. // },
  496. openAdviceTemplate() {
  497. this.templateForm = { id: '' }
  498. this.title = '选择医嘱模板'
  499. this.showTemplateForm = true
  500. this.showGroupForm = false
  501. },
  502. submitNameForm() {
  503. if (this.nameForm.advice_name.length == 0) {
  504. this.$message.error('请填写医嘱名称')
  505. return
  506. }
  507. if (this.nameForm.isEdit) {
  508. this.groupForm.adviceNames[this.nameForm.index].advice_name = this.nameForm.advice_name
  509. this.groupForm.adviceNames[this.nameForm.index].single_dose = this.nameForm.single_dose
  510. this.groupForm.adviceNames[this.nameForm.index].single_dose_unit = this.nameForm.single_dose_unit
  511. this.groupForm.adviceNames[this.nameForm.index].drug_spec = this.nameForm.drug_spec
  512. this.groupForm.adviceNames[this.nameForm.index].drug_spec_unit = this.nameForm.drug_spec_unit
  513. this.groupForm.adviceNames[this.nameForm.index].prescribing_number = this.nameForm.prescribing_number
  514. this.groupForm.adviceNames[this.nameForm.index].prescribing_number_unit = this.nameForm.prescribing_number_unit
  515. this.groupForm.adviceNames[this.nameForm.index].delivery_way = this.nameForm.delivery_way
  516. this.groupForm.adviceNames[this.nameForm.index].execution_frequency = this.nameForm.execution_frequency
  517. } else {
  518. this.groupForm.adviceNames.push(this.nameForm)
  519. }
  520. this.title = '新增医嘱'
  521. this.showNameForm = false
  522. this.showGroupForm = true
  523. },
  524. groupClassName({ row, rowIndex }) {
  525. row.index = rowIndex
  526. },
  527. selectGroupAdvice(row) {
  528. this.groupSelectRow = row
  529. },
  530. openDeleteGroupAdvice() {
  531. if (this.groupSelectRow === null) {
  532. this.$message.error('未选择要删除的医嘱内容')
  533. return
  534. }
  535. this.DeleteGroupAdvice(this.groupSelectRow.groupno)
  536. // this.$confirm('确认删除些条医嘱内容?', '删除医嘱内容', {
  537. // confirmButtonText: '确定',
  538. // cancelButtonText: '取消',
  539. // type: 'warning'
  540. // }).then(() => {
  541. // this.groupForm.adviceNames.splice(this.groupSelectRow.index, 1);
  542. // }).catch(() => {
  543. // });
  544. },
  545. openAdviceName(isEdit) {
  546. if (isEdit) {
  547. if (this.groupSelectRow === null) {
  548. this.$message.error('未选择要修改的医嘱内容')
  549. return
  550. }
  551. this.nameForm = {
  552. advice_name: this.groupSelectRow.advice_name,
  553. single_dose: this.groupSelectRow.single_dose,
  554. single_dose_unit: this.groupSelectRow.single_dose_unit,
  555. drug_spec: this.groupSelectRow.drug_spec,
  556. drug_spec_unit: this.groupSelectRow.drug_spec_unit,
  557. prescribing_number: this.groupSelectRow.prescribing_number,
  558. prescribing_number_unit: this.groupSelectRow.prescribing_number_unit,
  559. delivery_way: this.groupSelectRow.delivery_way,
  560. execution_frequency: this.groupSelectRow.execution_frequency,
  561. isEdit: 1,
  562. index: this.groupSelectRow.index
  563. }
  564. } else {
  565. this.nameForm = {
  566. advice_name: '',
  567. single_dose: '',
  568. single_dose_unit: '',
  569. drug_spec: '',
  570. drug_spec_unit: '',
  571. prescribing_number: '',
  572. prescribing_number_unit: '',
  573. delivery_way: '',
  574. execution_frequency: '',
  575. isEdit: 0,
  576. index: 0
  577. }
  578. }
  579. this.title = '新增医嘱内容'
  580. this.showNameForm = true
  581. this.showGroupForm = false
  582. },
  583. tableRowClassName({ row, rowIndex }) {
  584. // if (row.stop_state == 1 || row.execution_state == 1) {
  585. // return 'stoped-row';
  586. // }
  587. // return 'success-rows'
  588. row.index = rowIndex
  589. const arr = this.hoverOrderArr
  590. for (let i = 0; i < arr.length; i++) {
  591. if (rowIndex == arr[i]) {
  592. return 'success-row'
  593. }
  594. }
  595. },
  596. changeAdviceName(key) {
  597. if (key in this.adviceTemplateMaps) {
  598. this.form.advice_name = this.adviceTemplateMaps[key].advice_name
  599. this.form.advice_desc = this.adviceTemplateMaps[key].advice_desc
  600. this.form.single_dose_unit = this.adviceTemplateMaps[key].single_dose_unit
  601. this.form.single_dose = this.adviceTemplateMaps[key].single_dose + ''
  602. this.form.prescribing_number_unit = this.adviceTemplateMaps[key].prescribing_number_unit
  603. this.form.prescribing_number = this.adviceTemplateMaps[key].prescribing_number + ''
  604. this.form.delivery_way = this.adviceTemplateMaps[key].delivery_way
  605. this.form.execution_frequency = this.adviceTemplateMaps[key].execution_frequency
  606. }
  607. },
  608. submitExce() {
  609. if (this.currentRow == null) {
  610. this.$message.error('请先选择要执行的医嘱!')
  611. return false
  612. }
  613. if (this.execTime.length == 0) {
  614. this.$message.error('请选择执行时间!')
  615. return false
  616. }
  617. var execTime = Math.round(new Date(this.execTime).getTime() / 1000)
  618. if (execTime < this.currentRow.start_time) {
  619. this.$message.error('执行医嘱不能在开始之前!')
  620. return false
  621. }
  622. this.exceLoading = true
  623. ExecDoctorAdvice(this.patient.id, this.currentRow.id, this.execTime).then(response => {
  624. if (response.data.state == 0) {
  625. this.$message.error('执行失败!')
  626. this.exceLoading = false
  627. return false
  628. } else {
  629. this.$notify({
  630. title: '成功',
  631. message: '执行医嘱成功',
  632. type: 'success',
  633. duration: 2000
  634. })
  635. var exid = response.data.data.advice.id
  636. if (response.data.data.advice.parent_id > 0) {
  637. exid = response.data.data.advice.parent_id
  638. }
  639. // if (this.currentRow.parent_id > 0) {
  640. // exid = this.currentRow.parent_id;
  641. // }
  642. this.currentRow.execution_state = 1
  643. this.currentRow.execution_staff = response.data.data.advice.execution_staff
  644. this.currentRow.execution_time = response.data.data.advice.execution_time
  645. var alen = this.doctor_advices.length
  646. for (var index in this.doctor_advices) {
  647. if (this.doctor_advices[index].id == exid || this.doctor_advices[index].parent_id == exid) {
  648. this.doctor_advices[index].execution_state = 1
  649. this.doctor_advices[index].execution_staff = response.data.data.advice.execution_staff
  650. this.doctor_advices[index].execution_time = response.data.data.advice.execution_time
  651. // this.doctor_advices[index].checker = response.data.data.advice.checker;
  652. break
  653. }
  654. }
  655. this.execTimeDialogVisible = false
  656. return false
  657. }
  658. }).catch(() => {
  659. this.exceLoading = false
  660. })
  661. },
  662. submitAdvice() {
  663. if (this.form.advice_name.length == 0) {
  664. this.$message.error('请填写医嘱名称')
  665. return
  666. }
  667. if (this.form.start_time.length == 0) {
  668. this.$message.error('请选择开始时间')
  669. return
  670. }
  671. if (!(this.patient.id > 0)) {
  672. this.$message.error('没有选择患者')
  673. return false
  674. }
  675. CreateDoctorAdvice(this.patient.id, this.form).then(response => {
  676. this.loading = false
  677. if (response.data.state == 0) {
  678. this.$message.error(response.data.msg)
  679. return false
  680. } else {
  681. this.$notify({
  682. title: '成功',
  683. message: '新增医嘱成功',
  684. type: 'success',
  685. duration: 2000
  686. })
  687. this.currentIndex = -1
  688. this.currentRow = null
  689. this.setCurrent()
  690. this.hideForm()
  691. if (this.form.parent_id > 0) {
  692. var spliceIndex = -1
  693. for (let index = this.doctor_advices.length - 1; ; index--) {
  694. if (this.doctor_advices[index].parent_id === this.form.parent_id) {
  695. spliceIndex = index
  696. break
  697. } else if (this.doctor_advices[index].id === this.form.parent_id) {
  698. spliceIndex = index
  699. break
  700. }
  701. }
  702. if (spliceIndex > -1) {
  703. spliceIndex += 1
  704. if (spliceIndex === this.doctor_advices.length) {
  705. this.doctor_advices.push(response.data.data.advice)
  706. } else {
  707. var swapData = this.doctor_advices.splice(spliceIndex)
  708. this.doctor_advices.push(response.data.data.advice)
  709. for (var index in swapData) {
  710. this.doctor_advices.push(swapData[index])// = this.doctor_advices.concat(swapData);
  711. }
  712. }
  713. }
  714. } else {
  715. this.doctor_advices.unshift(response.data.data.advice)
  716. }
  717. // this.$emit("new_create", response.data.data.advice);
  718. return false
  719. }
  720. }).catch(v => {
  721. this.loading = false
  722. })
  723. }, openNewChildTwo(index, row) {
  724. this.currentRow = row
  725. if (this.currentRow == null) {
  726. this.$message.error('请先选择要新增子药的医嘱!')
  727. return false
  728. }
  729. if (this.currentRow.stop_state == 1 || this.currentRow.execution_state == 1) {
  730. this.$message.error('所选医嘱已停止或执行')
  731. return false
  732. }
  733. this.title = '新增子药'
  734. this.showAdviceForm = true
  735. this.showAdvicePanel = false
  736. this.form = {
  737. id: 0,
  738. advice_type: 2,
  739. advice_date: this.record_date,
  740. start_time: uParseTime(
  741. this.currentRow.start_time,
  742. '{y}-{m}-{d} {h}:{i}'
  743. ),
  744. advice_name: '',
  745. drug_spec: '',
  746. drug_spec_unit: '',
  747. single_dose: '',
  748. single_dose_unit: '',
  749. prescribing_number: '',
  750. prescribing_number_unit: '',
  751. delivery_way: this.currentRow.delivery_way,
  752. execution_frequency: this.currentRow.execution_frequency,
  753. advice_doctor: '',
  754. remark: '',
  755. parent_id: this.currentRow.id
  756. }
  757. },
  758. openNewChild() {
  759. if (this.currentRow == null) {
  760. this.$message.error('请先选择要新增子药的医嘱!')
  761. return false
  762. }
  763. if (this.currentRow.stop_state == 1 || this.currentRow.execution_state == 1) {
  764. this.$message.error('所选医嘱已停止或执行')
  765. return false
  766. }
  767. this.title = '新增子药'
  768. this.showAdviceForm = true
  769. this.showAdvicePanel = false
  770. this.form = {
  771. id: 0,
  772. advice_type: 2,
  773. advice_date: this.record_date,
  774. start_time: uParseTime(
  775. this.currentRow.start_time,
  776. '{y}-{m}-{d} {h}:{i}'
  777. ),
  778. advice_name: '',
  779. drug_spec: '',
  780. drug_spec_unit: '',
  781. single_dose: '',
  782. single_dose_unit: '',
  783. prescribing_number: '',
  784. prescribing_number_unit: '',
  785. delivery_way: this.currentRow.delivery_way,
  786. execution_frequency: this.currentRow.execution_frequency,
  787. advice_doctor: '',
  788. remark: '',
  789. parent_id: this.currentRow.id
  790. }
  791. },
  792. openEdit(index, row) {
  793. if (row.stop_state == 1 || row.execution_state == 1) {
  794. this.$message.error('所选医嘱已停止或执行')
  795. return false
  796. }
  797. this.title = row.parent_id > 0 ? '编辑子药' : '编辑医嘱'
  798. this.showAdviceForm = true
  799. this.showAdvicePanel = false
  800. this.currentIndex = index
  801. this.form = {
  802. id: row.id,
  803. advice_type: 2,
  804. advice_date: uParseTime(
  805. row.advice_date,
  806. '{y}-{m}-{d}'
  807. ),
  808. start_time: uParseTime(
  809. row.start_time,
  810. '{y}-{m}-{d} {h}:{i}'
  811. ),
  812. advice_desc: row.advice_desc,
  813. advice_name: row.advice_name,
  814. drug_spec: row.drug_spec != 0 ? '' + row.drug_spec : '',
  815. drug_spec_unit: row.drug_spec_unit,
  816. single_dose: row.single_dose != 0 ? '' + row.single_dose : '',
  817. single_dose_unit: row.single_dose_unit,
  818. prescribing_number: row.prescribing_number != 0 ? '' + row.prescribing_number : '',
  819. prescribing_number_unit: row.prescribing_number_unit,
  820. delivery_way: row.delivery_way,
  821. execution_frequency: row.execution_frequency,
  822. advice_doctor: row.advice_doctor,
  823. remark: row.remark,
  824. parent_id: row.parent_id
  825. }
  826. },
  827. openEditGroupAdvice() {
  828. if (this.groupSelectRow === null) {
  829. this.$message.error('未选择要修改的医嘱内容')
  830. return
  831. }
  832. this.$refs.editGroupForm.open(this.groupSelectRow.groupno)
  833. },
  834. openGroupFrom() {
  835. this.$refs.addGroupForm.open()
  836. // this.title="新增医嘱";
  837. // this.showGroupForm = true;
  838. // this.showAdviceForm = false;
  839. // this.showAdvicePanel = false;
  840. // this.$refs.advices_list.setCurrentRow(null);
  841. // this.currentIndex = -1;
  842. // this.currentRow = null;
  843. // this.groupForm.advice_date = this.record_date;
  844. // this.form = {
  845. // id: 0,
  846. // advice_type: 2,
  847. // advice_date: this.record_date,
  848. // start_time: "",
  849. // advice_name: "",
  850. // advice_desc: "",
  851. // single_dose: "",
  852. // single_dose_unit: "",
  853. // prescribing_number: "",
  854. // prescribing_number_unit: "",
  855. // delivery_way: "",
  856. // execution_frequency: "",
  857. // advice_doctor: "",
  858. // remark: "",
  859. // parent_id: 0
  860. // };
  861. },
  862. checkAdvice() {
  863. console.log(this.$store.getters.xt_user)
  864. if (this.currentRow == null) {
  865. this.$message.error('请先选择要核对的医嘱!')
  866. return false
  867. }
  868. if (this.currentRow.check_state == 1) {
  869. this.$message.error('所选医嘱已核对')
  870. return false
  871. }
  872. if (this.currentRow.execution_staff > 0 && this.currentRow.execution_staff == this.$store.getters.xt_user.user.id) {
  873. this.$message.error('核对与执行不能是同一人')
  874. return false
  875. }
  876. this.$confirm('确认提交核对?', '医嘱核对', {
  877. confirmButtonText: '确定',
  878. cancelButtonText: '取消',
  879. closeOnClickModal: false,
  880. type: 'warning'
  881. }).then(() => {
  882. this.deleLoading = true
  883. let mode = "7"
  884. CheckDoctorAdvice(this.patient.id, this.currentRow.id,mode).then(response => {
  885. if (response.data.state == 0) {
  886. this.$message.error(response.data.msg)
  887. this.deleLoading = false
  888. return false
  889. } else {
  890. this.$notify({
  891. title: '成功',
  892. message: '核对成功',
  893. type: 'success',
  894. duration: 2000
  895. })
  896. var exid = response.data.data.advice.id
  897. if (response.data.data.advice.parent_id > 0) {
  898. exid = response.data.data.advice.parent_id
  899. }
  900. // if (this.currentRow.parent_id > 0) {
  901. // exid = this.currentRow.parent_id;
  902. // }
  903. this.currentRow.check_state = 1
  904. this.currentRow.check_time = response.data.data.advice.check_time
  905. this.currentRow.checker = response.data.data.advice.checker
  906. var alen = this.doctor_advices.length
  907. for (var index in this.doctor_advices) {
  908. if (this.doctor_advices[index].id == exid || this.doctor_advices[index].parent_id == exid) {
  909. this.doctor_advices[index].check_state = 1
  910. this.doctor_advices[index].check_time = response.data.data.advice.check_time
  911. this.doctor_advices[index].checker = response.data.data.advice.checker
  912. // break;
  913. }
  914. }
  915. this.deleLoading = false
  916. }
  917. })
  918. }).catch(() => {
  919. this.deleLoading = false
  920. })
  921. },
  922. execAdvice() {
  923. if (this.currentRow == null) {
  924. this.$message.error('请先选择要执行的医嘱!')
  925. return false
  926. }
  927. if (this.currentRow.stop_state == 1 || this.currentRow.execution_state == 1) {
  928. this.$message.error('所选医嘱已停止或执行')
  929. return false
  930. }
  931. if (this.currentRow.checker > 0 && this.currentRow.checker == this.$store.getters.xt_user.user.id) {
  932. this.$message.error('核对与执行不能是同一人')
  933. return false
  934. }
  935. this.execTimeDialogVisible = true
  936. this.deleLoading = true
  937. },
  938. DeleteGroupAdvice(groupno) {
  939. this.$confirm('确认删除这组医嘱?', '医嘱删除', {
  940. confirmButtonText: '确定',
  941. cancelButtonText: '取消',
  942. type: 'warning'
  943. }).then(() => {
  944. DeleteGroupAdvice(groupno).then(response => {
  945. if (response.data.state == 0) {
  946. this.$message.error(response.data.msg)
  947. return false
  948. } else {
  949. this.$notify({
  950. title: '成功',
  951. message: '医嘱已经删除',
  952. type: 'success',
  953. duration: 2000
  954. })
  955. var alen = this.doctor_advices.length
  956. for (let index = alen - 1; index >= 0; index--) {
  957. if (this.doctor_advices[index].groupno === groupno) {
  958. this.doctor_advices.splice(index, 1)
  959. }
  960. }
  961. }
  962. })
  963. }).catch(() => {
  964. })
  965. this.handleSpanTempArr()
  966. },
  967. openDelete(index, row) {
  968. this.currentRow = row
  969. this.$confirm('确认删除此条医嘱?', '医嘱删除', {
  970. confirmButtonText: '确定',
  971. cancelButtonText: '取消',
  972. closeOnClickModal: false,
  973. type: 'warning'
  974. }).then(() => {
  975. this.deleLoading = true
  976. DeleteDoctorAdvice(this.currentRow.id).then(response => {
  977. this.deleLoading = false
  978. if (response.data.state == 0) {
  979. this.$message.error(response.data.msg)
  980. return false
  981. } else {
  982. this.$notify({
  983. title: '成功',
  984. message: '医嘱已经删除',
  985. type: 'success',
  986. duration: 2000
  987. })
  988. this.deleteResetData(this.currentRow)
  989. this.currentRow = null
  990. this.setCurrent()
  991. }
  992. })
  993. }).catch(() => {
  994. this.deleLoading = false
  995. })
  996. },
  997. deleteAdvice() {
  998. if (this.currentRow == null) {
  999. this.$message.error('请先选择要删除的医嘱!')
  1000. return false
  1001. }
  1002. this.$confirm('确认删除此条医嘱?', '医嘱删除', {
  1003. confirmButtonText: '确定',
  1004. cancelButtonText: '取消',
  1005. closeOnClickModal: false,
  1006. type: 'warning'
  1007. }).then(() => {
  1008. this.deleLoading = true
  1009. DeleteDoctorAdvice(this.currentRow.id).then(response => {
  1010. this.deleLoading = false
  1011. if (response.data.state == 0) {
  1012. this.$message.error(response.data.msg)
  1013. return false
  1014. } else {
  1015. this.$notify({
  1016. title: '成功',
  1017. message: '医嘱已经删除',
  1018. type: 'success',
  1019. duration: 2000
  1020. })
  1021. this.deleteResetData(this.currentRow)
  1022. this.currentRow = null
  1023. this.setCurrent()
  1024. }
  1025. })
  1026. }).catch(() => {
  1027. this.deleLoading = false
  1028. })
  1029. },
  1030. deleteResetData(row) {
  1031. if (row.parent_id > 0) {
  1032. for (var index in this.doctor_advices) {
  1033. if (this.doctor_advices[index].id == row.id) {
  1034. this.doctor_advices.splice(index, 1)
  1035. break
  1036. }
  1037. }
  1038. } else {
  1039. var spliceIndex = -1
  1040. var splitNums = 0
  1041. for (var index in this.doctor_advices) {
  1042. if (this.doctor_advices[index].id == row.id) {
  1043. spliceIndex = index
  1044. splitNums++
  1045. } else if (this.doctor_advices[index].parent_id == row.id) {
  1046. splitNums++
  1047. }
  1048. }
  1049. this.doctor_advices.splice(spliceIndex, splitNums)
  1050. }
  1051. },
  1052. selectRow(row) {
  1053. this.currentRow = row
  1054. },
  1055. getAdviceConfig() {
  1056. getAdviceConfig().then(response => {
  1057. if (response.data.state == 1) {
  1058. this.deliveryWayOptions = response.data.data.drugways === null ? [] : response.data.data.drugways
  1059. this.executionFrequencyOptions = response.data.data.efs === null ? [] : response.data.data.efs
  1060. this.adviceTemplates = response.data.data.advice_templates === null ? [] : response.data.data.advice_templates
  1061. var templateLen = this.adviceTemplates.length
  1062. for (let index = 0; index < templateLen; index++) {
  1063. if (!this.adviceTemplates[index].DoctorAdviceTemplate) {
  1064. continue
  1065. }
  1066. var DoctorAdviceTemplate = this.adviceTemplates[index].DoctorAdviceTemplate
  1067. for (let i = 0; i < DoctorAdviceTemplate.length; i++) {
  1068. DoctorAdviceTemplate[i].selection = false
  1069. }
  1070. var item = this.adviceTemplates[index]
  1071. item.DoctorAdviceTemplate = []
  1072. var datMap = {}
  1073. for (const key in DoctorAdviceTemplate) {
  1074. if (DoctorAdviceTemplate[key].parent_id == 0) {
  1075. datMap[DoctorAdviceTemplate[key].id] = DoctorAdviceTemplate[key]
  1076. }
  1077. }
  1078. for (const key in DoctorAdviceTemplate) {
  1079. if (DoctorAdviceTemplate[key].parent_id in datMap) {
  1080. if ('children' in datMap[DoctorAdviceTemplate[key].parent_id]) {
  1081. datMap[DoctorAdviceTemplate[key].parent_id].children.push(DoctorAdviceTemplate[key])
  1082. } else {
  1083. datMap[DoctorAdviceTemplate[key].parent_id].children = []
  1084. datMap[DoctorAdviceTemplate[key].parent_id].children.push(DoctorAdviceTemplate[key])
  1085. }
  1086. }
  1087. }
  1088. for (const key in datMap) {
  1089. item.DoctorAdviceTemplate.push(datMap[key])
  1090. }
  1091. this.$set(this.adviceTemplateMaps, this.adviceTemplates[index].id, item)
  1092. }
  1093. }
  1094. })
  1095. this.handleSpanTempArr()
  1096. this.handleStyle()
  1097. },
  1098. getXuserName(id) {
  1099. if (id <= 0) {
  1100. return ''
  1101. }
  1102. var name = ''
  1103. if (
  1104. this.admin_users == null ||
  1105. typeof this.admin_users.length === 'undefined'
  1106. ) {
  1107. return name
  1108. }
  1109. var leng = this.admin_users.length
  1110. if (leng == 0) {
  1111. return name
  1112. }
  1113. for (let index = 0; index < leng; index++) {
  1114. if (this.admin_users[index].id == id) {
  1115. name = this.admin_users[index].name
  1116. break
  1117. }
  1118. }
  1119. return name
  1120. }, addNewOrder() {
  1121. this.$refs.addGroupForm.open()
  1122. },
  1123. show() {
  1124. this.isVisibility = true
  1125. },
  1126. hide() {
  1127. this.isVisibility = false
  1128. },
  1129. hideForm() {
  1130. this.title = '临时医嘱'
  1131. this.showGroupForm = false
  1132. this.showAdviceForm = false
  1133. this.showAdvicePanel = true
  1134. },
  1135. hideNameForm() {
  1136. this.title = '新增医嘱'
  1137. this.showGroupForm = true
  1138. this.showNameForm = false
  1139. },
  1140. hideTemplateForm() {
  1141. this.title = '新增医嘱'
  1142. this.showGroupForm = true
  1143. this.showTemplateForm = false
  1144. },
  1145. hideGroupForm() {
  1146. this.title = '临时医嘱'
  1147. this.showAdviceForm = false
  1148. this.showGroupForm = false
  1149. this.showAdvicePanel = true
  1150. },
  1151. resetDialog() {
  1152. this.hoverOrderArr = []
  1153. this.title = '临时医嘱'
  1154. this.showAdviceForm = false
  1155. this.showGroupForm = false
  1156. this.showAdvicePanel = true
  1157. this.currentRow = null
  1158. this.groupSelectRow = null
  1159. this.setCurrent()
  1160. },
  1161. closeTimePanel() {
  1162. this.execTimeDialogVisible = false
  1163. this.deleLoading = false
  1164. this.exceLoading = false
  1165. this.execTime = ''
  1166. },
  1167. setCurrent(row) {
  1168. this.$refs.advices_list.setCurrentRow(row)
  1169. },
  1170. isShowStartTime(index, row) {
  1171. if (row.parent_id > 0) {
  1172. return false
  1173. } else if (index > 0 && row.groupno > 0 && row.groupno == this.doctor_advices[index - 1].groupno) {
  1174. return false
  1175. }
  1176. return true
  1177. }, mergeSpan({ row, column, rowIndex, columnIndex }) {
  1178. if (columnIndex != 2) {
  1179. const _row = this.tempArr[rowIndex]
  1180. const _col = _row > 0 ? 1 : 0
  1181. return {
  1182. rowspan: _row,
  1183. colspan: _col
  1184. }
  1185. }
  1186. }, handleSpanTempArr() {
  1187. this.tempArr = []
  1188. for (let i = 0; i < this.doctor_advices.length; i++) {
  1189. if (i === 0) {
  1190. this.tempArr.push(1)
  1191. this.pos = 0
  1192. } else {
  1193. // 判断当前元素与上一个元素是否相同
  1194. if (this.doctor_advices[i].groupno === this.doctor_advices[i - 1].groupno) {
  1195. this.tempArr[this.pos] += 1
  1196. this.tempArr.push(0)
  1197. } else {
  1198. this.tempArr.push(1)
  1199. this.pos = i
  1200. }
  1201. }
  1202. }
  1203. }, cellMouseEnter: function(row, column, event) {
  1204. this.currentRow = row
  1205. this.groupSelectRow = row
  1206. this.sameRowArr.forEach((arr, i) => {
  1207. if (arr.indexOf(row.index) != -1) {
  1208. this.hoverOrderArr = arr
  1209. }
  1210. })
  1211. }, cellMouseLeave: function(row, column, cell, event) {
  1212. this.hoverOrderArr = []
  1213. }, handleStyle() {
  1214. let sameRowArr = [], sIdx = 0
  1215. this.doctor_advices.forEach((item, index) => {
  1216. item.index = index
  1217. if (index === 0) {
  1218. sameRowArr.push([index])
  1219. } else {
  1220. if (item.groupno === this.doctor_advices[index - 1].groupno) {
  1221. sameRowArr[sIdx].push(index)
  1222. } else {
  1223. sIdx = sIdx + 1
  1224. sameRowArr.push([index])
  1225. }
  1226. }
  1227. })
  1228. this.sameRowArr = sameRowArr
  1229. }, getAdviceContent(row, isChild) {
  1230. let tempSingleDoseDesc = ''
  1231. let tempDrugSpecDesc = ''
  1232. let tempPrescribingNumberDesc = ''
  1233. if (row.prescribing_number) {
  1234. tempPrescribingNumberDesc = row.prescribing_number + '' + row.prescribing_number_unit
  1235. }
  1236. if (row.single_dose) {
  1237. if (this.template_id != 6) {
  1238. tempSingleDoseDesc = ' 单次用量 ' + ' ' + row.single_dose + '' + row.single_dose_unit
  1239. } else {
  1240. tempSingleDoseDesc = row.single_dose + '' + row.single_dose_unit
  1241. }
  1242. }
  1243. if (row.advice_desc) {
  1244. tempDrugSpecDesc = '(' + row.advice_desc + row.drug_spec_unit + ')'
  1245. }
  1246. if (isChild == 1) { // 不是子药
  1247. return row.advice_name + tempDrugSpecDesc + ' ' + tempPrescribingNumberDesc + tempSingleDoseDesc + ' ' + row.delivery_way + ' ' + row.execution_frequency
  1248. } else { // 是子药
  1249. return row.advice_name + tempDrugSpecDesc + ' ' + tempPrescribingNumberDesc + tempSingleDoseDesc
  1250. }
  1251. }
  1252. },
  1253. created() {
  1254. var date = this.$route.query && this.$route.query.date
  1255. this.record_date = uParseTime(date, '{y}-{m}-{d}')
  1256. this.form.advice_date = this.record_date
  1257. this.getAdviceConfig()
  1258. this.unitsOption = getDataConfig('hemodialysis', 'units')
  1259. this.template_id = this.$store.getters.xt_user.template_info.template_id
  1260. },
  1261. components: {
  1262. AddGroupAdvice,
  1263. EditGroupAdvice
  1264. }
  1265. }
  1266. </script>
  1267. <style>
  1268. @import "../../../../../static/css/table_row.css";
  1269. .txsj {
  1270. text-align: center;
  1271. margin-bottom: 20px;
  1272. }
  1273. .dialysisadvicenamedisplay .cell {
  1274. float: left;
  1275. text-align: left;
  1276. }
  1277. </style>
  1278. <!--<style scoped>-->
  1279. <!--.txsj{-->
  1280. <!--text-align: center;-->
  1281. <!--margin-bottom: 20px;-->
  1282. <!--}-->
  1283. <!--</style>-->
  1284. <!--<style rel="stylesheet/scss" lang="scss" >-->
  1285. <!--.row-class-active {-->
  1286. <!--background: #badcff;-->
  1287. <!--}-->
  1288. <!--.doctor-advice-box .current-box-class .current-row>td{-->
  1289. <!--background: #6fb5fa;-->
  1290. <!--color:#fff;-->
  1291. <!--}-->
  1292. <!--.doctor-advice-box .current-box-class .current-row:hover>td{-->
  1293. <!--background: #6fb5fa;-->
  1294. <!--}-->
  1295. <!--// .doctor-advice-box .current-box-class .stoped-row>td{-->
  1296. <!--// background: #c9c9c9;-->
  1297. <!--// color:#000;-->
  1298. <!--// }-->
  1299. <!--// .doctor-advice-box .current-box-class .stoped-row:hover>td{-->
  1300. <!--// background: #c9c9c9;-->
  1301. <!--// }-->
  1302. <!--</style>-->