From 631cb637d65eacb7f5dce42abcf86cf4e9e7ba8e Mon Sep 17 00:00:00 2001 From: zzc Date: Tue, 8 Apr 2025 16:59:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=8A=E7=96=97=E6=A1=A3=E6=A1=88=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=BC=96=E5=8F=B7=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=8F=AF?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E8=AF=8A=E7=96=97=E6=A1=A3=E6=A1=88ID?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BA=BA=E4=BD=93=E6=88=90=E5=88=86=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/web/ExternalController.java | 8 +-- .../web/service/WebDmsLoginService.java | 2 +- .../src/main/resources/mbg.xml | 8 +-- .../system/domain/dto/ExternalDto.java | 3 +- .../system/domain/po/PmsTreatment.java | 11 ++++ .../system/domain/po/PmsTreatmentExample.java | 60 +++++++++++++++++++ .../system/domain/vo/PmsTreatmentVo.java | 1 + .../system/persist/dao/ExternalDao.java | 2 + .../system/service/ExternalService.java | 4 +- .../system/service/PmsTreatmentService.java | 2 + .../service/impl/ExternalServiceImpl.java | 50 ++++++++++++---- .../service/impl/PmsTreatmentServiceImpl.java | 20 +++++++ .../main/resources/mapper/dao/ExternalDao.xml | 24 ++++++++ .../resources/mapper/dao/PmsTreatmentDao.xml | 1 + .../mapper/system/PmsTreatmentMapper.xml | 33 +++++++--- 15 files changed, 196 insertions(+), 33 deletions(-) diff --git a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java index dda7802b..e26940dd 100644 --- a/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java +++ b/acupuncture-admin/src/main/java/com/acupuncture/web/controller/web/ExternalController.java @@ -111,7 +111,7 @@ public class ExternalController { @ApiOperation("上传数据") @PostMapping("/http/uploadMemberInfo") public Object add(@RequestBody String str){ - + log.info("str:{}", str); JSONArray objects = new JSONArray(str); List list = new ArrayList<>(); for (Object object : objects) { @@ -180,15 +180,15 @@ public class ExternalController { return externalService.list(); } - @ApiOperation("根据住院号/门诊号查询人体成分信息") + @ApiOperation("根据诊疗档案ID查询人体成分信息") @PostMapping("/api/http/selectByMemberId") public JsonResponse selectByMemberId(@RequestBody @Validated ExternalDto.MemberDto dto){ - return JsonResponse.ok(externalService.selectByMemberId(dto.getMemberId())); + return JsonResponse.ok(externalService.selectByMemberId(dto.getId(), dto.getMemberId())); } @ApiOperation("根据住院号/门诊号查询人体成分报告") @PostMapping("/api/http/selectReportByMemberId") public JsonResponse selectReportByMemberId(@RequestBody @Validated ExternalDto.MemberDto dto){ - return JsonResponse.ok(externalService.selectReportByMemberId(dto.getMemberId())); + return JsonResponse.ok(externalService.selectReportByMemberId(dto.getId())); } } diff --git a/acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java b/acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java index f5a40b40..9f65dacb 100644 --- a/acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java +++ b/acupuncture-framework/src/main/java/com/acupuncture/framework/web/service/WebDmsLoginService.java @@ -62,7 +62,7 @@ public class WebDmsLoginService public String login(String username, String password, String code, String uuid) { // 验证码校验 - validateCaptcha(username, code, uuid); +// validateCaptcha(username, code, uuid); // 登录前置校验 loginPreCheck(username, password); // 用户验证 diff --git a/acupuncture-generator/src/main/resources/mbg.xml b/acupuncture-generator/src/main/resources/mbg.xml index e2b9b78a..b655781a 100644 --- a/acupuncture-generator/src/main/resources/mbg.xml +++ b/acupuncture-generator/src/main/resources/mbg.xml @@ -74,14 +74,14 @@ - -
-
+ + + - +
diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java index 45c63fa4..bc30b81b 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/dto/ExternalDto.java @@ -24,8 +24,9 @@ public class ExternalDto { @Data public static class MemberDto{ - @NotNull +// @NotNull private String memberId; + private Long id; } @Data diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsTreatment.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsTreatment.java index 68bee48d..3bc166ab 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsTreatment.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsTreatment.java @@ -48,6 +48,8 @@ public class PmsTreatment implements Serializable { private Byte status; + private Long memberId; + private Byte delFlag; private Long tenantId; @@ -240,6 +242,14 @@ public class PmsTreatment implements Serializable { this.status = status; } + public Long getMemberId() { + return memberId; + } + + public void setMemberId(Long memberId) { + this.memberId = memberId; + } + public Byte getDelFlag() { return delFlag; } @@ -324,6 +334,7 @@ public class PmsTreatment implements Serializable { sb.append(", diagnosisCode=").append(diagnosisCode); sb.append(", diagnosisName=").append(diagnosisName); sb.append(", status=").append(status); + sb.append(", memberId=").append(memberId); sb.append(", delFlag=").append(delFlag); sb.append(", tenantId=").append(tenantId); sb.append(", createBy=").append(createBy); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsTreatmentExample.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsTreatmentExample.java index 677c8114..96f09b92 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsTreatmentExample.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/po/PmsTreatmentExample.java @@ -1562,6 +1562,66 @@ public class PmsTreatmentExample { return (Criteria) this; } + public Criteria andMemberIdIsNull() { + addCriterion("member_id is null"); + return (Criteria) this; + } + + public Criteria andMemberIdIsNotNull() { + addCriterion("member_id is not null"); + return (Criteria) this; + } + + public Criteria andMemberIdEqualTo(Long value) { + addCriterion("member_id =", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdNotEqualTo(Long value) { + addCriterion("member_id <>", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdGreaterThan(Long value) { + addCriterion("member_id >", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdGreaterThanOrEqualTo(Long value) { + addCriterion("member_id >=", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdLessThan(Long value) { + addCriterion("member_id <", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdLessThanOrEqualTo(Long value) { + addCriterion("member_id <=", value, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdIn(List values) { + addCriterion("member_id in", values, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdNotIn(List values) { + addCriterion("member_id not in", values, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdBetween(Long value1, Long value2) { + addCriterion("member_id between", value1, value2, "memberId"); + return (Criteria) this; + } + + public Criteria andMemberIdNotBetween(Long value1, Long value2) { + addCriterion("member_id not between", value1, value2, "memberId"); + return (Criteria) this; + } + public Criteria andDelFlagIsNull() { addCriterion("del_flag is null"); return (Criteria) this; diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java index 342fdc49..b204ae74 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/domain/vo/PmsTreatmentVo.java @@ -56,6 +56,7 @@ public class PmsTreatmentVo { private String tenantName; private String zyzdQt; + private Long memberId; @Data public static class QueueVo{ diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ExternalDao.java b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ExternalDao.java index abc338f4..68959709 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ExternalDao.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/persist/dao/ExternalDao.java @@ -16,4 +16,6 @@ import java.util.List; public interface ExternalDao { List select(@Param("query") ExternalDto.Query query); + + List selectByMemberId(@Param("query") ExternalDto.Query query); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java index 130f5f54..57f13367 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/ExternalService.java @@ -45,13 +45,13 @@ public interface ExternalService { * @param membreId * @return */ - UplRtcfInfoVo.Result selectByMemberId(String membreId); + UplRtcfInfoVo.Result selectByMemberId(Long id, String membreId); /** * 根据住院号/门诊号查询人体成分信息 * @param membreId * @return */ - UplReportImage selectReportByMemberId(String membreId); + UplReportImage selectReportByMemberId(Long id); } diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java index f3c0c33c..72bf6fa7 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/PmsTreatmentService.java @@ -23,6 +23,8 @@ public interface PmsTreatmentService { */ void addTreatment(PmsTreatmentDto.TreatmentAdd dto); + Long getMemberId(); + /** * 修改诊疗档案 * @param dto diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java index 21c7a869..a88b0641 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/ExternalServiceImpl.java @@ -3,15 +3,14 @@ package com.acupuncture.system.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; import com.acupuncture.common.core.redis.RedisCache; import com.acupuncture.system.domain.dto.ExternalDto; -import com.acupuncture.system.domain.po.UplReportImage; -import com.acupuncture.system.domain.po.UplReportImageExample; -import com.acupuncture.system.domain.po.UplRtcfInfo; -import com.acupuncture.system.domain.po.UplRtcfInfoExample; +import com.acupuncture.system.domain.po.*; import com.acupuncture.system.domain.vo.ExternalVo; import com.acupuncture.system.domain.vo.UplRtcfInfoVo; import com.acupuncture.system.persist.dao.ExternalDao; +import com.acupuncture.system.persist.mapper.PmsTreatmentMapper; import com.acupuncture.system.persist.mapper.UplReportImageMapper; import com.acupuncture.system.persist.mapper.UplRtcfInfoMapper; import com.acupuncture.system.service.ExternalService; @@ -38,12 +37,20 @@ public class ExternalServiceImpl implements ExternalService { private ExternalDao externalDao; @Resource private RedisCache redisCache; + @Resource + private PmsTreatmentMapper pmsTreatmentMapper; @Override public ExternalVo.Result query(String from, String memberid) { ExternalDto.Query query = new ExternalDto.Query(); query.setFrom(from); query.setMemberid(memberid); + //先根据memberId字段查询,查询空再根据门诊号查询 + List results = externalDao.selectByMemberId(query); + if (CollectionUtil.isNotEmpty(results)) { + return results.get(0); + } + List select = externalDao.select(query); if (CollectionUtil.isNotEmpty(select)) { return select.get(0); @@ -166,27 +173,44 @@ public class ExternalServiceImpl implements ExternalService { } - @Override public List list() { return uplRtcfInfoMapper.selectByExample(new UplRtcfInfoExample()); } @Override - public UplRtcfInfoVo.Result selectByMemberId(String membreId) { - UplRtcfInfoExample uplRtcfInfoExample = new UplRtcfInfoExample(); - uplRtcfInfoExample.createCriteria().andMemberidEqualTo(membreId).andDelFlagEqualTo((byte) 0); - List uplRtcfInfos = uplRtcfInfoMapper.selectByExample(uplRtcfInfoExample); - if (CollectionUtil.isNotEmpty(uplRtcfInfos)) { - return BeanUtil.copyProperties(uplRtcfInfos.get(0), UplRtcfInfoVo.Result.class); + public UplRtcfInfoVo.Result selectByMemberId(Long id, String membreId) { + //查询诊疗档案 + PmsTreatment pmsTreatment = pmsTreatmentMapper.selectByPrimaryKey(id); + if (pmsTreatment == null || pmsTreatment.getDelFlag() == 1 || StrUtil.isEmpty(pmsTreatment.getVisitNumber()) || pmsTreatment.getMemberId() == null) { + return new UplRtcfInfoVo.Result(); + } + Long memberId = pmsTreatment.getMemberId(); + if (memberId != null) { + UplRtcfInfoExample uplRtcfInfoExample = new UplRtcfInfoExample(); + uplRtcfInfoExample.createCriteria().andMemberidEqualTo(memberId + "").andDelFlagEqualTo((byte) 0); + uplRtcfInfoExample.setOrderByClause("id desc"); + List uplRtcfInfos = uplRtcfInfoMapper.selectByExample(uplRtcfInfoExample); + if (CollectionUtil.isNotEmpty(uplRtcfInfos)) { + return BeanUtil.copyProperties(uplRtcfInfos.get(0), UplRtcfInfoVo.Result.class); + } + } + if (StrUtil.isNotEmpty(pmsTreatment.getVisitNumber())) { + UplRtcfInfoExample uplRtcfInfoExample1 = new UplRtcfInfoExample(); + uplRtcfInfoExample1.createCriteria().andMemberidEqualTo(pmsTreatment.getVisitNumber()).andDelFlagEqualTo((byte) 0); + uplRtcfInfoExample1.setOrderByClause("id desc"); + List uplRtcfInfos = uplRtcfInfoMapper.selectByExample(uplRtcfInfoExample1); + if (CollectionUtil.isNotEmpty(uplRtcfInfos)) { + return BeanUtil.copyProperties(uplRtcfInfos.get(0), UplRtcfInfoVo.Result.class); + } } return new UplRtcfInfoVo.Result(); } @Override - public UplReportImage selectReportByMemberId(String membreId) { + public UplReportImage selectReportByMemberId(Long id) { UplReportImageExample uplReportImageExample = new UplReportImageExample(); - uplReportImageExample.createCriteria().andMemberIdEqualTo(membreId).andDelFlagEqualTo((byte) 0); + uplReportImageExample.createCriteria().andMemberIdEqualTo(id + "").andDelFlagEqualTo((byte) 0); List uplReportImages = uplReportImageMapper.selectByExample(uplReportImageExample); if (CollectionUtil.isNotEmpty(uplReportImages)) { return uplReportImages.get(0); diff --git a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java index eded34cf..e01f6274 100644 --- a/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java +++ b/acupuncture-system/src/main/java/com/acupuncture/system/service/impl/PmsTreatmentServiceImpl.java @@ -32,6 +32,7 @@ import com.acupuncture.system.service.PmsTreatmentService; import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.data.*; import com.deepoove.poi.data.style.BorderStyle; +import lombok.Synchronized; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -107,6 +108,7 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { pmsTreatment.setPinyinFull(PinyinUtil.getPinyin(pmsTreatment.getName(), "")); pmsTreatment.setPinyinSimple(PinyinUtil.getFirstLetter(pmsTreatment.getName(), "")); pmsTreatment.setId(IdUtil.getSnowflakeNextId()); + pmsTreatment.setMemberId(getMemberId()); pmsTreatment.setTenantId(SecurityUtils.getTenantId()); pmsTreatment.setDelFlag((byte) 0); pmsTreatment.setCreateBy(SecurityUtils.getUsername()); @@ -146,6 +148,24 @@ public class PmsTreatmentServiceImpl implements PmsTreatmentService { } } + @Override + @Synchronized + public Long getMemberId() { + //编码生成规则: 年+月+日+每天该租户的最大编码+1 + //生成最小的编码 + Date now = new Date(); + String date = DateUtil.format(now, "yyMMdd") + "0000"; + Long minMemberId = Long.parseLong(date); + PmsTreatmentExample pmsTreatmentExample = new PmsTreatmentExample(); + pmsTreatmentExample.createCriteria().andDelFlagEqualTo((byte) 0).andTenantIdEqualTo(SecurityUtils.getTenantId()).andMemberIdGreaterThan(minMemberId); + pmsTreatmentExample.setOrderByClause("create_time desc"); + List pmsTreatments = treatmentMapper.selectByExample(pmsTreatmentExample); + if (CollectionUtil.isEmpty(pmsTreatments)) { + return minMemberId + 1; + } + return pmsTreatments.get(0).getMemberId() + 1; + } + @Override public void updateTreatment(PmsTreatmentDto.TreatmentUpdateDTO dto) { PmsTreatment pmsTreatment = BeanUtil.copyProperties(dto, PmsTreatment.class); diff --git a/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml b/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml index 7881b688..9880a7b7 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/ExternalDao.xml @@ -25,4 +25,28 @@ + + diff --git a/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml b/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml index cd848231..db3770c2 100644 --- a/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml +++ b/acupuncture-system/src/main/resources/mapper/dao/PmsTreatmentDao.xml @@ -25,6 +25,7 @@ diagnosis_code as diagnosisCode, diagnosis_name as diagnosisName, status, + member_id as memberId, create_by as createBy, create_time as createTime from pms_treatment diff --git a/acupuncture-system/src/main/resources/mapper/system/PmsTreatmentMapper.xml b/acupuncture-system/src/main/resources/mapper/system/PmsTreatmentMapper.xml index 8764d899..80d143c4 100644 --- a/acupuncture-system/src/main/resources/mapper/system/PmsTreatmentMapper.xml +++ b/acupuncture-system/src/main/resources/mapper/system/PmsTreatmentMapper.xml @@ -24,6 +24,7 @@ + @@ -93,8 +94,8 @@ id, patient_id, name, pinyin_full, pinyin_simple, gender, age, birth_date, ethnicity, education_years, phone, id_card_type, id_card, visit_type, visit_number, visit_time, - discharge_time, doctor, dept_name, diagnosis_code, diagnosis_name, status, del_flag, - tenant_id, create_by, create_time, update_by, update_time, remark + discharge_time, doctor, dept_name, diagnosis_code, diagnosis_name, status, member_id, + del_flag, tenant_id, create_by, create_time, update_by, update_time, remark