LtModal.vue 17 KB

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