LtModal.vue 20 KB

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