LtModal.vue 20 KB

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