1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144 |
- <!-- 添加常见科室症状 -->
- <template>
- <div class="AddDiagBaseWrapper" @click="close">
- <crumbs
- :title="'诊断依据数据维护-'+titleText"
- class="topBack"
- :param="$route.params"
- linkTo="DiagBase"
- ></crumbs>
- <el-form ref="ruleForm" class="addDepartForm">
- <el-form-item class="addDiagName" label="选择添加疾病名称:" >
- <input class="searchInput" @focus="focuInput" type="text" v-model = "searchDiagVal">
- <span class="searchName" @click="searchDiag">搜索</span>
- <ul v-if="showDiagList&&diagList.length > 0" class="itemList diagList" ref="diagList">
- <li
- v-for="item in diagList"
- class="diagItem ellipsis"
- :title="item.name"
- @click="selectDiag(item)"
- :key="item.conceptId">
- {{item.name}}
- </li>
- </ul>
- </el-form-item>
- <el-form-item class="isRequired" label="已选添加疾病名称:" :class="{colorRed: !disNameExist}">
- {{disName}}
- </el-form-item>
- </el-form>
- <div class="symptomList">
- <p class="moduleTitle">疾病特征:</p>
- <p class="inpTips">序号输入规则“序号+.”后可输入的范围0~99;标准词只能有一个词;化验类型关联只能出现一个词,其他类型可以输入多个词;化验类型可输入结果列,其他类型不可输入</p>
- <table class="diagTable">
- <tr class="tableTitle">
- <td class="FeatureSort">排序</td>
- <td class="FeatureType require">类型</td>
- <td class="FeatureNumber require">序号</td>
- <td class="FeatureStand require">标准词</td>
- <td class="FeatureRelate">关联词</td>
- <td class="FeatureuniqueName">化验公表项</td>
- <td class="FeatureResult">结果</td>
- <td class="FeatureOpera"></td>
- </tr>
- <tr v-for="(item, index) in disFeatureList" :key="item.index">
- <td class="FeatureSort" >{{index+1}}</td>
- <td class="FeatureType" >
- <el-select size="mini" :class="{selectType: item.typeNull}" v-model.trim="item.type" placeholder="标签类型" @change="clickItem(index,'FeatureType')" clearable>
- <el-option v-for="item in featureTypeList" :label="item.name" :value="item.key" :key="item.key"></el-option>
- </el-select>
- </td>
- <td class="FeatureNumber" >
- <el-tooltip :disabled="!item.verifyCode&&!item.codeNull&&!item.codeError" class="item" effect="dark" :content="item.verifyCode||item.codeNull||item.codeError" placement="top">
- <el-input class="groupTextarea"
- type="textarea"
- :autosize="{ minRows: 1}"
- :class="{borderRed:item.verifyCode||item.codeNull, colorRed: item.codeError}"
- :title="item.code"
- v-model.trim="item.code"
- @input="handleInp(index,$event,'FeatureNumber')"
- @focus="clickItem(index,'FeatureNumber')">
- </el-input>
- </el-tooltip>
- </td>
- <td class="FeatureStand" >
- <el-tooltip :disabled="!item.verifyStandard&&!item.standardNull" class="item" effect="dark" :content="item.verifyStandard||item.standardNull" placement="top">
- <el-input class="groupTextarea"
- type="textarea"
- :autosize="{ minRows: 1}"
- :class="{borderRed:item.verifyStandard||item.standardNull}"
- :title="item.standard"
- v-model.trim="item.standard"
- @input="handleInp(index,$event,'FeatureStand')"
- @focus="clickItem(index,'FeatureStand')">
- </el-input>
- </el-tooltip>
- </td>
- <td class="FeatureRelate">
- <el-tooltip :disabled="!item.verifyRelation&&!item.relationNull" class="item" effect="dark" :content="item.verifyRelation||item.relationNull" placement="top">
- <el-input class="groupTextarea"
- type="textarea"
- :autosize="{ minRows: 1}"
- :class="{borderRed:item.verifyRelation|| item.relationNull}"
- :title="item.relation"
- v-model.trim="item.relation"
- @input="handleInp(index,$event,'FeatureRelate',item.type)"
- @focus="clickItem(index,'FeatureRelate')">
- </el-input>
- </el-tooltip>
- </td>
- <td class="FeatureuniqueName">
- <el-tooltip :disabled="!item.verifyUnique" class="item" effect="dark" :content="item.verifyUnique" placement="top">
- <el-input class="groupTextarea inpDisabled"
- type="textarea"
- :readonly = true
- :autosize="{ minRows: 1}"
- :class="{borderRed:item.uniqueName===null}"
- :title="item.uniqueName"
- v-model.trim="item.uniqueName"
- >
- </el-input>
- </el-tooltip>
- <!-- <div>{{item.uniqueName}}</div> -->
- </td>
- <td class="FeatureResult">
- <el-tooltip :disabled="!item.verifyResult" class="item" effect="dark" :content="item.verifyResult" placement="top">
- <el-input class="groupTextarea"
- type="textarea"
- :autosize="{ minRows: 1}"
- :readonly="item.type!=3"
- :class="{borderRed:item.verifyResult, inpDisabled:item.type!=3}"
- :title="item.midResult"
- v-model.trim="item.midResult"
- @input="handleInp(index,$event,'FeatureResult')"
- @focus="clickItem(index,'FeatureResult')">
- </el-input>
- </el-tooltip>
- </td>
- <td class="FeatureOpera">
- <el-button type="text" size="small" class="delete" @click="addItem(index, 1)"><div class="btnOpera">+</div></el-button>
- <el-button v-if="index !=0" type="text" size="small" class="delete" @click="delItem(index, 1)"><div class="btnOpera">-</div></el-button>
- </td>
- </tr>
- </table>
- <p class="moduleTitle">诊断公式:</p>
- <p class="inpTips">可输入数字(0~9);可输入规定汉字:任、一、二、三、四、五、六、七、八、九、十,其余汉字不可输入;可输入的符号:“.”、“/”、“()” “+”;确诊还可输入“拟、诊”二字;鉴别诊断的序号不可输入公式中,数据放入后该条件无效;</p>
- <table class="diagTable">
- <tr class="tableTitle">
- <td class="FormulaSort">排序</td>
- <td class="FormulaType">类型</td>
- <td class="FormulaNumber">公式</td>
- <td class="FormulaOpera"></td>
- </tr>
- <tr v-for="(item, index) in disFormulaList" :key="item.index">
- <td class="FormulaSort">{{index +1}}</td>
- <td class="FormulaType">
- <el-select size="mini" :class="{selectType: item.verifyType}" v-model.trim="item.type" placeholder="标签类型" @change="clickItem(index,'FormulaType')" clearable>
- <el-option v-for="item in formulaTypeList" :label="item.name" :value="item.key" :key="item.key"></el-option>
- </el-select>
- </td>
- <td class="FormulaNumber">
- <el-tooltip :disabled="!item.verifyFormula" class="item" effect="dark" :content="item.verifyFormula" placement="top">
- <el-input class="groupTextarea"
- type="textarea"
- :readonly="!item.type"
- :autosize="{ minRows: 1}"
- :class="{borderRed:item.verifyFormula,inpDisabled:!item.type}"
- :title="item.formula"
- v-model.trim="item.formula"
- @input="handleInp(index,$event,'FormulaNumber',item.type)"
- @focus="clickItem(index,'FormulaNumber')">
- </el-input>
- </el-tooltip>
- </td>
- <td class="FeatureOpera">
- <el-button type="text" size="small" class="delete" @click="addItem(index, 2)"><div class="btnOpera">+</div></el-button>
- <el-button v-if="index !=0" type="text" size="small" class="delete" @click="delItem(index, 2)"><div class="btnOpera">-</div></el-button>
- </td>
- <!-- <td class="selectedContent ">{{item.indexUnique}}</td>
- <td class="selectedContentGroup"><input class="groupInput" type="text" v-model="item.indexDesc" @input="handleInp(index,$event)"></td>
- <td class="selectedContentOpera"><el-button type="text" size="small" class="delete" @click="delSelectedIndex(item, index)">删除</el-button></td> -->
- </tr>
-
- </table>
- <div class="btn clearfix">
- <div class="btnBox">
- <!-- <el-button size="mini" @click="uploadClick">导入</el-button>
- <input type="file" name="uploadfile " id="upFile" @change="uploadFile($event)" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
- -->
- <el-button
- type="primary"
- :disabled = "isReady"
- @click="submitForm('save')"
- >校验并保存数据</el-button>
- <el-button
- type="primary"
- :disabled = "hasQuestion == 1"
- @click="exportDiagnosticAll"
- >导出诊断依据</el-button>
- <el-button
- type="primary"
- :disabled = "hasQuestion == 1"
- @click="updateNeo"
- >更新图谱</el-button>
- </div>
-
- </div>
- </div>
-
- </div>
-
- </template>
- <script>
- import api from '@api/diagBase.js';
- import utils from '@api/utils.js';
- import apis from '@api/icss.js';
- export default {
- name: 'AddChronicAndIndexRelation',
- data() {
- return{
-
- id: '', //诊断id
- disName:'', //诊断名称
- modifier: '', //操作人
- titleText: '添加',
- diagList: [],
- featureTypeList: [],
- formulaTypeList: [],
- disFeatureList: [
- {
- type:'',
- code:'',
- standard:'',
- relation:'',
- midResult:'',
- formula:'',
- result:'',
- uniqueName:''
- }
- ], //疾病特征列表
- disFeatureListResult:[], //疾病特征列表(保存用)
- disFormulaList:[
- {
- type:'',
- code:'',
- standard:'',
- relation:'',
- midResult:'',
- result:'',
- formula:'',
- uniqueName:''
- }
- ],
- disFormulaListResult:[], //诊断公式列表(保存用)
- searchDiagVal: '',
- isEdit: false,
- saveDisable: false ,
- hasQuestion: 1, //是否有问题词
- disNameExist: true, //诊断名称是否存在
- hasNoUniqueName: false, //是否存在没有公表项的化验
- isReady:false,
- showDiagList: false
- }
- },
- created(){
- const userLoginDTO = JSON.parse(localStorage.getItem('userLoginDTO'))
- this.modifier = userLoginDTO && userLoginDTO.linkman
- this.getDropList()
- const { isEdit, data } = this.$route.params;
- if(isEdit) {
- if(isEdit) {
- this.isEdit = isEdit;
- this.titleText = '修改';
- this.disName = data.disName
- this.id = data.id
- this.disNameExist = data.disNameExist
- if(data.disFeature.length) {
- this.disFeatureList = data.disFeature
- }
- if(data.disformula.length) {
- this.disFormulaList = data.disformula
- }
- this.hasQuestion = data.hasQuestion
- }
- } else {
-
- }
- },
- watch: {
- // searchTagVal(newVal, preVal) {
- // if(newVal.trim() == ''){
- // this.getTagList()
- // }else if(newVal.trim() != preVal.trim()){
- // this.getTagList()
- // }
- // }
- },
- methods: {
- getDropList() {
- return apis.getKnowledgeEnums().then((res) =>{
- if(res.data.code === '0') {
- this.featureTypeList = res.data.data.diagnoseFeatureTypeEnum.filter(item => item.key != 0)
- this.formulaTypeList = res.data.data.diagnoseTypeEnum
- }
-
- })
- },
- close() {
- this.diagList = [];
- },
- back(){
- this.$router.go(-1);
- },
- searchDiag() {
- if(!this.searchDiagVal) {
- return
- }
- const param = {
- "name": this.searchDiagVal,
- }
-
- api.diagBaseIndex(param).then((res)=>{
- if(res.data.code === '0') {
- this.diagList = res.data.data
- this.showDiagList = true
- }
- })
- },
- selectDiag(item) {
- this.disName = item.name
- this.searchDiagVal = ''
- this.diagList=[]
- },
- focuInput() {
- this.showDiagList = false
- },
- addItem(index, type) {
- if(type == 1) {
- const item = {
- type:'',
- code:'',
- standard:'',
- relation:'',
- midResult:'',
- result:'',
- uniqueName:''
- }
- this.disFeatureList.splice(index+1, 0, item)
- }else if(type == 2) {
- const item = {
- type:'',
- code:'',
- standard:'',
- relation:'',
- midResult:'',
- result:'',
- uniqueName:''
- }
- this.disFormulaList.splice(index+1, 0, item)
- }
- },
- delItem(index, type) {
- if(type == 1) {
- this.disFeatureList.splice(index, 1)
- }else if(type == 2) {
- this.disFormulaList.splice(index, 1)
- }
- },
- //导入
- // uploadClick() {
- // let inp = document.getElementById("upFile");
- // inp.click();
- // },
- // uploadFile(e){
- // let fileInfo = e.target.files[0];
- // e.preventDefault();
- // let formData = new FormData();
- // formData.append('uploadfile', fileInfo);
- // const header = {
- // headers:{
- // 'Content-Type': 'multipart/form-data'
- // }
- // }
- // api.importDiagnosticBasis(formData,header).then((res)=>{
- // console.log('ress', res)
- // if(res.data.code==0){
- // const data = res.data.data
- // this.warning('上传成功','success')
- // let feature = data.feature
- // let equation = data.equation
- // const featureList = []
- // const formulaList = []
- // if(feature&&feature.length > 0) {
- // for(let i = 1; i <feature.length; i++) {
- // const item = {}
- // item.type = '';
- // for (let j = 0; j < this.featureTypeList.length; j++) {
- // if(feature[i].type.indexOf(this.featureTypeList[j].name) > -1) {
- // item.type = this.featureTypeList[j].key
- // break;
- // }
- // }
-
- // item.code = feature[i].code
- // item.standard = feature[i].standard
- // item.relation = feature[i].associated
- // if(item.type === 4) {
- // item.midResult = ''
- // } else {
- // item.midResult = feature[i].midResult
- // }
- // featureList.push(item)
- // }
- // }
- // if(equation&&equation.length > 0) {
- // for(let i = 1; i <equation.length; i++) {
- // const item = {}
- // item.type = '';
- // for (let j = 0; j < this.formulaTypeList.length; j++) {
- // if(equation[i].type.indexOf(this.formulaTypeList[j].name) > -1) {
- // item.type = this.formulaTypeList[j].key
- // break;
- // }
- // }
- // item.formula = equation[i].associated
-
- // formulaList.push(item)
- // }
- // }
- // this.disFeatureList = featureList
- // this.disFormulaList = formulaList
- // console.log(' this.disFormulaListResult', this.disFormulaListResult)
- // }else{
- // /*this.$message({
- // dangerouslyUseHTMLString: true,
- // message:res.data.msg,
- // type:'warning'
- // });*/
- // this.$alert(res.data.msg,'错误信息',{
- // dangerouslyUseHTMLString: true,
- // confirmButtonText: '确定',
- // callback: action => {
- // /*this.$message({
- // type: 'info',
- // message: `action: ${ action }`
- // });*/
- // }
- // });
- // }
- // })
-
- // //解决上传相同文件不触发change
- // let inp = document.getElementById("upFile");
- // inp.value = "";
- // },
- updateNeo() {
- this.submitForm('updateNeo').then(() => {
- if(this.hasQuestion == 0) {
- const param = {
- id: this.id,
- modifier: this.modifier
- }
- api.diagBaseUpdateNeo(param).then((res) => {
- if(res.data.code == 0) {
- this.warning('更新成功', 'success');
- } else {
- this.warning(res.data.msg)
- }
- })
- } else {
- this.warning('更新失败');
- }
-
- })
- // api.diagBaseUpdateNeo(param).then((res) =>{
- // })
- },
- exportDiagnosticAll(){
-
- this.submitForm('export').then(() => {
- if(this.hasQuestion == 0) {
- const param = {
- diagnoseId: this.id
- }
- api.exportDiagnosticAll(param).then((res) => {
- utils.downloadExportedData(res.data,'诊断依据.xls');
- })
- }else {
- this.warning('导出失败');
- }
-
- })
-
- },
- submitForm(type) {
- if(!this.disName) {
- this.warning('请选择诊断');
- return
- }
- this.disFeatureListResult = []
- this.disFormulaListResult = []
- let errStrList = [];
- for(let i = 0; i < this.disFeatureList.length; i++) { //如果有任意一项有值,就检测,所有项都没值,则删掉这条数据
- if(this.disFeatureList[i].type || this.disFeatureList[i].code || this.disFeatureList[i].standard || this.disFeatureList[i].relation || this.disFeatureList[i].midResult) {
- this.disFeatureListResult.push(this.disFeatureList[i])
- }
- }
- for(let i = 0; i < this.disFormulaList.length; i++) { //如果有任意一项有值,就检测,所有项都没值,则删掉这条数据
- if(this.disFormulaList[i].type || this.disFormulaList[i].formula ) {
- this.disFormulaListResult.push(this.disFormulaList[i])
- }
- }
- let disFeatureList;
- if(this.disFeatureListResult.length) {
- disFeatureList = this.disFeatureListResult;
- } else {
- disFeatureList = [
- {
- type:'',
- code:'',
- standard:'',
- relation:'',
- midResult:'',
- result:'',
- formula:'',
- uniqueName:''
- }
- ];
- }
- const disFormulaList = this.disFormulaListResult;
- let codeErrorNum = 0;
- //必填项是否填写
- for(let i=0; i < disFeatureList.length; i++) {
- if(!disFeatureList[i].type) {
- disFeatureList[i].typeNull = "未选择类型"
- }
- if(!disFeatureList[i].code) {
- disFeatureList[i].codeNull = "未填写编码"
- }
- if(!disFeatureList[i].standard) {
- disFeatureList[i].standardNull = "未填写标准词"
- }
- if(!disFeatureList[i].type||!disFeatureList[i].code||!disFeatureList[i].standard) {
- const errStr = "第" + (i+ 1) +"行必填项未填写"
- errStrList.push(errStr)
- }
- let regex =new RegExp(`^${disFeatureList[i].type}\\.(0|[1-9]\\d?)$`,)
- if(disFeatureList[i].code &&!regex.test(disFeatureList[i].code)) { //序号和类型不匹配
- codeErrorNum++
- disFeatureList[i].codeError = "序号和类型不匹配"
- const errStr = "疾病特征第" + (i+ 1) +"行序号和类型不匹配"
- errStrList.push(errStr)
- } else { //序号和类型匹配但序号重复
- let codeArr = disFeatureList.filter(item => item.code ===disFeatureList[i].code)
- if(codeArr.length > 1) {
- codeErrorNum++
- disFeatureList[i].codeError = "序号重复"
- const errStr = "疾病特征第" + (i+ 1) +"行序号重复"
- errStrList.push(errStr)
- }
- }
- //化验项有结果则必须有关联词
- if(disFeatureList[i].type == '3' && disFeatureList[i].midResult && !disFeatureList[i].relation) {
- disFeatureList[i].relationNull = "未填写关联词"
- const errStr = "第" + (i+ 1) +"行化验项数据填写不完整"
- errStrList.push(errStr)
- }
-
- //导入后判断
- // let regexPause = new RegExp(`、`) //判断标准词是否有顿号
- // if(disFeatureList[i].standard &®exPause.test(disFeatureList[i].standard)) {
- // disFeatureList[i].verifyStandard ='数据异常'
- // const errStr = "疾病特征第" + (i+ 1) +"行标准词数据异常"
- // errStrList.push(errStr)
- // }
- // if(disFeatureList[i].type == '3'&®exPause.test(disFeatureList[i].relation)) {
- // disFeatureList[i].verifyRelation ='数据异常'
- // const errStr = "疾病特征第" + (i+ 1) +"行化验关联词数据异常"
- // errStrList.push(errStr)
- // }
- //导入后判断
- if(disFeatureList[i].type == '3' && !disFeatureList[i].midResult ) { //化验项下面诊断公式如果有用到,判断是否填写结果项
- const regex2 = new RegExp(`(?<=\\D|\\s?)${disFeatureList[i].code.replace('.','\\.')}(?=\\D|\\s?)`)
- // const regex2 = new RegExp(`、\\s*、{1,}`)
- // const regex2 = new RegExp(`([^0-9]|\\s{0,1})${disFeatureList[i].code}([^0-9]|\\s{0,1})`)
- let hasError = disFormulaList.find(item => {return regex2.test(item.formula)})
- if(hasError) {
- if(!disFeatureList[i].relation) {
- disFeatureList[i].verifyRelation = "数据异常"
- }
- disFeatureList[i].verifyResult = "数据异常"
- const errStr = "第" + (i+ 1) +"行化验项数据异常"
- errStrList.push(errStr)
- }
- }
- if(disFeatureList[i].type == '4' && !disFeatureList[i].relation ) { //辅检项下面诊断公式如果有用到,判断是否填写结果项(辅检结果是填在关联词列)
- const regex2 = new RegExp(`(?<=\\D|\\s?)${disFeatureList[i].code.replace('.','\\.')}(?=\\D|\\s?)`)
- let hasError = disFormulaList.find(item => {return regex2.test(item.formula)})
- if(hasError) {
- disFeatureList[i].verifyRelation = "数据异常"
- const errStr = "第" + (i+ 1) +"行辅捡项数据异常"
- errStrList.push(errStr)
- }
- }
- let regex1 =new RegExp(`、\\s*、{1,}|^、|、$`)
- if(disFeatureList[i].relation &®ex1.test(disFeatureList[i].relation)) { //不能输入连续的、,前后也不能是、
- disFeatureList[i].verifyRelation ='数据异常'
- const errStr = "疾病特征第" + (i+ 1) +"行数据异常"
- errStrList.push(errStr)
- }
- if(disFeatureList[i].midResult &®ex1.test(disFeatureList[i].midResult)) {
- disFeatureList[i].verifyResult ='数据异常'
- const errStr = "疾病特征第" + (i+ 1) +"行数据异常"
- errStrList.push(errStr)
- }
-
-
-
- }
- this.disFeatureList = JSON.parse(JSON.stringify(disFeatureList))
- let formulaListErrNum = 0
- for(let i=0; i < disFormulaList.length; i++) {
- if(disFormulaList[i].type&&!disFormulaList[i].formula ) {
- disFormulaList[i].verifyFormula = "诊断公式不能为空"
- formulaListErrNum++;
- const errStr = "诊断公式第" + (i+ 1) +"行诊断公式不能为空"
- errStrList.push(errStr)
- } else if(disFormulaList[i].formula&&!disFormulaList[i].type) {
- disFormulaList[i].verifyType = "诊断类型不能为空"
- const errStr = "诊断公式第" + (i+ 1) +"行诊断类型不能为空"
- errStrList.push(errStr)
- formulaListErrNum++;
- }
-
- //导入后判断
- // if(disFormulaList[i].type == 91) { //确诊中有没有包含其他不可输入内容
- // let regexDisFormula = /[^\u4EFB\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341\u62df\u8bca0-9\/\.+\(\)\(\)]/g
- // if(regexDisFormula.test(disFormulaList[i].formula)) {
- // disFormulaList[i].verifyFormula = "公式格式错误"
- // const errStr = "诊断公式第" + (i+ 1) +"行公式格式错误,"
- // errStrList.push(errStr)
- // formulaListErrNum++;
- // }
- // } else { //其他诊断中有没有包含其他不可输入内容
- // //计算公式只能输入以下内容: 任、一、二、三、四、五、六、七、八、九、十、0-9、/、.、(、)、(、)
- // let regexDisFormula = /[^\u4EFB\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u53410-9\/\.+\(\)\(\)]/g
- // if(regexDisFormula.test(disFormulaList[i].formula)) {
- // disFormulaList[i].verifyFormula = "公式格式错误"
- // const errStr = "诊断公式第" + (i+ 1) +"行公式格式错误。"
- // errStrList.push(errStr)
- // formulaListErrNum++;
- // }
- // }
- //导入后判断
- if(disFormulaList[i].type == 91 && disFormulaList[i].formula.indexOf("拟诊") > -1) { //确诊项如果有拟诊这两个字,判断公式列表中有没有拟诊这项
- const noError = disFormulaList.filter(item => item.type == 92).length > 0
- if(!noError) {
- disFormulaList[i].verifyFormula = "公式格式错误"
- const errStr = "诊断公式第" + (i+ 1) +"行公式格式错误"
- errStrList.push(errStr)
- formulaListErrNum++;
- }
- }
- }
- if(disFormulaList.length) {
- this.disFormulaList = JSON.parse(JSON.stringify(disFormulaList))
- }
-
- let errorStr =''
- for(let i = 0; i <errStrList.length; i++) {
- errorStr += '<p>'+errStrList[i]+'</p>'
- }
-
- if(errStrList.length >0 ||codeErrorNum > 0 ||formulaListErrNum > 0) {
- this.errorTips(errorStr)
- }
- // this.showDelDialog()
- return this.diagBaseVerifyData(type)
-
- },
- diagBaseVerifyData(type) {
- //判断诊断依据先判断化验有没有公表项
- const labArr= []
- for (let i = 0; i < this.disFeatureListResult.length; i++) {
- if(+this.disFeatureListResult[i].type === 3) {
- labArr.push({index: i, mealName: this.disFeatureListResult[i].standard, itemName: this.disFeatureListResult[i].relation, uniqueName:''})
- }
- }
- const loading = this.$loading({
- lock: true,
- text: 'Loading',
- spinner: 'el-icon-loading',
- background: 'rgba(0, 0, 0, 0.7)'
- });
-
-
- if(type == 'save'){
- this.isReady = true
- }
- if(labArr.length > 0) {
- this.labVerifyData(labArr, loading).then(() =>{
- if(this.hasNoUniqueName) {
- loading.close()
- return
- }else {
- this.verifyDiagBase(loading)
- }
- })
- } else {
- this.verifyDiagBase(loading)
- }
- },
- labVerifyData(labArr, loading) {
- const labArrParam = {
- lisMappingSearchList : labArr
- }
- return api.getUniqueNameWithList(labArrParam).then((res) => {
- this.isReady=false
- if(res.data.code === '0') {
- const data = res.data.data
- let errorStr = ''
- for (let i = 0; i < data.length; i++ ) {
- if(!data[i].uniqueName) { //判断是否存在公表项
- if(!this.hasNoUniqueName) {
- this.hasNoUniqueName = true
- }
- errorStr +=`<p>第${+data[i].index+1}行化验公表项不存在</p>`
- this.disFeatureListResult[data[i].index].verifyUnique="公表项不存在"
- } else {
- this.disFeatureListResult[data[i].index].verifyUnique=""
- }
- this.disFeatureListResult[data[i].index].uniqueName = data[i].uniqueName
- if(data[i].uniqueName) { //有公表项和结果,则将公表项和结果拼接起来,结果用、分隔
- if(this.disFeatureListResult[data[i].index].midResult) {
- let midResult = this.disFeatureListResult[data[i].index].midResult.replace(' ', '').split('、')
- for (let j = 0; j < midResult.length; j++) {
- if(midResult[j]) {
- midResult[j] = data[i].uniqueName+midResult[j]
- }
- }
- this.disFeatureListResult[data[i].index].result = midResult.join('、')
- }
-
- }
- }
- console.log('errorStr', errorStr)
- if(errorStr) {
- this.errorTips(errorStr)
- }
- this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureListResult))
- this.disFeatureListResult = JSON.parse(JSON.stringify(this.disFeatureListResult))
-
- } else {
-
- this.warning(res.msg)
- loading.close()
- return
- }
- }).catch(()=>{ this.isReady=false;loading.close()})
- },
- verifyDiagBase(loading) {
-
- const param = {
- disFeature: this.disFeatureListResult,
- disName: this.disName,
- disformula: this.disFormulaListResult,
- id: this.id,
- modifier: this.modifier
- }
- return api.diagBaseVerifyData(param).then((res) => {
- if(+res.data.code === 0) {
- const data = res.data.data
- this.isReady=false
- if(type =='save') {
- if(data.hasQuestion) {
- this.warning('校验完成请先调整错误数据,该数据已保存')
- } else {
- this.warning('校验成功', 'success')
- }
- }
-
- this.id = data.id
- this.disNameExist = data.disNameExist
- this.disFeatureList = data.disFeature
- if(data.disformula.length) {
- this.disFormulaList = data.disformula
- }else {
- this.disFormulaList = [
- {
- type:'',
- code:'',
- standard:'',
- relation:'',
- result:'',
- midResult:'',
- formula:'',
- uniqueName:''
- }
- ]
- }
- this.hasQuestion = data.hasQuestion
- } else {
- this.hasQuestion = 1
- this.warning(res.msg)
- }
-
- loading.close()
-
- }).catch(()=>{ this.hasQuestion = false; this.isReady=false; loading.close()})
- },
- showConfirmDialog(msg, resolve) {
- this.$alert(msg, '提示', {
- confirmButtonText: '确定',
- type: 'warning'
- }).then(() => {
- resolve();
- }).catch(() => {});
- },
-
- handleInp(index,e,type,itemType){ //分组不能输入负数
- const value = e;
- if(type === 'FeatureNumber') { //序号只能输入数字和.
- this.$nextTick(() => {
- this.disFeatureList[index].code = value.replace(/[^\d.]/g,'')
- })
- } else if(type==='FeatureStand') { //标准词不能输入顿号
- this.$nextTick(() => {
- this.disFeatureList[index].standard = value.replace(/、/g,'')
- })
- // this.disFeatureList[index].standard = value.replace(/、/g,'')
- } else if ( type === 'FormulaNumber') {
- //计算公式确诊只能输入以下内容: 任、一、二、三、四、五、六、七、八、九、十、拟、诊、0-9、/、.、(、)、(、)
- if(itemType == 91) {
- this.$nextTick(() => {
-
- this.disFormulaList[index].formula = value.replace(/[^\u4EFB\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341\u62df\u8bca0-9\/\.+\(\)\(\)]/g,'').replace(/[\(]/g, '(').replace(/[\)]/g, ')').replace(/' '/g, '')
- })
- } else { //计算公式其他只能输入以下内容: 任、一、二、三、四、五、六、七、八、九、十、0-9、/、.、(、)、(、)
- //计算公式只能输入以下内容: 任、一、二、三、四、五、六、七、八、九、十、0-9、/、.、(、)、(、)
- this.$nextTick(() => {
- this.disFormulaList[index].formula = value.replace(/[^\u4EFB\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u53410-9\/\.+\(\)\(\)]/g,'').replace(/[\(]/g, '(').replace(/[\)]/g, ')').replace(/' '/g, '')
- })
- }
-
-
- } else if ( type === 'FeatureRelate') {
- if(itemType == 3) {
- this.$nextTick(() => {
- this.disFeatureList[index].relation = value.replace(/、/g,'')
- })
- }
- }
- // const item = this.selectedIndexList[index].indexDesc;
- // e.target.value = value.replace(/[^\d]/g,'');
- // this.selectedIndexList[index].indexDesc = item.replace(/[^\d]/g,'');
- },
- clickItem(index, type) {
- switch(type) {
- case 'FeatureType':
- this.disFeatureList[index].typeNull = ''
- this.disFeatureList[index].code = ''
- this.disFeatureList[index].standard = ''
- this.disFeatureList[index].relation = ''
- this.disFeatureList[index].midResult = ''
- this.disFeatureList[index].result = ''
- this.disFeatureList[index].formula = ''
- this.disFeatureList[index].uniqueName = ''
- return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
- case 'FeatureNumber':
- this.disFeatureList[index].codeNull = ''
- this.disFeatureList[index].verifyCode = ''
- this.disFeatureList[index].codeError = ''
- return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
- case 'FeatureStand':
- this.disFeatureList[index].verifyStandard =''
- this.disFeatureList[index].standardNull =''
- return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
- case 'FeatureRelate':
- this.disFeatureList[index].verifyRelation =''
- return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
- case 'FeatureResult':
- this.disFeatureList[index].verifyResult =''
- return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
- case 'FeatureResult':
- this.disFeatureList[index].verifyResult =''
- return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
- case 'FormulaType':
- this.disFormulaList[index].verifyType =''
- this.disFormulaList[index].formula =''
- return this.disFormulaList = JSON.parse(JSON.stringify(this.disFormulaList))
- case 'FormulaNumber':
- this.disFormulaList[index].verifyFormula =''
- return this.disFormulaList = JSON.parse(JSON.stringify(this.disFormulaList))
- }
- },
- warning(msg, type,time) {
- this.$message({
- showClose: true,
- message: msg,
- type: type || 'warning',
- duration:time || '3000'
- })
- },
- errorTips(errorStr) {
- this.$alert(errorStr,'错误信息',{
- dangerouslyUseHTMLString: true,
- confirmButtonText: '确定',
- callback: action => {
- /*this.$message({
- type: 'info',
- message: `action: ${ action }`
- });*/
- }
- });
- return
- }
- }
- }
- </script>
- <style lang="less">
- @import '../../less/common.less';
- .AddDiagBaseWrapper {
- color: #606266;
- .topBack {
- top: 0;
- }
- .groupTitle {
- background-color: #fff;
- height: 40px;
- line-height: 40px;
- padding-left: 20px;
- }
- .searchInput, .searchName {
- display: inline-block;
- height: 32px;
- line-height: 32px;
- border: 1px solid #a9a9a9;
- margin: 0px 0 0 0;
- padding: 0 5px;
- float: left;
- margin-top: 4px;
- }
- .isRequired .el-form-item__label::before {
- content: '*';
- color: red;
- }
- .searchName {
- border-left: none;
- cursor: pointer;
- font-size: 16px;
- padding: 0 14px;
- }
- .itemList {
- position: absolute;
- background: #fff;
- width: 162px;
- max-height: 150px;
- border: 1px solid #a9a9a9;
- left: 138px;
- top: 37px;
- z-index: 2;
- overflow-y: auto;
- }
- .diagItem {
- padding: 0 5px;
- height: 30px;
- line-height: 30px;
- font-size: 14px;
- cursor: pointer;
- }
- .diagItem:hover {
- background: #f5f7fa;
- }
- .addDepartForm {
- position: relative;
- background-color: #fff;
- padding: 20px;
- margin: 70px 20px 0px 20px;
- }
- .addDiagName {
- position: relative;
- }
- .symptomList {
- position: relative;
- background-color: #fff;
- padding: 20px 20px 100px 20px;
- margin: 0px 20px 40px 20px;
- min-height: 400px;
- }
-
- .diagTable {
- width: 100%;
- border-collapse: collapse;
- margin-bottom: 20px;
- tr {
- td {
- border: 1px solid #a9a9a9;
- text-align: center;
- }
- .FormulaOpera, .FeatureOpera{
- background: #fff;
- border: none;
- text-align: left;
- padding-left: 30px;
- }
- /deep/.el-textarea__inner {
- width: 100%;
- line-height: 20px;
- resize:none;
- border: none;
- border-radius: 0;
- text-align: center;
- }
- }
- .selectedContent {
- width: 25%;
- }
- .selectedContentGroup {
- width: 55%;
- }
- .selectedContentOpera {
- width: 20%;
- }
- }
- .groupInput {
- text-align: center;
- color: #606266;
- width: 80%;
- }
- .groupTextarea {
- text-align: center;
- color: #606266;
- width: 100%;
- }
- .btn {
- position: absolute;
- background-color: #fff;
- width: 100%;
- margin: 20px 0;
- height: 40px;
- bottom: 0px;
- right: 0px;
- .btnBox {
- position: absolute;
- right: 0px;
-
- }
- .el-button {
- margin-right: 20px;
-
- }
- }
- .tableTitle{
- background: rgba(239,243,249,1);
- }
- .require::after{
- content:"*";
- color: red;
- }
- .borderRed {
- border: 3px solid red ;
- box-sizing: border-box;
- }
- .colorRed {
- color: red;
- }
- .FeatureSort {
- width: 5%;
- }
- .FeatureType {
- width: 7%;
- padding: 0 5px;
- }
- .FeatureNumber {
- width: 8%;
- }
- .FeatureStand {
- width: 25%;
- }
- .FeatureRelate {
- width: 25%;
- }
- .FeatureuniqueName {
- width: 10%;
- }
- .FeatureResult {
- width: 10%;
- }
- .FeatureOpera{
- width: 10%;
- }
- .FormulaSort{
- width: 5%;
- }
- .FormulaType{
- width: 7%;
- padding: 0 5px;
- }
- .FormulaNumber{
- width: 78%;
- }
- .FormulaOpera{
- width: 10%;
- }
- .btnOpera {
- width:16px;
- height:16px;
- background:rgba(176,190,197,1);
- border-radius: 50%;
- color: #fff;
- line-height: 16px;
- text-align: center;
- }
- /deep/.el-input--mini .el-input__inner {
- width: 80px;
- }
- /deep/ .is-disabled {
- background: #ECECEC;
- color: #AAAAAA;
- border: none;
- }
- .selectType {
- input {
- border: 3px solid red;
- }
- input:hover {
- border: 3px solid red;
- }
- }
- .moduleTitle {
- margin: 0 0 10px 0;
- }
- .inpDisabled{
- textarea {
- background: #ECECEC;
- color: #AAAAAA;
- border: none;
- cursor: not-allowed;
- height: 100%;
- }
-
- }
- .inpTips {
- font-size: 14px;
- color: red;
- margin-bottom: 10px;
- }
- #upFile{
- display: none
- }
- }
-
- </style>
|