1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435 |
- <template>
- <div>
- <div class="Dialog" v-show="index==0" style="width: 18rem;">
- <div class="DialogTit" @click="$emit('orderDialog')">
- <span class="iconfont"></span>
- <h1 class="name">临时医嘱</h1>
- <span class="success"> </span>
- </div>
- <div class="yzNav" style="width:100%;">
- <span @click="openNewAdvice"
- :class="{ forbid: this.$store.getters.user.user.user_type == 3 }"
- >新增医嘱</span>
- <span
- v-if="isShowExce"
- @click="execAdvice"
- :class="{ forbid: (current_advice&& current_advice.parent_id > 0)||(this.$store.getters.user.user.user_type == 2 && !isPremission) }"
- >执行医嘱</span>
- <span
- v-if="isShowMofifyExce"
- @click="modifyExecAdvice"
- :class="{ forbid: (current_advice&& current_advice.parent_id > 0) }"
- >修改执行医嘱</span>
- <span v-if="template_id != 6"
- @click="checkAdvice"
- :class="{ forbid: (current_advice&& current_advice.parent_id > 0) || (this.$store.getters.user.user.user_type == 2 && !isPremission) }"
- >医嘱核对</span>
- <span
- @click="openNewChild"
- :class="{ forbid: current_advice == null || current_advice.parent_id > 0 || currentAdvices.length != 1 || this.$store.getters.user.user.user_type == 3 }"
- >添加子药</span>
- <span v-if="currentSubAdvices.length <= 0" @click="modifyAdviceAction"
- :class="{ forbid: current_group_index < 0 || currentAdvices.length != 1 }">修改医嘱</span>
- <span v-if="currentSubAdvices.length <= 0" @click="deleteAdviceAction"
- :class="{ forbid: current_group_index < 0 || currentAdvices.length <= 0 }">删除医嘱</span>
-
- <span v-if="currentSubAdvices.length > 0" @click="modifySubdviceAction">修改子医嘱</span>
- <span v-if="currentSubAdvices.length > 0" @click="deleteSubAdviceAction">删除子医嘱</span>
-
- </div>
- <div class="DialogContent choose" id="dialogTop" style="height:6.5rem;">
- <div class="content clearfix">
-
- <table class="table">
- <tr @click="cancelAdviceSelect">
- <th width="8%">开嘱医生</th>
- <th width="10%">开始时间</th>
- <th width="40%">医嘱内容</th>
- <th width="10%">执行时间</th>
- <th width="10%">执行护士</th>
- <th v-if="template_id != 6" width="10%">核对人员</th>
- </tr>
- <template v-for="(group, group_index) in advice_groups">
- <tr
- v-for="(advice, advice_index) in group.advices"
- :key="advice.id"
- :class="{ 'row-class-active': current_group_index == group_index && current_advice_index < 0 }"
- >
- <td
- v-if="advice_index == 0"
- :rowspan="group.advices.length"
- @click="selectGroupAdviceAction(group_index, -1, null,group)"
- >
- <span v-if="advice.parent_id==0">{{getXuserName(advice.advice_doctor)}}</span>
- <span v-else></span>
- </td>
-
- <td
- v-if="advice_index == 0"
- :rowspan="group.advices.length"
- @click="selectGroupAdviceAction(group_index, -1, null,group)"
- >
- <span>{{uParseTime(advice.start_time, '{m}-{d} {h}:{i}')}}</span>
- </td>
-
- <td
- :class="{ 'advice_content': advice.parent_id == 0, 'subadvice_content': advice.parent_id > 0, 'td-active':current_group_index == group_index && advice.is_selected == 1 }"
- @click="selectAdviceAction(group_index, advice_index, advice)"
- >
- <div class="txt">
- <span>{{advice.advice_name }}</span>
- <span v-if="advice.advice_desc">({{ advice.advice_desc }}{{advice.drug_spec_unit}})</span>
- <span v-if="advice.prescribing_number"> {{advice.prescribing_number}}{{advice.prescribing_number_unit}}</span>
- <span v-if="advice.single_dose && template_id != 6" >单次用量{{advice.single_dose}}{{advice.single_dose_unit}}</span>
- <span v-if="advice.parent_id == 0">{{advice.delivery_way}}</span>
- <span v-if="advice.parent_id == 0">{{advice.execution_frequency}}</span>
- <span v-if="advice.parent_id == 0 && advice.remark.length > 0">({{advice.remark}})</span>
-
- </div>
- </td>
-
- <td
- :class="{'td-active':current_group_index == group_index && advice.is_selected == 1}"
-
- @click="selectAdviceAction(group_index,advice_index, advice)"
- >{{uParseTime(advice.execution_time, '{m}-{d} {h}:{i}')}}
- </td>
-
- <td
- :class="{'td-active':current_group_index == group_index && advice.is_selected == 1}"
- @click="selectAdviceAction(group_index,advice_index, advice)"
-
- > {{getXuserName(advice.execution_staff)}}
- </td>
- <td
- :class="{'td-active':current_group_index == group_index && advice.is_selected == 1}"
- @click="selectAdviceAction(group_index,advice_index, advice)"
- >{{getXuserName(advice.checker)}}
- </td>
- </tr>
- </template>
- </table>
- </div>
- </div>
- </div>
-
- <add-new-order-dialog
- v-show="index==1&&isShowDialog"
- @back-action="index = 0"
- :patient_id="patient.id"
- :drug_spec_unit_options="unitsOption"
- :delivery_way_options="deliveryWayOptions"
- :execution_frequency_options="executionFrequencyOptions"
- :single_dose_unit_options="unitsOption"
- :prescribing_number_unit_options="unitsOption"
- :advice_templates="adviceTemplates"
- @did-create-advices="didCreateAdvices"
- ></add-new-order-dialog>
-
- <advice-form
- ref="subdrug_form"
- @back="index = 0"
- @did-create-subdrug="didAddSubdrug"
- :single_dose_unit_options="unitsOption"
- :prescribing_number_unit_options="unitsOption"
- :drug_spec_unit_options="unitsOption"
- ></advice-form>
-
- <modify-advice-form
- ref="modify_advice_form"
- @back="index = 0"
- @did-modify="didModifyAdvice"
- :drug_spec_unit_options="unitsOption"
- :delivery_way_options="deliveryWayOptions"
- :execution_frequency_options="executionFrequencyOptions"
- :single_dose_unit_options="unitsOption"
- :prescribing_number_unit_options="unitsOption"
- ></modify-advice-form>
-
- <modify-advice-group-dialog
- ref="modify_advice_group"
- @back="index = 0"
- :patient_id="patient.id"
- :delivery_way_options="deliveryWayOptions"
- :execution_frequency_options="executionFrequencyOptions"
- :single_dose_unit_options="unitsOption"
- :drug_spec_unit_options="unitsOption"
- :prescribing_number_unit_options="unitsOption"
- :advice_templates="adviceTemplates"
- @did-create-advices="didCreateAdvices"
- ></modify-advice-group-dialog>
-
- <mt-datetime-picker
- ref="exec_time"
- type="datetime"
- @confirm="handleExecTime"
- v-model="nowExecTime"
- ></mt-datetime-picker>
-
- <mt-datetime-picker
- ref="mofify_exec_time"
- type="datetime"
- @confirm="handleModifyExecTime"
- v-model="nowExecTime"
- ></mt-datetime-picker>
- </div>
- </template>
-
- <script>
- import {Dialog, Toast} from 'vant'
- import {
- CheckDoctorAdvice,
- CreateDoctorAdvice,
- DeleteDoctorAdviceNew,
- DeleteSubDoctorAdvice,
- EditDoctorAdvice,
- ExecDoctorAdvice,
- getAdviceConfig,
- ModifyExecDoctorAdvice
- } from '@/api/advice'
- import {uParseTime} from '@/utils/tools'
- import CheckBoxSubMenu from './subMenu/checkBoxSubMenu'
- import {getDataConfig} from '@/utils/data'
- import AddNewOrderDialog from './new_order/AddNewOrders'
- import AdviceForm from './new_order/order_form'
- import ModifyAdviceForm from './modify_order/modify_order_form'
- import ModifyAdviceGroupDialog from './modify_order/ModifyAdviceGroup'
-
- export default {
- name: 'OrdersDialog',
- components: {
- CheckBoxSubMenu,
- AddNewOrderDialog,
- AdviceForm,
- ModifyAdviceForm,
- ModifyAdviceGroupDialog,
-
- },
- props: {
- advice_groups: {
- type: Array,
- default: () => {
- return []
- }
- },
- patient_prop: {
- type: Object
- },
- advice_list_prop: {
- type: Array
- },
- admin_users_prop: {
- type: Array
- },
- special_premission:{
- type: Array
- }
-
- },
- data () {
- return {
- isShowDialog: true,
- template_id: 0,
- isShowExce: true,
- isShowMofifyExce: false,
- title: '临时医嘱',
- index: 0,
- doctor: '',
- adviceTemplates: [],
- drugOptions: {},
- deliveryWayOptions: [],
- executionFrequencyOptions: [],
- unitsOption: [],
- unitsObj: [],
- record_date: '',
- nowExecTime: new Date(),
- patient: {
- id: 0
- },
- admin_users: [],
- adviceList: [],
- parent_id: 0,
- current_select_object: -1,
- current_group_index: -1,
- current_advice_index: -1,
- current_advice: null,
- currentAdviceIdsStr: '',
- currentAdvices: [],
- currentSubAdvices: [],
- isPremission:false,
-
- }
- },
- created () {
- this.template_id = this.$store.getters.user.template_info.template_id
- var date = this.$route.query && this.$route.query.date
- date *= 1000
- var newDate = new Date(date)
-
- var y = newDate.getFullYear()
- var m = newDate.getMonth() + 1
- var d = newDate.getDate()
- if (isNaN(y) || isNaN(m) || isNaN(d)) {
- newDate = new Date()
- y = newDate.getFullYear()
- m = newDate.getMonth() + 1
- d = newDate.getDate()
- }
- this.record_date =
- y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d)
-
- this.patient = this.patient_prop
- this.adviceList = this.advice_list_prop
- this.admin_users = this.admin_users_prop
- this.doctor = this.$store.getters.user.user.user_name
- this.getAdviceConfig()
-
- this.unitsOption = getDataConfig('hemodialysis', 'units')
- for (var index in this.unitsOption) {
- this.unitsObj[this.unitsOption[index].id] = this.unitsOption[index]
- }
-
- for (let i = 0; i < this.special_premission.length; i++) {
- if (this.$store.getters.user.user.id == this.special_premission[i].admin_user_id) {
- this.isPremission = true
- }
- }
-
-
- },
- watch: {
- 'advice_groups': function () {
-
- },
- 'currentAdvices': function (currentAdvices) {
- if (currentAdvices.length == 0) {
- this.isShowExce = true
- this.isShowMofifyExce = false
- } else {
- let a = 0
- for (let i = 0; i < currentAdvices.length; i++) {
- if (currentAdvices[i].execution_state == 1) {
- a = a + 1
- }
- }
-
-
- if (a == currentAdvices.length) {
- this.isShowExce = false
- this.isShowMofifyExce = true
- }else{
- this.isShowExce = true
- this.isShowMofifyExce = false
- }
- }
- }
-
- },
-
- methods: {
- modifyExecAdvice: function () {
- // if(!this.isPremission){
- // Toast.fail('你没有权限修改医嘱!')
- // }else{
- this.nowExecTime = new Date(this.currentAdvices[0].start_time * 1000)
- this.$refs.mofify_exec_time.open()
-
- // }
-
- },
- didCreateAdvices: function (advices) {
-
- if (advices.length == 0) {
- return
- }
- for (let i = 0; i < advices.length; i++) {
- advices[i]['is_selected'] = 0
- }
-
- var new_group = Object.assign(
- {},
- {
- group_no: 0,
- start_time: 0,
- advices: []
- }
- )
- new_group.group_no = advices[0].groupno
- new_group.start_time = advices[0].start_time
- new_group.advices.push(...advices)
-
- var insertIndex = -1
- for (let index = 0; index < this.advice_groups.length; index++) {
- const group = this.advice_groups[index]
- if (group.start_time < new_group.start_time) {
- insertIndex = index
- break
- }
- }
- if (insertIndex < 0) {
- this.advice_groups.push(new_group)
- } else {
- this.advice_groups.splice(insertIndex, 0, new_group)
- }
- this.index = 0
- this.advice_groups.sort((a, b) => a.start_time - b.start_time)
-
- },
- didModifyAdvice: function (advice) {
- Toast.loading({forbidClick: true, duration: 0})
- EditDoctorAdvice(advice.id, {
- advice_name: advice.title,
- advice_desc: advice.advice_desc,
- remark: advice.remark,
- start_time: advice.start_time,
- drug_spec: String(advice.drug_spec),
- drug_spec_unit: advice.drug_spec_unit,
- delivery_way: advice.delivery_way,
- execution_frequency: advice.execution_frequency,
- single_dose: String(advice.single_dose),
- single_dose_unit: advice.single_dose_unit,
- prescribing_number: String(advice.prescribing_number),
- prescribing_number_unit: advice.prescribing_number_unit
- })
- .then(rs => {
- if (rs.data.state == 1) {
- var resp_advice = rs.data.data.advice
- if(!rs.data.data.isChange){
- var group = this.advice_groups[this.current_group_index]
- for (let index = 0; index < group.advices.length; index++) {
- const advice = group.advices[index]
- if (advice.id == resp_advice.id) {
- advice.advice_name = resp_advice.advice_name
- advice.advice_desc = resp_advice.advice_desc
- advice.remark = resp_advice.remark;
- advice.start_time = resp_advice.start_time;
- advice.drug_spec = resp_advice.drug_spec;
- (advice.drug_spec_unit = resp_advice.drug_spec_unit),
- (advice.delivery_way = resp_advice.delivery_way),
- (advice.execution_frequency =
- resp_advice.execution_frequency),
- (advice.single_dose = resp_advice.single_dose),
- (advice.single_dose_unit = resp_advice.single_dose_unit),
- (advice.prescribing_number = resp_advice.prescribing_number),
- (advice.prescribing_number_unit =
- resp_advice.prescribing_number_unit)
- break
- }
- }
- }else{
- // var group = this.advice_groups[this.current_group_index]
- //先删除旧数据,再插入新数据
- var adviceArr = this.advice_groups[this.current_group_index].advices
- for (let y = resp_advice.length - 1; y >= 0; y--) {
- for (let i = adviceArr.length - 1; i >= 0; i--) {
- if (adviceArr[i].id == resp_advice[y].id || adviceArr[i].parent_id == resp_advice[y].id) {
- adviceArr.splice(i, 1)
- }
- }
- }
- var newAdvice = {}
- newAdvice['advices'] = resp_advice
- newAdvice['group_no'] = resp_advice[0].groupno
- this.advice_groups.push(newAdvice)
- }
-
- this.currentAdvices = []
- this.currentSubAdvices = []
- for (let i = 0; i < this.advice_groups.length; i++) {
- for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
- var advices = this.advice_groups[i].advices[y]
- advices.is_selected = 0
- }
- }
- console.log(this.advice_groups)
-
- this.advice_groups.sort((a, b) => a.advices[0].start_time - b.advices[0].start_time)
-
- this.$refs.modify_advice_form.dismiss()
- Toast.clear()
- this.index = 0
- } else {
- Toast.fail(rs.data.msg)
- }
- })
- .catch(err => {
- Toast.fail(err)
- })
- },
- uParseTime (time, format) {
- if (time == 0) {
-
- return ''
- }
- return uParseTime(time, format)
- },
- getXuserName (id) {
- if (id <= 0) {
- return ''
- }
- var name = ''
- if (
- this.admin_users == null ||
- typeof this.admin_users.length == 'undefined'
- ) {
- return name
- }
- var leng = this.admin_users.length
- if (leng == 0) {
- return name
- }
- for (let index = 0; index < leng; index++) {
- if (this.admin_users[index].id == id) {
- name = this.admin_users[index].name
- break
- }
- }
- return name
- },
- didAddSubdrug: function (subdrug) {
- Toast.loading({forbidClick: true, duration: 0})
- CreateDoctorAdvice(this.patient.id, {
- parent_id: subdrug.parent_id,
- advice_type: 2,
- advice_date: subdrug.record_time,
- start_time: subdrug.start_time,
- advice_name: subdrug.title,
- advice_desc: subdrug.advice_desc,
- drug_spec: String(subdrug.drug_spec),
- drug_spec_unit: subdrug.drug_spec_unit,
- single_dose: String(subdrug.single_dose),
- single_dose_unit: subdrug.single_dose_unit,
- prescribing_number: String(subdrug.prescribing_number),
- prescribing_number_unit: subdrug.prescribing_number_unit
- // delivery_way: subdrug.delivery_way,
- // execution_frequency: subdrug.execution_frequency
- })
- .then(response => {
- if (response.data.state == 0) {
- Toast.fail(response.data.msg)
- return false
- } else {
- Toast.success('添加成功')
- var resp_advice = response.data.data.advice
- var group_index = this.current_group_index
-
- var adviceArr = this.advice_groups[this.current_group_index].advices
- for (let i = 0; i < adviceArr.length; i++) {
- if (adviceArr[i].id == this.currentAdvices[0].id && adviceArr[i].is_selected == 1) {
- var advice_index = i
-
- }
- }
-
- var group = this.advice_groups[group_index]
-
- var insert_index = -1
- var last_child_index = -1
- for (
- let index = advice_index + 1;
- index < group.advices.length;
- index++
- ) {
- const advice = group.advices[index]
- if (resp_advice.parent_id != advice.parent_id) {
- insert_index = index
- break
- } else {
- last_child_index = index
- }
- }
- if (insert_index < 0) {
- if (last_child_index < 0) {
- group.advices.splice(advice_index + 1, 0, resp_advice)
- } else {
- group.advices.splice(last_child_index + 1, 0, resp_advice)
- }
- } else {
- group.advices.splice(insert_index, 0, resp_advice)
- }
-
- this.cancelAdviceSelect()
- this.$refs.subdrug_form.dismiss()
- this.index = 0
- // this.$emit("new_create", response.data.data.advice);
-
- this.currentAdvices = []
- this.currentSubAdvices = []
- for (let i = 0; i < this.advice_groups.length; i++) {
- for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
- var advices = this.advice_groups[i].advices[y]
- advices.is_selected = 0
- }
- }
-
- return false
-
- }
- })
- .catch(err => {
- Toast.fail(err)
- })
- },
- getAdviceConfig () {
- getAdviceConfig().then(response => {
- if (response.data.state == 1) {
- this.deliveryWayOptions =
- response.data.data.drugways === null
- ? []
- : response.data.data.drugways
- this.executionFrequencyOptions =
- response.data.data.efs === null ? [] : response.data.data.efs
-
- this.adviceTemplates =
- response.data.data.advice_templates === null
- ? []
- : response.data.data.advice_templates
- }
- })
- },handleModifyExecTime(time){
- var exceTime = this.handleTime(time)
- var currentAdviceIdArr = []
- var exceParams = null
- for (let i = 0; i < this.currentAdvices.length; i++) {
- if ( this.currentAdvices[i].execution_state == 1) {
- currentAdviceIdArr.push(this.currentAdvices[i].id)
- }
- }
- this.currentAdviceIdsStr = currentAdviceIdArr.join(',')
- if (this.current_select_object == 1) {
- exceParams = {
- groupno: 0,
- advice_id: this.currentAdviceIdsStr,
- execution_time: exceTime
- }
-
- } else {
- var group = this.advice_groups[this.current_group_index]
- exceParams = {
- groupno: group.group_no <= 0 ? 0 : group.group_no,
- advice_id: group.group_no <= 0 ? group.advices[0].id : 0,
- execution_time: exceTime
- }
- }
-
- ModifyExecDoctorAdvice(exceParams)
- .then(response => {
- if (response.data.state == 0) {
- Toast.fail(response.data.msg)
- return false
- } else {
- Toast.success('执行成功!')
- var advice = response.data.data.advice
- if (this.current_select_object == 1) {
- var ids = this.currentAdviceIdsStr.split(',')
- var adviceArr = this.advice_groups[this.current_group_index].advices
- for (let i = 0; i < adviceArr.length; i++) {
- for (let a = 0; a < ids.length; a++) {
- if ((adviceArr[i].execution_state == 1 && adviceArr[i].id == ids[a]) || (adviceArr[i].execution_state == 1 && adviceArr[i].parent_id == ids[a])) {
- adviceArr[i].execution_time = advice.execution_time
- }
- }
- }
- } else {
- for (let index = 0; index < group.advices.length; index++) {
- const adv = group.advices[index]
- if (adv.execution_state == 1) {
- adv.execution_time = advice.execution_time
- }
- }
- }
- }
- })
- .catch(err => {
- Toast.fail(err)
- return false
- })
-
-
-
- },
- handleExecTime (time) {
- var exceTime = this.handleTime(time)
- var exceParams = null
- if (this.current_select_object == 1) {
- exceParams = {
- groupno: 0,
- advice_id: this.currentAdviceIdsStr,
- execution_time: exceTime
- }
-
- } else {
- var group = this.advice_groups[this.current_group_index]
- exceParams = {
- groupno: group.group_no <= 0 ? 0 : group.group_no,
- advice_id: group.group_no <= 0 ? group.advices[0].id : 0,
- execution_time: exceTime
- }
- }
- Toast.loading({forbidClick: true, duration: 0})
- ExecDoctorAdvice(exceParams)
- .then(response => {
- if (response.data.state == 0) {
- Toast.fail(response.data.msg)
- return false
- } else {
- Toast.success('执行成功!')
- var advice = response.data.data.advice
- if (this.current_select_object == 1) {
- var ids = this.currentAdviceIdsStr.split(',')
- var adviceArr = this.advice_groups[this.current_group_index].advices
- for (let i = 0; i < adviceArr.length; i++) {
- for (let a = 0; a < ids.length; a++) {
- if ((adviceArr[i].execution_state == 2 && adviceArr[i].id == ids[a]) || (adviceArr[i].execution_state == 2 && adviceArr[i].parent_id == ids[a])) {
- adviceArr[i].execution_staff = advice.execution_staff
- adviceArr[i].execution_time = advice.execution_time
- adviceArr[i].execution_state = advice.execution_state
- }
- }
- }
- } else {
- for (let index = 0; index < group.advices.length; index++) {
- const adv = group.advices[index]
- if (adv.execution_state == 2) {
- adv.execution_staff = advice.execution_staff
- adv.execution_time = advice.execution_time
- adv.execution_state = advice.execution_state
- }
- }
- }
- }
- })
- .catch(err => {
- Toast.fail(err)
- return false
- })
-
- },
- handleTime (time) {
- var year = time.getFullYear()
- var month = time.getMonth() + 1
- var day = time.getDate()
- var hour = time.getHours()
- var minute = time.getMinutes()
- if (month < 10) {
- month = '0' + month
- }
- if (day < 10) {
- day = '0' + day
- }
- if (hour < 10) {
- hour = '0' + hour
- }
- if (minute < 10) {
- minute = '0' + minute
- }
- return year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':00'
- }, deleteSubAdviceAction: function () {
- if (this.currentSubAdvices.length <= 0) {
- return
- }
- Dialog.confirm({
- title: '删除医嘱',
- message: '确认删除医嘱吗?'
- }).then(() => {
- Toast.loading({forbidClick: true, duration: 0})
- DeleteSubDoctorAdvice(this.currentSubAdvices[0].id)
- .then(rs => {
- if (rs.data.state == 1) {
- Toast.success('删除成功')
- var adviceArr = this.advice_groups[this.current_group_index].advices
- for (let i = adviceArr.length - 1; i >= 0; i--) {
- if (adviceArr[i].id == this.currentSubAdvices[0].id) {
- adviceArr.splice(i, 1)
- }
- }
- this.currentSubAdvices = []
- this.currentAdvices = []
- for (let i = 0; i < this.advice_groups.length; i++) {
- for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
- var advices = this.advice_groups[i].advices[y]
- advices.is_selected = 0
- }
- }
-
- } else {
-
- Toast.fail(rs.data.msg)
- }
- })
- .catch(err => {
- Toast.fail(err)
- })
- })
-
- },
- deleteAdviceAction: function () {
- if (this.current_select_object == 1) {
- if (this.currentAdvices.length <= 0) {
- return
- }
- Dialog.confirm({
- title: '删除医嘱',
- message: '确认删除医嘱吗?'
- }).then(() => {
- Toast.loading({forbidClick: true, duration: 0})
- var group_no = 0
- var advice_id = this.currentAdvices.join(',')
- var ids = []
- for (let i = 0; i < this.currentAdvices.length; i++) {
- ids.push(this.currentAdvices[i].id)
- }
- advice_id = ids.join(',')
-
- DeleteDoctorAdviceNew(group_no, advice_id)
- .then(rs => {
- if (rs.data.state == 1) {
- Toast.success('删除成功')
- var adviceArr = this.advice_groups[this.current_group_index].advices
-
- for (let y = ids.length - 1; y >= 0; y--) {
- for (let i = adviceArr.length - 1; i >= 0; i--) {
- if (adviceArr[i].id == ids[y] || adviceArr[i].parent_id == ids[y]) {
- adviceArr.splice(i, 1)
- }
- }
- }
- this.currentSubAdvices = []
- this.currentAdvices = []
- for (let i = 0; i < this.advice_groups.length; i++) {
- for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
- var advices = this.advice_groups[i].advices[y]
- advices.is_selected = 0
- }
- }
-
- } else {
- Toast.fail(rs.data.msg)
- }
- })
- .catch(err => {
- Toast.fail(err)
- })
- })
-
- } else {
- if (this.current_group_index < 0) {
- return
- }
- var group = this.advice_groups[this.current_group_index]
- Dialog.confirm({
- title: '删除医嘱',
- message: '确认删除这组医嘱吗?'
- }).then(() => {
- Toast.loading({forbidClick: true, duration: 0})
- var group_no = group.group_no <= 0 ? 0 : group.group_no
- var advice_id = 0
- if (group.group_no <= 0) {
- advice_id = group.advices[0].id
- } else if (this.current_advice != null) {
- group_no = 0
- advice_id = this.current_advice.id
- }
-
- DeleteDoctorAdviceNew(group_no, advice_id)
- .then(rs => {
- if (rs.data.state == 1) {
- Toast.success('删除成功')
- // if (group.group_no <= 0) {
- // this.advice_groups.splice(this.current_group_index, 1);
- // } else {
- if (this.current_advice_index >= 0) {
- // if (group.advices.length <= 1) {
- // this.advice_groups.splice(this.current_group_index, 1);
- // } else {
- var advice = group.advices[this.current_advice_index]
- if (advice.parent_id > 0) {
- group.advices.splice(this.current_advice_index, 1)
- } else {
- var child_count = 0
- for (
- let index = this.current_advice_index + 1;
- index < group.advices.length;
- index++
- ) {
- const adv = group.advices[index]
- if (adv.parent_id == advice.id) {
- child_count++
- }
- }
- group.advices.splice(
- this.current_advice_index,
- child_count + 1
- )
- }
- if (group.advices.length == 0) {
- this.advice_groups.splice(this.current_group_index, 1)
- }
- // }
- } else {
- this.advice_groups.splice(this.current_group_index, 1)
- }
- // }
- this.cancelAdviceSelect()
- } else {
- Toast.fail(rs.data.msg)
- }
- })
- .catch(err => {
- Toast.fail(err)
- })
- })
- }
- },
- checkAdvice () {
- if (this.currentAdvices.length <= 0) {
- return
- }
-
- if (this.current_select_object == 1) {
- var isCheck = true
- var adviceArr = this.advice_groups[this.current_group_index].advices
- for (let i = 0; i < adviceArr.length; i++) {
- if (adviceArr[i].check_state == 0 && adviceArr[i].is_selected == 1) {
- isCheck = false
- }
- }
- if (isCheck) {
- Toast.fail('所选医嘱已核对')
- return false
- }
-
- for (let i = 0; i < adviceArr.length; i++) {
- if (adviceArr[i].is_selected == 1 && adviceArr[i].execution_staff > 0 && adviceArr[i].execution_staff == this.$store.getters.user.user.id) {
- Toast.fail('核对与执行不能是同一人')
- return false
- }
- }
-
- var currentAdviceIdArr = []
- for (let i = 0; i < adviceArr.length; i++) {
- if (adviceArr[i].is_selected == 1) {
- currentAdviceIdArr.push(adviceArr[i].id)
- }
- }
- this.currentAdviceIdsStr = currentAdviceIdArr.join(',')
-
- } else {
- if (!(this.current_group_index >= 0 && this.current_advice_index < 0)) {
- return
- }
- var isCheck = true
- var group_top_advice = this.advice_groups[this.current_group_index]
- .advices[0]
-
- var adviceArr = this.advice_groups[this.current_group_index].advices
- var advice = null
- for (let i = 0; i < adviceArr.length; i++) {
- if (adviceArr[i].check_state == 0) {
- isCheck = false
- }
- }
-
- if (isCheck) {
- Toast.fail('所选医嘱已核对')
- return false
- }
-
- for (let i = 0; i < adviceArr.length; i++) {
- if (adviceArr[i].is_selected == 1 && adviceArr[i].execution_staff > 0 && adviceArr[i].execution_staff == this.$store.getters.user.user.id) {
- Toast.fail('核对与执行不能是同一人')
- return false
- }
- }
-
- // if (
- // group_top_advice.execution_staff > 0 &&
- // group_top_advice.execution_staff == this.$store.getters.user.user.id
- // ) {
- // Toast.fail('核对与执行不能是同一人')
- // return false
- // }
- }
-
- Dialog.confirm({
- title: '医嘱核对',
- message: '确认提交核对?'
- }).then(() => {
- var params = null
- Toast.loading({forbidClick: true, duration: 0})
- if (this.current_select_object == 1) {
- params = {
- groupno: 0,
- advice_id: this.currentAdviceIdsStr
- }
- } else {
- var group = this.advice_groups[this.current_group_index]
- params = {
- groupno: group.group_no <= 0 ? 0 : group.group_no,
- advice_id: group.group_no <= 0 ? group.advices[0].id : 0
- }
- }
-
- CheckDoctorAdvice(params)
- .then(response => {
- if (response.data.state == 0) {
- return false
- } else {
- Toast.success('核对成功!')
-
- var advice = response.data.data.advice
- if (this.current_select_object == 1) {
- var ids = this.currentAdviceIdsStr.split(',')
-
- var adviceArr = this.advice_groups[this.current_group_index].advices
- for (let i = 0; i < adviceArr.length; i++) {
- for (let a = 0; a < ids.length; a++) {
- if ((adviceArr[i].check_state == 0 && adviceArr[i].id == ids[a]) || (adviceArr[i].check_state == 0 && adviceArr[i].parent_id == ids[a])) {
- adviceArr[i].checker = advice.checker
- adviceArr[i].check_time = advice.check_time
- adviceArr[i].check_state = advice.check_state
- }
- }
- }
- } else {
- for (let index = 0; index < group.advices.length; index++) {
- const adv = group.advices[index]
- adv.checker = advice.checker
- adv.check_time = advice.check_time
- adv.check_state = advice.check_state
- }
- }
-
- }
- })
- .catch(err => {
- Toast.fail(err)
- })
- })
- // .catch(err => {
- // Toast.fail(err);
- // });
- },
- execAdvice () {
-
- if (this.currentAdvices.length <= 0) {
- return
- }
- if (this.current_select_object == 1) {
- var isExecution = true
- var adviceArr = this.advice_groups[this.current_group_index].advices
- for (let i = 0; i < adviceArr.length; i++) {
- if (adviceArr[i].execution_state == 2 && adviceArr[i].is_selected == 1) {
- isExecution = false
- }
- }
- if (isExecution) {
- Toast.fail('所选医嘱已停止或执行')
- return false
- }
-
- for (let i = 0; i < adviceArr.length; i++) {
- if (adviceArr[i].is_selected == 1 && adviceArr[i].checker > 0 && adviceArr[i].checker == this.$store.getters.user.user.id) {
- Toast.fail('核对与执行不能是同一人')
- return false
- }
- }
- var currentAdviceIdArr = []
- for (let i = 0; i < adviceArr.length; i++) {
- if (adviceArr[i].is_selected == 1) {
- currentAdviceIdArr.push(adviceArr[i].id)
- }
- }
- this.currentAdviceIdsStr = currentAdviceIdArr.join(',')
- this.nowExecTime = new Date(adviceArr[0].start_time * 1000)
- } else {
- if (!(this.current_group_index >= 0 && this.current_advice_index < 0)) {
- return
- }
- var isExecution = true
- var group_top_advice = this.advice_groups[this.current_group_index]
- .advices[0]
-
- var adviceArr = this.advice_groups[this.current_group_index].advices
- for (let i = 0; i < adviceArr.length; i++) {
- if (adviceArr[i].is_selected == 1 && adviceArr[i].execution_state == 2) {
- isExecution = false
- }
- }
- if (isExecution) {
- Toast.fail('所选医嘱已停止或执行')
- return false
- }
-
- for (let i = 0; i < adviceArr.length; i++) {
- if (adviceArr[i].is_selected == 1 && adviceArr[i].checker > 0 && adviceArr[i].checker == this.$store.getters.user.user.id) {
- Toast.fail('核对与执行不能是同一人')
- return false
- }
- }
-
- this.nowExecTime = new Date(group_top_advice.start_time * 1000)
- }
- this.$refs.exec_time.open()
- },
- openNewChild () {
- if (this.$store.getters.user.user.user_type == 3) {
- Toast.fail('你没有权限添加子药!')
- return
- }
-
- if (this.currentAdvices.length == 0) {0
- return false
- }
- this.current_advice = this.currentAdvices[0]
-
- if (
- this.current_advice.stop_state == 1 ||
- this.current_advice.execution_state == 1 ||
- this.current_advice.check_state == 1
-
- ) {
- Toast.fail('所选医嘱已停止或执行或核对')
- return false
- }
-
- this.index = 2
- var start_time = uParseTime(
- this.current_advice.start_time,
- '{y}-{m}-{d} {h}:{i}'
- )
- this.$refs.subdrug_form.showWithNewSubDrug(
- this.current_advice.id,
- this.record_date,
- start_time,
- this.current_advice.delivery_way,
- this.current_advice.execution_frequency
- )
- return
- },
- openNewAdvice () {
- if (this.$store.getters.user.user.user_type == 3) {
- Toast.fail('你没有权限新增医嘱!')
- return
- }
-
- this.currentAdvices = []
- this.currentSubAdvices = []
- for (let i = 0; i < this.advice_groups.length; i++) {
- for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
- var advices = this.advice_groups[i].advices[y]
- advices.is_selected = 0
- }
- }
-
- this.index = 1
- this.current_group_index = -1
- this.current_advice_index = -1
- this.current_advice = null
- }, modifySubdviceAction: function () {
- if (this.currentSubAdvices.length <= 0) {
- return
- }
-
- if (this.current_advice_index >= 0) {
- this.index = 3
- var advice = this.currentSubAdvices[0]
- this.$refs.modify_advice_form.showWithModify({
- id: advice.id,
- parent_id: advice.parent_id,
- title: advice.advice_name,
- advice_desc: advice.advice_desc,
- remark: advice.remark,
- drug_spec: advice.drug_spec,
- drug_spec_unit: advice.drug_spec_unit,
- delivery_way: advice.delivery_way,
- execution_frequency: advice.execution_frequency,
- single_dose: advice.single_dose,
- single_dose_unit: advice.single_dose_unit,
- prescribing_number: advice.prescribing_number,
- prescribing_number_unit: advice.prescribing_number_unit
- })
- }
-
- },
- modifyAdviceAction: function () {
- if (this.current_group_index < 0) {
- return
- }
- var group = this.advice_groups[this.current_group_index]
-
- if (this.current_advice_index >= 0) {
- this.index = 3
- var advice = this.currentAdvices[0]
- this.$refs.modify_advice_form.showWithModify({
- id: advice.id,
- parent_id: advice.parent_id,
- title: advice.advice_name,
- advice_desc: advice.advice_desc,
- remark: advice.remark,
- start_time: advice.start_time,
- drug_spec: advice.drug_spec,
- drug_spec_unit: advice.drug_spec_unit,
- delivery_way: advice.delivery_way,
- execution_frequency: advice.execution_frequency,
- single_dose: advice.single_dose,
- single_dose_unit: advice.single_dose_unit,
- prescribing_number: advice.prescribing_number,
- prescribing_number_unit: advice.prescribing_number_unit
- })
- } else {
- if (group.group_no <= 0) {
- this.index = 3
- var advice = group.advices[0]
- this.$refs.modify_advice_form.showWithModify({
- id: advice.id,
- parent_id: advice.parent_id,
- title: advice.advice_name,
- advice_desc: advice.advice_desc,
- remark: advice.remark,
-
- drug_spec: advice.drug_spec,
- drug_spec_unit: advice.drug_spec_unit,
- delivery_way: advice.delivery_way,
- execution_frequency: advice.execution_frequency,
- single_dose: advice.single_dose,
- single_dose_unit: advice.single_dose_unit,
- prescribing_number: advice.prescribing_number,
- prescribing_number_unit: advice.prescribing_number_unit
- })
- } else {
- this.index = 4
- this.$refs.modify_advice_group.show(group.group_no, group.advices)
- }
- }
- },
-
- cancelAdviceSelect: function () {
- this.current_group_index = -1
- this.current_advice_index = -1
- this.current_advice = null
- },
- selectAdviceAction: function (group_index, advice_index, advice) {
- console.log(this.current_group_index)
- console.log(group_index)
- console.log(advice.parent_id)
-
-
-
- if ((this.current_group_index != -1 && this.current_group_index != group_index) || advice.parent_id > 0) { //选择其他组,将原来的组选择状态清除
- this.currentAdvices = []
- this.currentSubAdvices = []
- for (let i = 0; i < this.advice_groups.length; i++) {
- for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
- var advices = this.advice_groups[i].advices[y]
- advices.is_selected = 0
- }
- }
- }
-
- for (let i = 0; i < this.advice_groups.length; i++) { //选择子医嘱,将已经选择的医嘱选择状态清除
- for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
- var advices = this.advice_groups[i].advices[y]
- if (advices.parent_id > 0) {
- advices.is_selected = 0
- }
- }
- }
-
- for (let i = 0; i < this.advice_groups.length; i++) { //设置选择状态
- for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
- var advices = this.advice_groups[i].advices[y]
- if (advices.id == advice.id) {
- if (advice.is_selected == 1) {
- advice.is_selected = 0
- for (let a = this.currentAdvices.length - 1; a >= 0; a--) {
- if (this.currentAdvices[a].id == advice.id) {
- this.currentAdvices.splice(a, 1)
- }
- }
- } else {
- advice.is_selected = 1
- if (advice.parent_id == 0) {
- this.currentAdvices.push(advice)
- }
- }
- }
-
- }
- }
-
- if (advice.parent_id == 0) {
- this.currentSubAdvices = []
- } else {
- this.currentSubAdvices.push(advice)
- }
-
- this.current_select_object = 1 //单条医嘱
- this.current_group_index = group_index
- this.current_advice_index = advice_index
- this.current_advice = advice
-
- }, selectGroupAdviceAction: function (group_index, advice_index, advice, group) {
-
- if (this.current_group_index != -1 && this.current_group_index != group_index) { //选择其他组,将原来的组选择状态清除
- this.currentAdvices = []
- this.currentSubAdvices = []
- for (let i = 0; i < this.advice_groups.length; i++) {
- for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
- var advices = this.advice_groups[i].advices[y]
- advices.is_selected = 0
- }
- }
- }
-
- for (let i = 0; i < this.advice_groups.length; i++) { //选择子医嘱,将已经选择的医嘱选择状态清除
- for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
- var advices = this.advice_groups[i].advices[y]
- if (advices.parent_id > 0) {
- advices.is_selected = 0
- }
- }
- }
-
- for (let i = 0; i < this.advice_groups.length; i++) {
- for (let y = 0; y < this.advice_groups[i].advices.length; y++) {
- var advices = this.advice_groups[i].advices[y]
- if (advices.groupno == group.group_no) {
- advices.is_selected = 1
- this.currentAdvices.push(advices)
- }
- }
- }
- this.current_select_object = 2 //单组医嘱
- this.current_group_index = group_index
- this.current_advice_index = advice_index
- this.current_advice = advice
- }
- }
- }
- </script>
-
- <style style="stylesheet/scss" lang="scss" scoped>
- .DialogContent{
- .content{
- .yzNav{
- position: fixed;
- top: 0.16rem;
- }
- }
- }
- .table {
- width: 100%;
- tr {
- th {
- background: $main-color;
- color: #fff;
- height: 0.88rem;
- line-height: 0.88rem;
- }
- td {
- line-height: 0.4rem;
- .txt {
- // float: left;
- padding: 0 10px 0 10px;
- // width: 75%;
- text-align: left;
- }
- .ico {
- float: right;
- width: 60px;
- text-align: right;
- padding-right: 3px;
- }
- .iconfont {
- font-size: 20px;
- padding: 0 2px;
- color: #7b8a97;
- }
- .handle {
- color: #409eff;
- // padding: 0 7px;
- }
- }
- .advice_content {
- // background: #eff6fc;
- }
- .subadvice_content {
- // background: #fafcfe;
- padding-left: 20px;
- }
- .td-active {
- background: #badcff !important;
- }
- }
- .row-class-active {
- td {
- background: #badcff;
- }
- }
- }
- .content {
-
- .cell {
- float: left;
- width: 3.42rem;
- margin: 0.35rem 0.3rem 0 0.4rem;
- label {
- display: block;
- height: 0.55rem;
- line-height: 0.55rem;
- color: $pgh-color;
- }
- select {
- width: 100%;
- padding: 0.2rem 0;
- border: 1px $border-color solid;
- border-radius: 2px;
- padding-left: 5px;
- }
-
- .inputBox {
- border: 1px $border-color solid;
- border-radius: 2px;
- padding: 0.18rem 0;
- padding-left: 5px;
- }
-
- .textarea {
- width: 100%;
- height: 1.22rem;
- border: 1px $border-color solid;
- border-radius: 2px;
- padding-left: 5px;
- }
- }
- .width {
- width: 90%;
- @include box-sizing;
- margin-top: 1rem;
- label {
- display: inline-block;
- }
- button {
- background: $main-color;
- color: #fff;
- border-radius: 6px;
- width: 3rem;
- height: 0.9rem;
- line-height: 0.9rem;
- text-align: center;
- margin: 0 0.1rem 0.6rem 0.1rem;
- border: 1px $main-color solid;
- &.smt-danger {
- background: #fff;
- color: $main-color;
- }
- }
- }
- .center {
- text-align: center;
- }
- }
- </style>
-
|