Commit ca004c6e authored by songrui's avatar songrui

诊断表单提交处理

parent 36a0fee3
......@@ -38,4 +38,9 @@ export function addDiagnose(params) {
// 修改诊断
export function updateDiagnose(params) {
return fetchBase({ url: `/chronic-admin/v1/chronic-diagnose-record/update`, body: params, loading: true })
}
//删除诊断
export function delDiagnose(params) {
return fetchBase({ url: `/chronic-admin/v1/chronic-diagnose-record/delete`, body: params, loading: true })
}
\ No newline at end of file
......@@ -66,7 +66,7 @@ export default {
if (!token) {
token = sessionStorage.getItem('token')
if (process.env.NODE_ENV !== 'production') {
token = 'f44efca7-3c9b-4638-b8b0-8e35c6fbb54b'
token = '779099b2-3d34-41ef-b14a-4a435fb48adb'
}
}
if (token) {
......
......@@ -374,7 +374,12 @@ export default {
this.$refs.form.validate().then(() => {
resolve(this.form)
}).catch((e) => {
console.warn('ArchiveCommon error', e)
reject('档案信息校验失败')
console.warn('档案信息校验失败', e)
const array = e || []
if (array.length) {
this.$refs.form.scrollToField(array[0].name)
}
})
})
}
......
......@@ -106,6 +106,7 @@ export default {
if (this.info.check) {
let check = this.info.check
this.check = typeof check === 'string' ? check.split(',') : check
this.checkName = this.store.getDictValue('CP00111', this.check)
}
getInspectCode(2).then(res => {
console.log(res)
......@@ -152,7 +153,12 @@ export default {
console.log(data, check)
resolve({ check, data })
}).catch((e) => {
reject(e)
reject('检查表单校验失败')
console.warn('检查表单校验失败', e)
const array = e || []
if (array.length) {
this.$refs.form.scrollToField(array[0].name)
}
})
})
},
......
......@@ -174,6 +174,7 @@ export default {
if (this.info.inspect) {
let inspect = this.info.inspect
this.inspect = typeof inspect === 'string' ? inspect.split(',') : inspect
this.inspectName = this.store.getDictValue('CP00100', this.inspect)
}
this.image = this.info.image
this.imageData = this.info.imageData || []
......@@ -210,7 +211,12 @@ export default {
console.log(data, inspect, image)
resolve({ inspect, data, image })
}).catch((e) => {
reject(e)
reject('检验表单校验失败')
console.warn('检验表单校验失败', e)
const array = e || []
if (array.length) {
this.$refs.form.scrollToField(array[0].name)
}
})
})
},
......
......@@ -7,8 +7,8 @@
:excludeType="excludeType"
:value="diseaseType"
ref="DiseaseSelect"/>
<archiveCommon :info="baseInfo" v-else-if="step == 2"></archiveCommon>
<FormCont :info="diagnoseInfo" v-else-if="step == 3"/>
<archiveCommon :info="baseInfo" v-else-if="step == 2" ref="archiveCommon"></archiveCommon>
<FormCont :info="diagnoseInfo" v-else-if="step == 3" ref="FormCont"/>
</div>
<div class="shrink-0">
<div class='bottom-small-line'></div>
......@@ -39,6 +39,7 @@ import DocNavBar from '@/doctor/components/docNavBar/DocNavBar.vue'
import archiveCommon from '@/doctor/components/archiveCommon/archiveCommon.vue'
import DiseaseSelect from './DiseaseSelect.vue'
import FormCont from './FormCont.vue'
import { useStore } from '@/doctor/store/index.js'
import { fetchDataHandle } from '@/utils/common.js'
import { getChronicResidentsId } from '@/api/doctor/generalFU'
import { showSuccessToast } from 'vant'
......@@ -53,6 +54,7 @@ export default {
},
data() {
return {
store: useStore(),
step: 1,
// 患者基础信息
baseInfo: {},
......@@ -114,12 +116,24 @@ export default {
}
},
submit() {
showSuccessToast('提交成功')
setTimeout(() => {
this.$router.replace({
path: '/doctor/workbench'
this.$refs.FormCont.submit().then(res => {
if (!res) return
console.log('FormCont.submit', res)
const query = {
...res,
residentsRecord: this.baseInfo
}
const func = query.id ? updateDiagnose : addDiagnose
func(query).then(() => {
this.store.onRefreshMark()
showSuccessToast('提交成功')
setTimeout(() => {
this.$router.replace({
path: '/doctor/workbench'
})
}, 600)
})
}, 600)
})
},
// 上一步
toPrev() {
......@@ -131,6 +145,10 @@ export default {
const diseaseType = await this.$refs.DiseaseSelect.submit()
console.log(diseaseType)
this.diagnoseInfo.diseaseType = diseaseType
} else if (this.step == 2) {
const baseInfo = await this.$refs.archiveCommon.onSubmit()
console.log(baseInfo)
this.baseInfo = baseInfo
}
this.onStep(this.step + 1)
} catch (e) {
......
......@@ -22,7 +22,7 @@ export default {
props: {
// 排除已选择的疾病
excludeType: { default: () => [] },
value: { default: () => [] }
value: Number
},
data() {
return {
......
......@@ -139,7 +139,12 @@ export default {
this.$refs.form.validate().then(() => {
resolve(this.form)
}).catch((e) => {
reject(e)
reject('医生信息校验失败')
console.warn('医生信息校验失败', e)
const array = e || []
if (array.length) {
this.$refs.form.scrollToField(array[0].name)
}
})
})
}
......
......@@ -79,7 +79,6 @@
name="diagnoseResult"
placeholder="请选择"
@click="showOptions('diagnoseResult', 'CP00103', 'checkbox')"
:rules="rules.requiredSelect"
/>
<div class='doc-form-label' required>出血性脑卒中</div>
<van-field
......@@ -89,7 +88,6 @@
name="diagnoseLevel"
placeholder="请选择"
@click="showOptions('diagnoseLevel', 'CP00104')"
:rules="rules.requiredSelect"
/>
</template>
<template v-else-if="[2,3].includes(diseaseType)">
......@@ -184,12 +182,13 @@
:disease="diseaseType"
:info="checkInfo"
ref="check"/>
<DoctorInfo :info="info"/>
<DoctorInfo :info="info" ref="DoctorInfo"/>
</div>
</template>
<script>
import { useStore } from '@/doctor/store'
import { fetchDataHandle } from '@/utils/common.js'
import InstpectCommon from '../common/Instpect.vue'
import CheckCommon from '../common/Check.vue'
import DiagnosePicker from './DiagnosePicker.vue'
......@@ -222,7 +221,12 @@ const defaultForm = (info = {}) => {
isInspect: 2,
// 是否需要检查
isCheck: 2,
diseaseType: undefined
diseaseType: undefined,
checkItem: undefined,
checkItemName: undefined,
inspectItem: undefined,
inspectItemName: undefined,
source: undefined,
}
Reflect.ownKeys(form).forEach(key => {
if (info[key] != undefined) {
......@@ -360,8 +364,98 @@ export default {
this.dateRange.min = new Date(date.year() - 20, date.month(), date.date())
},
submit() {
this.form.diseaseType = this.diseaseType
async submit() {
try {
this.$refs.form.validate()
if (this.form.diseaseType === 4) {
const diagnoseResult = this.form.diagnoseResult || []
if (!diagnoseResult.length && !this.form.diagnoseLevel) {
this.$message.info('请在 缺血性脑卒中 和 出血性脑卒中 中选择一项填写')
this.$refs.form.scrollToField('diagnoseResult')
return
}
}
this.form.diagnoseInspectList = []
if (this.form.isInspect === 1) {
let { inspect: inspectItems, data, image} = await this.$refs.inspect.submit()
let inspectObj = {}
for (let item of data) {
if (inspectObj[item.insType] === void 0) {
inspectObj[item.insType] = []
}
const insItem = {
insType: item.insType,
insName: item.insName,
itemCode: item.itemCode,
itemName: item.itemName,
itemType: item.itemType,
itemValue: item.itemValue,
unit: item.unit
}
inspectObj[item.insType].push(insItem)
}
for (let diagType in inspectObj) {
let diagInspect = {
projectType: 0,
diagnoseType: diagType,
diagnoseName: inspectObj[diagType][0].insName,
inspectDetailed: JSON.stringify(inspectObj[diagType])
}
// inspectItems.push(inspectObj[diagType][0].insType)
this.form.diagnoseInspectList.push(diagInspect)
}
this.form.inspectItem = inspectItems
this.form.inspectFile = image
}
if (this.form.isCheck === 1) {
let { check: checkItems, data } = await this.$refs.check.submit()
let checkObj = {}, fileObj = {}
for (let item of data) {
if (item.itemType === 5 && item.itemValue !== void 0 && item.itemValue !== '') {
fileObj[item.insType] = item.itemValue
} else {
if (checkObj[item.insType] === void 0) {
checkObj[item.insType] = []
}
let checkItem = {
insType: item.insType,
insName: item.insName,
itemCode: item.itemCode,
itemName: item.itemName,
itemType: item.itemType,
itemValue: item.itemValue
}
checkObj[item.insType].push(checkItem)
}
}
for (let diagType in checkObj) {
let diagCheck = {
projectType: 1,
diagnoseType: diagType,
diagnoseName: checkObj[diagType][0].insName,
inspectDetailed: JSON.stringify(checkObj[diagType]),
inspectFile: fileObj[diagType]
}
// checkItems.push(checkObj[diagType][0].insType);
this.form.diagnoseInspectList.push(diagCheck)
}
this.form.checkItem = checkItems
}
const doctorInfo = await this.$refs.DoctorInfo.submit()
let query = fetchDataHandle(this.form, {
diagnoseResult: 'arrToStr'
})
return {
...query,
...doctorInfo
}
} catch(err) {
this.$message.info('表单校验不通过')
const array = err || []
if (array.length) {
this.$refs.form.scrollToField(array[0].name)
}
}
},
// 日期确定
dateConfirm({ selectedValues }) {
......
......@@ -92,6 +92,7 @@
</template>
<script>
import { useStore } from '@/doctor/store'
import { queryResidentInfo } from '@/api/doctor/resident.js'
import { showNotify } from 'vant'
import DocNavBar from '@/doctor/components/docNavBar/DocNavBar.vue'
......@@ -118,6 +119,7 @@ export default {
},
data() {
return {
store: useStore(),
residentInfoId: null,
residentInfo: {},
// 折叠
......@@ -190,6 +192,9 @@ export default {
}
queryResidentInfo({ residentInfoId: this.residentInfoId }).then(res => {
this.residentInfo = res.data || {}
if (!this.activeTabItem.value) {
this.activeTab = 0
}
})
},
onAddChange(val, option) {
......@@ -221,6 +226,9 @@ export default {
if (!val) return
this.residentInfo = {}
this.load()
},
'store.refreshMark'() {
this.load()
}
}
}
......
......@@ -136,8 +136,9 @@
</template>
<script>
import { fetchDiseaseTypeList } from '@/api/doctor/disease.js'
import { fetchDiseaseTypeList, delDiagnose } from '@/api/doctor/disease.js'
import { useStore } from '@/doctor/store'
import { showConfirmDialog } from 'vant'
export default {
inject: ['residentInfo'],
......@@ -210,8 +211,20 @@ export default {
}
})
},
delBtn() {
delBtn(record) {
showConfirmDialog({
message: '确定要删除吗?'
}).then(() => {
delDiagnose({ id: record.id }).then(res => {
setTimeout(() => {
this.$message.info('删除成功')
}, 600)
this.diagnoseRecord = this.diagnoseRecord.filter(e => e.id !== record.id)
if (!this.diagnoseRecord.length) {
this.store.onRefreshMark()
}
})
}).catch((err) => { console.warn('delDiagnoseBtn', err) })
}
},
watch: {
......
......@@ -3,7 +3,7 @@
<DocNavBar :title="`${id ? '修改' : '新增'}主要慢病高危筛查`" class="shrink-0"
:backFunc="onBack" :hideBack="step == 3"></DocNavBar>
<div class="p-4 overflow-y-auto grow" ref="all">
<archiveCommon :info="baseInfo" v-if="step == 1"></archiveCommon>
<archiveCommon :info="baseInfo" v-if="step == 1" ref="archiveCommon"></archiveCommon>
<FormCont :resident-info="baseInfo" :info="screenInfo" v-else-if="step == 2" ref="FormCont"/>
<Result v-else-if="step == 3" :info="resultInfo"/>
</div>
......@@ -91,7 +91,15 @@ export default {
}
},
toNext(val) {
if (val == 3) {
if (val == 2) {
// 基础信息
this.$refs.archiveCommon.onSubmit().then(res => {
this.baseInfo = res
this.step = val
this.$refs.all.scrollTo(0, 0)
})
} else if (val == 3) {
// 筛查信息
this.$refs.FormCont.submit().then(res => {
if (!res) return
console.log('FormCont.submit', res)
......@@ -108,10 +116,10 @@ export default {
this.step = val
})
})
return
} else {
this.step = val
this.$refs.all.scrollTo(0, 0)
}
this.step = val
this.$refs.all.scrollTo(0, 0)
},
onBack() {
if (this.step == 1) {
......
......@@ -350,7 +350,7 @@
<script>
import { useStore } from '@/doctor/store'
import { checkboxReject, fetchDataHandle } from '@/utils/common.js'
import { checkboxReject } from '@/utils/common.js'
import dayjs from 'dayjs'
import DoctorInfo from './DoctorInfo.vue'
import CheckBtn from '@/doctor/components/checkBtn/CheckBtn.vue'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment