血透系统pad前端

OrdersDialog.vue 52KB

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