LtModal.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  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.hisName}};</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. },
  172. showDrop: false, //下拉框显示文字
  173. saveDisable: false, //保存按钮禁止点击
  174. uniqueNameList: [],
  175. rules: {
  176. hisName: [
  177. { required: true, message: '请输入' + this.meal, trigger: 'change' },
  178. { max: 80, message: this.meal + '最多80字', trigger: 'change' }
  179. ],
  180. searchText: [
  181. { required: true, message: '请选择' + this.meal, trigger: 'change' }
  182. ]
  183. },
  184. ty: this.type,
  185. searchType: '',
  186. isEdit: false,
  187. editId: '',
  188. drugList: [],
  189. tableData: [],
  190. mapList: [],
  191. getIndex: 6
  192. };
  193. },
  194. created() {
  195. //修改
  196. if (this.data != {}) {
  197. this.isEdit = true;
  198. this.editId = this.data.id;
  199. this.form.hisName = this.data.hisName;
  200. this.form.searchText = this.data.uniqueName;
  201. this.form.icdCode = this.data.icdCode;
  202. this.form.conceptId = this.data.conceptId;
  203. this.form.formConceptId = this.data.formConceptId;
  204. this.form.form = this.data.form;
  205. this.getTermMatching();
  206. this.getRelatedMapping();
  207. }
  208. },
  209. methods: {
  210. selectedstyle({ row, rowIndex }) {
  211. if (this.getIndex === rowIndex) {
  212. return {
  213. 'background-color': '#EBEEF5'
  214. };
  215. }
  216. },
  217. tableRowClassName({ row, rowIndex }) {
  218. row.index = rowIndex;
  219. },
  220. btn(row) {
  221. if (this.getIndex == row.index) {
  222. this.getIndex = 6;
  223. this.form.searchText = '';
  224. this.form.conceptId = '';
  225. this.form.icdCode = '';
  226. } else {
  227. this.getIndex = row.index;
  228. this.form.searchText = row.name;
  229. this.form.conceptId = row.id;
  230. this.form.icdCode = row.code;
  231. }
  232. },
  233. // 搜索列表
  234. searchTerms(query) {
  235. if (!query) {
  236. this.uniqueNameList = [];
  237. return;
  238. }
  239. if (this.type == 1) {
  240. const { hisName, hisDetailName } = this.form;
  241. this.ty = 2; // 1-化验大项、2-化验小项
  242. if (hisName !== '' && hisDetailName === '') {
  243. this.ty = 1;
  244. }
  245. this.searchType = this.ty;
  246. }
  247. this.showDrop = true;
  248. let params = {
  249. type: this.ty ? this.ty : this.type,
  250. inputStr: query,
  251. sex: 3,
  252. age: 0
  253. };
  254. api.retrievalSearch(params).then(res => {
  255. this.showDrop = false;
  256. if (res.data.code === '0') {
  257. if (this.ty == 2 && this.ty) {
  258. this.uniqueNameList = res.data.data.lisDetailNames;
  259. } else {
  260. this.uniqueNameList = res.data.data.nameList;
  261. }
  262. }
  263. });
  264. },
  265. searchDrug(query) {
  266. if (!query) {
  267. this.drugList = [];
  268. return;
  269. }
  270. this.showDrop = true;
  271. let params = {
  272. type: 15,
  273. inputStr: query,
  274. sex: 3,
  275. age: 0
  276. };
  277. api.retrievalSearch(params).then(res => {
  278. this.showDrop = false;
  279. if (res.data.code === '0') {
  280. this.drugList = res.data.data.nameList;
  281. }
  282. });
  283. },
  284. onchange() {
  285. this.getRelatedMapping();
  286. },
  287. getRelatedMapping() {
  288. const { hisName, hisDetailName } = this.form;
  289. if (this.type == 1) {
  290. this.ty = 2; // 1-化验大项、2-化验小项
  291. if (hisName !== '' && hisDetailName === '') {
  292. this.ty = 1;
  293. }
  294. }
  295. let params = {
  296. type: this.ty ? this.ty : this.type,
  297. hisDetailName: hisDetailName,
  298. hisName: hisName
  299. };
  300. api.getRelatedMapping(params).then(res => {
  301. this.showDrop = false;
  302. if (res.data.code === '0') {
  303. this.mapList = res.data.data;
  304. }
  305. });
  306. },
  307. changeWord(newValue) {
  308. this.form.searchText = newValue.name;
  309. this.form.icdCode = newValue.code;
  310. this.form.conceptId = newValue.id;
  311. this.getIndex = 6;
  312. },
  313. drugchangeWord(newValue) {
  314. this.form.formConceptId = newValue.id;
  315. this.form.form = newValue.name;
  316. },
  317. handleVisible(flag) {
  318. if (!flag) {
  319. this.uniqueNameList = [];
  320. }
  321. },
  322. // 获取焦点
  323. handleFocus() {},
  324. onblur() {
  325. this.getTermMatching();
  326. },
  327. getTermMatching() {
  328. let params = {
  329. type: this.ty ? this.ty : this.type,
  330. inputStr: this.form.hisName
  331. };
  332. api.getTermMatching(params).then(res => {
  333. this.showDrop = false;
  334. if (res.data.code === '0') {
  335. this.tableData = res.data.data;
  336. }
  337. });
  338. },
  339. // 建立关联-参数处理
  340. submitForm() {
  341. this.$refs.relationForm.validate(valid => {
  342. if (valid) {
  343. const {
  344. searchText,
  345. hisName,
  346. hisDetailName,
  347. icdCode,
  348. conceptId,
  349. formConceptId
  350. } = this.form;
  351. // 当标准术语是套餐时,细项必须为空
  352. if (this.searchType === 1 && hisDetailName !== '') {
  353. this.warning('医院术语与标准术语类型不匹配,请修改');
  354. return;
  355. }
  356. // 当标准术语是细项时,医院术语套餐和细项均不能为空
  357. if (this.searchType === 2) {
  358. if (hisName === '') {
  359. this.warning('医院术语与标准术语类型不匹配,请修改');
  360. return;
  361. } else if (hisDetailName === '') {
  362. this.warning('医院术语与标准术语类型不匹配,请修改');
  363. return;
  364. }
  365. }
  366. let params = {
  367. hisName: hisName,
  368. uniqueName: searchText,
  369. hisDetailName: hisDetailName,
  370. type: this.type,
  371. conceptId: conceptId,
  372. formConceptId: formConceptId,
  373. };
  374. this.showSaveDialog(params);
  375. } else {
  376. console.log('error submit!!');
  377. return false;
  378. }
  379. });
  380. },
  381. // 建立关联-映射关系是否已存在
  382. showSaveDialog(params) {
  383. this.saveDisable = true; //提交保存按钮不可点击,返回结果时才可点击,防止频繁发送请求
  384. api
  385. .diseaseIsExistRecord(params)
  386. .then(res => {
  387. if (!res.data.data) {
  388. // 不存在,创建新的关联
  389. // 如果是编辑时,需要携带id
  390. if (this.isEdit) {
  391. params = { ...params, id: this.editId };
  392. }
  393. this.saveLisMapping(params, '保存成功', 'success');
  394. } else {
  395. // 已存在,提示修改
  396. this.warning('该条关联已存在,无法添加');
  397. this.saveDisable = false;
  398. }
  399. })
  400. .catch(err => {
  401. if (err.code === '900010001') {
  402. return false;
  403. }
  404. this.warning(err);
  405. });
  406. },
  407. // 初始化表单数据
  408. initForm() {
  409. this.form.hisName = '';
  410. this.form.searchText = '';
  411. this.form.icdCode = '';
  412. this.form.hisDetailName = '';
  413. this.form.form = '';
  414. this.form.conceptId = '';
  415. },
  416. // 映射关系不存在-建立关联
  417. saveLisMapping(params, msg, type) {
  418. api.saveOrUpdateDiseaseRecord(params).then(res => {
  419. if (res.data.code === '0') {
  420. this.warning(res.data.msg || msg, type);
  421. this.initForm();
  422. this.$emit('func', 'updata');
  423. } else {
  424. this.warning(res.data.msg);
  425. }
  426. this.saveDisable = false;
  427. });
  428. },
  429. // 关联已存在模态框
  430. showConfirmDialog(msg, resolve) {
  431. this.$alert(msg, '提示', {
  432. // customClass: 'confirmRealation',
  433. confirmButtonText: '是',
  434. // cancelButtonText: '否',
  435. // cancelButtonClass: 'cancelButton',
  436. type: 'warning'
  437. })
  438. .then(() => {
  439. resolve();
  440. })
  441. .catch(() => {
  442. this.saveDisable = false;
  443. this.warning('建立失败', 'error');
  444. });
  445. },
  446. warning(msg, type) {
  447. this.$message({
  448. showClose: true,
  449. message: msg,
  450. type: type || 'warning'
  451. });
  452. },
  453. closeModal() {
  454. this.$emit('func', 'close');
  455. }
  456. }
  457. };
  458. </script>
  459. <style lang="less" scoped>
  460. .modal-container {
  461. position: fixed;
  462. top: 0;
  463. left: 0;
  464. width: 100%;
  465. height: 100%;
  466. z-index: 21;
  467. .cover {
  468. background: #000;
  469. opacity: 0.2;
  470. width: 100%;
  471. height: 100%;
  472. }
  473. .modal-box {
  474. width: 900px;
  475. background: #fff;
  476. position: absolute;
  477. top: 50%;
  478. left: 50%;
  479. transform: translate(-50%, -50%);
  480. .modal-title {
  481. height: 40px;
  482. background: #e3eaf4;
  483. .close {
  484. float: right;
  485. margin: 3px 13px 0 0;
  486. font-size: 22px;
  487. color: #979797;
  488. cursor: pointer;
  489. }
  490. }
  491. .btns {
  492. display: inline-block;
  493. width: 70px;
  494. height: 34px;
  495. line-height: 34px;
  496. background: #48c5d7;
  497. border-radius: 4px;
  498. color: #fff;
  499. text-align: center;
  500. cursor: pointer;
  501. outline: none;
  502. border: none;
  503. }
  504. .cancel {
  505. background: #fff;
  506. color: #48c5d7;
  507. border: 1px #48c5d7 solid;
  508. margin-left: 40px;
  509. }
  510. .modal-body {
  511. padding: 34px 22px;
  512. }
  513. .modal-footer {
  514. margin-bottom: 60px;
  515. width: 100%;
  516. text-align: center;
  517. }
  518. }
  519. }
  520. .tab {
  521. max-width: 240px;
  522. min-width: 240px;
  523. // position: absolute;
  524. // top: 0;
  525. z-index: 999;
  526. margin-bottom: 15px;
  527. }
  528. // .tabs {
  529. // max-width: 240px;
  530. // min-width: 240px;
  531. // position: absolute;
  532. // top: 0;
  533. // left: 250px;
  534. // }
  535. .mapList {
  536. width: 380px;
  537. padding: 0 20px 20px;
  538. font-size: 14px;
  539. line-height: 24px;
  540. & span {
  541. padding: 0 3px;
  542. }
  543. }
  544. .el-select-dropdown__list,
  545. .el-select-dropdown__item {
  546. width: 219px;
  547. cursor: pointer;
  548. }
  549. .el-dropdown-menu__item:focus,
  550. .el-checkbox__input.is-checked + .el-checkbox__label,
  551. .el-dropdown-menu__item:not(.is-disabled):hover,
  552. .el-button--text,
  553. .el-date-table td.today span,
  554. .el-radio__input.is-checked + .el-radio__label,
  555. .el-pagination.is-background .el-pager li:not(.disabled):hover,
  556. .el-select-dropdown__item.selected {
  557. font-size: 14px;
  558. padding: 0 20px;
  559. position: relative;
  560. white-space: nowrap;
  561. overflow: hidden;
  562. text-overflow: ellipsis;
  563. color: #606266;
  564. height: 34px;
  565. line-height: 34px;
  566. -webkit-box-sizing: border-box;
  567. box-sizing: border-box;
  568. width: 219px;
  569. cursor: pointer;
  570. }
  571. /deep/ .el-form-item__error{
  572. width: 150px;
  573. }
  574. /*********新增编辑***********/
  575. .topBack {
  576. top: 0;
  577. }
  578. .titleBox {
  579. padding: 0 0 10px 0px;
  580. }
  581. .title {
  582. width: 50%;
  583. float: left;
  584. font-size: 14px;
  585. }
  586. .leftBox,
  587. .midBox,
  588. .rightBox {
  589. width: 380px;
  590. float: left;
  591. min-height: 200px;
  592. font-size: 14px;
  593. }
  594. .midBox {
  595. width: 6%;
  596. padding: 50px 0 0 0;
  597. text-align: center;
  598. }
  599. .midTitle {
  600. width: 40px;
  601. margin: 0 auto;
  602. }
  603. .midLogo {
  604. margin: 0 auto;
  605. }
  606. .leftBox,
  607. .rightBox {
  608. border: 1px solid #dcdfe6;
  609. padding: 20px 10px;
  610. }
  611. .itemLabel {
  612. width: 100%;
  613. min-height: 50px;
  614. line-height: 50px;
  615. position: relative;
  616. }
  617. .itemLabelName,
  618. .searchInput,
  619. .searchName {
  620. float: left;
  621. color: #606266;
  622. }
  623. .itemLabelName {
  624. width: 150px;
  625. }
  626. .isRequired::before {
  627. content: '*';
  628. color: red;
  629. }
  630. .searchInput,
  631. .mealNameItem {
  632. padding: 0 5px;
  633. }
  634. .searchInput,
  635. .searchName {
  636. display: inline-block;
  637. height: 32px;
  638. line-height: 32px;
  639. border: 1px solid #a9a9a9;
  640. margin: 8px 0 0 0;
  641. }
  642. .searchName {
  643. text-align: center;
  644. border-left: none;
  645. cursor: pointer;
  646. padding: 0 12px;
  647. font-size: 16px;
  648. }
  649. .itemList {
  650. position: absolute;
  651. background: #fff;
  652. width: 162px;
  653. max-height: 150px;
  654. border: 1px solid #a9a9a9;
  655. left: 150px;
  656. top: 42px;
  657. z-index: 2;
  658. overflow-y: auto;
  659. }
  660. .itemList {
  661. width: calc(100% - 131px);
  662. }
  663. .mealNameItem {
  664. height: 30px;
  665. line-height: 30px;
  666. font-size: 14px;
  667. cursor: pointer;
  668. }
  669. .mealNameItem:hover {
  670. background: #f5f7fa;
  671. }
  672. .previewInfo {
  673. padding-left: 4px;
  674. display: inline-block;
  675. margin-top: 8px;
  676. // width: calc(100% - 160px);s
  677. line-height: 24px;
  678. overflow: hidden;
  679. word-wrap: break-word;
  680. word-break: break-all;
  681. }
  682. .sumbit {
  683. position: absolute;
  684. display: inline-block;
  685. width: 80px;
  686. height: 30px;
  687. line-height: 30px;
  688. border: 1px solid #a9a9a9;
  689. text-align: center;
  690. right: 100px;
  691. }
  692. .confirmRealation {
  693. .cancelButton {
  694. border: 1px solid #a9a9a9;
  695. span {
  696. color: #606266;
  697. }
  698. }
  699. }
  700. </style>