LtModal.vue 19 KB

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