You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

444 lines
14 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="box" style="width: 100%">
  3. <div style="width: 90%">
  4. <el-table
  5. :data="tableData"
  6. border
  7. style="width: 100%"
  8. class="el-table__body-wrapper tbody"
  9. :height="window.pageHeight < 600 ? 260 : window.pageHeight - 340"
  10. @row-click="rowick"
  11. highlight-current-row
  12. >
  13. <el-table-column prop="forSexId" label="性别">
  14. <template slot-scope="scope">
  15. <div>
  16. {{ ldddw(forSexId, "id", scope.row.forSexId, "displayName") }}
  17. </div>
  18. </template>
  19. </el-table-column>
  20. <el-table-column prop="ageLowerLimit" label="年龄上限" />
  21. <el-table-column prop="ageUpperLimit" label="年龄下限" />
  22. <el-table-column prop="referenceRangeValue" label="参考范围" />
  23. <el-table-column prop="criticalRangeValue" label="警告范围" />
  24. <el-table-column prop="lowerDiagnosisId" label="偏低诊断">
  25. <template slot-scope="scope">
  26. <div>
  27. {{
  28. ldddw(
  29. diagnosis,
  30. "id",
  31. scope.row.lowerDiagnosisId,
  32. "displayName"
  33. )
  34. }}
  35. </div>
  36. </template>
  37. </el-table-column>
  38. <el-table-column prop="upperDiagnosisId" label="偏高诊断">
  39. <template slot-scope="scope">
  40. <div>
  41. {{
  42. ldddw(
  43. diagnosis,
  44. "id",
  45. scope.row.upperDiagnosisId,
  46. "displayName"
  47. )
  48. }}
  49. </div>
  50. </template>
  51. </el-table-column>
  52. <!-- <el-table-column label="操作">
  53. <template>
  54. <el-tag
  55. class="move"
  56. style="cursor: move; margin-left: 15px"
  57. draggable="true"
  58. >
  59. <i class="el-icon-d-caret" style="width: 1rem; height: 1rem"></i>
  60. </el-tag>
  61. </template>
  62. </el-table-column> -->
  63. </el-table>
  64. </div>
  65. <!-- 按钮区域 -->
  66. <div style="margin-left: 10px; width: 10%" class="editButton">
  67. <div style="width:100%;">
  68. <el-button type="success" @click="add">新增</el-button>
  69. </div>
  70. <div style="margin-top: 5px;width:100%;">
  71. <el-button type="primary" @click="edit">编辑</el-button>
  72. </div>
  73. <div style="margin-top: 5px;width:100%;">
  74. <el-button type="danger" @click="del">删除</el-button>
  75. </div>
  76. </div>
  77. <!-- 新增或者编辑弹框 -->
  78. <el-dialog
  79. :title="id ? '编辑' : '新增'"
  80. :visible.sync="dialogVisible"
  81. width="70%"
  82. :append-to-body="true"
  83. >
  84. <el-form ref="form" :model="form" label-width="100px" :rules="rules">
  85. <el-row>
  86. <el-col :span="8">
  87. <el-form-item label="性别" prop="forSexId">
  88. <el-select v-model="form.forSexId" placeholder="请选择">
  89. <el-option
  90. v-for="item in forSexId"
  91. :key="item.id"
  92. :label="item.displayName"
  93. :value="item.id"
  94. >
  95. </el-option>
  96. </el-select>
  97. </el-form-item>
  98. </el-col>
  99. <el-col :span="8">
  100. <el-form-item label="年龄下限" prop="ageLowerLimit">
  101. <el-input
  102. v-model="form.ageLowerLimit"
  103. style="width: 100%"
  104. ></el-input> </el-form-item
  105. ></el-col>
  106. <el-col :span="8">
  107. <el-form-item label="年龄上限" prop="ageUpperLimit">
  108. <el-input
  109. v-model="form.ageUpperLimit"
  110. style="width: 85%"
  111. ></el-input> </el-form-item
  112. ></el-col>
  113. <el-col :span="8">
  114. <el-form-item label="参考范围" prop="referenceRangeValue">
  115. <el-input
  116. v-model="form.referenceRangeValue"
  117. style="width: 85%"
  118. ></el-input> </el-form-item
  119. ></el-col>
  120. <el-col :span="8">
  121. <el-form-item label="警告范围" prop="">
  122. <el-input
  123. v-model="form.criticalRangeValue"
  124. style="width: 100%"
  125. ></el-input> </el-form-item
  126. ></el-col>
  127. <el-col :span="8">
  128. <el-form-item label="偏低诊断" prop="lowerDiagnosisId">
  129. <el-select v-model="form.lowerDiagnosisId" placeholder="请选择" filterable :filter-method="remoteMethods" default-first-option clearable @change="quckEditdigoisce">
  130. <el-option
  131. v-for="item in diagnosis"
  132. :key="item.id"
  133. :label="item.displayName"
  134. :value="item.id"
  135. >
  136. </el-option>
  137. </el-select> </el-form-item
  138. ></el-col>
  139. <el-col :span="8">
  140. <el-form-item label="偏高诊断" prop="upperDiagnosisId">
  141. <el-select v-model="form.upperDiagnosisId" placeholder="请选择" filterable :filter-method="remoteMethodes" default-first-option clearable @change="quckEditdigoisces">
  142. <el-option
  143. v-for="item in diagnosies"
  144. :key="item.id"
  145. :label="item.displayName"
  146. :value="item.id"
  147. >
  148. </el-option>
  149. </el-select> </el-form-item
  150. ></el-col>
  151. </el-row>
  152. </el-form>
  153. <span slot="footer" class="dialog-footer">
  154. <el-button @click="dialogVisible = false,id=curRowes.id"> </el-button>
  155. <el-button type="primary" @click="onsbmint"> </el-button>
  156. </span>
  157. </el-dialog>
  158. </div>
  159. </template>
  160. <script>
  161. import { mapState } from "vuex";
  162. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  163. import { examinationgender } from "@/request/systemapi";
  164. import { dddw } from "../../utlis/proFunc";
  165. // import
  166. export default {
  167. props: ["itemId", "ReferenceRangeTypeFlag"],
  168. data() {
  169. return {
  170. rules: {
  171. itemId: [{ required: true, message: "请选择项目", trigger: "blur" }],
  172. forSexId: [{ required: true, message: "请选择性别", trigger: "blur" }],
  173. ageLowerLimit: [
  174. { required: true, message: "请输入年龄下限", trigger: "blur" },
  175. ],
  176. ageUpperLimit: [
  177. { required: true, message: "请输入年龄上限", trigger: "blur" },
  178. ],
  179. referenceRangeValue: [
  180. { required: true, message: "请输入参考范围", trigger: "blur"},
  181. ],
  182. criticalRangeValue: [
  183. { required: true, message: "请输入临界范围", trigger: "blur" },
  184. ],
  185. lowerDiagnosisId: [
  186. { required: true, message: "请选择偏低诊断", trigger: "blur" },
  187. ],
  188. upperDiagnosisId: [
  189. { required: true, message: "请选择偏高诊断", trigger: "blur" },
  190. ],
  191. },
  192. pages: {
  193. SkipCount: 0,
  194. MaxResultCount: 100,
  195. // Sorting: "displayOrder desc",
  196. },
  197. dialogVisible: false,
  198. form: {
  199. itemId: "",
  200. forSexId: "",
  201. ageLowerLimit: "",
  202. ageUpperLimit: "",
  203. referenceRangeValue: "",
  204. criticalRangeValue: "",
  205. lowerDiagnosisId: "",
  206. upperDiagnosisId: "",
  207. referenceRangeTypeFlag: "1",
  208. },
  209. id: "", //新增/编辑 或删除的记录 id
  210. forSexId: [], //性别
  211. diagnosis: [], //偏低诊断
  212. diagnosies:[],//偏高诊断
  213. tableData: [],
  214. curRowes:{},
  215. diagnosisId:""
  216. };
  217. },
  218. created() {},
  219. mounted() {
  220. //console.log('@子节点', this.itemId, this.ReferenceRangeTypeFlag)
  221. this.addtoedit();
  222. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  223. },
  224. computed: {
  225. ...mapState(["itemSet","window"]),
  226. },
  227. methods: {
  228. getlist(itemId, ReferenceRangeTypeFlag) {
  229. getapi(
  230. `/api/app/reference-range/in-type/${itemId}?ReferenceRangeTypeFlag=${ReferenceRangeTypeFlag}`
  231. ).then((res) => {
  232. this.tableData = res.data;
  233. });
  234. },
  235. remoteMethods(keyWords){
  236. if (keyWords) {
  237. this.diagnosis = [];
  238. this.diagnosisId.forEach(item => {
  239. if (item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  240. || item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  241. // || item.shortName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  242. ) {
  243. this.diagnosis.push(item);
  244. }
  245. });
  246. } else {
  247. this.quckeDitd = deepCopy(this.diagnosis);
  248. }
  249. },
  250. remoteMethodes(keyWords){
  251. if (keyWords) {
  252. this.diagnosies = [];
  253. this.diagnosisId.forEach(item => {
  254. if (item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  255. || item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  256. // || item.shortName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  257. ) {
  258. this.diagnosies.push(item);
  259. }
  260. });
  261. } else {
  262. this.quckeDitd = deepCopy(this.diagnosies);
  263. }
  264. },
  265. rowick(row) {
  266. getapi(`/api/app/reference-range/${row.id}`).then((res) => {
  267. this.curRowes = res.data;
  268. this.id = res.data.id;
  269. });
  270. },
  271. quckEditdigoisce(e){
  272. if(!e){
  273. this.remoteMethods()
  274. }
  275. },
  276. quckEditdigoisces(e){
  277. if(!e){
  278. this.remoteMethodes()
  279. }
  280. },
  281. //ldddw(forSexId, 'id', scope.row.forSexId, 'displayName')
  282. ldddw(arrayData, key, value, display) {
  283. return dddw(arrayData, key, value, display);
  284. },
  285. // 新增或者编辑需要的类别
  286. addtoedit() {
  287. //性别
  288. getapi("/api/app/sex").then((res) => {
  289. this.forSexId = res.data;
  290. });
  291. //诊断
  292. postapi("/api/app/diagnosis/getlistinsuggestion").then((res) => {
  293. this.diagnosis = res.data;
  294. this.diagnosies=res.data
  295. this.diagnosisId=res.data
  296. });
  297. },
  298. add() {
  299. this.addtoedit()
  300. this.id = "";
  301. this.dialogVisible = true;
  302. if (this.$refs.form !== undefined){
  303. this.$refs.form.resetFields()
  304. }
  305. Object.assign(this.$data.form, this.$options.data().form)
  306. this.form = {
  307. itemId: this.itemId,
  308. referenceRangeTypeFlag: this.ReferenceRangeTypeFlag,
  309. };
  310. },
  311. //编辑弹框
  312. edit() {
  313. if (!this.id) {
  314. this.$message.warning("请先选中要编辑的记录");
  315. return;
  316. }
  317. this.dialogVisible = true;
  318. if (this.$refs.form !== undefined){
  319. this.$refs.form.resetFields()
  320. }
  321. this.form={...this.curRowes}
  322. this.addtoedit()
  323. },
  324. del() {
  325. //this.$message.success("删除操作");
  326. if (!this.id) {
  327. this.$message.warning("请先选中要删除的记录");
  328. return;
  329. }
  330. this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
  331. confirmButtonText: "确定",
  332. cancelButtonText: "取消",
  333. type: "warning",
  334. })
  335. .then(() => {
  336. return deletapi(`/api/app/reference-range/${this.id}`, this.form);
  337. })
  338. .then((res) => {
  339. if(res.code!=-1){
  340. this.$message.success("删除成功");
  341. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  342. this.id = "";
  343. }
  344. })
  345. .catch(() => {
  346. this.$message({
  347. type: "info",
  348. message: "已取消删除",
  349. });
  350. });
  351. },
  352. confirmationRequest(){
  353. if (!this.id) {
  354. postapi("/api/app/reference-range", this.form).then((res) => {
  355. if(res.code!=-1){
  356. this.$message.success("新增成功");
  357. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  358. this.id = this.curRowes.id;
  359. this.dialogVisible=false
  360. }
  361. });
  362. } else {
  363. putapi(`/api/app/reference-range/${this.id}`, this.form).then(
  364. (res) => {
  365. if(res.code!=-1){
  366. this.$message.success("修改成功");
  367. this.dialogVisible=false
  368. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  369. }
  370. }
  371. );
  372. }
  373. },
  374. //确定新增或者编辑
  375. onsbmint() {
  376. this.$refs["form"].validate((v) => {
  377. let that=this
  378. if (v) {
  379. if(that.form.referenceRangeValue.includes('-')){
  380. let before=/^\d+\.?\d?$/.test(that.form.referenceRangeValue.match(/(\S*)-/)[1])
  381. let after=/^\d+\.?\d?$/.test(that.form.referenceRangeValue.match(/-(\S*)/)[1])
  382. if(before && after){
  383. console.log(that.form)
  384. if(that.form.criticalRangeValue!="" && that.form.criticalRangeValue!=undefined){
  385. if(that.form.criticalRangeValue.includes('-')){
  386. let criticalBefore=/^\d+\.?\d?$/.test(that.form.criticalRangeValue.match(/(\S*)-/)[1])
  387. let criticalAfter=/^\d+\.?\d?$/.test(that.form.criticalRangeValue.match(/-(\S*)/)[1])
  388. if(criticalBefore && criticalAfter){
  389. that.confirmationRequest()
  390. }else{
  391. return that.$message.warning("警告范围值-符号前后必须是数字");
  392. }
  393. }else{
  394. return that.$message.warning("警告范围值必须以-符号隔开");
  395. }
  396. }else{
  397. that.confirmationRequest()
  398. }
  399. }else{
  400. return that.$message.warning("参考范围值-符号前后必须是数字");
  401. }
  402. }else{
  403. return that.$message.warning("参考范围值必须以-符号隔开");
  404. }
  405. }
  406. });
  407. },
  408. },
  409. //监听事件
  410. watch: {
  411. //itemId','ReferenceRangeTypeFlag'
  412. itemId(newVal, oldVal) {
  413. if (newVal != oldVal && newVal != "") {
  414. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  415. }
  416. },
  417. ReferenceRangeTypeFlag(newVal, oldVal) {
  418. if (newVal != oldVal && newVal != "") {
  419. this.getlist(this.itemId, this.ReferenceRangeTypeFlag);
  420. }
  421. },
  422. },
  423. };
  424. </script>
  425. <style scoped>
  426. .box {
  427. display: flex;
  428. margin-top: 15px;
  429. }
  430. :deep .editButton .el-button{
  431. width: 100%;
  432. }
  433. </style>