LtModal.vue 19 KB

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