LtModal.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  1. <template>
  2. <div class="modal-container">
  3. <div class="cover"></div>
  4. <div class="modal-box">
  5. <div class="modal-title">
  6. <a class="close" @click="closeModal()">×</a>
  7. </div>
  8. <div class="modal-body">
  9. <el-form
  10. :model="form"
  11. :rules="rules"
  12. label-position="right"
  13. label-width="145px"
  14. ref="relationForm"
  15. >
  16. <div class="AddChemicalAndCommonMappingBox clearfix">
  17. <div class="titleBox clearfix">
  18. <p class="title">医院术语</p>
  19. <p class="title">标准术语</p>
  20. </div>
  21. <div class="leftBox clearfix">
  22. <el-row>
  23. <el-col :span="16">
  24. <el-form-item :label="meal+':'" prop="hisName">
  25. <el-input
  26. v-model.trim="form.hisName"
  27. clearable
  28. style="minWidth: 240px"
  29. @input="onchange"
  30. @blur="onblur"
  31. ></el-input>
  32. </el-form-item>
  33. <el-form-item :label="meal+'预览:'">
  34. <span class="previewInfo" style="minWidth: 240px">{{form.hisName}}</span>
  35. </el-form-item>
  36. </el-col>
  37. <el-col :span="16" v-if="type == 1">
  38. <el-form-item :label="detail+':'" prop="hisDetailName">
  39. <el-input
  40. v-model.trim="form.hisDetailName"
  41. clearable
  42. style="minWidth: 240px"
  43. @input="onchange"
  44. ></el-input>
  45. </el-form-item>
  46. <el-form-item :label="detail+'预览:'">
  47. <span class="previewInfo" style="minWidth: 240px">{{form.hisDetailName}}</span>
  48. </el-form-item>
  49. </el-col>
  50. </el-row>
  51. </div>
  52. <div class="midBox">
  53. <img class="midLogo" src="../../images/relation.png" alt />
  54. <p class="midTitle">相互关联</p>
  55. </div>
  56. <div class="rightBox">
  57. <el-row>
  58. <el-col :span="16">
  59. <el-form-item :label="standard+':'" prop="searchText">
  60. <el-select
  61. style="width:100%;minWidth: 240px"
  62. v-model="form.searchText"
  63. filterable
  64. remote
  65. clearable
  66. :loading="showDrop"
  67. loading-text="加载中..."
  68. @change="changeWord"
  69. @focus="handleFocus"
  70. @visible-change="handleVisible"
  71. placeholder="搜索"
  72. :remote-method="searchTerms"
  73. reserve-keyword
  74. >
  75. <el-option
  76. v-for="item in uniqueNameList"
  77. :key="item.icd10Code"
  78. :label="item.name"
  79. :value="item"
  80. :title="item.name"
  81. ></el-option>
  82. </el-select>
  83. </el-form-item>
  84. <el-form-item v-if="tableData.length >0">
  85. <el-table
  86. :row-class-name="tableRowClassName"
  87. :row-style="selectedstyle"
  88. :data="tableData"
  89. @row-click="btn"
  90. size="mini"
  91. :class="{tabs:uniqueNameList}"
  92. class="tab"
  93. >
  94. <el-table-column prop="name" :show-overflow-tooltip="true" label="词名"></el-table-column>
  95. <el-table-column prop="address" :show-overflow-tooltip="true" label="来源">
  96. <template slot-scope="scope">
  97. <span>{{scope.row.source == 1?'标准词匹配':scope.row.source == 2?'同义词匹配':scope.row.source == 5?'相似词匹配':''}}</span>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. </el-form-item>
  102. <el-form-item :label="standard+'预览:'">
  103. <!-- <span class="previewInfo">{{!isEdit ? form.searchText.name : form.searchText}}</span> -->
  104. <span class="previewInfo" style="minWidth: 240px">{{form.searchText}}</span>
  105. </el-form-item>
  106. <el-form-item label="ICD编码:" v-if="type == 4">
  107. <span class="previewInfo" style="minWidth: 240px">{{form.icdCode}}</span>
  108. </el-form-item>
  109. <el-form-item :label="detail+':'" v-if="type == 12 || type == 13">
  110. <span class="previewInfo" style="minWidth: 240px">{{form.icdCode}}</span>
  111. </el-form-item>
  112. <el-form-item label="药品剂型:" v-if="type == 5">
  113. <el-select
  114. style="width:100%;minWidth: 240px"
  115. v-model="form.form"
  116. filterable
  117. remote
  118. clearable
  119. :loading="showDrop"
  120. loading-text="加载中..."
  121. @change="drugchangeWord"
  122. @focus="handleFocus"
  123. @visible-change="handleVisible"
  124. placeholder="搜索"
  125. :remote-method="searchDrug"
  126. reserve-keyword
  127. >
  128. <el-option
  129. v-for="item in drugList"
  130. :key="item.icd10Code"
  131. :label="item.name"
  132. :value="item"
  133. :title="item.name"
  134. ></el-option>
  135. </el-select>
  136. </el-form-item>
  137. </el-col>
  138. </el-row>
  139. </div>
  140. </div>
  141. </el-form>
  142. </div>
  143. <div class="mapList">
  144. 已关联标准术语:
  145. <span v-for="item in mapList" :key="item.id">{{item.uniqueName}};</span>
  146. </div>
  147. <div class="modal-footer">
  148. <button class="confirm btns" :disabled="saveDisable" @click="submitForm">确定</button>
  149. <button class="cancel btns" @click="closeModal">取消</button>
  150. </div>
  151. </div>
  152. </div>
  153. </template>
  154. <script>
  155. import api from '@api/icss.js';
  156. import config from '@api/config.js';
  157. import utils from '@api/utils.js';
  158. export default {
  159. name: 'lt-modal',
  160. props: ['modalVisiable', 'meal', 'detail', 'standard', 'type', 'data'],
  161. data() {
  162. return {
  163. form: {
  164. searchText: '', //搜索字段
  165. hisName: '',
  166. icdCode: '',
  167. hisDetailName: '',
  168. formConceptId: '',
  169. conceptId: '',
  170. form: '',
  171. source:''
  172. },
  173. showDrop: false, //下拉框显示文字
  174. saveDisable: false, //保存按钮禁止点击
  175. uniqueNameList: [],
  176. rules: {
  177. hisName: [
  178. { required: true, message: '请输入' + this.meal, trigger: 'change' },
  179. { max: 80, message: this.meal + '最多80字', trigger: 'change' }
  180. ],
  181. searchText: [
  182. { required: true, message: '请选择' + this.meal, trigger: 'change' }
  183. ]
  184. },
  185. isEdit: false,
  186. editId: '',
  187. drugList: [],
  188. tableData: [],
  189. mapList: [],
  190. getIndex: 6
  191. };
  192. },
  193. created() {
  194. //修改
  195. if (this.data != {}) {
  196. this.isEdit = true;
  197. this.editId = this.data.id;
  198. this.form.hisName = this.data.hisName;
  199. this.form.searchText = this.data.uniqueName;
  200. this.form.icdCode = this.data.code;
  201. this.form.conceptId = this.data.conceptId;
  202. this.form.formConceptId = this.data.formConceptId;
  203. this.form.form = this.data.form;
  204. this.form.source = this.data.source;
  205. this.form.hisCode = this.data.hisCode;
  206. this.getTermMatching();
  207. this.getRelatedMapping();
  208. }
  209. },
  210. methods: {
  211. selectedstyle({ row, rowIndex }) {
  212. if (this.getIndex === rowIndex) {
  213. return {
  214. 'background-color': '#EBEEF5'
  215. };
  216. }
  217. },
  218. tableRowClassName({ row, rowIndex }) {
  219. row.index = rowIndex;
  220. },
  221. btn(row) {
  222. if (this.getIndex == row.index) {
  223. this.getIndex = 6;
  224. this.form.searchText = '';
  225. this.form.conceptId = '';
  226. this.form.icdCode = '';
  227. this.form.source = '';
  228. } else {
  229. this.getIndex = row.index;
  230. this.form.searchText = row.name;
  231. this.form.conceptId = row.id;
  232. this.form.icdCode = row.code;
  233. this.form.source = row.source;
  234. }
  235. },
  236. // 搜索列表
  237. searchTerms(query) {
  238. if (!query) {
  239. this.uniqueNameList = [];
  240. return;
  241. }
  242. this.showDrop = true;
  243. let params = {
  244. type: this.type,
  245. inputStr: query,
  246. sex: 3,
  247. age: 0
  248. };
  249. api.retrievalSearch(params).then(res => {
  250. this.showDrop = false;
  251. if (res.data.code === '0') {
  252. this.uniqueNameList = res.data.data.nameList;
  253. }
  254. });
  255. },
  256. searchDrug(query) {
  257. if (!query) {
  258. this.drugList = [];
  259. return;
  260. }
  261. this.showDrop = true;
  262. let params = {
  263. type: 15,
  264. inputStr: query,
  265. sex: 3,
  266. age: 0
  267. };
  268. api.retrievalSearch(params).then(res => {
  269. this.showDrop = false;
  270. if (res.data.code === '0') {
  271. this.drugList = res.data.data.nameList;
  272. }
  273. });
  274. },
  275. onchange() {
  276. this.getRelatedMapping();
  277. },
  278. getRelatedMapping() {
  279. const { hisName, hisDetailName } = this.form;
  280. let params = {
  281. type: this.type,
  282. hisDetailName: hisDetailName,
  283. hisName: hisName
  284. };
  285. api.getRelatedMapping(params).then(res => {
  286. this.showDrop = false;
  287. if (res.data.code === '0') {
  288. this.mapList = res.data.data;
  289. }
  290. });
  291. },
  292. changeWord(newValue) {
  293. this.form.searchText = newValue.name;
  294. this.form.icdCode = newValue.code;
  295. this.form.conceptId = newValue.id;
  296. this.getIndex = 6;
  297. },
  298. drugchangeWord(newValue) {
  299. this.form.formConceptId = newValue.id;
  300. this.form.form = newValue.name;
  301. },
  302. handleVisible(flag) {
  303. if (!flag) {
  304. this.uniqueNameList = [];
  305. }
  306. },
  307. // 获取焦点
  308. handleFocus() {},
  309. onblur() {
  310. this.getTermMatching();
  311. },
  312. getTermMatching() {
  313. let params = {
  314. type: this.type,
  315. inputStr: this.form.hisName
  316. };
  317. api.getTermMatching(params).then(res => {
  318. this.showDrop = false;
  319. if (res.data.code === '0') {
  320. this.tableData = res.data.data;
  321. this.getIndex = 6;
  322. }
  323. });
  324. },
  325. // 建立关联-参数处理
  326. submitForm() {
  327. this.$refs.relationForm.validate(valid => {
  328. if (valid) {
  329. const {
  330. searchText,
  331. hisName,
  332. hisDetailName,
  333. icdCode,
  334. conceptId,
  335. formConceptId,
  336. source
  337. } = this.form;
  338. // 当标准术语是套餐时,细项必须为空
  339. let params = {
  340. hisName: hisName,
  341. uniqueName: searchText,
  342. hisDetailName: hisDetailName,
  343. type: this.type,
  344. conceptId: conceptId,
  345. formConceptId: formConceptId,
  346. source: source?source:1
  347. };
  348. this.showSaveDialog(params);
  349. } else {
  350. console.log('error submit!!');
  351. return false;
  352. }
  353. });
  354. },
  355. // 建立关联-映射关系是否已存在
  356. showSaveDialog(params) {
  357. this.saveDisable = true; //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
  358. api
  359. .diseaseIsExistRecord(params)
  360. .then(res => {
  361. if (!res.data.data) {
  362. // 不存在,创建新的关联
  363. // 如果是编辑时,需要携带id
  364. if (this.isEdit) {
  365. params = { ...params, id: this.editId };
  366. }
  367. this.saveLisMapping(params, '保存成功', 'success');
  368. } else {
  369. // 已存在,提示修改
  370. this.warning('该条关联已存在,无法添加');
  371. this.saveDisable = false;
  372. }
  373. })
  374. .catch(err => {
  375. if (err.code === '900010001') {
  376. return false;
  377. }
  378. this.warning(err);
  379. });
  380. },
  381. // 初始化表单数据
  382. initForm() {
  383. this.form.hisName = '';
  384. this.form.searchText = '';
  385. this.form.icdCode = '';
  386. this.form.hisDetailName = '';
  387. this.form.form = '';
  388. this.form.conceptId = '';
  389. this.form.source = ''
  390. },
  391. // 映射关系不存在-建立关联
  392. saveLisMapping(params, msg, type) {
  393. api.saveOrUpdateDiseaseRecord(params).then(res => {
  394. if (res.data.code === '0') {
  395. this.warning(res.data.msg || msg, type);
  396. this.initForm();
  397. this.$emit('func', 'updata');
  398. } else {
  399. this.warning(res.data.msg);
  400. }
  401. this.saveDisable = false;
  402. });
  403. },
  404. // 关联已存在模态框
  405. showConfirmDialog(msg, resolve) {
  406. this.$alert(msg, '提示', {
  407. // customClass: 'confirmRealation',
  408. confirmButtonText: '是',
  409. // cancelButtonText: '否',
  410. // cancelButtonClass: 'cancelButton',
  411. type: 'warning'
  412. })
  413. .then(() => {
  414. resolve();
  415. })
  416. .catch(() => {
  417. this.saveDisable = false;
  418. this.warning('建立失败', 'error');
  419. });
  420. },
  421. warning(msg, type) {
  422. this.$message({
  423. showClose: true,
  424. message: msg,
  425. type: type || 'warning'
  426. });
  427. },
  428. closeModal() {
  429. this.$emit('func', 'close');
  430. }
  431. }
  432. };
  433. </script>
  434. <style lang="less" scoped>
  435. .modal-container {
  436. position: fixed;
  437. top: 0;
  438. left: 0;
  439. width: 100%;
  440. height: 100%;
  441. z-index: 21;
  442. .cover {
  443. background: #000;
  444. opacity: 0.2;
  445. width: 100%;
  446. height: 100%;
  447. }
  448. .modal-box {
  449. width: 950px;
  450. background: #fff;
  451. position: absolute;
  452. top: 50%;
  453. left: 50%;
  454. transform: translate(-50%, -50%);
  455. .modal-title {
  456. height: 40px;
  457. background: #e3eaf4;
  458. .close {
  459. float: right;
  460. margin: 3px 13px 0 0;
  461. font-size: 22px;
  462. color: #979797;
  463. cursor: pointer;
  464. }
  465. }
  466. .btns {
  467. display: inline-block;
  468. width: 70px;
  469. height: 34px;
  470. line-height: 34px;
  471. background: #48c5d7;
  472. border-radius: 4px;
  473. color: #fff;
  474. text-align: center;
  475. cursor: pointer;
  476. outline: none;
  477. border: none;
  478. }
  479. .cancel {
  480. background: #fff;
  481. color: #48c5d7;
  482. border: 1px #48c5d7 solid;
  483. margin-left: 40px;
  484. }
  485. .modal-body {
  486. padding: 34px 22px;
  487. }
  488. .modal-footer {
  489. margin-bottom: 60px;
  490. width: 100%;
  491. text-align: center;
  492. }
  493. }
  494. }
  495. .tab {
  496. max-width: 240px;
  497. min-width: 240px;
  498. // position: absolute;
  499. // top: 0;
  500. z-index: 999;
  501. margin-bottom: 15px;
  502. }
  503. // .tabs {
  504. // max-width: 240px;
  505. // min-width: 240px;
  506. // position: absolute;
  507. // top: 0;
  508. // left: 250px;
  509. // }
  510. .mapList {
  511. padding: 0 20px 20px;
  512. font-size: 14px;
  513. line-height: 24px;
  514. & span {
  515. padding: 0 3px;
  516. }
  517. }
  518. .el-select-dropdown__list,
  519. .el-select-dropdown__item {
  520. width: 219px;
  521. cursor: pointer;
  522. }
  523. .el-dropdown-menu__item:focus,
  524. .el-checkbox__input.is-checked + .el-checkbox__label,
  525. .el-dropdown-menu__item:not(.is-disabled):hover,
  526. .el-button--text,
  527. .el-date-table td.today span,
  528. .el-radio__input.is-checked + .el-radio__label,
  529. .el-pagination.is-background .el-pager li:not(.disabled):hover,
  530. .el-select-dropdown__item.selected {
  531. font-size: 14px;
  532. padding: 0 20px;
  533. position: relative;
  534. white-space: nowrap;
  535. overflow: hidden;
  536. text-overflow: ellipsis;
  537. color: #606266;
  538. height: 34px;
  539. line-height: 34px;
  540. -webkit-box-sizing: border-box;
  541. box-sizing: border-box;
  542. width: 219px;
  543. cursor: pointer;
  544. }
  545. /deep/ .el-form-item__error{
  546. width: 150px;
  547. }
  548. /*********新增编辑***********/
  549. .topBack {
  550. top: 0;
  551. }
  552. .titleBox {
  553. padding: 0 0 10px 0px;
  554. }
  555. .title {
  556. width: 50%;
  557. float: left;
  558. font-size: 14px;
  559. }
  560. .leftBox,
  561. .midBox,
  562. .rightBox {
  563. width: 380px;
  564. float: left;
  565. min-height: 200px;
  566. font-size: 14px;
  567. }
  568. .midBox {
  569. width: 6%;
  570. padding: 50px 0 0 0;
  571. text-align: center;
  572. }
  573. .midTitle {
  574. width: 40px;
  575. margin: 0 auto;
  576. }
  577. .midLogo {
  578. margin: 0 auto;
  579. }
  580. .leftBox,
  581. .rightBox {
  582. border: 1px solid #dcdfe6;
  583. padding: 20px 10px;
  584. }
  585. .rightBox {
  586. padding-right: 33px;
  587. height: 200px;
  588. overflow-y: auto;
  589. }
  590. .itemLabel {
  591. width: 100%;
  592. min-height: 50px;
  593. line-height: 50px;
  594. position: relative;
  595. }
  596. .itemLabelName,
  597. .searchInput,
  598. .searchName {
  599. float: left;
  600. color: #606266;
  601. }
  602. .itemLabelName {
  603. width: 150px;
  604. }
  605. .isRequired::before {
  606. content: '*';
  607. color: red;
  608. }
  609. .searchInput,
  610. .mealNameItem {
  611. padding: 0 5px;
  612. }
  613. .searchInput,
  614. .searchName {
  615. display: inline-block;
  616. height: 32px;
  617. line-height: 32px;
  618. border: 1px solid #a9a9a9;
  619. margin: 8px 0 0 0;
  620. }
  621. .searchName {
  622. text-align: center;
  623. border-left: none;
  624. cursor: pointer;
  625. padding: 0 12px;
  626. font-size: 16px;
  627. }
  628. .itemList {
  629. position: absolute;
  630. background: #fff;
  631. width: 162px;
  632. max-height: 150px;
  633. border: 1px solid #a9a9a9;
  634. left: 150px;
  635. top: 42px;
  636. z-index: 2;
  637. overflow-y: auto;
  638. }
  639. .itemList {
  640. width: calc(100% - 131px);
  641. }
  642. .mealNameItem {
  643. height: 30px;
  644. line-height: 30px;
  645. font-size: 14px;
  646. cursor: pointer;
  647. }
  648. .mealNameItem:hover {
  649. background: #f5f7fa;
  650. }
  651. .previewInfo {
  652. padding-left: 4px;
  653. display: inline-block;
  654. margin-top: 8px;
  655. // width: calc(100% - 160px);s
  656. line-height: 24px;
  657. overflow: hidden;
  658. word-wrap: break-word;
  659. word-break: break-all;
  660. }
  661. .sumbit {
  662. position: absolute;
  663. display: inline-block;
  664. width: 80px;
  665. height: 30px;
  666. line-height: 30px;
  667. border: 1px solid #a9a9a9;
  668. text-align: center;
  669. right: 100px;
  670. }
  671. .confirmRealation {
  672. .cancelButton {
  673. border: 1px solid #a9a9a9;
  674. span {
  675. color: #606266;
  676. }
  677. }
  678. }
  679. </style>