LtModal.vue 20 KB

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