AddDiagBase.vue 52 KB

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