AddDiagBase.vue 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144
  1. <!-- 添加常见科室症状 -->
  2. <template>
  3. <div class="AddDiagBaseWrapper" @click="close">
  4. <crumbs
  5. :title="'诊断依据数据维护-'+titleText"
  6. class="topBack"
  7. :param="$route.params"
  8. linkTo="DiagBase"
  9. ></crumbs>
  10. <el-form ref="ruleForm" class="addDepartForm">
  11. <el-form-item class="addDiagName" label="选择添加疾病名称:" >
  12. <input class="searchInput" @focus="focuInput" type="text" v-model = "searchDiagVal">
  13. <span class="searchName" @click="searchDiag">搜索</span>
  14. <ul v-if="showDiagList&&diagList.length > 0" class="itemList diagList" ref="diagList">
  15. <li
  16. v-for="item in diagList"
  17. class="diagItem ellipsis"
  18. :title="item.name"
  19. @click="selectDiag(item)"
  20. :key="item.conceptId">
  21. {{item.name}}
  22. </li>
  23. </ul>
  24. </el-form-item>
  25. <el-form-item class="isRequired" label="已选添加疾病名称:" :class="{colorRed: !disNameExist}">
  26. {{disName}}
  27. </el-form-item>
  28. </el-form>
  29. <div class="symptomList">
  30. <p class="moduleTitle">疾病特征:</p>
  31. <p class="inpTips">序号输入规则“序号+.”后可输入的范围0~99;标准词只能有一个词;化验类型关联只能出现一个词,其他类型可以输入多个词;化验类型可输入结果列,其他类型不可输入</p>
  32. <table class="diagTable">
  33. <tr class="tableTitle">
  34. <td class="FeatureSort">排序</td>
  35. <td class="FeatureType require">类型</td>
  36. <td class="FeatureNumber require">序号</td>
  37. <td class="FeatureStand require">标准词</td>
  38. <td class="FeatureRelate">关联词</td>
  39. <td class="FeatureuniqueName">化验公表项</td>
  40. <td class="FeatureResult">结果</td>
  41. <td class="FeatureOpera"></td>
  42. </tr>
  43. <tr v-for="(item, index) in disFeatureList" :key="item.index">
  44. <td class="FeatureSort" >{{index+1}}</td>
  45. <td class="FeatureType" >
  46. <el-select size="mini" :class="{selectType: item.typeNull}" v-model.trim="item.type" placeholder="标签类型" @change="clickItem(index,'FeatureType')" clearable>
  47. <el-option v-for="item in featureTypeList" :label="item.name" :value="item.key" :key="item.key"></el-option>
  48. </el-select>
  49. </td>
  50. <td class="FeatureNumber" >
  51. <el-tooltip :disabled="!item.verifyCode&&!item.codeNull&&!item.codeError" class="item" effect="dark" :content="item.verifyCode||item.codeNull||item.codeError" placement="top">
  52. <el-input class="groupTextarea"
  53. type="textarea"
  54. :autosize="{ minRows: 1}"
  55. :class="{borderRed:item.verifyCode||item.codeNull, colorRed: item.codeError}"
  56. :title="item.code"
  57. v-model.trim="item.code"
  58. @input="handleInp(index,$event,'FeatureNumber')"
  59. @focus="clickItem(index,'FeatureNumber')">
  60. </el-input>
  61. </el-tooltip>
  62. </td>
  63. <td class="FeatureStand" >
  64. <el-tooltip :disabled="!item.verifyStandard&&!item.standardNull" class="item" effect="dark" :content="item.verifyStandard||item.standardNull" placement="top">
  65. <el-input class="groupTextarea"
  66. type="textarea"
  67. :autosize="{ minRows: 1}"
  68. :class="{borderRed:item.verifyStandard||item.standardNull}"
  69. :title="item.standard"
  70. v-model.trim="item.standard"
  71. @input="handleInp(index,$event,'FeatureStand')"
  72. @focus="clickItem(index,'FeatureStand')">
  73. </el-input>
  74. </el-tooltip>
  75. </td>
  76. <td class="FeatureRelate">
  77. <el-tooltip :disabled="!item.verifyRelation&&!item.relationNull" class="item" effect="dark" :content="item.verifyRelation||item.relationNull" placement="top">
  78. <el-input class="groupTextarea"
  79. type="textarea"
  80. :autosize="{ minRows: 1}"
  81. :class="{borderRed:item.verifyRelation|| item.relationNull}"
  82. :title="item.relation"
  83. v-model.trim="item.relation"
  84. @input="handleInp(index,$event,'FeatureRelate',item.type)"
  85. @focus="clickItem(index,'FeatureRelate')">
  86. </el-input>
  87. </el-tooltip>
  88. </td>
  89. <td class="FeatureuniqueName">
  90. <el-tooltip :disabled="!item.verifyUnique" class="item" effect="dark" :content="item.verifyUnique" placement="top">
  91. <el-input class="groupTextarea inpDisabled"
  92. type="textarea"
  93. :readonly = true
  94. :autosize="{ minRows: 1}"
  95. :class="{borderRed:item.uniqueName===null}"
  96. :title="item.uniqueName"
  97. v-model.trim="item.uniqueName"
  98. >
  99. </el-input>
  100. </el-tooltip>
  101. <!-- <div>{{item.uniqueName}}</div> -->
  102. </td>
  103. <td class="FeatureResult">
  104. <el-tooltip :disabled="!item.verifyResult" class="item" effect="dark" :content="item.verifyResult" placement="top">
  105. <el-input class="groupTextarea"
  106. type="textarea"
  107. :autosize="{ minRows: 1}"
  108. :readonly="item.type!=3"
  109. :class="{borderRed:item.verifyResult, inpDisabled:item.type!=3}"
  110. :title="item.midResult"
  111. v-model.trim="item.midResult"
  112. @input="handleInp(index,$event,'FeatureResult')"
  113. @focus="clickItem(index,'FeatureResult')">
  114. </el-input>
  115. </el-tooltip>
  116. </td>
  117. <td class="FeatureOpera">
  118. <el-button type="text" size="small" class="delete" @click="addItem(index, 1)"><div class="btnOpera">+</div></el-button>
  119. <el-button v-if="index !=0" type="text" size="small" class="delete" @click="delItem(index, 1)"><div class="btnOpera">-</div></el-button>
  120. </td>
  121. </tr>
  122. </table>
  123. <p class="moduleTitle">诊断公式:</p>
  124. <p class="inpTips">可输入数字(0~9);可输入规定汉字:任、一、二、三、四、五、六、七、八、九、十,其余汉字不可输入;可输入的符号:“.”、“/”、“()” “+”;确诊还可输入“拟、诊”二字;鉴别诊断的序号不可输入公式中,数据放入后该条件无效;</p>
  125. <table class="diagTable">
  126. <tr class="tableTitle">
  127. <td class="FormulaSort">排序</td>
  128. <td class="FormulaType">类型</td>
  129. <td class="FormulaNumber">公式</td>
  130. <td class="FormulaOpera"></td>
  131. </tr>
  132. <tr v-for="(item, index) in disFormulaList" :key="item.index">
  133. <td class="FormulaSort">{{index +1}}</td>
  134. <td class="FormulaType">
  135. <el-select size="mini" :class="{selectType: item.verifyType}" v-model.trim="item.type" placeholder="标签类型" @change="clickItem(index,'FormulaType')" clearable>
  136. <el-option v-for="item in formulaTypeList" :label="item.name" :value="item.key" :key="item.key"></el-option>
  137. </el-select>
  138. </td>
  139. <td class="FormulaNumber">
  140. <el-tooltip :disabled="!item.verifyFormula" class="item" effect="dark" :content="item.verifyFormula" placement="top">
  141. <el-input class="groupTextarea"
  142. type="textarea"
  143. :readonly="!item.type"
  144. :autosize="{ minRows: 1}"
  145. :class="{borderRed:item.verifyFormula,inpDisabled:!item.type}"
  146. :title="item.formula"
  147. v-model.trim="item.formula"
  148. @input="handleInp(index,$event,'FormulaNumber',item.type)"
  149. @focus="clickItem(index,'FormulaNumber')">
  150. </el-input>
  151. </el-tooltip>
  152. </td>
  153. <td class="FeatureOpera">
  154. <el-button type="text" size="small" class="delete" @click="addItem(index, 2)"><div class="btnOpera">+</div></el-button>
  155. <el-button v-if="index !=0" type="text" size="small" class="delete" @click="delItem(index, 2)"><div class="btnOpera">-</div></el-button>
  156. </td>
  157. <!-- <td class="selectedContent ">{{item.indexUnique}}</td>
  158. <td class="selectedContentGroup"><input class="groupInput" type="text" v-model="item.indexDesc" @input="handleInp(index,$event)"></td>
  159. <td class="selectedContentOpera"><el-button type="text" size="small" class="delete" @click="delSelectedIndex(item, index)">删除</el-button></td> -->
  160. </tr>
  161. </table>
  162. <div class="btn clearfix">
  163. <div class="btnBox">
  164. <!-- <el-button size="mini" @click="uploadClick">导入</el-button>
  165. <input type="file" name="uploadfile " id="upFile" @change="uploadFile($event)" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
  166. -->
  167. <el-button
  168. type="primary"
  169. :disabled = "isReady"
  170. @click="submitForm('save')"
  171. >校验并保存数据</el-button>
  172. <el-button
  173. type="primary"
  174. :disabled = "hasQuestion == 1"
  175. @click="exportDiagnosticAll"
  176. >导出诊断依据</el-button>
  177. <el-button
  178. type="primary"
  179. :disabled = "hasQuestion == 1"
  180. @click="updateNeo"
  181. >更新图谱</el-button>
  182. </div>
  183. </div>
  184. </div>
  185. </div>
  186. </template>
  187. <script>
  188. import api from '@api/diagBase.js';
  189. import utils from '@api/utils.js';
  190. import apis from '@api/icss.js';
  191. export default {
  192. name: 'AddChronicAndIndexRelation',
  193. data() {
  194. return{
  195. id: '', //诊断id
  196. disName:'', //诊断名称
  197. modifier: '', //操作人
  198. titleText: '添加',
  199. diagList: [],
  200. featureTypeList: [],
  201. formulaTypeList: [],
  202. disFeatureList: [
  203. {
  204. type:'',
  205. code:'',
  206. standard:'',
  207. relation:'',
  208. midResult:'',
  209. formula:'',
  210. result:'',
  211. uniqueName:''
  212. }
  213. ], //疾病特征列表
  214. disFeatureListResult:[], //疾病特征列表(保存用)
  215. disFormulaList:[
  216. {
  217. type:'',
  218. code:'',
  219. standard:'',
  220. relation:'',
  221. midResult:'',
  222. result:'',
  223. formula:'',
  224. uniqueName:''
  225. }
  226. ],
  227. disFormulaListResult:[], //诊断公式列表(保存用)
  228. searchDiagVal: '',
  229. isEdit: false,
  230. saveDisable: false ,
  231. hasQuestion: 1, //是否有问题词
  232. disNameExist: true, //诊断名称是否存在
  233. hasNoUniqueName: false, //是否存在没有公表项的化验
  234. isReady:false,
  235. showDiagList: false
  236. }
  237. },
  238. created(){
  239. const userLoginDTO = JSON.parse(localStorage.getItem('userLoginDTO'))
  240. this.modifier = userLoginDTO && userLoginDTO.linkman
  241. this.getDropList()
  242. const { isEdit, data } = this.$route.params;
  243. if(isEdit) {
  244. if(isEdit) {
  245. this.isEdit = isEdit;
  246. this.titleText = '修改';
  247. this.disName = data.disName
  248. this.id = data.id
  249. this.disNameExist = data.disNameExist
  250. if(data.disFeature.length) {
  251. this.disFeatureList = data.disFeature
  252. }
  253. if(data.disformula.length) {
  254. this.disFormulaList = data.disformula
  255. }
  256. this.hasQuestion = data.hasQuestion
  257. }
  258. } else {
  259. }
  260. },
  261. watch: {
  262. // searchTagVal(newVal, preVal) {
  263. // if(newVal.trim() == ''){
  264. // this.getTagList()
  265. // }else if(newVal.trim() != preVal.trim()){
  266. // this.getTagList()
  267. // }
  268. // }
  269. },
  270. methods: {
  271. getDropList() {
  272. return apis.getKnowledgeEnums().then((res) =>{
  273. if(res.data.code === '0') {
  274. this.featureTypeList = res.data.data.diagnoseFeatureTypeEnum.filter(item => item.key != 0)
  275. this.formulaTypeList = res.data.data.diagnoseTypeEnum
  276. }
  277. })
  278. },
  279. close() {
  280. this.diagList = [];
  281. },
  282. back(){
  283. this.$router.go(-1);
  284. },
  285. searchDiag() {
  286. if(!this.searchDiagVal) {
  287. return
  288. }
  289. const param = {
  290. "name": this.searchDiagVal,
  291. }
  292. api.diagBaseIndex(param).then((res)=>{
  293. if(res.data.code === '0') {
  294. this.diagList = res.data.data
  295. this.showDiagList = true
  296. }
  297. })
  298. },
  299. selectDiag(item) {
  300. this.disName = item.name
  301. this.searchDiagVal = ''
  302. this.diagList=[]
  303. },
  304. focuInput() {
  305. this.showDiagList = false
  306. },
  307. addItem(index, type) {
  308. if(type == 1) {
  309. const item = {
  310. type:'',
  311. code:'',
  312. standard:'',
  313. relation:'',
  314. midResult:'',
  315. result:'',
  316. uniqueName:''
  317. }
  318. this.disFeatureList.splice(index+1, 0, item)
  319. }else if(type == 2) {
  320. const item = {
  321. type:'',
  322. code:'',
  323. standard:'',
  324. relation:'',
  325. midResult:'',
  326. result:'',
  327. uniqueName:''
  328. }
  329. this.disFormulaList.splice(index+1, 0, item)
  330. }
  331. },
  332. delItem(index, type) {
  333. if(type == 1) {
  334. this.disFeatureList.splice(index, 1)
  335. }else if(type == 2) {
  336. this.disFormulaList.splice(index, 1)
  337. }
  338. },
  339. //导入
  340. // uploadClick() {
  341. // let inp = document.getElementById("upFile");
  342. // inp.click();
  343. // },
  344. // uploadFile(e){
  345. // let fileInfo = e.target.files[0];
  346. // e.preventDefault();
  347. // let formData = new FormData();
  348. // formData.append('uploadfile', fileInfo);
  349. // const header = {
  350. // headers:{
  351. // 'Content-Type': 'multipart/form-data'
  352. // }
  353. // }
  354. // api.importDiagnosticBasis(formData,header).then((res)=>{
  355. // console.log('ress', res)
  356. // if(res.data.code==0){
  357. // const data = res.data.data
  358. // this.warning('上传成功','success')
  359. // let feature = data.feature
  360. // let equation = data.equation
  361. // const featureList = []
  362. // const formulaList = []
  363. // if(feature&&feature.length > 0) {
  364. // for(let i = 1; i <feature.length; i++) {
  365. // const item = {}
  366. // item.type = '';
  367. // for (let j = 0; j < this.featureTypeList.length; j++) {
  368. // if(feature[i].type.indexOf(this.featureTypeList[j].name) > -1) {
  369. // item.type = this.featureTypeList[j].key
  370. // break;
  371. // }
  372. // }
  373. // item.code = feature[i].code
  374. // item.standard = feature[i].standard
  375. // item.relation = feature[i].associated
  376. // if(item.type === 4) {
  377. // item.midResult = ''
  378. // } else {
  379. // item.midResult = feature[i].midResult
  380. // }
  381. // featureList.push(item)
  382. // }
  383. // }
  384. // if(equation&&equation.length > 0) {
  385. // for(let i = 1; i <equation.length; i++) {
  386. // const item = {}
  387. // item.type = '';
  388. // for (let j = 0; j < this.formulaTypeList.length; j++) {
  389. // if(equation[i].type.indexOf(this.formulaTypeList[j].name) > -1) {
  390. // item.type = this.formulaTypeList[j].key
  391. // break;
  392. // }
  393. // }
  394. // item.formula = equation[i].associated
  395. // formulaList.push(item)
  396. // }
  397. // }
  398. // this.disFeatureList = featureList
  399. // this.disFormulaList = formulaList
  400. // console.log(' this.disFormulaListResult', this.disFormulaListResult)
  401. // }else{
  402. // /*this.$message({
  403. // dangerouslyUseHTMLString: true,
  404. // message:res.data.msg,
  405. // type:'warning'
  406. // });*/
  407. // this.$alert(res.data.msg,'错误信息',{
  408. // dangerouslyUseHTMLString: true,
  409. // confirmButtonText: '确定',
  410. // callback: action => {
  411. // /*this.$message({
  412. // type: 'info',
  413. // message: `action: ${ action }`
  414. // });*/
  415. // }
  416. // });
  417. // }
  418. // })
  419. // //解决上传相同文件不触发change
  420. // let inp = document.getElementById("upFile");
  421. // inp.value = "";
  422. // },
  423. updateNeo() {
  424. this.submitForm('updateNeo').then(() => {
  425. if(this.hasQuestion == 0) {
  426. const param = {
  427. id: this.id,
  428. modifier: this.modifier
  429. }
  430. api.diagBaseUpdateNeo(param).then((res) => {
  431. if(res.data.code == 0) {
  432. this.warning('更新成功', 'success');
  433. } else {
  434. this.warning(res.data.msg)
  435. }
  436. })
  437. } else {
  438. this.warning('更新失败');
  439. }
  440. })
  441. // api.diagBaseUpdateNeo(param).then((res) =>{
  442. // })
  443. },
  444. exportDiagnosticAll(){
  445. this.submitForm('export').then(() => {
  446. if(this.hasQuestion == 0) {
  447. const param = {
  448. diagnoseId: this.id
  449. }
  450. api.exportDiagnosticAll(param).then((res) => {
  451. utils.downloadExportedData(res.data,'诊断依据.xls');
  452. })
  453. }else {
  454. this.warning('导出失败');
  455. }
  456. })
  457. },
  458. submitForm(type) {
  459. if(!this.disName) {
  460. this.warning('请选择诊断');
  461. return
  462. }
  463. this.disFeatureListResult = []
  464. this.disFormulaListResult = []
  465. let errStrList = [];
  466. for(let i = 0; i < this.disFeatureList.length; i++) { //如果有任意一项有值,就检测,所有项都没值,则删掉这条数据
  467. if(this.disFeatureList[i].type || this.disFeatureList[i].code || this.disFeatureList[i].standard || this.disFeatureList[i].relation || this.disFeatureList[i].midResult) {
  468. this.disFeatureListResult.push(this.disFeatureList[i])
  469. }
  470. }
  471. for(let i = 0; i < this.disFormulaList.length; i++) { //如果有任意一项有值,就检测,所有项都没值,则删掉这条数据
  472. if(this.disFormulaList[i].type || this.disFormulaList[i].formula ) {
  473. this.disFormulaListResult.push(this.disFormulaList[i])
  474. }
  475. }
  476. let disFeatureList;
  477. if(this.disFeatureListResult.length) {
  478. disFeatureList = this.disFeatureListResult;
  479. } else {
  480. disFeatureList = [
  481. {
  482. type:'',
  483. code:'',
  484. standard:'',
  485. relation:'',
  486. midResult:'',
  487. result:'',
  488. formula:'',
  489. uniqueName:''
  490. }
  491. ];
  492. }
  493. const disFormulaList = this.disFormulaListResult;
  494. let codeErrorNum = 0;
  495. //必填项是否填写
  496. for(let i=0; i < disFeatureList.length; i++) {
  497. if(!disFeatureList[i].type) {
  498. disFeatureList[i].typeNull = "未选择类型"
  499. }
  500. if(!disFeatureList[i].code) {
  501. disFeatureList[i].codeNull = "未填写编码"
  502. }
  503. if(!disFeatureList[i].standard) {
  504. disFeatureList[i].standardNull = "未填写标准词"
  505. }
  506. if(!disFeatureList[i].type||!disFeatureList[i].code||!disFeatureList[i].standard) {
  507. const errStr = "第" + (i+ 1) +"行必填项未填写"
  508. errStrList.push(errStr)
  509. }
  510. let regex =new RegExp(`^${disFeatureList[i].type}\\.(0|[1-9]\\d?)$`,)
  511. if(disFeatureList[i].code &&!regex.test(disFeatureList[i].code)) { //序号和类型不匹配
  512. codeErrorNum++
  513. disFeatureList[i].codeError = "序号和类型不匹配"
  514. const errStr = "疾病特征第" + (i+ 1) +"行序号和类型不匹配"
  515. errStrList.push(errStr)
  516. } else { //序号和类型匹配但序号重复
  517. let codeArr = disFeatureList.filter(item => item.code ===disFeatureList[i].code)
  518. if(codeArr.length > 1) {
  519. codeErrorNum++
  520. disFeatureList[i].codeError = "序号重复"
  521. const errStr = "疾病特征第" + (i+ 1) +"行序号重复"
  522. errStrList.push(errStr)
  523. }
  524. }
  525. //化验项有结果则必须有关联词
  526. if(disFeatureList[i].type == '3' && disFeatureList[i].midResult && !disFeatureList[i].relation) {
  527. disFeatureList[i].relationNull = "未填写关联词"
  528. const errStr = "第" + (i+ 1) +"行化验项数据填写不完整"
  529. errStrList.push(errStr)
  530. }
  531. //导入后判断
  532. // let regexPause = new RegExp(`、`) //判断标准词是否有顿号
  533. // if(disFeatureList[i].standard &&regexPause.test(disFeatureList[i].standard)) {
  534. // disFeatureList[i].verifyStandard ='数据异常'
  535. // const errStr = "疾病特征第" + (i+ 1) +"行标准词数据异常"
  536. // errStrList.push(errStr)
  537. // }
  538. // if(disFeatureList[i].type == '3'&&regexPause.test(disFeatureList[i].relation)) {
  539. // disFeatureList[i].verifyRelation ='数据异常'
  540. // const errStr = "疾病特征第" + (i+ 1) +"行化验关联词数据异常"
  541. // errStrList.push(errStr)
  542. // }
  543. //导入后判断
  544. if(disFeatureList[i].type == '3' && !disFeatureList[i].midResult ) { //化验项下面诊断公式如果有用到,判断是否填写结果项
  545. const regex2 = new RegExp(`(?<=\\D|\\s?)${disFeatureList[i].code.replace('.','\\.')}(?=\\D|\\s?)`)
  546. // const regex2 = new RegExp(`、\\s*、{1,}`)
  547. // const regex2 = new RegExp(`([^0-9]|\\s{0,1})${disFeatureList[i].code}([^0-9]|\\s{0,1})`)
  548. let hasError = disFormulaList.find(item => {return regex2.test(item.formula)})
  549. if(hasError) {
  550. if(!disFeatureList[i].relation) {
  551. disFeatureList[i].verifyRelation = "数据异常"
  552. }
  553. disFeatureList[i].verifyResult = "数据异常"
  554. const errStr = "第" + (i+ 1) +"行化验项数据异常"
  555. errStrList.push(errStr)
  556. }
  557. }
  558. if(disFeatureList[i].type == '4' && !disFeatureList[i].relation ) { //辅检项下面诊断公式如果有用到,判断是否填写结果项(辅检结果是填在关联词列)
  559. const regex2 = new RegExp(`(?<=\\D|\\s?)${disFeatureList[i].code.replace('.','\\.')}(?=\\D|\\s?)`)
  560. let hasError = disFormulaList.find(item => {return regex2.test(item.formula)})
  561. if(hasError) {
  562. disFeatureList[i].verifyRelation = "数据异常"
  563. const errStr = "第" + (i+ 1) +"行辅捡项数据异常"
  564. errStrList.push(errStr)
  565. }
  566. }
  567. let regex1 =new RegExp(`、\\s*、{1,}|^、|、$`)
  568. if(disFeatureList[i].relation &&regex1.test(disFeatureList[i].relation)) { //不能输入连续的、,前后也不能是、
  569. disFeatureList[i].verifyRelation ='数据异常'
  570. const errStr = "疾病特征第" + (i+ 1) +"行数据异常"
  571. errStrList.push(errStr)
  572. }
  573. if(disFeatureList[i].midResult &&regex1.test(disFeatureList[i].midResult)) {
  574. disFeatureList[i].verifyResult ='数据异常'
  575. const errStr = "疾病特征第" + (i+ 1) +"行数据异常"
  576. errStrList.push(errStr)
  577. }
  578. }
  579. this.disFeatureList = JSON.parse(JSON.stringify(disFeatureList))
  580. let formulaListErrNum = 0
  581. for(let i=0; i < disFormulaList.length; i++) {
  582. if(disFormulaList[i].type&&!disFormulaList[i].formula ) {
  583. disFormulaList[i].verifyFormula = "诊断公式不能为空"
  584. formulaListErrNum++;
  585. const errStr = "诊断公式第" + (i+ 1) +"行诊断公式不能为空"
  586. errStrList.push(errStr)
  587. } else if(disFormulaList[i].formula&&!disFormulaList[i].type) {
  588. disFormulaList[i].verifyType = "诊断类型不能为空"
  589. const errStr = "诊断公式第" + (i+ 1) +"行诊断类型不能为空"
  590. errStrList.push(errStr)
  591. formulaListErrNum++;
  592. }
  593. //导入后判断
  594. // if(disFormulaList[i].type == 91) { //确诊中有没有包含其他不可输入内容
  595. // let regexDisFormula = /[^\u4EFB\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341\u62df\u8bca0-9\/\.+\(\)\(\)]/g
  596. // if(regexDisFormula.test(disFormulaList[i].formula)) {
  597. // disFormulaList[i].verifyFormula = "公式格式错误"
  598. // const errStr = "诊断公式第" + (i+ 1) +"行公式格式错误,"
  599. // errStrList.push(errStr)
  600. // formulaListErrNum++;
  601. // }
  602. // } else { //其他诊断中有没有包含其他不可输入内容
  603. // //计算公式只能输入以下内容: 任、一、二、三、四、五、六、七、八、九、十、0-9、/、.、(、)、(、)
  604. // let regexDisFormula = /[^\u4EFB\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u53410-9\/\.+\(\)\(\)]/g
  605. // if(regexDisFormula.test(disFormulaList[i].formula)) {
  606. // disFormulaList[i].verifyFormula = "公式格式错误"
  607. // const errStr = "诊断公式第" + (i+ 1) +"行公式格式错误。"
  608. // errStrList.push(errStr)
  609. // formulaListErrNum++;
  610. // }
  611. // }
  612. //导入后判断
  613. if(disFormulaList[i].type == 91 && disFormulaList[i].formula.indexOf("拟诊") > -1) { //确诊项如果有拟诊这两个字,判断公式列表中有没有拟诊这项
  614. const noError = disFormulaList.filter(item => item.type == 92).length > 0
  615. if(!noError) {
  616. disFormulaList[i].verifyFormula = "公式格式错误"
  617. const errStr = "诊断公式第" + (i+ 1) +"行公式格式错误"
  618. errStrList.push(errStr)
  619. formulaListErrNum++;
  620. }
  621. }
  622. }
  623. if(disFormulaList.length) {
  624. this.disFormulaList = JSON.parse(JSON.stringify(disFormulaList))
  625. }
  626. let errorStr =''
  627. for(let i = 0; i <errStrList.length; i++) {
  628. errorStr += '<p>'+errStrList[i]+'</p>'
  629. }
  630. if(errStrList.length >0 ||codeErrorNum > 0 ||formulaListErrNum > 0) {
  631. this.errorTips(errorStr)
  632. }
  633. // this.showDelDialog()
  634. return this.diagBaseVerifyData(type)
  635. },
  636. diagBaseVerifyData(type) {
  637. //判断诊断依据先判断化验有没有公表项
  638. const labArr= []
  639. for (let i = 0; i < this.disFeatureListResult.length; i++) {
  640. if(+this.disFeatureListResult[i].type === 3) {
  641. labArr.push({index: i, mealName: this.disFeatureListResult[i].standard, itemName: this.disFeatureListResult[i].relation, uniqueName:''})
  642. }
  643. }
  644. const loading = this.$loading({
  645. lock: true,
  646. text: 'Loading',
  647. spinner: 'el-icon-loading',
  648. background: 'rgba(0, 0, 0, 0.7)'
  649. });
  650. if(type == 'save'){
  651. this.isReady = true
  652. }
  653. if(labArr.length > 0) {
  654. this.labVerifyData(labArr, loading).then(() =>{
  655. if(this.hasNoUniqueName) {
  656. loading.close()
  657. return
  658. }else {
  659. this.verifyDiagBase(loading)
  660. }
  661. })
  662. } else {
  663. this.verifyDiagBase(loading)
  664. }
  665. },
  666. labVerifyData(labArr, loading) {
  667. const labArrParam = {
  668. lisMappingSearchList : labArr
  669. }
  670. return api.getUniqueNameWithList(labArrParam).then((res) => {
  671. this.isReady=false
  672. if(res.data.code === '0') {
  673. const data = res.data.data
  674. let errorStr = ''
  675. for (let i = 0; i < data.length; i++ ) {
  676. if(!data[i].uniqueName) { //判断是否存在公表项
  677. if(!this.hasNoUniqueName) {
  678. this.hasNoUniqueName = true
  679. }
  680. errorStr +=`<p>第${+data[i].index+1}行化验公表项不存在</p>`
  681. this.disFeatureListResult[data[i].index].verifyUnique="公表项不存在"
  682. } else {
  683. this.disFeatureListResult[data[i].index].verifyUnique=""
  684. }
  685. this.disFeatureListResult[data[i].index].uniqueName = data[i].uniqueName
  686. if(data[i].uniqueName) { //有公表项和结果,则将公表项和结果拼接起来,结果用、分隔
  687. if(this.disFeatureListResult[data[i].index].midResult) {
  688. let midResult = this.disFeatureListResult[data[i].index].midResult.replace(' ', '').split('、')
  689. for (let j = 0; j < midResult.length; j++) {
  690. if(midResult[j]) {
  691. midResult[j] = data[i].uniqueName+midResult[j]
  692. }
  693. }
  694. this.disFeatureListResult[data[i].index].result = midResult.join('、')
  695. }
  696. }
  697. }
  698. console.log('errorStr', errorStr)
  699. if(errorStr) {
  700. this.errorTips(errorStr)
  701. }
  702. this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureListResult))
  703. this.disFeatureListResult = JSON.parse(JSON.stringify(this.disFeatureListResult))
  704. } else {
  705. this.warning(res.msg)
  706. loading.close()
  707. return
  708. }
  709. }).catch(()=>{ this.isReady=false;loading.close()})
  710. },
  711. verifyDiagBase(loading) {
  712. const param = {
  713. disFeature: this.disFeatureListResult,
  714. disName: this.disName,
  715. disformula: this.disFormulaListResult,
  716. id: this.id,
  717. modifier: this.modifier
  718. }
  719. return api.diagBaseVerifyData(param).then((res) => {
  720. if(+res.data.code === 0) {
  721. const data = res.data.data
  722. this.isReady=false
  723. if(type =='save') {
  724. if(data.hasQuestion) {
  725. this.warning('校验完成请先调整错误数据,该数据已保存')
  726. } else {
  727. this.warning('校验成功', 'success')
  728. }
  729. }
  730. this.id = data.id
  731. this.disNameExist = data.disNameExist
  732. this.disFeatureList = data.disFeature
  733. if(data.disformula.length) {
  734. this.disFormulaList = data.disformula
  735. }else {
  736. this.disFormulaList = [
  737. {
  738. type:'',
  739. code:'',
  740. standard:'',
  741. relation:'',
  742. result:'',
  743. midResult:'',
  744. formula:'',
  745. uniqueName:''
  746. }
  747. ]
  748. }
  749. this.hasQuestion = data.hasQuestion
  750. } else {
  751. this.hasQuestion = 1
  752. this.warning(res.msg)
  753. }
  754. loading.close()
  755. }).catch(()=>{ this.hasQuestion = false; this.isReady=false; loading.close()})
  756. },
  757. showConfirmDialog(msg, resolve) {
  758. this.$alert(msg, '提示', {
  759. confirmButtonText: '确定',
  760. type: 'warning'
  761. }).then(() => {
  762. resolve();
  763. }).catch(() => {});
  764. },
  765. handleInp(index,e,type,itemType){ //分组不能输入负数
  766. const value = e;
  767. if(type === 'FeatureNumber') { //序号只能输入数字和.
  768. this.$nextTick(() => {
  769. this.disFeatureList[index].code = value.replace(/[^\d.]/g,'')
  770. })
  771. } else if(type==='FeatureStand') { //标准词不能输入顿号
  772. this.$nextTick(() => {
  773. this.disFeatureList[index].standard = value.replace(/、/g,'')
  774. })
  775. // this.disFeatureList[index].standard = value.replace(/、/g,'')
  776. } else if ( type === 'FormulaNumber') {
  777. //计算公式确诊只能输入以下内容: 任、一、二、三、四、五、六、七、八、九、十、拟、诊、0-9、/、.、(、)、(、)
  778. if(itemType == 91) {
  779. this.$nextTick(() => {
  780. 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, '')
  781. })
  782. } else { //计算公式其他只能输入以下内容: 任、一、二、三、四、五、六、七、八、九、十、0-9、/、.、(、)、(、)
  783. //计算公式只能输入以下内容: 任、一、二、三、四、五、六、七、八、九、十、0-9、/、.、(、)、(、)
  784. this.$nextTick(() => {
  785. 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, '')
  786. })
  787. }
  788. } else if ( type === 'FeatureRelate') {
  789. if(itemType == 3) {
  790. this.$nextTick(() => {
  791. this.disFeatureList[index].relation = value.replace(/、/g,'')
  792. })
  793. }
  794. }
  795. // const item = this.selectedIndexList[index].indexDesc;
  796. // e.target.value = value.replace(/[^\d]/g,'');
  797. // this.selectedIndexList[index].indexDesc = item.replace(/[^\d]/g,'');
  798. },
  799. clickItem(index, type) {
  800. switch(type) {
  801. case 'FeatureType':
  802. this.disFeatureList[index].typeNull = ''
  803. this.disFeatureList[index].code = ''
  804. this.disFeatureList[index].standard = ''
  805. this.disFeatureList[index].relation = ''
  806. this.disFeatureList[index].midResult = ''
  807. this.disFeatureList[index].result = ''
  808. this.disFeatureList[index].formula = ''
  809. this.disFeatureList[index].uniqueName = ''
  810. return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
  811. case 'FeatureNumber':
  812. this.disFeatureList[index].codeNull = ''
  813. this.disFeatureList[index].verifyCode = ''
  814. this.disFeatureList[index].codeError = ''
  815. return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
  816. case 'FeatureStand':
  817. this.disFeatureList[index].verifyStandard =''
  818. this.disFeatureList[index].standardNull =''
  819. return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
  820. case 'FeatureRelate':
  821. this.disFeatureList[index].verifyRelation =''
  822. return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
  823. case 'FeatureResult':
  824. this.disFeatureList[index].verifyResult =''
  825. return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
  826. case 'FeatureResult':
  827. this.disFeatureList[index].verifyResult =''
  828. return this.disFeatureList = JSON.parse(JSON.stringify(this.disFeatureList))
  829. case 'FormulaType':
  830. this.disFormulaList[index].verifyType =''
  831. this.disFormulaList[index].formula =''
  832. return this.disFormulaList = JSON.parse(JSON.stringify(this.disFormulaList))
  833. case 'FormulaNumber':
  834. this.disFormulaList[index].verifyFormula =''
  835. return this.disFormulaList = JSON.parse(JSON.stringify(this.disFormulaList))
  836. }
  837. },
  838. warning(msg, type,time) {
  839. this.$message({
  840. showClose: true,
  841. message: msg,
  842. type: type || 'warning',
  843. duration:time || '3000'
  844. })
  845. },
  846. errorTips(errorStr) {
  847. this.$alert(errorStr,'错误信息',{
  848. dangerouslyUseHTMLString: true,
  849. confirmButtonText: '确定',
  850. callback: action => {
  851. /*this.$message({
  852. type: 'info',
  853. message: `action: ${ action }`
  854. });*/
  855. }
  856. });
  857. return
  858. }
  859. }
  860. }
  861. </script>
  862. <style lang="less">
  863. @import '../../less/common.less';
  864. .AddDiagBaseWrapper {
  865. color: #606266;
  866. .topBack {
  867. top: 0;
  868. }
  869. .groupTitle {
  870. background-color: #fff;
  871. height: 40px;
  872. line-height: 40px;
  873. padding-left: 20px;
  874. }
  875. .searchInput, .searchName {
  876. display: inline-block;
  877. height: 32px;
  878. line-height: 32px;
  879. border: 1px solid #a9a9a9;
  880. margin: 0px 0 0 0;
  881. padding: 0 5px;
  882. float: left;
  883. margin-top: 4px;
  884. }
  885. .isRequired .el-form-item__label::before {
  886. content: '*';
  887. color: red;
  888. }
  889. .searchName {
  890. border-left: none;
  891. cursor: pointer;
  892. font-size: 16px;
  893. padding: 0 14px;
  894. }
  895. .itemList {
  896. position: absolute;
  897. background: #fff;
  898. width: 162px;
  899. max-height: 150px;
  900. border: 1px solid #a9a9a9;
  901. left: 138px;
  902. top: 37px;
  903. z-index: 2;
  904. overflow-y: auto;
  905. }
  906. .diagItem {
  907. padding: 0 5px;
  908. height: 30px;
  909. line-height: 30px;
  910. font-size: 14px;
  911. cursor: pointer;
  912. }
  913. .diagItem:hover {
  914. background: #f5f7fa;
  915. }
  916. .addDepartForm {
  917. position: relative;
  918. background-color: #fff;
  919. padding: 20px;
  920. margin: 70px 20px 0px 20px;
  921. }
  922. .addDiagName {
  923. position: relative;
  924. }
  925. .symptomList {
  926. position: relative;
  927. background-color: #fff;
  928. padding: 20px 20px 100px 20px;
  929. margin: 0px 20px 40px 20px;
  930. min-height: 400px;
  931. }
  932. .diagTable {
  933. width: 100%;
  934. border-collapse: collapse;
  935. margin-bottom: 20px;
  936. tr {
  937. td {
  938. border: 1px solid #a9a9a9;
  939. text-align: center;
  940. }
  941. .FormulaOpera, .FeatureOpera{
  942. background: #fff;
  943. border: none;
  944. text-align: left;
  945. padding-left: 30px;
  946. }
  947. /deep/.el-textarea__inner {
  948. width: 100%;
  949. line-height: 20px;
  950. resize:none;
  951. border: none;
  952. border-radius: 0;
  953. text-align: center;
  954. }
  955. }
  956. .selectedContent {
  957. width: 25%;
  958. }
  959. .selectedContentGroup {
  960. width: 55%;
  961. }
  962. .selectedContentOpera {
  963. width: 20%;
  964. }
  965. }
  966. .groupInput {
  967. text-align: center;
  968. color: #606266;
  969. width: 80%;
  970. }
  971. .groupTextarea {
  972. text-align: center;
  973. color: #606266;
  974. width: 100%;
  975. }
  976. .btn {
  977. position: absolute;
  978. background-color: #fff;
  979. width: 100%;
  980. margin: 20px 0;
  981. height: 40px;
  982. bottom: 0px;
  983. right: 0px;
  984. .btnBox {
  985. position: absolute;
  986. right: 0px;
  987. }
  988. .el-button {
  989. margin-right: 20px;
  990. }
  991. }
  992. .tableTitle{
  993. background: rgba(239,243,249,1);
  994. }
  995. .require::after{
  996. content:"*";
  997. color: red;
  998. }
  999. .borderRed {
  1000. border: 3px solid red ;
  1001. box-sizing: border-box;
  1002. }
  1003. .colorRed {
  1004. color: red;
  1005. }
  1006. .FeatureSort {
  1007. width: 5%;
  1008. }
  1009. .FeatureType {
  1010. width: 7%;
  1011. padding: 0 5px;
  1012. }
  1013. .FeatureNumber {
  1014. width: 8%;
  1015. }
  1016. .FeatureStand {
  1017. width: 25%;
  1018. }
  1019. .FeatureRelate {
  1020. width: 25%;
  1021. }
  1022. .FeatureuniqueName {
  1023. width: 10%;
  1024. }
  1025. .FeatureResult {
  1026. width: 10%;
  1027. }
  1028. .FeatureOpera{
  1029. width: 10%;
  1030. }
  1031. .FormulaSort{
  1032. width: 5%;
  1033. }
  1034. .FormulaType{
  1035. width: 7%;
  1036. padding: 0 5px;
  1037. }
  1038. .FormulaNumber{
  1039. width: 78%;
  1040. }
  1041. .FormulaOpera{
  1042. width: 10%;
  1043. }
  1044. .btnOpera {
  1045. width:16px;
  1046. height:16px;
  1047. background:rgba(176,190,197,1);
  1048. border-radius: 50%;
  1049. color: #fff;
  1050. line-height: 16px;
  1051. text-align: center;
  1052. }
  1053. /deep/.el-input--mini .el-input__inner {
  1054. width: 80px;
  1055. }
  1056. /deep/ .is-disabled {
  1057. background: #ECECEC;
  1058. color: #AAAAAA;
  1059. border: none;
  1060. }
  1061. .selectType {
  1062. input {
  1063. border: 3px solid red;
  1064. }
  1065. input:hover {
  1066. border: 3px solid red;
  1067. }
  1068. }
  1069. .moduleTitle {
  1070. margin: 0 0 10px 0;
  1071. }
  1072. .inpDisabled{
  1073. textarea {
  1074. background: #ECECEC;
  1075. color: #AAAAAA;
  1076. border: none;
  1077. cursor: not-allowed;
  1078. height: 100%;
  1079. }
  1080. }
  1081. .inpTips {
  1082. font-size: 14px;
  1083. color: red;
  1084. margin-bottom: 10px;
  1085. }
  1086. #upFile{
  1087. display: none
  1088. }
  1089. }
  1090. </style>