AddChemicalAndCommonMapping.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <div class="AddChemicalAndCommonMappingWrapper clearfix" @click="close">
  3. <crumbs
  4. :title="isEdit ? '诊断关联维护--修改关联' : '诊断关联维护--添加关联'"
  5. class="topBack"
  6. :param="$route.params"
  7. linkTo="ChemicalAndCommonMapping"
  8. ></crumbs>
  9. <div class="AddChemicalAndCommonMappingBox clearfix">
  10. <div class="titleBox clearfix">
  11. <p class="title">医院术语</p>
  12. <p class="title">标准术语</p>
  13. </div>
  14. <div class="leftBox clearfix">
  15. <div class="itemLabel clearfix">
  16. <label class="itemLabelName">诊断名称</label>
  17. <input class="searchInput" type="text" v-model="mealText" />
  18. </div>
  19. <div class="itemLabel clearfix">
  20. <!-- <label class="itemLabelName isRequired">诊断名称预览:</label> -->
  21. <label class="itemLabelName">诊断名称预览:</label>
  22. <span class="selectItemName">{{mealText}}</span>
  23. </div>
  24. <!-- <div class="itemLabel clearfix">
  25. <label class="itemLabelName">选择化验大项:</label>
  26. <input class="searchInput" @focus="focuInput" type="text" v-model="mealText" />
  27. <span class="searchName" @click="searchMealItem(1)">搜索</span>
  28. <ul
  29. v-if="showMealNameList&&mealNameList.length >0"
  30. class="itemList mealNameList"
  31. ref="mealNameList"
  32. >
  33. <li
  34. v-for="item in mealNameList"
  35. class="mealNameItem ellipsis"
  36. :title="item.conceptName"
  37. @click="selectMealName(item)"
  38. :key="item.conceptId"
  39. >{{item.conceptName}}</li>
  40. </ul>
  41. </div>-->
  42. <!-- <div class="itemLabel clearfix">
  43. <label class="itemLabelName isRequired">已选择化验大项:</label>
  44. <span class="selectItemName">{{form.mealName}}</span>
  45. </div>-->
  46. <!-- <div class="itemLabel clearfix">
  47. <label class="itemLabelName">选择化验小项:</label>
  48. <input class="searchInput" @focus="focuInput" type="text" v-model="itemText" />
  49. <span class="searchName" @click="searchMealItem(2)">搜索</span>
  50. <ul
  51. v-if="showItemNameList&&itemNameList.length >0"
  52. class="itemList itemNameList"
  53. ref="itemNameList"
  54. >
  55. <li
  56. v-for="item in itemNameList"
  57. class="mealNameItem ellipsis"
  58. :title="item.conceptName"
  59. @click="selectItemName(item)"
  60. :key="item.conceptId"
  61. >{{item.conceptName}}</li>
  62. </ul>
  63. </div>-->
  64. <!-- <div class="itemLabel">
  65. <label class="itemLabelName">已选择化验小项:</label>
  66. <span class="selectItemName">{{form.itemName}}</span>
  67. </div>-->
  68. </div>
  69. <div class="midBox">
  70. <img class="midLogo" src="../../../images/relation.png" alt />
  71. <p class="midTitle">相互关联</p>
  72. </div>
  73. <div class="rightBox">
  74. <div class="itemLabel">
  75. <label class="itemLabelName">诊断名称</label>
  76. <input class="searchInput" @focus="focuInput" type="text" v-model="uniqueText" />
  77. <span class="searchName" @click="searchMealItem(3)">搜索</span>
  78. <ul
  79. v-if="showUniqueNameList&&uniqueNameList.length >0"
  80. class="itemList uniqueNameList"
  81. ref="uniqueNameList"
  82. >
  83. <li
  84. v-for="item in uniqueNameList"
  85. class="mealNameItem ellipsis"
  86. :title="item.name"
  87. @click="selectUniqueName(item)"
  88. :key="item.icd10Code"
  89. >{{item.name}}</li>
  90. </ul>
  91. <ul
  92. v-else-if="showUniqueNameList&&uniqueNameList.length === 0"
  93. class="itemList uniqueNameList"
  94. >
  95. <li class="mealNameItem ellipsis">无数据</li>
  96. </ul>
  97. <ul
  98. v-else-if=" isSendDataOver === 1"
  99. class="itemList uniqueNameList"
  100. >
  101. <li class="mealNameItem ellipsis">加载中.....</li>
  102. </ul>
  103. </div>
  104. <div class="itemLabel">
  105. <!-- <label class="itemLabelName isRequired">诊断名称预览:</label> -->
  106. <label class="itemLabelName">诊断名称预览:</label>
  107. <span class="selectItemName">{{form.uniqueName}}</span>
  108. </div>
  109. </div>
  110. </div>
  111. <div class="btn">
  112. <!-- <span class="sumbit" @click="submitForm">建立关联</span> -->
  113. <el-button type="primary" :disabled="saveDisable" @click="submitForm">确定</el-button>
  114. </div>
  115. </div>
  116. </template>
  117. <script>
  118. import api from '@api/icss.js';
  119. export default {
  120. name: 'AddChemicalAndCommonMapping',
  121. data() {
  122. return {
  123. mealText: '', //化验大项搜索文字内容
  124. itemText: '', //化验小项搜索文字内容
  125. uniqueText: '', //公表项搜索文字内容
  126. isEdit: false,
  127. editId: '',
  128. mealNameList: [],
  129. itemNameList: [],
  130. uniqueNameList: [],
  131. showMealNameList: false,
  132. showItemNameList: false,
  133. showUniqueNameList: false,
  134. form: {
  135. mealName: '', //大项名称
  136. mealId: '', //大项Id
  137. itemName: '', //小项名称
  138. itemId: '', //小项Id
  139. uniqueName: '', //公表名称,必填
  140. uniqueId: '' //公表项Id
  141. },
  142. saveDisable: false, //保存按钮禁止点击
  143. isSendDataOver: 0 // 请求列表数据过程 0 发送请求前 1 请求过程 2请求结束
  144. };
  145. },
  146. created() {
  147. //修改
  148. const { isEdit, data } = this.$route.params;
  149. if (isEdit) {
  150. this.isEdit = isEdit;
  151. this.editId = data.id;
  152. this.uniqueText = data.uniqueName;
  153. this.mealText = data.hisName;
  154. this.form.uniqueName = data.uniqueName;
  155. }
  156. },
  157. methods: {
  158. close() {
  159. this.mealNameList = [];
  160. this.itemNameList = [];
  161. this.uniqueNameList = [];
  162. this.showSearchList();
  163. },
  164. // 搜索
  165. searchMealItem(type) {
  166. if (type == '1' || type == '2') {
  167. this.getTagList(type);
  168. } else if (type == '3') {
  169. this.isSendDataOver = 1; // 发送请求中
  170. // 搜索标准术语列表
  171. this.getAllLisConcept();
  172. }
  173. },
  174. getTagList(type) {
  175. let param = {
  176. relationPosition: 3
  177. };
  178. if (type == 1) {
  179. param.name = this.mealText.trim();
  180. param.typeId = 12;
  181. } else if (type == 2) {
  182. param.name = this.itemText.trim();
  183. param.typeId = 13;
  184. }
  185. if (!param.name) {
  186. return;
  187. }
  188. api.getConceptInfoAssay(param).then(res => {
  189. if (res.data.code === '0') {
  190. if (type == 1) {
  191. this.mealNameList = res.data.data;
  192. this.showSearchList('showMealNameList');
  193. } else if (type == 2) {
  194. this.itemNameList = res.data.data;
  195. this.showSearchList('showItemNameList');
  196. }
  197. }
  198. });
  199. },
  200. // 标准术语搜索列表
  201. getAllLisConcept() {
  202. let params = {
  203. type: 4,
  204. inputStr: this.uniqueText,
  205. sex: 3,
  206. age: 0
  207. };
  208. if (!params.inputStr) {
  209. return;
  210. }
  211. api.retrievalSearch(params).then(res => {
  212. console.log(res,'==================res,');
  213. if (res.data.code === '0') {
  214. this.uniqueNameList = res.data.data.diseaseNames;
  215. this.showSearchList('showUniqueNameList');
  216. this.isSendDataOver = 2; //请求发送结束
  217. }
  218. });
  219. },
  220. // 获取焦点搜索
  221. focuInput() {
  222. this.showSearchList();
  223. },
  224. // 显示搜索列表数据
  225. showSearchList(type) {
  226. this.showMealNameList = false;
  227. this.showItemNameList = false;
  228. this.showUniqueNameList = false;
  229. if (type === 'showMealNameList') {
  230. this.showMealNameList = true;
  231. } else if (type === 'showItemNameList') {
  232. this.showItemNameList = true;
  233. } else if (type === 'showUniqueNameList') {
  234. this.showUniqueNameList = true;
  235. }
  236. },
  237. selectMealName(item) {
  238. this.form.mealName = item.conceptName;
  239. this.form.mealId = item.conceptId;
  240. // this.$refs['mealNameList'].style.display='none'
  241. this.mealText = '';
  242. this.mealNameList = [];
  243. },
  244. selectItemName(item) {
  245. this.form.itemName = item.conceptName;
  246. this.form.itemId = item.conceptId;
  247. this.itemText = '';
  248. this.itemNameList = [];
  249. },
  250. // 选中诊断标准术语
  251. selectUniqueName(item) {
  252. this.form.uniqueName = item.name;
  253. this.uniqueNameList = [];
  254. },
  255. // 初始化表单数据
  256. initForm() {
  257. this.form.uniqueName = '';
  258. this.mealText = '';
  259. this.uniqueText = '';
  260. },
  261. // 建立关联-参数处理
  262. submitForm() {
  263. const { mealText } = this;
  264. const { uniqueName } = this.form;
  265. if (!mealText || !uniqueName) {
  266. this.warning('请填写相关数据');
  267. return;
  268. }
  269. let params = {
  270. hisName: mealText,
  271. uniqueName: uniqueName
  272. };
  273. if (this.isEdit) {
  274. params = { ...params, id: this.editId };
  275. }
  276. this.showSaveDialog(params);
  277. },
  278. // 建立关联-映射关系是否已存在
  279. showSaveDialog(params) {
  280. this.saveDisable = true; //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
  281. api
  282. .diseaseIsExistRecord(params)
  283. .then(res => {
  284. if (!res.data.data) {
  285. // 不存在,创建新的关联
  286. // 如果是编辑时,需要携带id
  287. if (this.isEdit) {
  288. params = { ...params, id: this.editId };
  289. }
  290. this.saveLisMapping(params, '保存成功', 'success');
  291. } else {
  292. // 已存在,提示修改
  293. // this.showConfirmDialog('该关联已存在是否替换旧的关系信息', () => {
  294. // this.saveLisMapping(params, '关联建立成功', 'success');
  295. // });
  296. this.warning('该条关联已存在,无法添加');
  297. this.saveDisable = false;
  298. }
  299. })
  300. .catch(err => {
  301. this.warning(err);
  302. });
  303. },
  304. // 映射关系不存在-建立关联
  305. saveLisMapping(params, msg, type) {
  306. api.saveOrUpdateDiseaseRecord(params).then(res => {
  307. if (res.data.code === '0') {
  308. this.warning(res.data.msg || msg, type);
  309. // this.$router.push({name: 'ChemicalAndCommonMapping'});
  310. this.initForm();
  311. this.$router.push({
  312. name: 'ChemicalAndCommonMapping',
  313. params: Object.assign({}, this.$route.params, {
  314. currentPage: 1
  315. })
  316. });
  317. } else {
  318. this.warning(res.data.msg);
  319. }
  320. this.saveDisable = false;
  321. });
  322. },
  323. // 关联已存在模态框
  324. showConfirmDialog(msg, resolve) {
  325. this.$confirm(msg, '提示', {
  326. customClass: 'confirmRealation',
  327. confirmButtonText: '是',
  328. cancelButtonText: '否',
  329. cancelButtonClass: 'cancelButton',
  330. type: 'warning'
  331. })
  332. .then(() => {
  333. resolve();
  334. })
  335. .catch(() => {
  336. this.saveDisable = false;
  337. this.warning('建立失败', 'error');
  338. });
  339. },
  340. warning(msg, type) {
  341. this.$message({
  342. showClose: true,
  343. message: msg,
  344. type: type || 'warning'
  345. });
  346. }
  347. }
  348. };
  349. </script>
  350. <style lang="less">
  351. .AddChemicalAndCommonMappingWrapper {
  352. .AddChemicalAndCommonMappingBox {
  353. min-width: 940px;
  354. }
  355. color: #606266;
  356. .topBack {
  357. top: 0;
  358. }
  359. // .groupTitle {
  360. // width: calc(100% - 50px);
  361. // height: 40px;
  362. // background: #fff;
  363. // padding: 0 20px 0 30px;
  364. // margin-bottom: 20px;
  365. // line-height: 40px;
  366. // position: relative;
  367. // z-index: 5;
  368. // }
  369. .titleBox {
  370. padding: 0 0 10px 0px;
  371. }
  372. .title {
  373. width: 50%;
  374. float: left;
  375. font-size: 14px;
  376. }
  377. .AddChemicalAndCommonMappingBox {
  378. padding: 20px 30px 20px 30px;
  379. margin: 70px 20px 0 20px;
  380. background: #fff;
  381. }
  382. .leftBox,
  383. .midBox,
  384. .rightBox {
  385. width: 40%;
  386. float: left;
  387. min-height: 200px;
  388. font-size: 14px;
  389. }
  390. .midBox {
  391. width: 6%;
  392. padding: 50px 0 0 0;
  393. text-align: center;
  394. }
  395. .midTitle {
  396. width: 40px;
  397. margin: 0 auto;
  398. }
  399. .midLogo {
  400. margin: 0 auto;
  401. }
  402. .leftBox,
  403. .rightBox {
  404. border: 1px solid #a9a9a9;
  405. padding: 20px 20px;
  406. }
  407. .itemLabel {
  408. width: 100%;
  409. min-height: 50px;
  410. line-height: 50px;
  411. position: relative;
  412. }
  413. .itemLabelName,
  414. .searchInput,
  415. .searchName {
  416. float: left;
  417. color: #606266;
  418. }
  419. .itemLabelName {
  420. width: 150px;
  421. }
  422. .isRequired::before {
  423. content: '*';
  424. color: red;
  425. }
  426. .searchInput,
  427. .mealNameItem {
  428. padding: 0 5px;
  429. }
  430. .searchInput,
  431. .searchName {
  432. display: inline-block;
  433. height: 32px;
  434. line-height: 32px;
  435. border: 1px solid #a9a9a9;
  436. margin: 8px 0 0 0;
  437. }
  438. .searchName {
  439. text-align: center;
  440. border-left: none;
  441. cursor: pointer;
  442. padding: 0 12px;
  443. font-size: 16px;
  444. }
  445. .itemList {
  446. position: absolute;
  447. background: #fff;
  448. width: 162px;
  449. max-height: 150px;
  450. border: 1px solid #a9a9a9;
  451. left: 150px;
  452. top: 42px;
  453. z-index: 2;
  454. overflow-y: auto;
  455. }
  456. .itemList {
  457. width: calc(100% - 131px);
  458. }
  459. .mealNameItem {
  460. height: 30px;
  461. line-height: 30px;
  462. font-size: 14px;
  463. cursor: pointer;
  464. }
  465. .mealNameItem:hover {
  466. background: #f5f7fa;
  467. }
  468. .selectItemName {
  469. display: inline-block;
  470. width: calc(100% - 160px);
  471. }
  472. .btn {
  473. position: relative;
  474. background-color: #fff;
  475. margin: 0px 20px;
  476. padding: 20px;
  477. min-width: 960px;
  478. height: 80px;
  479. .el-button {
  480. position: absolute;
  481. right: 80px;
  482. top: 20px;
  483. }
  484. }
  485. .sumbit {
  486. position: absolute;
  487. display: inline-block;
  488. width: 80px;
  489. height: 30px;
  490. line-height: 30px;
  491. border: 1px solid #a9a9a9;
  492. text-align: center;
  493. right: 100px;
  494. }
  495. }
  496. .confirmRealation {
  497. .cancelButton {
  498. border: 1px solid #a9a9a9;
  499. span {
  500. color: #606266;
  501. }
  502. }
  503. }
  504. </style>