diff --git a/openhis-server/core-common/src/main/java/com/core/common/core/domain/entity/SysUser.java b/openhis-server/core-common/src/main/java/com/core/common/core/domain/entity/SysUser.java index 2523d542..89835fab 100644 --- a/openhis-server/core-common/src/main/java/com/core/common/core/domain/entity/SysUser.java +++ b/openhis-server/core-common/src/main/java/com/core/common/core/domain/entity/SysUser.java @@ -7,6 +7,7 @@ import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; +import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -22,6 +23,7 @@ import com.core.common.xss.Xss; * * @author system */ +@Data public class SysUser extends BaseEntity { private static final long serialVersionUID = 1L; @@ -91,6 +93,12 @@ public class SysUser extends BaseEntity { /** 角色ID */ private Long roleId; + /** 租户ID */ + private Integer tenantId; + + /** 删除标识 */ + private String deleteFlag; + public SysUser() { } diff --git a/openhis-server/core-common/src/main/java/com/core/common/core/domain/model/LoginUser.java b/openhis-server/core-common/src/main/java/com/core/common/core/domain/model/LoginUser.java index 22206453..e0ed71df 100644 --- a/openhis-server/core-common/src/main/java/com/core/common/core/domain/model/LoginUser.java +++ b/openhis-server/core-common/src/main/java/com/core/common/core/domain/model/LoginUser.java @@ -3,13 +3,14 @@ package com.core.common.core.domain.model; import java.util.Collection; import java.util.Set; -import lombok.Data; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import com.alibaba.fastjson2.annotation.JSONField; import com.core.common.core.domain.entity.SysUser; +import lombok.Data; + /** * 登录用户身份权限 * @@ -72,6 +73,16 @@ public class LoginUser implements UserDetails { /** 租户ID */ private Integer tenantId; + /** + * 机构/科室id + */ + private Long orgId; + + /** + * 参与者id + */ + private Long practitionerId; + /** * 用户信息 */ diff --git a/openhis-server/core-common/src/main/java/com/core/common/core/domain/model/LoginUserExtend.java b/openhis-server/core-common/src/main/java/com/core/common/core/domain/model/LoginUserExtend.java new file mode 100644 index 00000000..e3bc85c2 --- /dev/null +++ b/openhis-server/core-common/src/main/java/com/core/common/core/domain/model/LoginUserExtend.java @@ -0,0 +1,21 @@ +package com.core.common.core.domain.model; + +import lombok.Data; + +/** + * 登录用户扩展 + */ +@Data +public class LoginUserExtend { + + /** + * 机构/科室id + */ + private Long orgId; + + /** + * 参与者id + */ + private Long practitionerId; + +} diff --git a/openhis-server/core-framework/src/main/java/com/core/framework/config/MybatisPlusConfig.java b/openhis-server/core-framework/src/main/java/com/core/framework/config/MybatisPlusConfig.java index 7ea46d21..95857469 100644 --- a/openhis-server/core-framework/src/main/java/com/core/framework/config/MybatisPlusConfig.java +++ b/openhis-server/core-framework/src/main/java/com/core/framework/config/MybatisPlusConfig.java @@ -1,5 +1,17 @@ package com.core.framework.config; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler; @@ -8,15 +20,9 @@ import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInt import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor; import com.core.common.utils.SecurityUtils; + import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.expression.LongValue; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.transaction.annotation.EnableTransactionManagement; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; @EnableTransactionManagement(proxyTargetClass = true) @Configuration @@ -41,7 +47,7 @@ public class MybatisPlusConfig { public PaginationInnerInterceptor paginationInnerInterceptor() { PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(); // 设置数据库类型为mysql - //paginationInnerInterceptor.setDbType(DbType.MYSQL); + // paginationInnerInterceptor.setDbType(DbType.MYSQL); paginationInnerInterceptor.setDbType(DbType.POSTGRE_SQL); // 设置最大单页限制数量,默认 500 条,-1 不受限制 paginationInnerInterceptor.setMaxLimit(-1L); @@ -81,56 +87,19 @@ public class MybatisPlusConfig { } // 配置需要租户隔离的表名集合 - private static final Set TENANT_TABLES = new HashSet<>(Arrays.asList( - "adm_account", - "adm_charge_item", - "adm_charge_item_def_detail", - "adm_charge_item_definition", - "adm_device", - "adm_device_definition", - "adm_encounter", - "adm_encounter_diagnosis", - "adm_encounter_location", - "adm_encounter_participant", - "adm_encounter_reason", - "adm_healthcare_service", - "adm_invoice", - "adm_location", - "adm_organization", - "adm_organization_location", - "adm_patient", - "adm_patient_identifier", - "adm_practitioner", - "adm_practitioner_role", - "adm_supplier", - "cli_condition", - "cli_condition_definition", - "cli_diagnosis_belong_binding", - "cli_procedure", - "cli_procedure_performer", - "doc_emr", - "doc_emr_template", - "doc_emr_detail", - "doc_emr_dict", - "fin_claim", - "fin_claim_response", - "fin_contract", - "fin_payment_notice", - "fin_payment_rec_detail", - "fin_payment_reconciliation", - "med_medication", - "med_medication_definition", - "med_medication_dispense", - "med_medication_request", - "wor_activity_definition", - "wor_device_dispense", - "wor_device_request", - "wor_inventory_item", - "wor_service_request", - "wor_service_request_detail", - "wor_supply_delivery", - "wor_supply_request" - )); + private static final Set TENANT_TABLES = new HashSet<>(Arrays.asList("adm_account", + "adm_charge_item", "adm_charge_item_def_detail", "adm_charge_item_definition", "adm_device", + "adm_device_definition", "adm_encounter", "adm_encounter_diagnosis", "adm_encounter_location", + "adm_encounter_participant", "adm_encounter_reason", "adm_healthcare_service", "adm_invoice", + "adm_location", "adm_organization", "adm_organization_location", "adm_patient", + "adm_patient_identifier", "sys_user", "adm_practitioner", "adm_practitioner_role", "adm_supplier", + "cli_condition", "cli_condition_definition", "cli_diagnosis_belong_binding", "cli_procedure", + "cli_procedure_performer", "doc_emr", "doc_emr_template", "doc_emr_detail", "doc_emr_dict", "fin_claim", + "fin_claim_response", "fin_contract", "fin_payment_notice", "fin_payment_rec_detail", + "fin_payment_reconciliation", "med_medication", "med_medication_definition", "med_medication_dispense", + "med_medication_request", "wor_activity_definition", "wor_device_dispense", "wor_device_request", + "wor_inventory_item", "wor_service_request", "wor_service_request_detail", "wor_supply_delivery", + "wor_supply_request")); @Override public boolean ignoreTable(String tableName) { @@ -147,10 +116,24 @@ public class MybatisPlusConfig { * 获取当前租户 ID */ private Integer getCurrentTenantId() { + // // 尝试从请求头中获取租户ID + ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); + if (attributes != null) { + HttpServletRequest request = attributes.getRequest(); + // 从请求头获取租户ID,假设header名称为"X-Tenant-ID" ; 登录接口前端把租户id放到请求头里 + String tenantIdHeader = request.getHeader("X-Tenant-ID"); + String requestMethodName = request.getHeader("Request-Method-Name"); + // 登录 + if ("login".equals(requestMethodName)) { + if (tenantIdHeader != null && !tenantIdHeader.isEmpty()) { + return Integer.parseInt(tenantIdHeader); + } + } + } // 获取当前登录用户的租户 ID if (SecurityUtils.getAuthentication() != null) { return SecurityUtils.getLoginUser().getTenantId(); } - return 0; + return 0; // 默认租户ID } } diff --git a/openhis-server/core-framework/src/main/java/com/core/framework/web/service/SysLoginService.java b/openhis-server/core-framework/src/main/java/com/core/framework/web/service/SysLoginService.java index 0630a89c..e3506c6a 100644 --- a/openhis-server/core-framework/src/main/java/com/core/framework/web/service/SysLoginService.java +++ b/openhis-server/core-framework/src/main/java/com/core/framework/web/service/SysLoginService.java @@ -1,6 +1,7 @@ package com.core.framework.web.service; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.authentication.AuthenticationManager; @@ -8,12 +9,15 @@ import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Component; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import com.core.common.constant.CacheConstants; import com.core.common.constant.Constants; import com.core.common.constant.UserConstants; import com.core.common.core.domain.entity.SysUser; import com.core.common.core.domain.model.LoginUser; +import com.core.common.core.domain.model.LoginUserExtend; import com.core.common.core.redis.RedisCache; import com.core.common.exception.ServiceException; import com.core.common.exception.user.*; @@ -60,7 +64,7 @@ public class SysLoginService { */ public String login(String username, String password, String code, String uuid) { // 验证码校验 - validateCaptcha(username, code, uuid); + validateCaptcha(username, code, uuid); // 登录前置校验 loginPreCheck(username, password); // 用户验证 @@ -88,11 +92,24 @@ public class SysLoginService { MessageUtils.message("user.login.success"))); LoginUser loginUser = (LoginUser)authentication.getPrincipal(); - // -----start-----登录时set租户id,正常应该从请求头获取,这行代码只是测试使用 - loginUser.setTenantId(1); - // -----end-----登录时set租户id,正常应该从请求头获取,这行代码只是测试使用 - + // -----start-----登录时set租户id + Integer tenantId = 0; + ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes(); + if (attributes != null) { + HttpServletRequest request = attributes.getRequest(); + // 从请求头获取租户ID,假设header名称为"X-Tenant-ID" ; 登录接口前端把租户id放到请求头里 + String tenantIdHeader = request.getHeader("X-Tenant-ID"); + if (tenantIdHeader != null && !tenantIdHeader.isEmpty()) { + tenantId = Integer.parseInt(tenantIdHeader); + } + } + loginUser.setTenantId(tenantId); + // -----end-----登录时set租户id recordLoginInfo(loginUser.getUserId()); + // 设置 机构id和参与者id + LoginUserExtend loginUserExtend = userService.getLoginUserExtend(loginUser.getUserId()); + loginUser.setOrgId(loginUserExtend.getOrgId()); + loginUser.setPractitionerId(loginUserExtend.getPractitionerId()); // 生成token return tokenService.createToken(loginUser); } diff --git a/openhis-server/core-system/src/main/java/com/core/system/mapper/SysUserMapper.java b/openhis-server/core-system/src/main/java/com/core/system/mapper/SysUserMapper.java index 5cab676f..d2f90d53 100644 --- a/openhis-server/core-system/src/main/java/com/core/system/mapper/SysUserMapper.java +++ b/openhis-server/core-system/src/main/java/com/core/system/mapper/SysUserMapper.java @@ -2,6 +2,7 @@ package com.core.system.mapper; import java.util.List; +import com.core.common.core.domain.model.LoginUserExtend; import org.apache.ibatis.annotations.Param; import com.core.common.core.domain.entity.SysUser; @@ -125,4 +126,12 @@ public interface SysUserMapper { * @return 结果 */ public SysUser checkEmailUnique(String email); + + /** + * 扩展属性 + * + * @param userId 系统用户id + * @return 扩展属性 + */ + LoginUserExtend getLoginUserExtend(@Param("userId") Long userId); } diff --git a/openhis-server/core-system/src/main/java/com/core/system/service/ISysUserService.java b/openhis-server/core-system/src/main/java/com/core/system/service/ISysUserService.java index 9718b9c4..769bf5df 100644 --- a/openhis-server/core-system/src/main/java/com/core/system/service/ISysUserService.java +++ b/openhis-server/core-system/src/main/java/com/core/system/service/ISysUserService.java @@ -3,6 +3,7 @@ package com.core.system.service; import java.util.List; import com.core.common.core.domain.entity.SysUser; +import com.core.common.core.domain.model.LoginUserExtend; /** * 用户 业务层 @@ -203,4 +204,12 @@ public interface ISysUserService { * @return 结果 */ public String importUser(List userList, Boolean isUpdateSupport, String operName); + + /** + * 扩展属性 + * + * @param userId 系统用户id + * @return 扩展属性 + */ + LoginUserExtend getLoginUserExtend(Long userId); } diff --git a/openhis-server/core-system/src/main/java/com/core/system/service/impl/SysUserServiceImpl.java b/openhis-server/core-system/src/main/java/com/core/system/service/impl/SysUserServiceImpl.java index 3a313f0a..2f2a742e 100644 --- a/openhis-server/core-system/src/main/java/com/core/system/service/impl/SysUserServiceImpl.java +++ b/openhis-server/core-system/src/main/java/com/core/system/service/impl/SysUserServiceImpl.java @@ -6,6 +6,7 @@ import java.util.stream.Collectors; import javax.validation.Validator; +import com.core.common.core.domain.model.LoginUserExtend; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -484,4 +485,16 @@ public class SysUserServiceImpl implements ISysUserService { } return successMsg.toString(); } + + /** + * 扩展属性 + * + * @param userId 系统用户id + * @return 扩展属性 + */ + @Override + public LoginUserExtend getLoginUserExtend(Long userId) { + return userMapper.getLoginUserExtend(userId); + } + } diff --git a/openhis-server/core-system/src/main/resources/mapper/system/SysRoleMapper.xml b/openhis-server/core-system/src/main/resources/mapper/system/SysRoleMapper.xml index 0db98b29..aaa8b474 100644 --- a/openhis-server/core-system/src/main/resources/mapper/system/SysRoleMapper.xml +++ b/openhis-server/core-system/src/main/resources/mapper/system/SysRoleMapper.xml @@ -121,8 +121,18 @@ #{roleKey}, #{roleSort}, #{dataScope}, - #{menuCheckStrictly}, - #{deptCheckStrictly}, + + + 1, + 0, + + + + + 1, + 0, + + #{status}, #{remark}, #{createBy}, @@ -137,8 +147,18 @@ role_key = #{roleKey}, role_sort = #{roleSort}, data_scope = #{dataScope}, - menu_check_strictly = #{menuCheckStrictly}, - dept_check_strictly = #{deptCheckStrictly}, + + + menu_check_strictly=1, + menu_check_strictly=0, + + + + + dept_check_strictly=1, + dept_check_strictly=0, + + status = #{status}, remark = #{remark}, update_by = #{updateBy}, diff --git a/openhis-server/core-system/src/main/resources/mapper/system/SysUserMapper.xml b/openhis-server/core-system/src/main/resources/mapper/system/SysUserMapper.xml index 9f2d5637..c0062a6b 100644 --- a/openhis-server/core-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/openhis-server/core-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -108,7 +108,7 @@ AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE cast(#{deptId} as - varchar) = any(string_to_array(ancestors,‘,’)) )) + varchar) = any(string_to_array(ancestors,',')) )) ${params.dataScope} @@ -265,4 +265,12 @@ + + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/appservice/IPractitionerAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/appservice/IPractitionerAppService.java index 9704f1d1..9db610ad 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/appservice/IPractitionerAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/appservice/IPractitionerAppService.java @@ -1,47 +1,48 @@ package com.openhis.web.basedatamanage.appservice; -import javax.servlet.http.HttpServletRequest; - +import com.baomidou.mybatisplus.core.metadata.IPage; import com.core.common.core.domain.R; -import com.openhis.web.basedatamanage.dto.PractSearchParam; -import com.openhis.web.basedatamanage.dto.PractitionerDto; +import com.openhis.web.basedatamanage.dto.UserAndPractitionerDto; /** - * Practitioner 应该服务类 + * 参与者 应该服务类 */ public interface IPractitionerAppService { - /** - * 查询员工信息 - * - * @param pageNo 当前页码 - * @param pageSize 查询条数 - * @param request 请求数据 - * @return 员工分页列表 - */ - R getPractitionerPage(PractSearchParam practSearchParam, String searchKey, Integer pageNo, Integer pageSize, - HttpServletRequest request); /** - * 员工信息详情 - * - * @param practitionerId 员工信息id - * @return 员工信息详情 + * 新增用户及参与者 + * + * @param userAndPractitionerDto 用户及参与者dto + * @return 结果 */ - R getPractitionerById(Long practitionerId); + R saveUserPractitioner(UserAndPractitionerDto userAndPractitionerDto); /** - * 添加/编辑员工信息 - * - * @param practitionerDto 员工信息 - * @return 操作结果 + * 查询用户及参与者 + * + * @param userAndPractitionerDto 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @return 用户及参与者 */ - R addOrEditPractitioner(PractitionerDto practitionerDto); + IPage getUserPractitionerPage(UserAndPractitionerDto userAndPractitionerDto, + String searchKey, Integer pageNo, Integer pageSize); /** - * 员工信息 + * 修改用户及参与者 * - * @param practitionerId 员工信息id - * @return 操作结果 + * @param userAndPractitionerDto 用户及参与者dto + * @return 结果 */ - R deletePractitioner(Long practitionerId); + R editUserPractitioner(UserAndPractitionerDto userAndPractitionerDto); + + /** + * 删除用户及参与者 ; admin不允许删除 + * + * @param userId 系统用户id + * @return 结果 + */ + R delUserPractitioner(Long userId); + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/appservice/impl/PractitionerAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/appservice/impl/PractitionerAppServiceImpl.java index fb2034da..2cc18a79 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/appservice/impl/PractitionerAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/appservice/impl/PractitionerAppServiceImpl.java @@ -2,116 +2,310 @@ package com.openhis.web.basedatamanage.appservice.impl; import java.util.Arrays; import java.util.HashSet; +import java.util.List; +import java.util.stream.Collectors; -import javax.servlet.http.HttpServletRequest; +import javax.annotation.Resource; -import org.springframework.beans.BeanUtils; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; +import com.core.common.utils.ChineseConvertUtils; import com.core.common.utils.MessageUtils; +import com.core.common.utils.SecurityUtils; +import com.openhis.administration.domain.BizUser; +import com.openhis.administration.domain.BizUserRole; import com.openhis.administration.domain.Practitioner; import com.openhis.administration.domain.PractitionerRole; -import com.openhis.administration.mapper.PractitionerMapper; +import com.openhis.administration.service.IBizUserRoleService; +import com.openhis.administration.service.IBizUserService; import com.openhis.administration.service.IPractitionerRoleService; import com.openhis.administration.service.IPractitionerService; import com.openhis.common.constant.PromptMsgConstant; -import com.openhis.common.utils.HisPageUtils; +import com.openhis.common.enums.AccountStatus; +import com.openhis.common.enums.PractitionerRoles; import com.openhis.common.utils.HisQueryUtils; import com.openhis.web.basedatamanage.appservice.IPractitionerAppService; -import com.openhis.web.basedatamanage.dto.PractSearchParam; -import com.openhis.web.basedatamanage.dto.PractitionerDto; +import com.openhis.web.basedatamanage.dto.PractitionerOrgAndLocationDto; +import com.openhis.web.basedatamanage.dto.PractitionerRolesDto; +import com.openhis.web.basedatamanage.dto.UserAndPractitionerDto; +import com.openhis.web.basedatamanage.mapper.PractitionerAppAppMapper; @Service public class PractitionerAppServiceImpl implements IPractitionerAppService { - @Autowired - private IPractitionerService practitionerService; + @Resource + PractitionerAppAppMapper practitionerAppAppMapper; - @Autowired - private PractitionerMapper practitionerMapper; + @Resource + IBizUserService iBizUserService; - @Autowired - private IPractitionerRoleService practitionerRoleService; + @Resource + IBizUserRoleService iBizUserRoleService; - @Override - public R getPractitionerPage(PractSearchParam practSearchParam, String searchKey, Integer pageNo, - Integer pageSize, HttpServletRequest request) { + @Resource + IPractitionerService iPractitionerService; - // 构建查询条件 - QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(practSearchParam, searchKey, - new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), request); - - // 查询员工分页列表 - Page practitionerDtoPage = - HisPageUtils.selectPage(practitionerMapper, queryWrapper, pageNo, pageSize, PractitionerDto.class); - - return R.ok(practitionerDtoPage, - MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"员工信息"})); - } + @Resource + IPractitionerRoleService iPractitionerRoleService; /** - * 员工信息详情 + * 新增用户及参与者 * - * @param practitionerId 员工信息id - * @return 员工信息详情 + * @param userAndPractitionerDto 用户及参与者dto + * @return 结果 */ @Override - public R getPractitionerById(Long practitionerId) { - Practitioner practitioner = practitionerService.getById(practitionerId); - if (practitioner != null) { - return R.ok(practitioner, - MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"员工信息"})); - } else { - return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"员工信息查询失败"})); + public R saveUserPractitioner(UserAndPractitionerDto userAndPractitionerDto) { + String userName = userAndPractitionerDto.getUserName(); + String nickName = userAndPractitionerDto.getNickName(); + String phonenumber = userAndPractitionerDto.getPhonenumber(); + String sex = userAndPractitionerDto.getSex(); + // 账号唯一性 + long count = iBizUserService.count(new LambdaQueryWrapper().eq(BizUser::getUserName, userName)); + if (count > 0L) { + return R.fail(null, "账号已存在"); } - } - - /** - * 添加/编辑员工信息 - * - * @param practitionerDto 员工信息 - * @return 操作结果 - */ - @Override - public R addOrEditPractitioner(PractitionerDto practitionerDto) { - + // 新增 sys_user + BizUser bizUser = new BizUser(); + bizUser.setUserName(userName); // 账号 + bizUser.setNickName(nickName); // 昵称 + bizUser.setEmail(userAndPractitionerDto.getEmail());// 邮箱 + bizUser.setPhonenumber(phonenumber); // 电话 + bizUser.setSex(sex); // 性别 + bizUser.setPassword(SecurityUtils.encryptPassword(userAndPractitionerDto.getPassword())); // 密码 + bizUser.setStatus(userAndPractitionerDto.getStatus()); // 状态 + bizUser.setRemark(userAndPractitionerDto.getRemark()); // 备注 + iBizUserService.save(bizUser); + Long userId = + iBizUserService.getOne(new LambdaQueryWrapper().eq(BizUser::getUserName, userName)).getUserId(); // 用户id + // 新增 sys_user_role + List practitionerRoleDtoList = userAndPractitionerDto.getPractitionerRolesDtoList(); + BizUserRole bizUserRole; + for (PractitionerRolesDto practitionerRolesDto : practitionerRoleDtoList) { + bizUserRole = new BizUserRole(); + bizUserRole.setUserId(userId); + bizUserRole.setRoleId(practitionerRolesDto.getRoleId()); + iBizUserRoleService.save(bizUserRole); + } + // 新增 adm_practitioner Practitioner practitioner = new Practitioner(); - BeanUtils.copyProperties(practitionerDto, practitioner); - PractitionerRole practitionerRole = new PractitionerRole(); - - if (practitionerDto.getId() != null) { - // 更新员工信息 - practitionerService.updateById(practitioner); - } else { - // 新增员工信息 - practitionerService.save(practitioner); - - // 新增员工岗位信息 - practitionerRole.setPractitionerId(practitioner.getId()); - practitionerRole.setName(practitioner.getName()); - practitionerRoleService.save(practitionerRole); + practitioner.setActiveFlag(AccountStatus.ACTIVE.getValue()); // 活动标记 + practitioner.setName(nickName); // 姓名 + practitioner.setGenderEnum(Integer.parseInt(sex)); // 性别 + practitioner.setBirthDate(userAndPractitionerDto.getBirthDate()); // 出生日期 + practitioner.setPhone(phonenumber); // 电话 + practitioner.setAddress(userAndPractitionerDto.getAddress()); // 地址 + practitioner.setYbNo(userAndPractitionerDto.getYbNo()); // 医保码 + practitioner.setUserId(userId); // 系统用户id + // 责任科室 + List responsibilityOrgDtoList = + userAndPractitionerDto.getResponsibilityOrgDtoList(); + practitioner.setOrgId(responsibilityOrgDtoList.get(0).getOrgId()); // 机构id + practitioner.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(nickName)); // 拼音码 + practitioner.setWbStr(ChineseConvertUtils.toWBFirstLetter(nickName)); // 五笔码 + iPractitionerService.save(practitioner); + Long practitionerId = practitioner.getId();// 参与者id + // 新增 adm_practitioner_role + PractitionerRole practitionerRole; + // 1.责任科室 + for (PractitionerOrgAndLocationDto responsibilityOrgDto : responsibilityOrgDtoList) { + practitionerRole = new PractitionerRole(); + practitionerRole.setName(nickName); // 姓名 + practitionerRole.setPractitionerId(practitionerId); // 参与者id + practitionerRole.setOrgId(responsibilityOrgDto.getOrgId()); // 机构id + iPractitionerRoleService.save(practitionerRole); } - // 返回员工id - return R.ok(practitioner.getId(), - MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"员工信息更新添加"})); + // 2.医生出诊科室 + List doctorVisitOrgDtoList = userAndPractitionerDto.getDoctorVisitOrgDtoList(); + for (PractitionerOrgAndLocationDto doctorVisitOrgDto : doctorVisitOrgDtoList) { + practitionerRole = new PractitionerRole(); + practitionerRole.setName(nickName); // 姓名 + practitionerRole.setPractitionerId(practitionerId); // 参与者id + practitionerRole.setRoleCode(PractitionerRoles.DOCTOR.getCode());// 角色code + practitionerRole.setOrgId(doctorVisitOrgDto.getOrgId()); // 机构id + iPractitionerRoleService.save(practitionerRole); + } + // 3.管理库房 + List manageLocationDtoList = userAndPractitionerDto.getManageLocationDtoList(); + for (PractitionerOrgAndLocationDto manageLocationDto : manageLocationDtoList) { + practitionerRole = new PractitionerRole(); + practitionerRole.setName(nickName); // 姓名 + practitionerRole.setPractitionerId(practitionerId); // 参与者id + practitionerRole.setRoleCode(PractitionerRoles.LOCATION_ADMIN.getCode()); // 角色code + practitionerRole.setLocationId(manageLocationDto.getLocationId()); // 位置id + practitionerRole.setOrgId(manageLocationDto.getOrgId()); // 机构id + iPractitionerRoleService.save(practitionerRole); + } + + return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"人员信息"})); } /** - * 删除员工 + * 查询用户及参与者 * - * @param practitionerId 员工信息id - * @return 操作结果 + * @param userAndPractitionerDto 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @return 用户及参与者 */ @Override - public R deletePractitioner(Long practitionerId) { - // 删除员工信息 - boolean deletepractitioner = practitionerService.removeById(practitionerId); - return deletepractitioner - ? R.ok(practitionerId, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"员工信息"})) - : R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"员工信息"})); + public IPage getUserPractitionerPage(UserAndPractitionerDto userAndPractitionerDto, + String searchKey, Integer pageNo, Integer pageSize) { + // 构建查询条件 + QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(userAndPractitionerDto, + searchKey, new HashSet<>(Arrays.asList("user_name", "nick_name", "py_str", "wb_str")), null); + queryWrapper.orderByDesc("user_id"); + IPage userPractitionerPage = + practitionerAppAppMapper.getUserPractitionerPage(new Page<>(pageNo, pageSize), queryWrapper); + List records = userPractitionerPage.getRecords(); + // 参与者id集合 + List practitionerIdList = + records.stream().map(UserAndPractitionerDto::getPractitionerId).collect(Collectors.toList()); + // 角色集合 + List practitionerRolesDtoList = + practitionerAppAppMapper.getPractitionerRolesDtoList(practitionerIdList); + // 科室和位置 + List orgAndLocationDtoList = + practitionerAppAppMapper.getOrgAndLocationDtoList(practitionerIdList); + for (UserAndPractitionerDto record : records) { + // 匹配角色 + List list1 = practitionerRolesDtoList.stream() + .filter(e -> e.getPractitionerId().equals(record.getPractitionerId())).collect(Collectors.toList()); + record.setPractitionerRolesDtoList(list1); + // 匹配责任科室 + List list2 = orgAndLocationDtoList.stream() + .filter(e -> e.getPractitionerId().equals(record.getPractitionerId()) && "".equals(e.getRoleCode())) + .collect(Collectors.toList()); + record.setResponsibilityOrgDtoList(list2); + // 匹配医生出诊科室 + List list3 = + orgAndLocationDtoList.stream().filter(e -> e.getPractitionerId().equals(record.getPractitionerId()) + && PractitionerRoles.DOCTOR.getCode().equals(e.getRoleCode())).collect(Collectors.toList()); + record.setDoctorVisitOrgDtoList(list3); + // 匹配管理库房 + List list4 = + orgAndLocationDtoList.stream() + .filter(e -> e.getPractitionerId().equals(record.getPractitionerId()) + && PractitionerRoles.LOCATION_ADMIN.getCode().equals(e.getRoleCode())) + .collect(Collectors.toList()); + record.setManageLocationDtoList(list4); + } + return userPractitionerPage; } + + /** + * 修改用户及参与者 : 登录账号和密码不允许编辑 + * + * @param userAndPractitionerDto 用户及参与者dto + * @return 结果 + */ + @Override + public R editUserPractitioner(UserAndPractitionerDto userAndPractitionerDto) { + Long userId = userAndPractitionerDto.getUserId(); // 系统用户id + Long practitionerId = userAndPractitionerDto.getPractitionerId(); // 参与者id + + String nickName = userAndPractitionerDto.getNickName(); + String phonenumber = userAndPractitionerDto.getPhonenumber(); + String sex = userAndPractitionerDto.getSex(); + // 编辑 sys_user + BizUser bizUser = new BizUser(); + bizUser.setNickName(nickName); // 昵称 + bizUser.setEmail(userAndPractitionerDto.getEmail());// 邮箱 + bizUser.setPhonenumber(phonenumber); // 电话 + bizUser.setSex(sex); // 性别 + bizUser.setStatus(userAndPractitionerDto.getStatus()); // 状态 + bizUser.setRemark(userAndPractitionerDto.getRemark()); // 备注 + iBizUserService.update(bizUser, new LambdaQueryWrapper().eq(BizUser::getUserId, userId)); + // 先删除,再新增 sys_user_role + practitionerAppAppMapper.delUserRole(userId); + List practitionerRoleDtoList = userAndPractitionerDto.getPractitionerRolesDtoList(); + BizUserRole bizUserRole; + for (PractitionerRolesDto practitionerRolesDto : practitionerRoleDtoList) { + bizUserRole = new BizUserRole(); + bizUserRole.setUserId(userId); + bizUserRole.setRoleId(practitionerRolesDto.getRoleId()); + iBizUserRoleService.save(bizUserRole); + } + // 编辑 adm_practitioner + Practitioner practitioner = new Practitioner(); + practitioner.setId(practitionerId); + practitioner.setName(nickName); // 姓名 + practitioner.setGenderEnum(Integer.parseInt(sex)); // 性别 + practitioner.setBirthDate(userAndPractitionerDto.getBirthDate()); // 出生日期 + practitioner.setPhone(phonenumber); // 电话 + practitioner.setAddress(userAndPractitionerDto.getAddress()); // 地址 + practitioner.setYbNo(userAndPractitionerDto.getYbNo()); // 医保码 + practitioner.setUserId(userId); // 系统用户id + // 责任科室 + List responsibilityOrgDtoList = + userAndPractitionerDto.getResponsibilityOrgDtoList(); + practitioner.setOrgId(responsibilityOrgDtoList.get(0).getOrgId()); // 机构id + practitioner.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(nickName)); // 拼音码 + practitioner.setWbStr(ChineseConvertUtils.toWBFirstLetter(nickName)); // 五笔码 + iPractitionerService.updateById(practitioner); + // 先删除,再新增 adm_practitioner_role + practitionerAppAppMapper.delPractitionerRole(practitionerId); + PractitionerRole practitionerRole; + // 1.责任科室 + for (PractitionerOrgAndLocationDto responsibilityOrgDto : responsibilityOrgDtoList) { + practitionerRole = new PractitionerRole(); + practitionerRole.setName(nickName); // 姓名 + practitionerRole.setPractitionerId(practitionerId); // 参与者id + practitionerRole.setOrgId(responsibilityOrgDto.getOrgId()); // 机构id + iPractitionerRoleService.save(practitionerRole); + } + // 2.医生出诊科室 + List doctorVisitOrgDtoList = userAndPractitionerDto.getDoctorVisitOrgDtoList(); + for (PractitionerOrgAndLocationDto doctorVisitOrgDto : doctorVisitOrgDtoList) { + practitionerRole = new PractitionerRole(); + practitionerRole.setName(nickName); // 姓名 + practitionerRole.setPractitionerId(practitionerId); // 参与者id + practitionerRole.setRoleCode(PractitionerRoles.DOCTOR.getCode());// 角色code + practitionerRole.setOrgId(doctorVisitOrgDto.getOrgId()); // 机构id + iPractitionerRoleService.save(practitionerRole); + } + // 3.管理库房 + List manageLocationDtoList = userAndPractitionerDto.getManageLocationDtoList(); + for (PractitionerOrgAndLocationDto manageLocationDto : manageLocationDtoList) { + practitionerRole = new PractitionerRole(); + practitionerRole.setName(nickName); // 姓名 + practitionerRole.setPractitionerId(practitionerId); // 参与者id + practitionerRole.setRoleCode(PractitionerRoles.LOCATION_ADMIN.getCode()); // 角色code + practitionerRole.setLocationId(manageLocationDto.getLocationId()); // 位置id + practitionerRole.setOrgId(manageLocationDto.getOrgId()); // 机构id + iPractitionerRoleService.save(practitionerRole); + } + + return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"人员信息"})); + } + + /** + * 删除用户及参与者 ; admin不允许删除 + * + * @param userId 系统用户id + * @return 结果 + */ + @Override + public R delUserPractitioner(Long userId) { + if (1L == userId) { + return R.fail(null, "admin不允许删除"); + } + iBizUserService.remove(new LambdaQueryWrapper().eq(BizUser::getUserId, userId)); + practitionerAppAppMapper.delUserRole(userId); + Practitioner one = + iPractitionerService.getOne(new LambdaQueryWrapper().eq(Practitioner::getUserId, userId)); + Long practitionerId = one.getId();// 参与者id + iPractitionerService.removeById(practitionerId); + iPractitionerRoleService + .remove(new LambdaQueryWrapper().eq(PractitionerRole::getPractitionerId, practitionerId)); + + return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"人员信息"})); + } + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/controller/PractitionerController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/controller/PractitionerController.java index 96173a77..22e5553e 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/controller/PractitionerController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/controller/PractitionerController.java @@ -3,25 +3,18 @@ */ package com.openhis.web.basedatamanage.controller; -import javax.servlet.http.HttpServletRequest; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.core.common.core.domain.R; import com.openhis.web.basedatamanage.appservice.IPractitionerAppService; -import com.openhis.web.basedatamanage.dto.PractSearchParam; -import com.openhis.web.basedatamanage.dto.PractitionerDto; +import com.openhis.web.basedatamanage.dto.UserAndPractitionerDto; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; /** - * 员工管理Controller业务层处理 - * - * @author - * @date 2025-02-21 + * 参与者 Controller业务层处理 */ @RestController @RequestMapping("/base-data-manage/practitioner") @@ -29,54 +22,72 @@ import lombok.extern.slf4j.Slf4j; @AllArgsConstructor public class PractitionerController { - @Autowired - private IPractitionerAppService practitionerAppService; + private final IPractitionerAppService practitionerAppService; /** - * 员工分页列表 - * - * @param practSearchParam 查询条件 - * @param pageNo 当前页码 - * @param pageSize 查询条数 - * @param request 请求数据 - * @return 员工分页列表 + * 新增用户及参与者 + * + * @param userAndPractitionerDto 用户及参与者dto + * @return 结果 */ - @GetMapping(value = "/practitioner") - public R getPractitionerPage(PractSearchParam practSearchParam, + @PostMapping(value = "/user-practitioner") + public R saveUserPractitioner(@RequestBody UserAndPractitionerDto userAndPractitionerDto) { + return practitionerAppService.saveUserPractitioner(userAndPractitionerDto); + } + + /** + * 查询用户及参与者 + * + * @param userAndPractitionerDto 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @return 用户及参与者 + */ + @GetMapping(value = "/user-practitioner-page") + public R getUserPractitionerPage(UserAndPractitionerDto userAndPractitionerDto, @RequestParam(value = "searchKey", defaultValue = "") String searchKey, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { - return practitionerAppService.getPractitionerPage(practSearchParam, searchKey, pageNo, pageSize, request); + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { + return R + .ok(practitionerAppService.getUserPractitionerPage(userAndPractitionerDto, searchKey, pageNo, pageSize)); } /** - * 获取员工需要编辑的信息 - * - * @param practitionerId 员工信息 + * 查询用户及参与者详情 + * + * @param userId 系统用户id + * @return 用户及参与者详情 */ - @GetMapping("/practitioner-getById") - public R getPractitionerById(@Validated @RequestParam Long practitionerId) { - return practitionerAppService.getPractitionerById(practitionerId); + @GetMapping(value = "/user-practitioner-detail") + public R getUserPractitionerPage(@RequestParam Long userId) { + UserAndPractitionerDto userAndPractitionerDto = new UserAndPractitionerDto(); + userAndPractitionerDto.setUserId(userId); + IPage userPractitionerPage = + practitionerAppService.getUserPractitionerPage(userAndPractitionerDto, "", 1, 1); + return R.ok(userPractitionerPage.getRecords().get(0)); } /** - * 编辑员工信息 + * 修改用户及参与者 * - * @param practitionerDto 员工信息 + * @param userAndPractitionerDto 用户及参与者dto + * @return 结果 */ - @PutMapping("/practitioner") - public R addOrEditPractitioner(@Validated @RequestBody PractitionerDto practitionerDto) { - return practitionerAppService.addOrEditPractitioner(practitionerDto); + @PutMapping(value = "/user-practitioner") + public R editUserPractitioner(@RequestBody UserAndPractitionerDto userAndPractitionerDto) { + return practitionerAppService.editUserPractitioner(userAndPractitionerDto); } /** - * 删除员工信息 - * - * @param practitionerId 主表id + * 删除用户及参与者 ; admin不允许删除 + * + * @param userId 系统用户id + * @return 结果 */ - @DeleteMapping("/practitioner") - public R deletePractitioner(@RequestParam Long practitionerId) { - return practitionerAppService.deletePractitioner(practitionerId); + @DeleteMapping(value = "/user-practitioner") + public R delUserPractitioner(@RequestParam Long userId) { + return practitionerAppService.delUserPractitioner(userId); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/OrgLocQueryDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/OrgLocQueryDto.java index b36ca597..f71efee3 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/OrgLocQueryDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/OrgLocQueryDto.java @@ -35,8 +35,8 @@ public class OrgLocQueryDto { @JsonSerialize(using = ToStringSerializer.class) private Long defLocationId; - /** 药品类别 */ - private String medCategoryCode; + /** 发放类别 */ + private String distributionCategoryCode; /** 开始时间 */ private Date startTime; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/PractitionerOrgAndLocationDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/PractitionerOrgAndLocationDto.java new file mode 100644 index 00000000..c3057f78 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/PractitionerOrgAndLocationDto.java @@ -0,0 +1,44 @@ +package com.openhis.web.basedatamanage.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 参与者机构和位置 dto + */ +@Data +@Accessors(chain = true) +public class PractitionerOrgAndLocationDto { + + /** + * 位置id + */ + @Dict(dictTable = "adm_location", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long locationId; + private String locationId_dictText; + + /** + * 角色code + */ + private String roleCode; + + /** + * 机构id + */ + @Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long orgId; + private String orgId_dictText; + + /** + * 参与者id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long practitionerId; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/PractitionerRolesDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/PractitionerRolesDto.java new file mode 100644 index 00000000..bb70bb01 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/PractitionerRolesDto.java @@ -0,0 +1,38 @@ +package com.openhis.web.basedatamanage.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 参与者角色 dto + */ +@Data +@Accessors(chain = true) +public class PractitionerRolesDto { + + /** + * 角色id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long roleId; + + /** + * 角色code + */ + private String roleCode; + + /** + * 角色名称 + */ + private String roleName; + + /** + * 参与者id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long practitionerId; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/UserAndPractitionerDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/UserAndPractitionerDto.java new file mode 100644 index 00000000..01866348 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/dto/UserAndPractitionerDto.java @@ -0,0 +1,125 @@ +package com.openhis.web.basedatamanage.dto; + +import java.util.Date; +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 用户 及 参与者 dto + */ +@Data +@Accessors(chain = true) +public class UserAndPractitionerDto { + + /** + * 用户id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long userId; + + /** + * 参与者id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long practitionerId; + + /** + * 账号 + */ + private String userName; + + /** + * 姓名 + */ + private String nickName; + + /** 拼音码 */ + private String pyStr; + + /** 五笔码 */ + private String wbStr; + + /** + * 邮箱 + */ + private String email; + + /** + * 电话 + */ + private String phonenumber; + + /** + * 性别 + */ + @Dict(dictCode = "sys_user_sex") + private String sex; + private String sex_dictText; + + /** + * 密码 + */ + private String password; + + /** + * 状态(0正常 1停用) + */ + @Dict(dictCode = "sys_normal_disable") + private String status; + private String status_dictText; + + /** + * 备注 + */ + private String remark; + + /** + * 出生日期 + */ + private Date birthDate; + + /** + * 地址 + */ + private String address; + + /** + * 医保码 + */ + private String ybNo; + + /** + * 机构id + */ + @Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long orgId; + private String orgId_dictText; + + /** + * 责任科室 + */ + private List responsibilityOrgDtoList; + + /** + * 参与者角色集合 + */ + private List practitionerRolesDtoList; + + /** + * 医生出诊科室集合 + */ + private List doctorVisitOrgDtoList; + + /** + * 管理库房集合 + */ + private List manageLocationDtoList; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/mapper/PractitionerAppAppMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/mapper/PractitionerAppAppMapper.java new file mode 100644 index 00000000..87a0d1d6 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/basedatamanage/mapper/PractitionerAppAppMapper.java @@ -0,0 +1,63 @@ +package com.openhis.web.basedatamanage.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.basedatamanage.dto.PractitionerOrgAndLocationDto; +import com.openhis.web.basedatamanage.dto.PractitionerRolesDto; +import com.openhis.web.basedatamanage.dto.UserAndPractitionerDto; + +/** + * 参与者 应用Mapper + */ +@Repository +public interface PractitionerAppAppMapper { + + /** + * 查询用户及参与者 + * + * @param page 分页参数 + * @param queryWrapper 查询条件 + * @return 用户及参与者 + */ + IPage getUserPractitionerPage(@Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + /** + * 查询参与者的角色信息 + * + * @param practitionerIdList 参与者id集合 + * @return 参与者的角色信息 + */ + List getPractitionerRolesDtoList(@Param("practitionerIdList") List practitionerIdList); + + /** + * 查询科室和位置集合 + * + * @param practitionerIdList 参与者id集合 + * @return 科室和位置集合 + */ + List + getOrgAndLocationDtoList(@Param("practitionerIdList") List practitionerIdList); + + /** + * 物理删除系统用户与角色的关系 + * + * @param userId 系统用户id + */ + void delUserRole(@Param("userId") Long userId); + + /** + * 物理删除参与者与业务角色的关系 + * + * @param practitionerId 参与者id + */ + void delPractitionerRole(@Param("practitionerId") Long practitionerId); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/basicservice/controller/HealthcareServiceController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/basicservice/controller/HealthcareServiceController.java index 4fc5c61f..ce63c456 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/basicservice/controller/HealthcareServiceController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/basicservice/controller/HealthcareServiceController.java @@ -132,8 +132,8 @@ public class HealthcareServiceController { * @param id 主键 * @return 详情 */ - @GetMapping(value = "/healthcare-service-detail/{id}") - public R getHealthcareServiceDetail(@PathVariable("id") Long id) { + @GetMapping(value = "/healthcare-service-detail") + public R getHealthcareServiceDetail(@RequestParam Long id) { HealthcareServiceDto healthcareServiceDto = new HealthcareServiceDto(); healthcareServiceDto.setId(id); // 构建查询条件 diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientChargeAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientChargeAppService.java index 9e76b7e8..7d493cd7 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientChargeAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientChargeAppService.java @@ -52,4 +52,11 @@ public interface IOutpatientChargeAppService { * @return 操作结果 */ R changeToMedicalInsurance(Long encounterId); + + /** + * 门诊收费页面初始化 + * + * @return 初始化信息 + */ + R outpatientChargeInit(); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java index 9386da1c..a8cd1849 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/IOutpatientRefundAppService.java @@ -3,10 +3,13 @@ */ package com.openhis.web.chargemanage.appservice; -import com.core.common.core.domain.R; - import java.util.List; +import javax.servlet.http.HttpServletRequest; + +import com.core.common.core.domain.R; +import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; + /** * 门诊退费 service * @@ -30,4 +33,24 @@ public interface IOutpatientRefundAppService { * @return 操作结果 */ R refundPayment(List paymentIdList); + + /** + * 查询结算过的就诊患者分页列表 + * + * @param encounterPatientPageParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @param request 请求 + * @return 就诊患者分页列表 + */ + R getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey, + Integer pageNo, Integer pageSize, HttpServletRequest request); + + /** + * 门诊退费页面初始化 + * + * @return 初始化信息 + */ + R outpatientRefundInit(); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java index 14afe3eb..a5ccca46 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientChargeAppServiceImpl.java @@ -3,8 +3,10 @@ */ package com.openhis.web.chargemanage.appservice.impl; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; +import java.util.List; import javax.servlet.http.HttpServletRequest; @@ -28,6 +30,7 @@ import com.openhis.common.utils.HisQueryUtils; import com.openhis.web.chargemanage.appservice.IOutpatientChargeAppService; import com.openhis.web.chargemanage.dto.EncounterPatientPageDto; import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; +import com.openhis.web.chargemanage.dto.OutpatientInitDto; import com.openhis.web.chargemanage.mapper.OutpatientChargeAppMapper; /** @@ -46,6 +49,25 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi @Autowired private IAccountService accountService; + /** + * 门诊收费页面初始化 + * + * @return 初始化信息 + */ + @Override + public R outpatientChargeInit() { + OutpatientInitDto initDto = new OutpatientInitDto(); + List chargeItemStatusOptions = new ArrayList<>(); + chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.PLANNED.getValue(), + ChargeItemStatus.PLANNED.getInfo())); + chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLABLE.getValue(), + ChargeItemStatus.BILLABLE.getInfo())); + chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(), + ChargeItemStatus.BILLED.getInfo())); + initDto.setChargeItemStatusOptions(chargeItemStatusOptions); + return R.ok(initDto); + } + /** * 查询就诊患者分页列表 * diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java index 8dfd14ae..90df039b 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRefundAppServiceImpl.java @@ -3,24 +3,34 @@ */ package com.openhis.web.chargemanage.appservice.impl; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; -import java.util.stream.Collectors; -import com.openhis.web.chargemanage.dto.RefundItemDto; +import javax.servlet.http.HttpServletRequest; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; +import com.core.common.utils.AgeCalculatorUtil; import com.core.common.utils.MessageUtils; -import com.openhis.administration.domain.ChargeItem; import com.openhis.administration.service.IChargeItemService; import com.openhis.common.constant.CommonConstants; import com.openhis.common.constant.PromptMsgConstant; -import com.openhis.common.enums.PaymentStatus; +import com.openhis.common.enums.*; +import com.openhis.common.utils.EnumUtils; +import com.openhis.common.utils.HisQueryUtils; import com.openhis.financial.service.IPaymentReconciliationService; +import com.openhis.medication.service.IMedicationDispenseService; import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService; -import com.openhis.web.chargemanage.dto.EncounterPatientPaymentDto; +import com.openhis.web.chargemanage.dto.*; import com.openhis.web.chargemanage.mapper.OutpatientRefundAppMapper; +import com.openhis.workflow.service.IDeviceDispenseService; +import com.openhis.workflow.service.IServiceRequestService; /** * 门诊退费 impl @@ -37,6 +47,33 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi private IPaymentReconciliationService paymentReconciliationService; @Autowired private IChargeItemService chargeItemService; + @Autowired + private IMedicationDispenseService medicationDispenseService; + @Autowired + private IDeviceDispenseService deviceDispenseService; + @Autowired + private IServiceRequestService serviceRequestService; + + /** + * 门诊退费页面初始化 + * + * @return 初始化信息 + */ + @Override + public R outpatientRefundInit() { + OutpatientInitDto initDto = new OutpatientInitDto(); + List chargeItemStatusOptions = new ArrayList<>(); + chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.BILLED.getValue(), + ChargeItemStatus.BILLED.getInfo())); + chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.REFUNDING.getValue(), + ChargeItemStatus.REFUNDING.getInfo())); + chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption(ChargeItemStatus.REFUNDED.getValue(), + ChargeItemStatus.REFUNDED.getInfo())); + chargeItemStatusOptions.add(new OutpatientInitDto.chargeItemStatusOption( + ChargeItemStatus.PART_REFUND.getValue(), ChargeItemStatus.PART_REFUND.getInfo())); + initDto.setChargeItemStatusOptions(chargeItemStatusOptions); + return R.ok(initDto); + } /** * 根据就诊id查询患者的账单 @@ -60,29 +97,98 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi */ @Override public R refundPayment(List paymentIdList) { + // todo:医生同意退费(审批流) + // 根据支付id获取对应收费项目的id列表 + List chargeItemIdList = paymentReconciliationService.getChargeItemIdListByPayment(paymentIdList); - List refundItemList = outpatientRefundAppMapper.selectRefundItem(paymentIdList, CommonConstants.TableName.MED_MEDICATION_REQUEST, - CommonConstants.TableName.WOR_SERVICE_REQUEST, CommonConstants.TableName.WOR_DEVICE_REQUEST, - CommonConstants.Common.THREE); + // 根据收费项目id列表查询退费项 + List refundItemList = outpatientRefundAppMapper.selectRefundItem(chargeItemIdList, + CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST, + CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE); - // 医生同意退费 - // 查询所有的chargeid,对应生成一个负的chargeitem - // 根据每个 chargeitem判断对应的服务,药品,耗材是否已发放执行 - // 若已发放/执行需要对应的发药人/执行人审批(药品耗材需要先退药) - for (Long paymentId : paymentIdList) { - // 根据支付id获取对应收费项目的id列表 - List chargeItemIdList = paymentReconciliationService.getChargeItemIdListByPayment(paymentId); - if (chargeItemIdList == null) { - return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, null)); + List medDisIdList = new ArrayList<>(); + List devDisIdList = new ArrayList<>(); + List serReqIdList = new ArrayList<>(); + + for (RefundItemDto refundItem : refundItemList) { + if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(refundItem.getServiceTable())) { + + // 药品需要先退药 + if (DispenseStatus.COMPLETED.getValue().equals(refundItem.getRefundStatus()) + || DispenseStatus.PART_COMPLETED.getValue().equals(refundItem.getRefundStatus())) { + return R + .fail(MessageUtils.createMessage(PromptMsgConstant.ChargeRefund.M00001, new Object[] {"药品"})); + } else { + // todo:审批流药师同意退费 + medDisIdList.add(refundItem.getDispenseId()); + } + } else if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(refundItem.getServiceTable())) { + // 诊疗项目需医技科室同意退费 + if (RequestStatus.COMPLETED.getValue().equals(refundItem.getRefundStatus())) { + return R.fail(MessageUtils.createMessage(PromptMsgConstant.ChargeRefund.M00002, null)); + } else { + // todo:审批流医技师同意退费 + serReqIdList.add(refundItem.getServiceId()); + } + } else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(refundItem.getServiceTable())) { + // 耗材需要先退药 + if (DispenseStatus.COMPLETED.getValue().equals(refundItem.getRefundStatus()) + || DispenseStatus.PART_COMPLETED.getValue().equals(refundItem.getRefundStatus())) { + return R + .fail(MessageUtils.createMessage(PromptMsgConstant.ChargeRefund.M00001, new Object[] {"耗材"})); + } else { + devDisIdList.add(refundItem.getDispenseId()); + } } - - // 根据收费项目id列表获取收费信息 - List chargeItemList = chargeItemService.getChargeItemInfo(chargeItemIdList); - - List prescriptionNoList = - chargeItemList.stream().map(ChargeItem::getPrescriptionNo).collect(Collectors.toList()); - } - return null; + // 更新收费状态:已退费 + chargeItemService.updateRefundChargeStatus(chargeItemIdList); + // 更新未发放药品状态:停止发放,停止原因:退费 + medicationDispenseService.updateStopDispenseStatus(medDisIdList, NotPerformedReason.REFUND.getValue()); + // 更新未发放耗材状态:停止发放,停止原因:退费 + deviceDispenseService.updateStopDispenseStatus(devDisIdList, NotPerformedReason.REFUND.getValue()); + // 更新执行诊疗状态:停止 + serviceRequestService.updateStopRequestStatus(serReqIdList); + // 返回退费成功信息 + return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"处方退费"})); + } + + /** + * 查询结算过的就诊患者分页列表 + * + * @param encounterPatientPageParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @param request 请求 + * @return 就诊患者分页列表 + */ + @Override + public R getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, String searchKey, + Integer pageNo, Integer pageSize, HttpServletRequest request) { + // 构建查询条件 + QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper( + encounterPatientPageParam, searchKey, + new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientWbStr, CommonConstants.FieldName.PatientPyStr, + CommonConstants.FieldName.PatientName, CommonConstants.FieldName.PatientBusNo, + CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.idCard)), + request); + // 就诊患者分页列表 + Page encounterPatientPage = outpatientRefundAppMapper.selectBilledEncounterPatientPage( + new Page<>(pageNo, pageSize), queryWrapper, ChargeItemStatus.BILLED.getValue(), + ChargeItemStatus.REFUNDING.getValue(), ChargeItemStatus.REFUNDED.getValue(), + ChargeItemStatus.PART_REFUND.getValue(), AccountType.MEDICAL_INSURANCE.getValue()); + + encounterPatientPage.getRecords().forEach(e -> { + // 性别枚举 + e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); + // 收费状态枚举 + e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum())); + // 计算年龄 + e.setAge(AgeCalculatorUtil.getAge(e.getBirthDate())); + // 合同类型枚举 + e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(ContractCategory.class, e.getCategoryEnum())); + }); + return R.ok(encounterPatientPage); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java index 7aec115b..3ad9bb1c 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/appservice/impl/OutpatientRegistrationAppServiceImpl.java @@ -23,7 +23,7 @@ import com.openhis.administration.service.*; import com.openhis.common.constant.CommonConstants; import com.openhis.common.constant.PromptMsgConstant; import com.openhis.common.enums.*; -import com.openhis.common.enums.PractitionerRole; +import com.openhis.common.enums.PractitionerRoles; import com.openhis.common.utils.EnumUtils; import com.openhis.common.utils.HisPageUtils; import com.openhis.common.utils.HisQueryUtils; @@ -142,7 +142,7 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), null); IPage practitionerMetadataPage = outpatientRegistrationAppMapper.getPractitionerMetadataPage(new Page<>(pageNo, pageSize), locationId, - PractitionerRole.DOCTOR.getCode(), queryWrapper); + PractitionerRoles.DOCTOR.getCode(), queryWrapper); practitionerMetadataPage.getRecords().forEach(e -> { // 性别 e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); @@ -211,11 +211,13 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra EncounterLocation encounterLocation = new EncounterLocation(); BeanUtils.copyProperties(encounterLocationFormData, encounterLocation); iEncounterLocationService.saveEncounterLocationByRegister(encounterLocation); - // 保存就诊参数者信息 - encounterParticipantFormData.setEncounterId(encounterId); - EncounterParticipant encounterParticipant = new EncounterParticipant(); - BeanUtils.copyProperties(encounterParticipantFormData, encounterParticipant); - iEncounterParticipantService.saveEncounterParticipantByRegister(encounterParticipant); + // 保存就诊参数者信息 , 选了参与这才保存 + if (encounterParticipantFormData.getPractitionerId() != null) { + encounterParticipantFormData.setEncounterId(encounterId); + EncounterParticipant encounterParticipant = new EncounterParticipant(); + BeanUtils.copyProperties(encounterParticipantFormData, encounterParticipant); + iEncounterParticipantService.saveEncounterParticipantByRegister(encounterParticipant); + } // 保存就诊账户信息 accountFormData.setEncounterId(encounterId); Account account = new Account(); diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientChargeController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientChargeController.java index 2743406a..11efbed4 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientChargeController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientChargeController.java @@ -30,6 +30,16 @@ public class OutpatientChargeController { @Autowired private IOutpatientChargeAppService outpatientChargeAppService; + /** + * 门诊收费页面初始化 + * + * @return 初始化信息 + */ + @GetMapping(value = "/init") + public R outpatientChargeInit() { + return outpatientChargeAppService.outpatientChargeInit(); + } + /** * 查询就诊患者分页列表 * diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java index 174d080b..7dffbffd 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRefundController.java @@ -3,17 +3,20 @@ */ package com.openhis.web.chargemanage.controller; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import com.core.common.core.domain.R; import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService; +import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; -import java.util.List; - /** * 门诊退费 controller * @@ -29,6 +32,35 @@ public class OutpatientRefundController { @Autowired private IOutpatientRefundAppService outpatientRefundAppService; + /** + * 门诊退费页面初始化 + * + * @return 初始化信息 + */ + @GetMapping(value = "/init") + public R outpatientRefundInit() { + return outpatientRefundAppService.outpatientRefundInit(); + } + + /** + * 查询结算过的就诊患者分页列表 + * + * @param encounterPatientPageParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 + * @param request 请求 + * @return 就诊患者分页列表 + */ + @GetMapping(value = "/encounter-patient-page") + public R getBilledEncounterPatientPage(EncounterPatientPageParam encounterPatientPageParam, + @RequestParam(value = "searchKey", defaultValue = "") String searchKey, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { + return R.ok(outpatientRefundAppService.getBilledEncounterPatientPage(encounterPatientPageParam, searchKey, + pageNo, pageSize, request)); + } + /** * 根据就诊id查询患者的账单 * diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRegistrationController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRegistrationController.java index 5b24cc7a..7b9fdacc 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRegistrationController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/controller/OutpatientRegistrationController.java @@ -84,7 +84,7 @@ public class OutpatientRegistrationController { @GetMapping(value = "/location-tree") public R getLocationTree(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { - return R.ok(iLocationAppService.getLocationTree(LocationForm.ROOM.getValue(), pageNo, pageSize)); + return iLocationAppService.getLocationTree(LocationForm.ROOM.getValue(), pageNo, pageSize); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/AccountFormData.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/AccountFormData.java index afae30a6..e5aad841 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/AccountFormData.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/AccountFormData.java @@ -2,6 +2,8 @@ package com.openhis.web.chargemanage.dto; import java.math.BigDecimal; +import javax.validation.constraints.NotNull; + import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.openhis.common.enums.AccountBillingStatus; @@ -24,6 +26,7 @@ public class AccountFormData { private Long encounterId; /** 患者id */ + @NotNull(message = "患者id不能为空") @JsonSerialize(using = ToStringSerializer.class) private Long patientId; @@ -34,6 +37,7 @@ public class AccountFormData { private Integer billingStatusEnum; /** 账户类型编码 */ + @NotNull(message = "账户类型不能为空") private String typeCode; // 1:个人现金账户, 2:医保账户 /** 名称 */ diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/ChargeItemFormData.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/ChargeItemFormData.java index 15e9ee34..5ed61f87 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/ChargeItemFormData.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/ChargeItemFormData.java @@ -3,6 +3,8 @@ package com.openhis.web.chargemanage.dto; import java.math.BigDecimal; import java.util.Date; +import javax.validation.constraints.NotNull; + import com.core.common.utils.SecurityUtils; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; @@ -27,6 +29,7 @@ public class ChargeItemFormData { private Long encounterId; /** 患者id */ + @NotNull(message = "患者id不能为空") @JsonSerialize(using = ToStringSerializer.class) private Long patientId; @@ -47,6 +50,7 @@ public class ChargeItemFormData { private Long performerId; /** 费用定价ID */ + @NotNull(message = "费用定价ID不能为空") @JsonSerialize(using = ToStringSerializer.class) private Long definitionId; @@ -61,10 +65,12 @@ public class ChargeItemFormData { private String serviceTable; /** 医疗服务ID */ + @NotNull(message = "医疗服务ID不能为空") @JsonSerialize(using = ToStringSerializer.class) private Long serviceId; /** 总价 */ + @NotNull(message = "总价不能为空") private BigDecimal totalPrice; /** 关联账户ID */ @@ -78,8 +84,8 @@ public class ChargeItemFormData { this.statusEnum = ChargeItemStatus.BILLED.getValue(); this.contextEnum = EncounterClass.AMB.getValue(); this.occurrenceTime = new Date(); - this.performerId = SecurityUtils.getLoginUser().getUserId(); - this.entererId = SecurityUtils.getLoginUser().getUserId(); + this.performerId = SecurityUtils.getLoginUser().getPractitionerId(); + this.entererId = SecurityUtils.getLoginUser().getPractitionerId(); this.enteredDate = new Date(); this.serviceTable = CommonConstants.TableName.ADM_HEALTHCARE_SERVICE; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterFormData.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterFormData.java index e9b36c3a..512e3600 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterFormData.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterFormData.java @@ -1,5 +1,7 @@ package com.openhis.web.chargemanage.dto; +import javax.validation.constraints.NotNull; + import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.openhis.common.enums.*; @@ -7,8 +9,6 @@ import com.openhis.common.enums.*; import lombok.Data; import lombok.experimental.Accessors; -import javax.validation.constraints.NotBlank; - /** * 就诊 表单数据 */ @@ -19,7 +19,7 @@ public class EncounterFormData { /** * 患者ID */ - @NotBlank(message = "患者ID不能为空") + @NotNull(message = "患者ID不能为空") @JsonSerialize(using = ToStringSerializer.class) private Long patientId; @@ -41,7 +41,7 @@ public class EncounterFormData { /** * 优先级编码 */ - @NotBlank(message = "优先级编码不能为空") + @NotNull(message = "优先级编码不能为空") private Integer priorityEnum; /** @@ -52,7 +52,7 @@ public class EncounterFormData { /** * 服务ID */ - @NotBlank(message = "服务ID不能为空") + @NotNull(message = "服务ID不能为空") @JsonSerialize(using = ToStringSerializer.class) private Long serviceTypeId; @@ -64,7 +64,7 @@ public class EncounterFormData { /** * 机构ID */ - @NotBlank(message = "机构ID不能为空") + @NotNull(message = "机构ID不能为空") @JsonSerialize(using = ToStringSerializer.class) private Long organizationId; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterLocationFormData.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterLocationFormData.java index f06aec9d..d1d61a6b 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterLocationFormData.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterLocationFormData.java @@ -9,6 +9,7 @@ import lombok.Data; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; /** * 就诊位置 表单数据 @@ -26,7 +27,7 @@ public class EncounterLocationFormData { /** * 位置ID */ - @NotBlank(message = "位置ID不能为空") + @NotNull(message = "位置ID不能为空") @JsonSerialize(using = ToStringSerializer.class) private Long locationId; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterParticipantFormData.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterParticipantFormData.java index e8be696d..dbbf2fa8 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterParticipantFormData.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterParticipantFormData.java @@ -1,6 +1,6 @@ package com.openhis.web.chargemanage.dto; -import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; @@ -26,7 +26,6 @@ public class EncounterParticipantFormData { private String typeCode; /** 参与者ID */ - @NotBlank(message = "参与者ID不能为空") @JsonSerialize(using = ToStringSerializer.class) private Long practitionerId; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java index d81e11ad..a8231c02 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageDto.java @@ -3,12 +3,12 @@ */ package com.openhis.web.chargemanage.dto; -import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; import lombok.Data; import lombok.experimental.Accessors; @@ -21,9 +21,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class EncounterPatientPageDto implements Serializable { - - private static final long serialVersionUID = 1L; +public class EncounterPatientPageDto { /** * 就诊ID @@ -75,7 +73,9 @@ public class EncounterPatientPageDto implements Serializable { /** * 账户类型编码 */ + @Dict(dictCode = "account_code") private String typeCode; + private String typeCode_dictText; /** * 账户余额 @@ -95,4 +95,28 @@ public class EncounterPatientPageDto implements Serializable { /** 收费状态 */ private Integer statusEnum; private String statusEnum_enumText; + + /** + * 医保总额 + */ + private BigDecimal insurancePrice; + + /** + * 自费总额 + */ + private BigDecimal selfPrice; + + /** + * 付款总额 + */ + private BigDecimal totalAmount; + + /** 合同类型 */ + private Integer categoryEnum; + private String categoryEnum_enumText; + + /** + * 结算时间 + */ + private Date billDate; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java index 60c171f1..ff776799 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPageParam.java @@ -3,7 +3,6 @@ */ package com.openhis.web.chargemanage.dto; -import java.io.Serializable; import java.util.Date; import lombok.Data; @@ -17,9 +16,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class EncounterPatientPageParam implements Serializable { - - private static final long serialVersionUID = 1L; +public class EncounterPatientPageParam { /** * 患者姓名 @@ -56,6 +53,11 @@ public class EncounterPatientPageParam implements Serializable { */ private Date startTime; + /** + * 收费时间 + */ + private Date billTime; + /** * 收费状态 */ diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPaymentDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPaymentDto.java index c2f95817..8c5f4ccd 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPaymentDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPaymentDto.java @@ -3,7 +3,6 @@ */ package com.openhis.web.chargemanage.dto; -import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -24,9 +23,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class EncounterPatientPaymentDto implements Serializable { - - private static final long serialVersionUID = 1L; +public class EncounterPatientPaymentDto { /** ID */ @TableId(type = IdType.ASSIGN_ID) diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPrescriptionDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPrescriptionDto.java index b0d80b58..2c431f84 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPrescriptionDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/EncounterPatientPrescriptionDto.java @@ -3,7 +3,6 @@ */ package com.openhis.web.chargemanage.dto; -import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -18,9 +17,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class EncounterPatientPrescriptionDto implements Serializable { - - private static final long serialVersionUID = 1L; +public class EncounterPatientPrescriptionDto { /** 收费项目类型 */ private Integer contextEnum; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/OutpatientInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/OutpatientInitDto.java new file mode 100644 index 00000000..49392cc8 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/OutpatientInitDto.java @@ -0,0 +1,36 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.chargemanage.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * 门诊费用相关初始化 + * + * @author zwh + * @date 2025-03-30 + */ +@Data +@Accessors(chain = true) +public class OutpatientInitDto { + + private List chargeItemStatusOptions; + + /** + * 收费状态 + */ + @Data + public static class chargeItemStatusOption { + private Integer value; + private String label; + + public chargeItemStatusOption(Integer value, String label) { + this.value = value; + this.label = label; + } + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/OutpatientRegistrationAddParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/OutpatientRegistrationAddParam.java index c41ebfe6..aa9eb889 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/OutpatientRegistrationAddParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/OutpatientRegistrationAddParam.java @@ -1,5 +1,7 @@ package com.openhis.web.chargemanage.dto; +import javax.validation.Valid; + import lombok.Data; import lombok.experimental.Accessors; @@ -13,6 +15,7 @@ public class OutpatientRegistrationAddParam { /** * 就诊管理-表单数据 */ + @Valid private EncounterFormData encounterFormData; // /** @@ -23,20 +26,24 @@ public class OutpatientRegistrationAddParam { /** * 就诊位置管理-表单数据 */ + @Valid private EncounterLocationFormData encounterLocationFormData; /** * 就诊参数者管理-表单数据 */ + @Valid private EncounterParticipantFormData encounterParticipantFormData; /** * 就诊账户管理-表单数据 */ + @Valid private AccountFormData accountFormData; /** * 费用项管理-表单数据 */ + @Valid private ChargeItemFormData chargeItemFormData; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java index cf9fb746..1b9212e3 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/dto/RefundItemDto.java @@ -3,8 +3,6 @@ */ package com.openhis.web.chargemanage.dto; -import java.io.Serializable; - import lombok.Data; import lombok.experimental.Accessors; @@ -16,7 +14,35 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class RefundItemDto implements Serializable { +public class RefundItemDto { - private static final long serialVersionUID = 1L; + /** 收费ID */ + private Long chargeId; + + /** 医疗服务所在表 */ + private String serviceTable; + + /** 医疗服务ID */ + private Long serviceId; + + /** 请求编码 */ + private String busNo; + + /** 请求数量 */ + private Integer quantity; + + /** 请求单位编码 */ + private String unitCode; + + /** 退款状态 */ + private Integer refundStatus; + + /** 项目id */ + private Long itemId; + + /** 发放id */ + private Long dispenseId; + + /** 项目名 */ + private Long itemName; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java index aa0eab06..b6090a51 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/chargemanage/mapper/OutpatientRefundAppMapper.java @@ -8,6 +8,11 @@ import java.util.List; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.chargemanage.dto.EncounterPatientPageDto; +import com.openhis.web.chargemanage.dto.EncounterPatientPageParam; import com.openhis.web.chargemanage.dto.EncounterPatientPaymentDto; import com.openhis.web.chargemanage.dto.RefundItemDto; @@ -36,15 +41,32 @@ public interface OutpatientRefundAppMapper { /** * 查询退费项目 * - * @param paymentIdList 支付编号列表 + * @param chargeItemIdList 收费项列表 * @param medMedicationRequest 药品请求表 * @param worServiceRequest 服务请求表 * @param worDeviceRequest 耗材请求表 * @param three 用于字符截位 * @return 退费项目列表 */ - List selectRefundItem(@Param("paymentIdList") List paymentIdList, + List selectRefundItem(@Param("chargeItemIdList") List chargeItemIdList, @Param("medMedicationRequest") String medMedicationRequest, @Param("worServiceRequest") String worServiceRequest, @Param("worDeviceRequest") String worDeviceRequest, @Param("three") Integer three); + + /** + * 查询已结算就诊患者分页列表 + * + * @param page 分页 + * @param queryWrapper 查询条件 + * @param billed 收费状态:已结算 + * @param refunding 收费状态:退费中 + * @param refunded 收费状态:已退费 + * @param partRefund 收费状态:部分退费 + * @param insurance 账户类型:医保 + * @return 已结算就诊患者分页列表 + */ + Page selectBilledEncounterPatientPage(@Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper, @Param("billed") Integer billed, + @Param("refunding") Integer refunding, @Param("refunded") Integer refunded, + @Param("partRefund") Integer partRefund, @Param("insurance") Integer insurance); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IDeviceManageAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IDeviceManageAppService.java index ee8dbfc0..715b6036 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IDeviceManageAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IDeviceManageAppService.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody; import com.core.common.core.domain.R; import com.openhis.web.datadictionary.dto.DeviceManageSelParam; import com.openhis.web.datadictionary.dto.DeviceManageUpDto; +import org.springframework.web.bind.annotation.RequestParam; /** * 器材目录 service @@ -63,7 +64,7 @@ public interface IDeviceManageAppService { * @param id 查询条件 * @return 器材目录查询结果 */ - R getDeviceOne(@PathVariable("id") Long id); + R getDeviceOne(@RequestParam Long id); /** * 器材目录停用 diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IDiagnosisTreatmentManageAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IDiagnosisTreatmentManageAppService.java new file mode 100644 index 00000000..e4aa4f26 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IDiagnosisTreatmentManageAppService.java @@ -0,0 +1,86 @@ +package com.openhis.web.datadictionary.appservice; + +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +import com.core.common.core.domain.R; +import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam; +import com.openhis.web.datadictionary.dto.DiagnosisTreatmentUpDto; + +/** + * 诊疗目录 + * + * @author liuhr + * @date 2025/3/28 + */ +public interface IDiagnosisTreatmentManageAppService { + + /** + * 诊疗目录初期查询 + * + * @return + */ + R getDiseaseTreatmentInit(); + + /** + * 查询诊疗目录分页列表 + * + * @param DiagnosisTreatmentSelParam 查询条件 + * @param searchKey 查询条件-模糊查询 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @return + */ + R getDiseaseTreatmentPage(DiagnosisTreatmentSelParam DiagnosisTreatmentSelParam, + @RequestParam(value = "searchKey", defaultValue = "") String searchKey, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request); + + /** + * 根据id查询诊疗详情 + * + * @param id 诊疗ID + * @return + */ + R getDiseaseTreatmentOne(Long id); + + /** + * 诊疗目录编辑 + * + * @param diagnosisTreatmentUpDto 诊疗目录列表 + * @return + */ + R editDiseaseTreatment(DiagnosisTreatmentUpDto diagnosisTreatmentUpDto); + + /** + * 诊疗目录停用 + * + * @param ids 诊疗目录ID列表 + * @return + */ + R editDiseaseTreatmentStop(List ids); + + /** + * 诊疗目录启用 + * + * @param ids 诊疗目录ID列表 + * @return + */ + R editDiseaseTreatmentStart(List ids); + + /** + * 新增外来诊疗目录 + * + * @param diagnosisTreatmentUpDto 诊疗目录 + * @return + */ + @PostMapping("/information") + R addDiseaseTreatment(DiagnosisTreatmentUpDto diagnosisTreatmentUpDto); + +} \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IDiseaseManageAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IDiseaseManageAppService.java new file mode 100644 index 00000000..ccaa4bda --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IDiseaseManageAppService.java @@ -0,0 +1,80 @@ +package com.openhis.web.datadictionary.appservice; + +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.web.bind.annotation.GetMapping; + +import com.core.common.core.domain.R; +import com.openhis.web.datadictionary.dto.DiseaseManageSelParam; +import com.openhis.web.datadictionary.dto.DiseaseManageUpDto; + +/** + * 病种目录 + * + * @author liuhr + * @date 2025/3/30 + */ +public interface IDiseaseManageAppService { + + /** + * 病种目录初始化 + * + * @return + */ + R getDiseaseInit(); + + /** + * 查询病种目录分页列表 + * + * @param diseaseManageSelParam 查询条件 + * @param searchKey 查询条件-模糊查询 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @return + */ + R getDiseaseList(DiseaseManageSelParam diseaseManageSelParam, String searchKey, Integer pageNo, Integer pageSize, + HttpServletRequest request); + + /** + * 根据id查询疾病详情 + * + * @param id 疾病ID + * @return + */ + R getDiseaseOne(Long id); + + /** + * 病种目录编辑 + * + * @param diseaseManageDto 病种目录列表 + * @return + */ + R editDisease(DiseaseManageUpDto diseaseManageDto); + + /** + * 病种目录停用 + * + * @param ids 病种目录ID列表 + * @return + */ + R editDiseaseStop(List ids); + + /** + * 病种目录启用 + * + * @param ids 病种目录ID列表 + * @return + */ + R editDiseaseStart(List ids); + + /** + * 新增外来病种目录 + * + * @param diseaseManageUpDto 病种目录 + * @return + */ + R addDisease(DiseaseManageUpDto diseaseManageUpDto); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IItemDefinitionService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IItemDefinitionService.java new file mode 100644 index 00000000..15cce3a3 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IItemDefinitionService.java @@ -0,0 +1,32 @@ +package com.openhis.web.datadictionary.appservice; + +import com.openhis.administration.domain.ChargeItemDefinition; +import com.openhis.administration.domain.DeviceDefinition; +import com.openhis.medication.domain.MedicationDetail; +import com.openhis.web.datadictionary.dto.DeviceManageUpDto; +import com.openhis.web.datadictionary.dto.ItemUpFromDirectoryDto; +import com.openhis.web.datadictionary.dto.MedicationManageUpDto; + +/** + * 项目定价 + * + * @author liuhr + * @date 2025/3/25 + */ +public interface IItemDefinitionService { + + /** + * 添加药品/器材/诊疗的项目定价 + * + * @param itemUpFromDirectoryDto 药品/器材/诊疗目录信息 + */ + boolean addItem(ItemUpFromDirectoryDto itemUpFromDirectoryDto); + + /** + * 修改项目定价表 + * + * @param chargeItemDefinition 项目定价表信息 + */ + boolean updateItem(ChargeItemDefinition chargeItemDefinition); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IMedicationManageAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IMedicationManageAppService.java index 8644b9d4..7851f248 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IMedicationManageAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/IMedicationManageAppService.java @@ -8,6 +8,7 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.openhis.web.datadictionary.dto.MedicationSearchParam; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; @@ -32,14 +33,11 @@ public interface IMedicationManageAppService { * 药品目录查询 * * @param searchKey 查询条件 - * @param ybMatchFlag 查询条件-是否对码 - * @param statusEnum 查询条件-状态 - * @param categoryCode 查询条件-药品分类 * @param pageNo 当前页码 * @param pageSize 查询条数 * @return 药品目录查询结果 */ - R getMedicationList(String searchKey, Integer ybMatchFlag, Integer statusEnum, String categoryCode, + R getMedicationList(MedicationSearchParam medicationSearchParam,String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request); /** @@ -48,7 +46,7 @@ public interface IMedicationManageAppService { * @param id 查询条件 * @return 药品目录查询结果 */ - R getMedicationOne(@PathVariable("id") Long id); + R getMedicationOne(@RequestParam Long id); /** * 编辑药品目录信息 diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/ISupplierManagementAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/ISupplierManagementAppService.java index d243d9eb..2994c9ec 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/ISupplierManagementAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/ISupplierManagementAppService.java @@ -35,11 +35,12 @@ public interface ISupplierManagementAppService { * * @param supplierSearchParam 查询条件 * @param searchKey 查询条件-模糊查询 + * @param typeEnum 查询条件 * @param pageNo 查询条件 * @param pageSize 查询条件 * @return 厂商/产地查询结果 */ - R getSupplierList(SupplierSearchParam supplierSearchParam, String searchKey, Integer pageNo, Integer pageSize, + R getSupplierList(SupplierSearchParam supplierSearchParam, String searchKey,Integer typeEnum, Integer pageNo, Integer pageSize, HttpServletRequest request); /** diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DeviceManageAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DeviceManageAppServiceImpl.java index 8d14603d..64911631 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DeviceManageAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DeviceManageAppServiceImpl.java @@ -10,39 +10,44 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.stream.Collectors; import java.util.stream.Stream; +import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import com.openhis.administration.domain.Supplier; +import com.openhis.administration.service.ISupplierService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; -import com.core.common.utils.MessageUtils; +import com.core.common.core.domain.entity.SysDictData; +import com.core.common.utils.*; import com.core.common.utils.bean.BeanUtils; +import com.core.system.service.ISysDictTypeService; +import com.openhis.administration.domain.ChargeItemDefinition; import com.openhis.administration.domain.DeviceDefinition; import com.openhis.administration.domain.Organization; import com.openhis.administration.mapper.DeviceDefinitionMapper; import com.openhis.administration.service.IDeviceDefinitionService; import com.openhis.administration.service.IOrganizationService; +import com.openhis.common.constant.CommonConstants; import com.openhis.common.constant.PromptMsgConstant; -import com.openhis.common.enums.DeviceCategory; +import com.openhis.common.enums.AssignSeqEnum; import com.openhis.common.enums.OrganizationType; import com.openhis.common.enums.PublicationStatus; import com.openhis.common.enums.Whether; import com.openhis.common.utils.EnumUtils; -import com.openhis.common.utils.HisPageUtils; import com.openhis.common.utils.HisQueryUtils; import com.openhis.web.datadictionary.appservice.IDeviceManageAppService; -import com.openhis.web.datadictionary.dto.DeviceManageDto; -import com.openhis.web.datadictionary.dto.DeviceManageInitDto; -import com.openhis.web.datadictionary.dto.DeviceManageSelParam; -import com.openhis.web.datadictionary.dto.DeviceManageUpDto; +import com.openhis.web.datadictionary.appservice.IItemDefinitionService; +import com.openhis.web.datadictionary.dto.*; +import com.openhis.web.datadictionary.mapper.DeviceManageMapper; /** * 器材目录 impl @@ -62,6 +67,21 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService { @Autowired private IOrganizationService organizationService; + @Resource + DeviceManageMapper deviceManageMapper; + + @Autowired + private ISysDictTypeService sysDictTypeService; + + @Autowired + private IItemDefinitionService itemDefinitionServic; + + @Autowired + private ISupplierService supplierService; + + @Autowired(required = false) + AssignSeqUtil assignSeqUtil; + /** * 器材目录初始化 * @@ -69,25 +89,52 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService { */ @Override public R getDeviceManageInit() { + DeviceManageInitDto deviceManageInitDto = new DeviceManageInitDto(); + // 获取状态 List statusEnumOptions = Stream.of(PublicationStatus.values()) .map(status -> new DeviceManageInitDto.statusEnumOption(status.getValue(), status.getInfo())) .collect(Collectors.toList()); deviceManageInitDto.setStatusFlagOptions(statusEnumOptions); - // 获取执行科室 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(Organization::getTypeEnum, OrganizationType.HOSPITAL_DEPARTMENT); - List organizations = organizationService.list(queryWrapper); - List exeOrganizations = organizations.stream() - .map(exeOrg -> new DeviceManageInitDto.exeOrganization(exeOrg.getId(), exeOrg.getName())) - .collect(Collectors.toList()); - deviceManageInitDto.setExeOrganizations(exeOrganizations); - // 获取分类 - List deviceCategories = Stream.of(DeviceCategory.values()) - .map(category -> new DeviceManageInitDto.deviceCategory(category.getValue(), category.getInfo())) + +// // 获取执行科室 +// LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); +// queryWrapper.eq(Organization::getTypeEnum, OrganizationType.HOSPITAL_DEPARTMENT); +// List organizations = organizationService.list(queryWrapper); +// List exeOrganizations = organizations.stream() +// .map(exeOrg -> new DeviceManageInitDto.exeOrganization(exeOrg.getId(), exeOrg.getName())) +// .collect(Collectors.toList()); +// deviceManageInitDto.setExeOrganizations(exeOrganizations); + // // 从枚举中获取器材分类 + // List deviceCategories = Stream.of(DeviceCategory.values()) + // .map(category -> new DeviceManageInitDto.deviceCategory(category.getValue(), category.getInfo())) + // .collect(Collectors.toList()); + // deviceManageInitDto.setDeviceCategories(deviceCategories); + + // 获取器材 + List deviceList = + sysDictTypeService.selectDictDataByType(CommonConstants.DictName.DEVICE_CATEGORY_CODE); + // 从字典中获取器材分类 + List deviceCategories = deviceList.stream() + .map(category -> new DeviceManageInitDto.dictCategoryCode(category.getDictValue(), category.getDictLabel())) .collect(Collectors.toList()); deviceManageInitDto.setDeviceCategories(deviceCategories); + + // 获取医保是否对码 + List statusYBWeatherOption = Stream.of(Whether.values()) + .map(status -> new DeviceManageInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + deviceManageInitDto.setStatusYBWeatherOptions(statusYBWeatherOption); + + // 查询供应商列表 + List supplierList = supplierService.getList(); + // 供应商信息 + List supplierListOptions = supplierList.stream() + .map(supplier -> new DeviceManageInitDto.supplierListOption(supplier.getId(), supplier.getName())) + .collect(Collectors.toList()); + deviceManageInitDto.setSupplierListOptions(supplierListOptions); + return R.ok(deviceManageInitDto); } @@ -107,14 +154,12 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService { @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { // 构建查询条件 - QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(deviceManageSelParam, searchKey, + QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(deviceManageSelParam, searchKey, new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request); - // 设置排序 - queryWrapper.orderByAsc("bus_no"); // 分页查询 - Page deviceManagePage = - HisPageUtils.selectPage(deviceDefinitionMapper, queryWrapper, pageNo, pageSize, DeviceManageDto.class); + IPage deviceManagePage = + deviceManageMapper.getDevicePage(new Page<>(pageNo, pageSize), queryWrapper); deviceManagePage.getRecords().forEach(e -> { // 高值器材标志枚举类回显赋值 @@ -125,6 +170,11 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService { e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag())); // 过敏标记枚举类回显赋值 e.setAllergenFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getAllergenFlag())); + // 器材分类 + // e.setCategoryEnum_enumText(EnumUtils.getInfoByValue(DeviceCategory.class, e.getCategoryEnum())); + + // 器材状态 + e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum())); }); // 返回【器材目录列表DTO】分页 @@ -141,11 +191,24 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService { DeviceDefinition deviceDefinition = new DeviceDefinition(); BeanUtils.copyProperties(deviceManageDto, deviceDefinition); + // 拼音码 + deviceDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(deviceDefinition.getName())); + // 五笔码 + deviceDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(deviceDefinition.getName())); // 更新器材信息 - return deviceDefinitionService.updateById(deviceDefinition) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + if (deviceDefinitionService.updateById(deviceDefinition)) { + ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition(); + chargeItemDefinition.setYbType(deviceManageDto.getYbType()).setTypeCode(deviceManageDto.getItemTypeCode()) + .setInstanceTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION) + .setInstanceId(deviceDefinition.getId()); + + // 更新价格表 + return itemDefinitionServic.updateItem(chargeItemDefinition) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + } + return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); } /** @@ -155,10 +218,14 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService { * @return 器材目录查询结果 */ @Override - public R getDeviceOne(@PathVariable("id") Long id) { + public R getDeviceOne(@RequestParam Long id) { + + // 获取租户ID + Integer tenantId = SecurityUtils.getLoginUser().getTenantId(); // 根据ID查询【器材目录】 - DeviceDefinition byId = deviceDefinitionService.getById(id); - return R.ok(byId); + DeviceManageDto deviceManageDto = deviceManageMapper.getOne(id, tenantId); + + return R.ok(deviceManageDto); } /** @@ -176,7 +243,7 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService { for (Long detail : ids) { DeviceDefinition deviceDefinition = new DeviceDefinition(); deviceDefinition.setId(detail); - deviceDefinition.setStatusEnum(PublicationStatus.RETIRED); + deviceDefinition.setStatusEnum(PublicationStatus.RETIRED.getValue()); DeviceDefinitionList.add(deviceDefinition); } @@ -201,7 +268,7 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService { for (Long detail : ids) { DeviceDefinition DeviceDefinition = new DeviceDefinition(); DeviceDefinition.setId(detail); - DeviceDefinition.setStatusEnum(PublicationStatus.ACTIVE); + DeviceDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue()); DeviceDefinitionList.add(DeviceDefinition); } @@ -219,13 +286,35 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService { @Override public R addDevice(@Validated @RequestBody DeviceManageUpDto deviceManageUpDto) { - DeviceDefinition DeviceDefinition = new DeviceDefinition(); - BeanUtils.copyProperties(deviceManageUpDto, DeviceDefinition); + DeviceDefinition deviceDefinition = new DeviceDefinition(); + BeanUtils.copyProperties(deviceManageUpDto, deviceDefinition); + + // 使用10位数基础采番 + String code = assignSeqUtil.getSeq(AssignSeqEnum.DEVICE_NUM.getPrefix(), 10); + deviceDefinition.setBusNo(code); + // 拼音码 + deviceDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(deviceDefinition.getName())); + // 五笔码 + deviceDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(deviceDefinition.getName())); // 新增外来器材目录 - DeviceDefinition.setStatusEnum(PublicationStatus.DRAFT); - return deviceDefinitionService.addDevice(DeviceDefinition) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); + deviceDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue()); + + if (deviceDefinitionService.addDevice(deviceDefinition)) { + ItemUpFromDirectoryDto itemUpFromDirectoryDto = new ItemUpFromDirectoryDto(); + BeanUtils.copyProperties(deviceManageUpDto, itemUpFromDirectoryDto); + itemUpFromDirectoryDto.setTypeCode(deviceManageUpDto.getItemTypeCode()) + .setInstanceTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION) + .setEffectiveStart(DateUtils.getNowDate()).setStatusEnum(PublicationStatus.ACTIVE.getValue()) + .setConditionFlag(Whether.YES.getValue()).setChargeName(deviceManageUpDto.getName()) + .setInstanceId(deviceDefinition.getId()) + .setPrice(deviceManageUpDto.getRetailPrice()); + + return itemDefinitionServic.addItem(itemUpFromDirectoryDto) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); + } + + return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiagnosisTreatmentManageAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiagnosisTreatmentManageAppServiceImpl.java new file mode 100644 index 00000000..80a2ae18 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiagnosisTreatmentManageAppServiceImpl.java @@ -0,0 +1,331 @@ +package com.openhis.web.datadictionary.appservice.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +import com.openhis.administration.domain.Supplier; +import com.openhis.administration.service.ISupplierService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.core.common.core.domain.R; +import com.core.common.core.domain.entity.SysDictData; +import com.core.common.utils.*; +import com.core.common.utils.bean.BeanUtils; +import com.core.system.service.ISysDictTypeService; +import com.openhis.administration.domain.ChargeItemDefinition; +import com.openhis.administration.domain.Organization; +import com.openhis.administration.service.IOrganizationService; +import com.openhis.common.constant.CommonConstants; +import com.openhis.common.constant.PromptMsgConstant; +import com.openhis.common.enums.*; +import com.openhis.common.utils.EnumUtils; +import com.openhis.common.utils.HisQueryUtils; +import com.openhis.web.datadictionary.appservice.IDiagnosisTreatmentManageAppService; +import com.openhis.web.datadictionary.appservice.IItemDefinitionService; +import com.openhis.web.datadictionary.dto.*; +import com.openhis.web.datadictionary.mapper.ActivityDefinitionManageMapper; +import com.openhis.workflow.domain.ActivityDefinition; +import com.openhis.workflow.mapper.ActivityDefinitionMapper; +import com.openhis.workflow.service.IActivityDefinitionService; + +/** + * 诊疗实现类 + * + * @author Wuser + * @date 2025/3/28 + */ +@Service +public class DiagnosisTreatmentManageAppServiceImpl implements IDiagnosisTreatmentManageAppService { + + @Autowired + private IActivityDefinitionService iActivityDefinitionService; + @Autowired + private ActivityDefinitionMapper activityDefinitionMapper; + @Autowired + private IOrganizationService iOrganizationService; + @Autowired + private ISysDictTypeService iSysDictTypeService; + @Resource + private ActivityDefinitionManageMapper activityDefinitionManageMapper; + @Autowired + private IItemDefinitionService itemDefinitionServic; + @Autowired + private ISysDictTypeService sysDictTypeService; + + @Autowired(required = false) + AssignSeqUtil assignSeqUtil; + + /** + * 诊疗目录初期查询 + * + * @return + */ + @Override + public R getDiseaseTreatmentInit() { + DiagnosisTreatmentInitDto diagnosisTreatmentInitDto = new DiagnosisTreatmentInitDto(); + // 获取状态 + List statusEnumOptions = Stream.of(PublicationStatus.values()) + .map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + diagnosisTreatmentInitDto.setStatusFlagOptions(statusEnumOptions); + // 获取执行科室 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(Organization::getTypeEnum, OrganizationType.HOSPITAL_DEPARTMENT); + List organizations = iOrganizationService.list(queryWrapper); + List exeOrganizations = organizations.stream() + .map(exeOrg -> new DiagnosisTreatmentInitDto.exeOrganization(exeOrg.getId(), exeOrg.getName())) + .collect(Collectors.toList()); + diagnosisTreatmentInitDto.setExeOrganizations(exeOrganizations); + + // 获取诊目录疗分类 + List diagnosisList = + sysDictTypeService.selectDictDataByType(CommonConstants.DictName.DIAGNOSIS_CATEGORY_CODE); + // 获取诊疗录疗分类 + List diagnosisCategories = diagnosisList.stream().map( + category -> new DiagnosisTreatmentInitDto.dictCategoryCode(category.getDictValue(), category.getDictLabel())) + .collect(Collectors.toList()); + diagnosisTreatmentInitDto.setDiagnosisCategoryOptions(diagnosisCategories); + + // 查询医疗服务项类型 + List medical_service_items = + iSysDictTypeService.selectDictDataByType(ActivityDefCategory.MEDICAL_SERVICE_ITEM.getCode()); + // 获取医疗服务项List + List diseaseTreatmentCategoryList = medical_service_items + .stream().map(status -> new DiagnosisTreatmentInitDto.diseaseTreatmentType(status.getDictValue(), + status.getDictLabel())) + .collect(Collectors.toList()); + List diseaseTreatmentCategories = new ArrayList<>(); +// +// //获取目录分类 +// DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory = +// new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.MEDICAL_SERVICE_ITEM.getValue(), +// ActivityDefCategory.MEDICAL_SERVICE_ITEM.getInfo()); +// diseaseTreatmentCategory.setChildren(diseaseTreatmentCategoryList); +// diseaseTreatmentCategories.add(diseaseTreatmentCategory); +// diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); +// +// // 查询手术与治疗类型 +// List medical_service_items2 = +// iSysDictTypeService.selectDictDataByType(ActivityDefCategory.TREATMENT_SURGERY.getCode()); +// // 获取手术与治疗List +// List diseaseTreatmentCategoryList2 = medical_service_items2 +// .stream().map(status -> new DiagnosisTreatmentInitDto.diseaseTreatmentType(status.getDictValue(), +// status.getDictLabel())) +// .collect(Collectors.toList()); +// +// DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory2 = +// new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.TREATMENT_SURGERY.getValue(), +// ActivityDefCategory.TREATMENT_SURGERY.getInfo()); +// diseaseTreatmentCategory2.setChildren(diseaseTreatmentCategoryList2); +// diseaseTreatmentCategories.add(diseaseTreatmentCategory2); +// +// diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); + + // 获取类型 + List typeEnumOptions = Stream.of(ActivityType.values()) + .map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + diagnosisTreatmentInitDto.setTypeEnumOptions(typeEnumOptions); + + // 获取是/否 列表 + // 获取状态 + List statusWeatherOption = Stream.of(Whether.values()) + .map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + diagnosisTreatmentInitDto.setStatusWeatherOption(statusWeatherOption); + + return R.ok(diagnosisTreatmentInitDto); + } + + /** + * 查询诊疗目录分页列表 + * + * @param DiagnosisTreatmentSelParam 查询条件 + * @param searchKey 查询条件-模糊查询 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @return + */ + @Override + public R getDiseaseTreatmentPage(DiagnosisTreatmentSelParam DiagnosisTreatmentSelParam, String searchKey, + Integer pageNo, Integer pageSize, HttpServletRequest request) { + + // 构建查询条件 + QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam, + searchKey, new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request); + + // 分页查询 + IPage diseaseTreatmentPage = + activityDefinitionManageMapper.getDiseaseTreatmentPage(new Page<>(pageNo, pageSize), queryWrapper); + + diseaseTreatmentPage.getRecords().forEach(e -> { + // 医保标记枚举类回显赋值 + e.setYbFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbFlag())); + // 医保对码标记枚举类回显赋值 + e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag())); + // 类型举类回显赋值 + e.setTypeEnum_enumText(EnumUtils.getInfoByValue(ActivityType.class, e.getTypeEnum())); + // 状态举类回显赋值 + e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum())); + }); + + // 返回【诊疗目录列表DTO】分页 + return R.ok(diseaseTreatmentPage); + } + + /** + * 根据id查询诊疗详情 + * + * @param id 诊疗ID + * @return + */ + @Override + public R getDiseaseTreatmentOne(Long id) { + + // 获取租户ID + Integer tenantId = SecurityUtils.getLoginUser().getTenantId(); + // 根据ID查询【诊疗目录】 + return R.ok(activityDefinitionManageMapper.getDiseaseTreatmentOne(id, tenantId)); + + } + + /** + * 诊疗目录编辑 + * + * @param diagnosisTreatmentUpDto 诊疗目录列表 + * @return + */ + @Override + public R editDiseaseTreatment(DiagnosisTreatmentUpDto diagnosisTreatmentUpDto) { + + ActivityDefinition activityDefinition = new ActivityDefinition(); + BeanUtils.copyProperties(diagnosisTreatmentUpDto, activityDefinition); + + // 使用10位数基础采番 + String code = assignSeqUtil.getSeq(AssignSeqEnum.DEVICE_NUM.getPrefix(), 10); + activityDefinition.setBusNo(code); + // 拼音码 + activityDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(activityDefinition.getName())); + // 五笔码 + activityDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(activityDefinition.getName())); + + // 更新诊疗信息 + if (iActivityDefinitionService.updateById(activityDefinition)) { + ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition(); + chargeItemDefinition.setYbType(diagnosisTreatmentUpDto.getYbType()) + .setTypeCode(diagnosisTreatmentUpDto.getItemTypeCode()) + .setInstanceTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION) + .setInstanceId(diagnosisTreatmentUpDto.getId()); + + // 更新价格表 + return itemDefinitionServic.updateItem(chargeItemDefinition) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + + } + return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + } + + /** + * 诊疗目录停用 + * + * @param ids 诊疗目录ID列表 + * @return + */ + @Override + public R editDiseaseTreatmentStop(List ids) { + + List ActivityDefinitionList = new CopyOnWriteArrayList<>(); + + // 取得更新值 + for (Long detail : ids) { + ActivityDefinition ActivityDefinition = new ActivityDefinition(); + ActivityDefinition.setId(detail); + ActivityDefinition.setStatusEnum(PublicationStatus.RETIRED.getValue()); + ActivityDefinitionList.add(ActivityDefinition); + } + // 更新诊疗信息 + return iActivityDefinitionService.updateBatchById(ActivityDefinitionList) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + + } + + /** + * 诊疗目录启用 + * + * @param ids 诊疗目录ID列表 + * @return + */ + @Override + public R editDiseaseTreatmentStart(List ids) { + + List ActivityDefinitionList = new CopyOnWriteArrayList<>(); + + // 取得更新值 + for (Long detail : ids) { + ActivityDefinition ActivityDefinition = new ActivityDefinition(); + ActivityDefinition.setId(detail); + ActivityDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue()); + ActivityDefinitionList.add(ActivityDefinition); + } + // 更新诊疗信息 + return iActivityDefinitionService.updateBatchById(ActivityDefinitionList) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + + } + + /** + * 新增外来诊疗目录 + * + * @param diagnosisTreatmentUpDto 诊疗目录 + * @return + */ + @Override + public R addDiseaseTreatment(DiagnosisTreatmentUpDto diagnosisTreatmentUpDto) { + + ActivityDefinition activityDefinition = new ActivityDefinition(); + BeanUtils.copyProperties(diagnosisTreatmentUpDto, activityDefinition); + // 使用10位数基础采番 + String code = assignSeqUtil.getSeq(AssignSeqEnum.ACTIVITY_DEFINITION_NUM.getPrefix(), 10); + activityDefinition.setBusNo(code); + // 拼音码 + activityDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(activityDefinition.getName())); + // 五笔码 + activityDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(activityDefinition.getName())); + + // 新增外来诊疗目录 + activityDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue()); + if (iActivityDefinitionService.addDiagnosisTreatment(activityDefinition)) { + + ItemUpFromDirectoryDto itemUpFromDirectoryDto = new ItemUpFromDirectoryDto(); + BeanUtils.copyProperties(diagnosisTreatmentUpDto, itemUpFromDirectoryDto); + itemUpFromDirectoryDto.setTypeCode(diagnosisTreatmentUpDto.getItemTypeCode()) + .setInstanceTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION) + .setEffectiveStart(DateUtils.getNowDate()).setStatusEnum(PublicationStatus.ACTIVE.getValue()) + .setConditionFlag(Whether.YES.getValue()).setChargeName(diagnosisTreatmentUpDto.getName()) + .setInstanceId(activityDefinition.getId()).setPrice(diagnosisTreatmentUpDto.getRetailPrice()); + + return itemDefinitionServic.addItem(itemUpFromDirectoryDto) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); + + } + return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); + + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiseaseManageAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiseaseManageAppServiceImpl.java new file mode 100644 index 00000000..0db963c1 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/DiseaseManageAppServiceImpl.java @@ -0,0 +1,213 @@ +package com.openhis.web.datadictionary.appservice.impl; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import javax.servlet.http.HttpServletRequest; + +import com.core.common.utils.AssignSeqUtil; +import com.core.common.utils.ChineseConvertUtils; +import com.openhis.common.enums.AssignSeqEnum; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.core.common.core.domain.R; +import com.core.common.utils.MessageUtils; +import com.core.common.utils.bean.BeanUtils; +import com.openhis.clinical.domain.ConditionDefinition; +import com.openhis.clinical.mapper.ConditionDefinitionMapper; +import com.openhis.clinical.service.IConditionDefinitionService; +import com.openhis.common.constant.PromptMsgConstant; +import com.openhis.common.enums.ConditionDefinitionSource; +import com.openhis.common.enums.PublicationStatus; +import com.openhis.common.enums.Whether; +import com.openhis.common.utils.EnumUtils; +import com.openhis.common.utils.HisPageUtils; +import com.openhis.common.utils.HisQueryUtils; +import com.openhis.web.datadictionary.appservice.IDiseaseManageAppService; +import com.openhis.web.datadictionary.dto.DiseaseManageDto; +import com.openhis.web.datadictionary.dto.DiseaseManageInitDto; +import com.openhis.web.datadictionary.dto.DiseaseManageSelParam; +import com.openhis.web.datadictionary.dto.DiseaseManageUpDto; + +/** + * 病种目录 实现 + * + * @author liuhr + * @date 2025/3/30 + */ +@Service +public class DiseaseManageAppServiceImpl implements IDiseaseManageAppService { + + @Autowired + private ConditionDefinitionMapper conditionDefinitionMapper; + @Autowired + private IConditionDefinitionService ConditionDefinitionService; + @Autowired(required = false) + AssignSeqUtil assignSeqUtil; + + /** + * 病种目录初始化 + * + * @return + */ + @Override + public R getDiseaseInit() { + + DiseaseManageInitDto diseaseManageInitDto = new DiseaseManageInitDto(); + // 获取疾病目录种类 + List diseaseCategoryList = Stream.of(ConditionDefinitionSource.values()) + .map(status -> new DiseaseManageInitDto.diseaseCategory(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + diseaseManageInitDto.setDiseaseCategoryList(diseaseCategoryList); + // 获取状态 + List statusEnumOptions = Stream.of(PublicationStatus.values()) + .map(status -> new DiseaseManageInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + diseaseManageInitDto.setStatusFlagOptions(statusEnumOptions); + + return R.ok(diseaseManageInitDto); + } + + /** + * 查询病种目录分页列表 + * + * @param diseaseManageSelParam 查询条件 + * @param searchKey 查询条件-模糊查询 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @return + */ + public R getDiseaseList(DiseaseManageSelParam diseaseManageSelParam, String searchKey, Integer pageNo, + Integer pageSize, HttpServletRequest request) { + + // 构建查询条件 + QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(diseaseManageSelParam, + searchKey, new HashSet<>(Arrays.asList("condition_code", "name", "py_str", "wb_str")), request); + // 设置排序 + queryWrapper.orderByAsc("condition_code"); + // 分页查询 + Page diseasePage = + HisPageUtils.selectPage(conditionDefinitionMapper, queryWrapper, pageNo, pageSize, DiseaseManageDto.class); + + diseasePage.getRecords().forEach(e -> { + // 医保对码枚举类回显赋值 + e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag())); + // 状态 + e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum())); + }); + + // 返回【病种目录列表DTO】分页 + return R.ok(diseasePage); + } + + /** + * 根据id查询疾病详情 + * + * @param id 疾病ID + * @return + */ + public R getDiseaseOne(Long id) { + DiseaseManageDto diseaseManageDto = new DiseaseManageDto(); + // 根据ID查询【病种目录】 + ConditionDefinition conditionDefinition = ConditionDefinitionService.getById(id); + BeanUtils.copyProperties(conditionDefinition, diseaseManageDto); + return R.ok(diseaseManageDto); + } + + /** + * 病种目录编辑 + * + * @param diseaseManageDto 病种目录列表 + * @return + */ + public R editDisease(DiseaseManageUpDto diseaseManageDto) { + + ConditionDefinition conditionDefinition = new ConditionDefinition(); + BeanUtils.copyProperties(diseaseManageDto, conditionDefinition); + // 拼音码 + conditionDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(conditionDefinition.getName())); + // 五笔码 + conditionDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(conditionDefinition.getName())); + + // 更新病种信息 + return ConditionDefinitionService.updateById(conditionDefinition) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + } + + /** + * 病种目录停用 + * + * @param ids 病种目录ID列表 + * @return + */ + public R editDiseaseStop(List ids) { + List conditionDefinitionList = new CopyOnWriteArrayList<>(); + + // 取得更新值 + for (Long detail : ids) { + ConditionDefinition conditionDefinition = new ConditionDefinition(); + conditionDefinition.setId(detail); + conditionDefinition.setStatusEnum(PublicationStatus.RETIRED.getValue()); + conditionDefinitionList.add(conditionDefinition); + } + // 更新病种信息 + return ConditionDefinitionService.updateBatchById(conditionDefinitionList) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + } + + /** + * 病种目录启用 + * + * @param ids 病种目录ID列表 + * @return + */ + public R editDiseaseStart(List ids) { + List conditionDefinitionList = new CopyOnWriteArrayList<>(); + + // 取得更新值 + for (Long detail : ids) { + ConditionDefinition conditionDefinition = new ConditionDefinition(); + conditionDefinition.setId(detail); + conditionDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue()); + conditionDefinitionList.add(conditionDefinition); + } + // 更新病种信息 + return ConditionDefinitionService.updateBatchById(conditionDefinitionList) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + } + + /** + * 新增外来病种目录 + * + * @param diseaseManageUpDto 病种目录 + * @return + */ + public R addDisease(DiseaseManageUpDto diseaseManageUpDto) { + ConditionDefinition conditionDefinition = new ConditionDefinition(); + BeanUtils.copyProperties(diseaseManageUpDto, conditionDefinition); + // 使用10位数基础采番 + String code = assignSeqUtil.getSeq(AssignSeqEnum.CONDITION_DEFINITION_NUM.getPrefix(), 10); + conditionDefinition.setConditionCode(code); + + // 新增外来病种目录 + conditionDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue()); + // 拼音码 + conditionDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(conditionDefinition.getName())); + // 五笔码 + conditionDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(conditionDefinition.getName())); + return ConditionDefinitionService.addDisease(conditionDefinition) + ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"})) + : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); + } + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/ItemDefinitionServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/ItemDefinitionServiceImpl.java new file mode 100644 index 00000000..f003054d --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/ItemDefinitionServiceImpl.java @@ -0,0 +1,116 @@ +package com.openhis.web.datadictionary.appservice.impl; + +import java.util.ArrayList; +import java.util.List; + +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.core.common.utils.SecurityUtils; +import com.core.common.utils.bean.BeanUtils; +import com.openhis.administration.domain.DeviceDefinition; +import com.openhis.common.enums.ConditionCode; +import com.openhis.web.datadictionary.dto.DeviceManageUpDto; +import com.openhis.web.datadictionary.dto.ItemUpFromDirectoryDto; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.core.common.utils.DateUtils; +import com.core.common.utils.StringUtils; +import com.openhis.administration.domain.ChargeItemDefDetail; +import com.openhis.administration.domain.ChargeItemDefinition; +import com.openhis.administration.service.IChargeItemDefDetailService; +import com.openhis.administration.service.IChargeItemDefinitionService; +import com.openhis.common.constant.CommonConstants; +import com.openhis.common.enums.PublicationStatus; +import com.openhis.common.enums.Whether; +import com.openhis.medication.domain.MedicationDetail; +import com.openhis.web.datadictionary.appservice.IItemDefinitionService; +import com.openhis.web.datadictionary.dto.MedicationManageUpDto; + +/** + * 项目定价 实现 + * + * @author liuhr + * @date 2025/3/25 + */ +@Service +public class ItemDefinitionServiceImpl implements IItemDefinitionService { + + @Autowired + IChargeItemDefinitionService chargeItemDefinitionService; + + @Autowired + IChargeItemDefDetailService chargeItemDefDetailService; + + + /** + * 添加药品/器材/诊疗的项目定价 + * + * @param itemUpFromDirectoryDto 药品/器材/诊疗目录信息 + */ + @Override + public boolean addItem(ItemUpFromDirectoryDto itemUpFromDirectoryDto) { + + + ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition(); + BeanUtils.copyProperties(itemUpFromDirectoryDto, chargeItemDefinition); + + boolean insertCIDSuccess = chargeItemDefinitionService.save(chargeItemDefinition); + + if (insertCIDSuccess) { + List shargeItemDefDetails = new ArrayList<>(); + //插入购入价 + ChargeItemDefDetail chargeItemDefDetail1 = new ChargeItemDefDetail(); + chargeItemDefDetail1.setDefinitionId(chargeItemDefinition.getId()) + // 条件:采购 + .setConditionCode(ConditionCode.PROCUREMENT.getCode()) + // 购入价 + .setAmount(itemUpFromDirectoryDto.getPurchasePrice()); + shargeItemDefDetails.add(chargeItemDefDetail1); + //插入零售价 + ChargeItemDefDetail chargeItemDefDetail2 = new ChargeItemDefDetail(); + chargeItemDefDetail2.setDefinitionId(chargeItemDefinition.getId()) + // 条件:单位 + .setConditionCode(ConditionCode.UNIT.getCode()) + //单位枚举 + .setConditionValue(itemUpFromDirectoryDto.getUnitCode()) + // 零售价 + .setAmount(itemUpFromDirectoryDto.getRetailPrice()); + + shargeItemDefDetails.add(chargeItemDefDetail2); + + //插入最高零售价 + ChargeItemDefDetail chargeItemDefDetail3 = new ChargeItemDefDetail(); + chargeItemDefDetail3.setDefinitionId(chargeItemDefinition.getId()) + // 条件:限制 + .setConditionCode(ConditionCode.LIMIT.getCode()) + // 最高零售价 + .setAmount(itemUpFromDirectoryDto.getMaximumRetailPrice()); + + shargeItemDefDetails.add(chargeItemDefDetail3); + + return chargeItemDefDetailService.saveBatch(shargeItemDefDetails); + } + + return false; + } + + + /** + * 修改项目定价表 + * + * @param chargeItemDefinition 项目定价表信息 + */ + @Override + public boolean updateItem(ChargeItemDefinition chargeItemDefinition) { + + // 关联项目和代码位为key,更新表 + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.eq(ChargeItemDefinition::getInstanceId, chargeItemDefinition.getInstanceId()); + updateWrapper.eq(ChargeItemDefinition::getInstanceTable, chargeItemDefinition.getInstanceTable()) + .set(ChargeItemDefinition::getYbType, chargeItemDefinition.getYbType()) + .set(ChargeItemDefinition::getTypeCode, chargeItemDefinition.getTypeCode()); + + return chargeItemDefinitionService.update(null, updateWrapper); + } + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/MedicationManageAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/MedicationManageAppServiceImpl.java index 5d6a66a3..f1087146 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/MedicationManageAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/MedicationManageAppServiceImpl.java @@ -4,6 +4,8 @@ package com.openhis.web.datadictionary.appservice.impl; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -11,33 +13,37 @@ import java.util.stream.Stream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.core.common.utils.*; +import com.openhis.web.datadictionary.dto.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; -import com.core.common.utils.MessageUtils; -import com.core.common.utils.SecurityUtils; +import com.core.common.core.domain.entity.SysDictData; import com.core.common.utils.bean.BeanUtils; import com.core.common.utils.poi.ExcelUtil; +import com.core.system.service.ISysDictTypeService; +import com.openhis.administration.domain.ChargeItemDefinition; +import com.openhis.administration.domain.Supplier; +import com.openhis.administration.service.ISupplierService; +import com.openhis.common.constant.CommonConstants; import com.openhis.common.constant.PromptMsgConstant; -import com.openhis.common.enums.AccountStatus; -import com.openhis.common.enums.ApplicableScope; -import com.openhis.common.enums.PublicationStatus; +import com.openhis.common.enums.*; import com.openhis.common.utils.EnumUtils; +import com.openhis.common.utils.HisQueryUtils; import com.openhis.medication.domain.Medication; import com.openhis.medication.domain.MedicationDefinition; import com.openhis.medication.domain.MedicationDetail; import com.openhis.medication.service.IMedicationDefinitionService; import com.openhis.medication.service.IMedicationService; +import com.openhis.web.datadictionary.appservice.IItemDefinitionService; import com.openhis.web.datadictionary.appservice.IMedicationManageAppService; -import com.openhis.web.datadictionary.dto.MedicationManageDto; -import com.openhis.web.datadictionary.dto.MedicationManageInitDto; -import com.openhis.web.datadictionary.dto.MedicationManageUpDto; import com.openhis.web.datadictionary.mapper.MedicationManageSearchMapper; /** @@ -57,6 +63,17 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi @Autowired private MedicationManageSearchMapper medicationManageSearchMapper; + @Autowired + private ISupplierService supplierService; + + @Autowired + private ISysDictTypeService sysDictTypeService; + + @Autowired + private IItemDefinitionService itemDefinitionServic; + + @Autowired(required = false) + AssignSeqUtil assignSeqUtil; /** * 药品目录初始化 @@ -75,9 +92,52 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi List domainEnumOptions = Stream.of(ApplicableScope.values()) .map(domain -> new MedicationManageInitDto.domainEnumOption(domain.getValue(), domain.getInfo())) .collect(Collectors.toList()); + // 查询供应商列表 + List supplierList = supplierService.getList(); + // 供应商信息 + List supplierListOptions = supplierList.stream() + .map(supplier -> new MedicationManageInitDto.supplierListOption(supplier.getId(), supplier.getName())) + .collect(Collectors.toList()); + + // 获取药品分类 + List medicalList = + sysDictTypeService.selectDictDataByType(CommonConstants.DictName.MED_CATEGORY_CODE); + // 获取药品分类 + List medicationCategories = medicalList.stream().map( + category -> new MedicationManageInitDto.dictCategoryCode(category.getDictValue(), category.getDictLabel())) + .collect(Collectors.toList()); + + // 获取是/否 列表 + // 获取状态 + List statusWeatherOption = Stream.of(Whether.values()) + .map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + + // 权限限制 + List statusRestrictedOptions = Stream.of(PermissionLimit.values()) + .map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + + // 拆分属性 + List partAttributeEnumOptions = Stream.of(SplitPropertyCode.values()) + .map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); + + // 住院临时医嘱拆分属性的枚举 + List tempOrderSplitPropertyOptions = + Stream.of(TempOrderSplitPropertyCode.values()) + .map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo())) + .collect(Collectors.toList()); medicationManageInitDto.setStatusFlagOptions(statusEnumOptions); medicationManageInitDto.setDomainFlagOptions(domainEnumOptions); + medicationManageInitDto.setSupplierListOptions(supplierListOptions); + medicationManageInitDto.setMedicationCategoryCodeOptions(medicationCategories); + medicationManageInitDto.setStatusWeatherOptions(statusWeatherOption); + medicationManageInitDto.setStatusRestrictedOptions(statusRestrictedOptions); + medicationManageInitDto.setPartAttributeEnumOptions(partAttributeEnumOptions); + medicationManageInitDto.setTempOrderSplitPropertyEnumOptions(tempOrderSplitPropertyOptions); + return R.ok(medicationManageInitDto); } @@ -91,35 +151,56 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi * @return 药品目录查询结果 */ @Override - public R getMedicationList(@RequestParam(value = "searchKey", defaultValue = "") String searchKey, - @RequestParam(value = "ybMatchFlag", defaultValue = "-1") Integer ybMatchFlag, - @RequestParam(value = "statusEnum", defaultValue = "-1") Integer statusEnum, - @RequestParam(value = "categoryCode", defaultValue = "") String categoryCode, + public R getMedicationList(MedicationSearchParam medicationSearchParam, + @RequestParam(value = "searchKey", defaultValue = "") String searchKey, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { - // 分页设置 - Integer offset = (pageNo - 1) * pageSize; - // 获取租户ID - Integer tenantId = SecurityUtils.getLoginUser().getTenantId(); - // 查询药品目录列表 - List medicationDetailList = medicationManageSearchMapper.getPage(searchKey, ybMatchFlag, - statusEnum, categoryCode, tenantId, pageSize, offset); - // 查询总记录数 - long total = - medicationManageSearchMapper.getPageCount(searchKey, ybMatchFlag, statusEnum, categoryCode, tenantId); - // 创建Page对象并设置属性 - Page medicationManageDtoPage = new Page<>(pageNo, pageSize, total); - medicationManageDtoPage.setRecords(medicationDetailList); + // 构建查询条件 + QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(medicationSearchParam, + searchKey, new HashSet<>(Arrays.asList("name", "name_en", "merchandise_name", "bus_no", "py_str", "wb_str", + "merchandise_py_str", "merchandise_wb_str")), + null); + + IPage medicationManageDtoPage = + medicationManageSearchMapper.getPage(new Page<>(pageNo, pageSize), queryWrapper); // 枚举类回显赋值 medicationManageDtoPage.getRecords().forEach(e -> { // 药品状态 e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum())); - // 活动标记 - e.setActiveFlag_enumText(EnumUtils.getInfoByValue(AccountStatus.class, e.getActiveFlag())); + // 权限限制 + e.setRestrictedEnum_enumText(EnumUtils.getInfoByValue(PermissionLimit.class, e.getRestrictedEnum())); + // 是否为活性 + e.setActiveFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getActiveFlag())); + // 医保是否对码 + e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag())); + // 是否皮试 + e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag()));; + // 是否为注射药物 + e.setInjectFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getInjectFlag())); + // 是否限制使用 + e.setRestrictedFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getRestrictedFlag())); + // 儿童用药标志 + e.setChildrenFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getChildrenFlag())); // 适用范围 e.setDomainEnum_enumText(EnumUtils.getInfoByValue(ApplicableScope.class, e.getDomainEnum())); + + // 是否自制 + e.setSelfFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSelfFlag())); + // 是否抗生素 + e.setAntibioticFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getAntibioticFlag())); + // 基药标识 + e.setBasicFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getBasicFlag())); + // 拆分分属性 + e.setPartAttributeEnum_enumText( + EnumUtils.getInfoByValue(SplitPropertyCode.class, e.getPartAttributeEnum())); + // 住院临时医嘱拆分属性 + e.setThoPartAttributeEnum_enumText( + EnumUtils.getInfoByValue(TempOrderSplitPropertyCode.class, e.getThoPartAttributeEnum())); + // // 活动标记 + // e.setActiveFlag_enumText(EnumUtils.getInfoByValue(AccountStatus.class, e.getActiveFlag())); + }); // 返回【药品录列表DTO】分页 @@ -138,11 +219,31 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi Medication medication = new Medication(); BeanUtils.copyProperties(medicationManageUpDto, medication); // 子表信息 BeanUtils.copyProperties(medicationManageUpDto, medicationDefinition);// 主表信息 + medicationDefinition.setId(medicationManageUpDto.getMedicationDefId()); + // 拼音码 + medicationDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(medicationDefinition.getName())); + medicationDefinition + .setMerchandisePyStr(ChineseConvertUtils.toPinyinFirstLetter(medicationDefinition.getMerchandiseName())); + // 五笔码 + medicationDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(medicationDefinition.getName())); + medicationDefinition + .setMerchandiseWbStr(ChineseConvertUtils.toWBFirstLetter(medicationDefinition.getMerchandiseName())); + + ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition(); + chargeItemDefinition.setYbType(medicationManageUpDto.getYbType()) + .setTypeCode(medicationManageUpDto.getTypeCode()) + .setInstanceTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION) + .setInstanceId(medicationManageUpDto.getMedicationDefId()); // 更新子表药品信息 if (medicationService.updateById(medication)) { + // 更新主表药品信息 - return medicationDefinitionService.updateById(medicationDefinition) + boolean updateMedicationDefinition = medicationDefinitionService.updateById(medicationDefinition); + // 更新价格表 + boolean updateChargeItemDefinition = itemDefinitionServic.updateItem(chargeItemDefinition); + + return (updateMedicationDefinition && updateChargeItemDefinition) ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"药品目录"})) : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); } else { @@ -157,7 +258,7 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi * @return 药品目录查询结果 */ @Override - public R getMedicationOne(@PathVariable("id") Long id) { + public R getMedicationOne(@RequestParam Long id) { // 获取租户ID Integer tenantId = SecurityUtils.getLoginUser().getTenantId(); @@ -223,10 +324,38 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi MedicationDetail medicationDetail = new MedicationDetail(); BeanUtils.copyProperties(medicationManageUpDto, medicationDetail); + // 使用10位数基础采番 + String code = assignSeqUtil.getSeq(AssignSeqEnum.MEDICATION_NUM.getPrefix(),10); + medicationDetail.setBusNo(code); + // 拼音码 + medicationDetail.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(medicationDetail.getName())); + medicationDetail + .setMerchandisePyStr(ChineseConvertUtils.toPinyinFirstLetter(medicationDetail.getMerchandiseName())); + // 五笔码 + medicationDetail.setWbStr(ChineseConvertUtils.toWBFirstLetter(medicationDetail.getName())); + medicationDetail + .setMerchandiseWbStr(ChineseConvertUtils.toWBFirstLetter(medicationDetail.getMerchandiseName())); + // 新增主表外来药品目录 if (medicationDefinitionService.addMedication(medicationDetail)) { + // 新增子表外来药品目录 - return medicationService.addMedication(medicationDetail) + boolean insertMedicationSuccess = medicationService.addMedication(medicationDetail); + ItemUpFromDirectoryDto itemUpFromDirectoryDto = new ItemUpFromDirectoryDto(); + BeanUtils.copyProperties(medicationManageUpDto, itemUpFromDirectoryDto); + itemUpFromDirectoryDto.setInstanceId(medicationDetail.getMedicationDefId()) + .setStatusEnum(PublicationStatus.ACTIVE.getValue()) + .setInstanceTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION) + .setEffectiveStart(DateUtils.getNowDate()) + .setOrgId(SecurityUtils.getLoginUser().getOrgId()) + .setConditionFlag(Whether.YES.getValue()) + .setChargeName(medicationDetail.getName()) + .setPrice(medicationManageUpDto.getRetailPrice()); + + // 添加药品成功后,添加相应的条件价格表信息 + boolean insertItemDefinitionSuccess = itemDefinitionServic.addItem(itemUpFromDirectoryDto); + + return (insertMedicationSuccess && insertItemDefinitionSuccess) ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"药品目录"})) : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); } else { diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/SupplierManagementAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/SupplierManagementAppServiceImpl.java index b1491a05..a6d25ff3 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/SupplierManagementAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/appservice/impl/SupplierManagementAppServiceImpl.java @@ -12,12 +12,16 @@ import java.util.stream.Stream; import javax.servlet.http.HttpServletRequest; +import com.alibaba.druid.sql.visitor.functions.Isnull; import com.core.common.utils.ChineseConvertUtils; +import com.core.common.utils.StringUtils; import com.openhis.administration.domain.Supplier; import com.openhis.administration.mapper.SupplierMapper; import com.openhis.administration.service.ISupplierService; import com.openhis.common.enums.AccountStatus; import com.openhis.common.enums.SupplierType; +import com.openhis.common.enums.SupplyStatus; +import com.openhis.common.enums.SupplyType; import com.openhis.common.utils.EnumUtils; import com.openhis.web.datadictionary.appservice.ISupplierManagementAppService; import com.openhis.web.datadictionary.dto.SupplierDto; @@ -73,27 +77,33 @@ public class SupplierManagementAppServiceImpl implements ISupplierManagementAppS * * @param supplierSearchParam 查询条件 * @param searchKey 查询条件-模糊查询 + * @param typeEnum 查询条件 * @param pageNo 查询条件 * @param pageSize 查询条件 * @return 厂商/产地查询结果 */ @Override - public R getSupplierList(SupplierSearchParam supplierSearchParam, - @RequestParam(value = "searchKey", defaultValue = "") String searchKey, - @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { + public R getSupplierList(SupplierSearchParam supplierSearchParam, String searchKey, + Integer typeEnum, Integer pageNo, Integer pageSize, HttpServletRequest request) { // 构建查询条件 QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(supplierSearchParam, searchKey, new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request); + if(StringUtils.isNotNull(typeEnum)){ + queryWrapper.eq("type_enum",typeEnum); + } + // 设置排序 queryWrapper.orderByAsc("bus_no"); // 分页查询 Page supplierPage = HisPageUtils.selectPage(supplierMapper, queryWrapper, pageNo, pageSize, SupplierDto.class); // 枚举类回显赋值 - supplierPage.getRecords() - .forEach(e -> e.setActiveFlag_enumText(EnumUtils.getInfoByValue(AccountStatus.class, e.getActiveFlag()))); + supplierPage.getRecords().forEach(e -> { + e.setActiveFlag_enumText(EnumUtils.getInfoByValue(AccountStatus.class, e.getActiveFlag())); + // 厂商类型 + e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplierType.class, e.getTypeEnum())); + }); // 返回【病种目录列表DTO】分页 return R.ok(supplierPage); } @@ -104,7 +114,7 @@ public class SupplierManagementAppServiceImpl implements ISupplierManagementAppS * @param supplierUpDto 供应商信息 */ @Override - public R addSupplyRequest(@Validated @RequestBody SupplierUpDto supplierUpDto) { + public R addSupplyRequest(SupplierUpDto supplierUpDto) { Supplier supplierInfo = new Supplier(); BeanUtils.copyProperties(supplierUpDto, supplierInfo); @@ -123,7 +133,7 @@ public class SupplierManagementAppServiceImpl implements ISupplierManagementAppS * @param supplierUpDto 供应商信息 */ @Override - public R editSupplyRequest(@Validated @RequestBody SupplierUpDto supplierUpDto) { + public R editSupplyRequest(SupplierUpDto supplierUpDto) { Supplier supplier = new Supplier(); BeanUtils.copyProperties(supplierUpDto, supplier); diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DeviceManageController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DeviceManageController.java index b803360a..01b99d24 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DeviceManageController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DeviceManageController.java @@ -118,12 +118,9 @@ public class DeviceManageController { * @return */ @GetMapping("/information-one") - public R getDeviceOne(@PathVariable("id") Long id) { + public R getDeviceOne(@RequestParam Long id) { return deviceManageAppService.getDeviceOne(id); - // // 根据ID查询【器材目录】 - // DeviceDefinition byId = iDeviceDefinitionService.getById(id); - // return R.ok(byId); } /** @@ -137,13 +134,6 @@ public class DeviceManageController { return deviceManageAppService.editDevice(deviceManageDto); - // DeviceDefinition DeviceDefinition = new DeviceDefinition(); - // BeanUtils.copyProperties(deviceManageDto, DeviceDefinition); - // - // // 更新器材信息 - // return iDeviceDefinitionService.updateById(DeviceDefinition) - // ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"})) - // : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); } /** diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DiagnosisTreatmentController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DiagnosisTreatmentController.java index 7947c1b4..89112892 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DiagnosisTreatmentController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DiagnosisTreatmentController.java @@ -1,43 +1,18 @@ package com.openhis.web.datadictionary.controller; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.stream.Collectors; -import java.util.stream.Stream; import javax.servlet.http.HttpServletRequest; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; -import com.core.common.core.domain.entity.SysDictData; -import com.core.common.utils.MessageUtils; -import com.core.common.utils.bean.BeanUtils; -import com.core.system.service.ISysDictTypeService; -import com.openhis.administration.domain.Organization; -import com.openhis.administration.service.IOrganizationService; -import com.openhis.common.constant.PromptMsgConstant; -import com.openhis.common.enums.ActivityDefCategory; -import com.openhis.common.enums.OrganizationType; -import com.openhis.common.enums.PublicationStatus; -import com.openhis.common.enums.Whether; -import com.openhis.common.utils.EnumUtils; -import com.openhis.common.utils.HisPageUtils; -import com.openhis.common.utils.HisQueryUtils; +import com.openhis.web.datadictionary.appservice.IDiagnosisTreatmentManageAppService; import com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto; -import com.openhis.web.datadictionary.dto.DiagnosisTreatmentInitDto; import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam; import com.openhis.web.datadictionary.dto.DiagnosisTreatmentUpDto; -import com.openhis.workflow.domain.ActivityDefinition; -import com.openhis.workflow.mapper.ActivityDefinitionMapper; -import com.openhis.workflow.service.IActivityDefinitionService; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -49,14 +24,13 @@ import lombok.extern.slf4j.Slf4j; * @date 2025-02-20 */ @RestController -@RequestMapping("/datadictionary/diagnosistreatment") +@RequestMapping("/data-dictionary/diagnosis-treatment") @Slf4j @AllArgsConstructor public class DiagnosisTreatmentController { - private final IActivityDefinitionService iActivityDefinitionService; - private final ActivityDefinitionMapper activityDefinitionMapper; - private final IOrganizationService iOrganizationService; - private final ISysDictTypeService iSysDictTypeService; + + @Autowired + private IDiagnosisTreatmentManageAppService diagnosisTreatmentManageAppService; /** * 诊疗目录初期查询 @@ -65,55 +39,8 @@ public class DiagnosisTreatmentController { */ @GetMapping("/init") public R getDiseaseTreatmentInit() { - DiagnosisTreatmentInitDto diagnosisTreatmentInitDto = new DiagnosisTreatmentInitDto(); - // 获取状态 - List statusEnumOptions = Stream.of(PublicationStatus.values()) - .map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo())) - .collect(Collectors.toList()); - diagnosisTreatmentInitDto.setStatusFlagOptions(statusEnumOptions); - // 获取执行科室 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(Organization::getTypeEnum, OrganizationType.HOSPITAL_DEPARTMENT); - List organizations = iOrganizationService.list(queryWrapper); - List exeOrganizations = organizations.stream() - .map(exeOrg -> new DiagnosisTreatmentInitDto.exeOrganization(exeOrg.getId(), exeOrg.getName())) - .collect(Collectors.toList()); - diagnosisTreatmentInitDto.setExeOrganizations(exeOrganizations); - // 获取诊疗分类 - // 查询医疗服务项类型 - List medical_service_items = - iSysDictTypeService.selectDictDataByType(ActivityDefCategory.MEDICAL_SERVICE_ITEM.getCode()); - // 获取医疗服务项List - List diseaseTreatmentCategoryList = medical_service_items - .stream().map(status -> new DiagnosisTreatmentInitDto.diseaseTreatmentType(status.getDictValue(), - status.getDictLabel())) - .collect(Collectors.toList()); - List diseaseTreatmentCategories = new ArrayList<>(); - - DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory = - new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.MEDICAL_SERVICE_ITEM.getValue(), - ActivityDefCategory.MEDICAL_SERVICE_ITEM.getInfo()); - diseaseTreatmentCategory.setChildren(diseaseTreatmentCategoryList); - diseaseTreatmentCategories.add(diseaseTreatmentCategory); - diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); - - // 查询手术与治疗类型 - List medical_service_items2 = - iSysDictTypeService.selectDictDataByType(ActivityDefCategory.TREATMENT_SURGERY.getCode()); - // 获取手术与治疗List - List diseaseTreatmentCategoryList2 = medical_service_items2 - .stream().map(status -> new DiagnosisTreatmentInitDto.diseaseTreatmentType(status.getDictValue(), - status.getDictLabel())) - .collect(Collectors.toList()); - DiagnosisTreatmentInitDto.diseaseTreatmentCategory diseaseTreatmentCategory2 = - new DiagnosisTreatmentInitDto.diseaseTreatmentCategory(ActivityDefCategory.TREATMENT_SURGERY.getValue(), - ActivityDefCategory.TREATMENT_SURGERY.getInfo()); - diseaseTreatmentCategory2.setChildren(diseaseTreatmentCategoryList2); - diseaseTreatmentCategories.add(diseaseTreatmentCategory2); - - diagnosisTreatmentInitDto.setDiseaseTreatmentCategoryList(diseaseTreatmentCategories); - return R.ok(diagnosisTreatmentInitDto); + return diagnosisTreatmentManageAppService.getDiseaseTreatmentInit(); } /** @@ -131,24 +58,9 @@ public class DiagnosisTreatmentController { @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { - // 构建查询条件 - QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam, - searchKey, new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request); - // 设置排序 - queryWrapper.orderByAsc("bus_no"); - // 分页查询 - Page diseaseTreatmentPage = HisPageUtils.selectPage(activityDefinitionMapper, - queryWrapper, pageNo, pageSize, DiagnosisTreatmentDto.class); - - diseaseTreatmentPage.getRecords().forEach(e -> { - // 医保标记枚举类回显赋值 - e.setYbFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbFlag())); - // 医保对码标记枚举类回显赋值 - e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag())); - }); - // 返回【诊疗目录列表DTO】分页 - return R.ok(diseaseTreatmentPage); + return diagnosisTreatmentManageAppService.getDiseaseTreatmentPage(DiagnosisTreatmentSelParam, searchKey, pageNo, + pageSize, request); } /** @@ -158,12 +70,9 @@ public class DiagnosisTreatmentController { * @return */ @GetMapping("/information-one") - public R getDiseaseTreatmentOne(@PathVariable("id") Long id) { - DiagnosisTreatmentDto diagnosisTreatmentDto = new DiagnosisTreatmentDto(); - // 根据ID查询【诊疗目录】 - ActivityDefinition activityDefinition = iActivityDefinitionService.getById(id); - BeanUtils.copyProperties(activityDefinition, diagnosisTreatmentDto); - return R.ok(diagnosisTreatmentDto); + public R getDiseaseTreatmentOne(@RequestParam Long id) { + + return diagnosisTreatmentManageAppService.getDiseaseTreatmentOne(id); } /** @@ -175,13 +84,7 @@ public class DiagnosisTreatmentController { @PutMapping("/information") public R editDiseaseTreatment(@RequestBody DiagnosisTreatmentUpDto diagnosisTreatmentUpDto) { - ActivityDefinition ActivityDefinition = new ActivityDefinition(); - BeanUtils.copyProperties(diagnosisTreatmentUpDto, ActivityDefinition); - - // 更新诊疗信息 - return iActivityDefinitionService.updateById(ActivityDefinition) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + return diagnosisTreatmentManageAppService.editDiseaseTreatment(diagnosisTreatmentUpDto); } /** @@ -192,19 +95,8 @@ public class DiagnosisTreatmentController { */ @PutMapping("/information-stop") public R editDiseaseTreatmentStop(@RequestBody List ids) { - List ActivityDefinitionList = new CopyOnWriteArrayList<>(); - // 取得更新值 - for (Long detail : ids) { - ActivityDefinition ActivityDefinition = new ActivityDefinition(); - ActivityDefinition.setId(detail); - ActivityDefinition.setStatusEnum(PublicationStatus.RETIRED.getValue()); - ActivityDefinitionList.add(ActivityDefinition); - } - // 更新诊疗信息 - return iActivityDefinitionService.updateBatchById(ActivityDefinitionList) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + return diagnosisTreatmentManageAppService.editDiseaseTreatmentStop(ids); } /** @@ -215,19 +107,7 @@ public class DiagnosisTreatmentController { */ @PutMapping("/information-start") public R editDiseaseTreatmentStart(@RequestBody List ids) { - List ActivityDefinitionList = new CopyOnWriteArrayList<>(); - - // 取得更新值 - for (Long detail : ids) { - ActivityDefinition ActivityDefinition = new ActivityDefinition(); - ActivityDefinition.setId(detail); - ActivityDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue()); - ActivityDefinitionList.add(ActivityDefinition); - } - // 更新诊疗信息 - return iActivityDefinitionService.updateBatchById(ActivityDefinitionList) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + return diagnosisTreatmentManageAppService.editDiseaseTreatmentStart(ids); } /** @@ -238,13 +118,7 @@ public class DiagnosisTreatmentController { */ @PostMapping("/information") public R addDiseaseTreatment(@Validated @RequestBody DiagnosisTreatmentUpDto diagnosisTreatmentUpDto) { - ActivityDefinition ActivityDefinition = new ActivityDefinition(); - BeanUtils.copyProperties(diagnosisTreatmentUpDto, ActivityDefinition); - // 新增外来诊疗目录 - ActivityDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue()); - return iActivityDefinitionService.addDiagnosisTreatment(ActivityDefinition) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"诊疗目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); + return diagnosisTreatmentManageAppService.addDiseaseTreatment(diagnosisTreatmentUpDto); } /** diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DiseaseManageController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DiseaseManageController.java index 1b3cb1e1..ce946140 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DiseaseManageController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/DiseaseManageController.java @@ -1,32 +1,18 @@ package com.openhis.web.datadictionary.controller; -import java.util.Arrays; -import java.util.HashSet; import java.util.List; -import java.util.concurrent.CopyOnWriteArrayList; -import java.util.stream.Collectors; -import java.util.stream.Stream; import javax.servlet.http.HttpServletRequest; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; -import com.core.common.utils.MessageUtils; import com.core.common.utils.bean.BeanUtils; import com.openhis.clinical.domain.ConditionDefinition; -import com.openhis.clinical.mapper.ConditionDefinitionMapper; -import com.openhis.clinical.service.IConditionDefinitionService; -import com.openhis.common.constant.PromptMsgConstant; -import com.openhis.common.enums.ConditionDefinitionSource; -import com.openhis.common.enums.PublicationStatus; -import com.openhis.common.utils.HisPageUtils; -import com.openhis.common.utils.HisQueryUtils; +import com.openhis.web.datadictionary.appservice.IDiseaseManageAppService; import com.openhis.web.datadictionary.dto.DiseaseManageDto; -import com.openhis.web.datadictionary.dto.DiseaseManageInitDto; import com.openhis.web.datadictionary.dto.DiseaseManageSelParam; import com.openhis.web.datadictionary.dto.DiseaseManageUpDto; @@ -44,8 +30,9 @@ import lombok.extern.slf4j.Slf4j; @Slf4j @AllArgsConstructor public class DiseaseManageController { - private final IConditionDefinitionService iConditionDefinitionService; - private final ConditionDefinitionMapper conditionDefinitionMapper; + + @Autowired + private IDiseaseManageAppService diseaseManageAppService; /** * 病种目录初始化 @@ -54,18 +41,8 @@ public class DiseaseManageController { */ @GetMapping("/information-init") public R getDiseaseInit() { - DiseaseManageInitDto diseaseManageInitDto = new DiseaseManageInitDto(); - // 获取疾病目录种类 - List diseaseCategoryList = Stream.of(ConditionDefinitionSource.values()) - .map(status -> new DiseaseManageInitDto.diseaseCategory(status.getValue(), status.getInfo())) - .collect(Collectors.toList()); - diseaseManageInitDto.setDiseaseCategoryList(diseaseCategoryList); - // 获取状态 - List statusEnumOptions = Stream.of(PublicationStatus.values()) - .map(status -> new DiseaseManageInitDto.statusEnumOption(status.getValue(), status.getInfo())) - .collect(Collectors.toList()); - diseaseManageInitDto.setStatusFlagOptions(statusEnumOptions); - return R.ok(diseaseManageInitDto); + + return diseaseManageAppService.getDiseaseInit(); } /** @@ -83,16 +60,8 @@ public class DiseaseManageController { @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { - // 构建查询条件 - QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(diseaseManageSelParam, - searchKey, new HashSet<>(Arrays.asList("condition_code", "name", "py_str", "wb_str")), request); - // 设置排序 - queryWrapper.orderByAsc("condition_code"); - // 分页查询 - Page diseasePage = - HisPageUtils.selectPage(conditionDefinitionMapper, queryWrapper, pageNo, pageSize, DiseaseManageDto.class); // 返回【病种目录列表DTO】分页 - return R.ok(diseasePage); + return diseaseManageAppService.getDiseaseList(diseaseManageSelParam, searchKey, pageNo, pageSize, request); } /** @@ -102,12 +71,10 @@ public class DiseaseManageController { * @return */ @GetMapping("/information-one") - public R getDiseaseOne(@PathVariable("id") Long id) { - DiseaseManageDto diseaseManageDto = new DiseaseManageDto(); + public R getDiseaseOne(@RequestParam Long id) { + // 根据ID查询【病种目录】 - ConditionDefinition conditionDefinition = iConditionDefinitionService.getById(id); - BeanUtils.copyProperties(conditionDefinition, diseaseManageDto); - return R.ok(diseaseManageDto); + return diseaseManageAppService.getDiseaseOne(id); } /** @@ -123,9 +90,7 @@ public class DiseaseManageController { BeanUtils.copyProperties(diseaseManageDto, conditionDefinition); // 更新病种信息 - return iConditionDefinitionService.updateById(conditionDefinition) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + return diseaseManageAppService.editDisease(diseaseManageDto); } /** @@ -136,19 +101,8 @@ public class DiseaseManageController { */ @PutMapping("/information-stop") public R editDiseaseStop(@RequestBody List ids) { - List conditionDefinitionList = new CopyOnWriteArrayList<>(); - - // 取得更新值 - for (Long detail : ids) { - ConditionDefinition conditionDefinition = new ConditionDefinition(); - conditionDefinition.setId(detail); - conditionDefinition.setStatusEnum(PublicationStatus.RETIRED.getValue()); - conditionDefinitionList.add(conditionDefinition); - } // 更新病种信息 - return iConditionDefinitionService.updateBatchById(conditionDefinitionList) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + return diseaseManageAppService.editDiseaseStop(ids); } /** @@ -159,19 +113,9 @@ public class DiseaseManageController { */ @PutMapping("/information-start") public R editDiseaseStart(@RequestBody List ids) { - List conditionDefinitionList = new CopyOnWriteArrayList<>(); - // 取得更新值 - for (Long detail : ids) { - ConditionDefinition conditionDefinition = new ConditionDefinition(); - conditionDefinition.setId(detail); - conditionDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue()); - conditionDefinitionList.add(conditionDefinition); - } // 更新病种信息 - return iConditionDefinitionService.updateBatchById(conditionDefinitionList) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null)); + return diseaseManageAppService.editDiseaseStart(ids); } /** @@ -182,13 +126,8 @@ public class DiseaseManageController { */ @PostMapping("/information") public R addDisease(@Validated @RequestBody DiseaseManageUpDto diseaseManageUpDto) { - ConditionDefinition conditionDefinition = new ConditionDefinition(); - BeanUtils.copyProperties(diseaseManageUpDto, conditionDefinition); - // 新增外来病种目录 - conditionDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue()); - return iConditionDefinitionService.addDisease(conditionDefinition) - ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"疾病目录"})) - : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null)); + + return diseaseManageAppService.addDisease(diseaseManageUpDto); } /** diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/MedicationManageController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/MedicationManageController.java index d232cfac..679ec3cc 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/MedicationManageController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/MedicationManageController.java @@ -5,6 +5,7 @@ import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import com.openhis.web.datadictionary.dto.MedicationSearchParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -44,22 +45,18 @@ public class MedicationManageController { /** * 查询药品目录分页列表 * - * @param searchKey 查询条件 - * @param statusEnum 查询条件-状态 - * @param ybMatchFlag 查询条件-是否对码 - * @param categoryCode 查询条件-药品分类 + * @param medicationSearchParam 查询条件 + * @param searchKey 模糊查询条件 * @param pageNo 当前页码 * @param pageSize 查询条数 * @return */ @GetMapping("/information-page") - public R getMedicationList(@RequestParam(value = "searchKey", defaultValue = "") String searchKey, - @RequestParam(value = "ybMatchFlag", defaultValue = "-1") Integer ybMatchFlag, - @RequestParam(value = "statusEnum", defaultValue = "-1") Integer statusEnum, - @RequestParam(value = "categoryCode", defaultValue = "") String categoryCode, + public R getMedicationList( + MedicationSearchParam medicationSearchParam,@RequestParam(value = "searchKey", defaultValue = "") String searchKey, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { - return medicationManageAppService.getMedicationList(searchKey, ybMatchFlag, statusEnum, categoryCode, pageNo, + return medicationManageAppService.getMedicationList(medicationSearchParam,searchKey,pageNo, pageSize, request); } @@ -70,7 +67,7 @@ public class MedicationManageController { * @return */ @GetMapping("/information-one") - public R getMedicationOne(@PathVariable("id") Long id) { + public R getMedicationOne(@RequestParam Long id) { return medicationManageAppService.getMedicationOne(id); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/SupplierManagementController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/SupplierManagementController.java index 5e75103a..20ccc5dd 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/SupplierManagementController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/controller/SupplierManagementController.java @@ -46,6 +46,7 @@ public class SupplierManagementController { * * @param supplierSearchParam 查询条件 * @param searchKey 查询条件-模糊查询 + * @param typeEnum 查询条件 * @param pageNo 查询条件 * @param pageSize 查询条件 * @return 厂商/产地查询结果 @@ -53,11 +54,12 @@ public class SupplierManagementController { @GetMapping(value = "/get-supplier-list") public R getSupplierList(SupplierSearchParam supplierSearchParam, @RequestParam(value = "searchKey", defaultValue = "") String searchKey, + @RequestParam(value = "typeEnum", defaultValue = "") Integer typeEnum, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { // 返回分页 - return supplierManagementAppService.getSupplierList(supplierSearchParam, searchKey, pageNo, pageSize, request); + return supplierManagementAppService.getSupplierList(supplierSearchParam, searchKey,typeEnum, pageNo, pageSize, request); } /** diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageDto.java index 87196531..a8b937e7 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageDto.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; import com.openhis.common.enums.DeviceCategory; import com.openhis.common.enums.PublicationStatus; @@ -36,13 +37,19 @@ public class DeviceManageDto { private String wbStr; /** 器材分类 */ - private DeviceCategory categoryEnum; + @Dict(dictCode = "device_category_code") + private String categoryCode; + private String categoryCode_dictText; /** 器材种类 */ + @Dict(dictCode = "device_type_code") private String typeCode; + private String typeCode_dictText; /** 包装单位 */ + @Dict(dictCode = "unit_code") private String unitCode; + private String unitCode_dictText; /** 包装规格 */ private String size; @@ -51,7 +58,21 @@ public class DeviceManageDto { private BigDecimal partPercent; /** 最小使用单位 */ + @Dict(dictCode = "unit_code") private String minUnitCode; + private String minUnitCode_dictText; + + /** 所属科室 */ + @Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long orgId; + private String orgId_dictText; + + /** 所在位置 */ + @Dict(dictTable = "adm_location", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long locationId; + private String locationId_dictText; /** 产品型号 */ private String modelNumber; @@ -61,7 +82,9 @@ public class DeviceManageDto { private String hvcmFlag_enumText; /** 销售单位 */ + @Dict(dictCode = "unit_code") private String salesUnitCode; + private String salesUnitCode_dictText; /** 批准文号 */ private String approvalNumber; @@ -78,13 +101,21 @@ public class DeviceManageDto { private String ybMatchFlag_enumText; /** 状态 */ - private PublicationStatus statusEnum; + private Integer statusEnum; + private String statusEnum_enumText; /** 生产厂家 */ + @JsonSerialize(using = ToStringSerializer.class) private Long manufacturerId; + /** 生产厂商文本 */ + private String manufacturerText; + /** 供应商 */ + @JsonSerialize(using = ToStringSerializer.class) + @Dict(dictTable = "adm_supplier",dictCode = "id",dictText = "name") private Long supplyId; + private String supplyId_dictText; /** 说明 */ private String description; @@ -92,9 +123,6 @@ public class DeviceManageDto { /** 适用范围 */ private String jurisdiction; - /** 执行科室 */ - private Long ruleId; - /** 器材版本 */ private String version; @@ -104,4 +132,24 @@ public class DeviceManageDto { /** 过敏标记 */ private Integer allergenFlag; private String allergenFlag_enumText; + + /** 财务类别 */ + @Dict(dictCode = "fin_type_code") + private String itemTypeCode; + private String itemTypeCode_dictText; + + /** 医保类别 */ + @Dict(dictCode = "yb_type") + private String ybType; + private String ybType_dictText; + + /** 购入价 */ + private BigDecimal purchasePrice; + + /** 零售价 */ + private BigDecimal retailPrice; + + /** 最高零售价 */ + private BigDecimal maximumRetailPrice; + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageInitDto.java index 36090c28..17d6abea 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageInitDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageInitDto.java @@ -3,6 +3,8 @@ package com.openhis.web.datadictionary.dto; import java.util.ArrayList; import java.util.List; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import lombok.experimental.Accessors; @@ -16,8 +18,12 @@ import lombok.experimental.Accessors; @Accessors(chain = true) public class DeviceManageInitDto { private List statusFlagOptions; - private List deviceCategories; + private List deviceCategories; private List exeOrganizations; + // 供应商 + private List supplierListOptions; + // 是/否 状态 + private List statusYBWeatherOptions; /** * 状态 @@ -48,6 +54,21 @@ public class DeviceManageInitDto { } } + /** + * 器材分类 + */ + @Data + public static class dictCategoryCode { + private String value; + private String info; + private List children = new ArrayList<>(); + + public dictCategoryCode(String value, String info) { + this.value = value; + this.info = info; + } + } + /** * 执行机构 */ @@ -61,4 +82,21 @@ public class DeviceManageInitDto { this.label = label; } } + + /** + * 供应商 + */ + @Data + public static class supplierListOption { + + @JsonSerialize(using = ToStringSerializer.class) + private Long value; + private String label; + + public supplierListOption(Long value, String label) { + this.value = value; + this.label = label; + } + } + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageSelParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageSelParam.java index a51a2b21..10fbb9a7 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageSelParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageSelParam.java @@ -14,7 +14,7 @@ import lombok.experimental.Accessors; public class DeviceManageSelParam { /** 器材分类 */ - private Integer categoryEnum; + private String categoryCode; /** 医保对码标记 */ private Integer ybMatchFlag; @@ -22,6 +22,4 @@ public class DeviceManageSelParam { /** 状态 */ private Integer statusEnum; - /** 执行科室 */ - private Long ruleId; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageUpDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageUpDto.java index 2e163bed..2b161e0b 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageUpDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DeviceManageUpDto.java @@ -7,6 +7,7 @@ import javax.validation.constraints.NotNull; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; import com.openhis.common.enums.DeviceCategory; import lombok.Data; @@ -26,7 +27,6 @@ public class DeviceManageUpDto { private Long id; /** 编码 */ - @NotBlank(message = "器材编码不能为空") private String busNo; /** 器材名称 */ @@ -34,16 +34,14 @@ public class DeviceManageUpDto { private String name; /** 器材名称拼音 */ - @NotBlank(message = "器材名称拼音不能为空") private String pyStr; /** 器材五笔拼音 */ - @NotBlank(message = "器材五笔拼音不能为空") private String wbStr; /** 器材分类 */ @NotNull(message = "器材分类不能为空") - private DeviceCategory categoryEnum; + private String categoryCode; /** 器材种类 */ @NotBlank(message = "器材种类不能为空") @@ -65,12 +63,25 @@ public class DeviceManageUpDto { @NotBlank(message = "最小使用单位不能为空") private String minUnitCode; + /** 所属科室 */ + @NotNull(message = "所属科室不能为空") + @Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long orgId; + private String orgId_dictText; + + /** 所在位置 */ + @NotNull(message = "所在位置不能为空") + @Dict(dictTable = "adm_location", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long locationId; + private String locationId_dictText; + /** 产品型号 */ @NotBlank(message = "产品型号不能为空") private String modelNumber; /** 高值器材标志 */ - // @NotNull(message = "高值器材标志不能为空") private Integer hvcmFlag; /** 销售单位 */ @@ -82,22 +93,25 @@ public class DeviceManageUpDto { private String approvalNumber; /** 医保标记 */ - // @NotNull(message = "医保标记不能为空") private Integer ybFlag; /** 医保编码 */ private String ybNo; /** 医保对码标记 */ - // @NotNull(message = "医保对码标记不能为空") private Integer ybMatchFlag; /** 生产厂家 */ - @NotNull(message = "生产厂家不能为空") + @JsonSerialize(using = ToStringSerializer.class) private Long manufacturerId; + /** 生产厂商文本 */ + @JsonSerialize(using = ToStringSerializer.class) + private String manufacturerText; + /** 供应商 */ @NotNull(message = "供应商不能为空") + @JsonSerialize(using = ToStringSerializer.class) private Long supplyId; /** 说明 */ @@ -107,10 +121,6 @@ public class DeviceManageUpDto { @NotBlank(message = "适用范围不能为空") private String jurisdiction; - /** 执行科室 */ - @NotNull(message = "执行科室不能为空") - private Long ruleId; - /** 器材版本 */ private String version; @@ -118,6 +128,26 @@ public class DeviceManageUpDto { private String substanceText; /** 过敏标记 */ - // @NotNull(message = "过敏标记不能为空") private Integer allergenFlag; + + /** 购入价 */ + @NotNull(message = "购入价不能为空") + private BigDecimal purchasePrice; + + /** 零售价 */ + @NotNull(message = "零售价不能为空") + private BigDecimal retailPrice; + + /** 最高零售价 */ + @NotNull(message = "最高零售价不能为空") + private BigDecimal maximumRetailPrice; + + /** 财务类别 */ + @NotNull(message = "财务类别不能为空") + private String itemTypeCode; + + /** 医保类别 */ + @NotNull(message = "医保类别不能为空") + private String ybType; + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java index 79c4ed95..9b91cc16 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentDto.java @@ -2,12 +2,16 @@ package com.openhis.web.datadictionary.dto; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; import com.openhis.common.enums.ActivityDefCategory; import com.openhis.common.enums.PublicationStatus; import lombok.Data; import lombok.experimental.Accessors; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + /** * 诊疗目录分页检索 * @@ -22,7 +26,9 @@ public class DiagnosisTreatmentDto { private Long id; /** 目录类别 */ - private ActivityDefCategory categoryEnum; + @Dict(dictCode = "activity_category_code") + private String categoryCode; + private String categoryCode_dictText; /** 编码 */ private String busNo; @@ -37,10 +43,13 @@ public class DiagnosisTreatmentDto { private String wbStr; /** 类型 */ - private String typeCode; + private Integer typeEnum; + private String typeEnum_enumText; /** 使用单位 */ + @Dict(dictCode = "rate_code") private String permittedUnitCode; + private String permittedUnitCode_dictText; /** 医保标记 */ private Integer ybFlag; @@ -54,17 +63,55 @@ public class DiagnosisTreatmentDto { private String ybMatchFlag_enumText; /** 状态 */ - private PublicationStatus statusEnum; + private Integer statusEnum; + private String statusEnum_enumText; /** 身体部位 */ + @Dict(dictCode = "body_site_code") private String bodySiteCode; + private String bodySiteCode_dictText; /** 所需标本 */ + @Dict(dictCode = "specimen_code") private String specimenCode; + private String specimenCode_dictText; /** 说明 */ private String descriptionText; /** 规则id */ private Integer ruleId; + + /** 所属科室 */ + @Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long orgId; + private String orgId_dictText; + + /** 所在位置 */ + @Dict(dictTable = "adm_location", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long locationId; + private String locationId_dictText; + + /** 财务类别 */ + @Dict(dictCode = "fin_type_code") + private String typeCode; + private String typeCode_dictText; + + /** 医保类别 */ + @Dict(dictCode = "med_chrgitm_type") + private String ybType; + private String ybType_dictText; + + /** 购入价 */ + private BigDecimal purchasePrice; + + /** 零售价 */ + private BigDecimal retailPrice; + + /** 最高零售价 */ + private BigDecimal maximumRetailPrice; + + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java index 6cc44888..57172737 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentInitDto.java @@ -3,6 +3,8 @@ package com.openhis.web.datadictionary.dto; import java.util.ArrayList; import java.util.List; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import lombok.experimental.Accessors; @@ -18,6 +20,11 @@ public class DiagnosisTreatmentInitDto { private List statusFlagOptions; private List diseaseTreatmentCategoryList; private List exeOrganizations; + private List typeEnumOptions; + //诊疗目录 + private List diagnosisCategoryOptions; + //是否list + private List statusWeatherOption; /** * 状态 @@ -63,6 +70,21 @@ public class DiagnosisTreatmentInitDto { } } + /** + * 诊疗目录类型 + */ + @Data + public static class dictCategoryCode { + private String value; + private String info; + private List children = new ArrayList<>(); + + public dictCategoryCode(String value, String info) { + this.value = value; + this.info = info; + } + } + /** * 执行机构 */ @@ -76,4 +98,5 @@ public class DiagnosisTreatmentInitDto { this.label = label; } } + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java index fd5c2294..e5fd9eb5 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentSelParam.java @@ -14,11 +14,12 @@ import lombok.experimental.Accessors; @Data @Accessors(chain = true) public class DiagnosisTreatmentSelParam { + /** 目录类别 */ - private Integer categoryEnum; + private Integer categoryCode; /** 类型 */ - private String typeCode; + private Integer typeEnum; /** 医保对码标记 */ private Integer ybMatchFlag; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java index 154a1158..3eafc386 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiagnosisTreatmentUpDto.java @@ -5,11 +5,14 @@ import javax.validation.constraints.NotNull; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; import com.openhis.common.enums.ActivityDefCategory; import lombok.Data; import lombok.experimental.Accessors; +import java.math.BigDecimal; + /** * 诊疗目录分页更新 * @@ -19,13 +22,14 @@ import lombok.experimental.Accessors; @Data @Accessors(chain = true) public class DiagnosisTreatmentUpDto { + /** ID */ @JsonSerialize(using = ToStringSerializer.class) private Long id; /** 目录类别 */ - @NotNull(message = "目录类别不能为空") - private ActivityDefCategory categoryEnum; + @NotBlank(message = "目录类别不能为空") + private String categoryCode; /** 编码 */ @NotBlank(message = "项目编码不能为空") @@ -73,4 +77,36 @@ public class DiagnosisTreatmentUpDto { /** 规则id */ private Integer ruleId; + + /** 所属科室 */ + @Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long orgId; + private String orgId_dictText; + + /** 所在位置 */ + @Dict(dictTable = "adm_location", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long locationId; + private String locationId_dictText; + + /** 财务类别 */ + @Dict(dictCode = "fin_type_code") + private String itemTypeCode; + private String itemTypeCode_dictText; + + /** 医保类别 */ + @Dict(dictCode = "yb_type") + private String ybType; + private String ybType_dictText; + + /** 购入价 */ + private BigDecimal purchasePrice; + + /** 零售价 */ + private BigDecimal retailPrice; + + /** 最高零售价 */ + private BigDecimal maximumRetailPrice; + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiseaseManageDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiseaseManageDto.java index d710d634..312fac10 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiseaseManageDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/DiseaseManageDto.java @@ -50,8 +50,10 @@ public class DiseaseManageDto { /** 医保对码标记 */ private Integer ybMatchFlag; + private String ybMatchFlag_enumText; /** 状态 */ - private PublicationStatus statusEnum; + private Integer statusEnum; + private String statusEnum_enumText; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/ItemUpFromDirectoryDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/ItemUpFromDirectoryDto.java new file mode 100644 index 00000000..89fce04a --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/ItemUpFromDirectoryDto.java @@ -0,0 +1,74 @@ +package com.openhis.web.datadictionary.dto; + +import java.math.BigDecimal; +import java.util.Date; + +import com.openhis.common.annotation.Dict; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 从目录添加定价表信息用的Dto + * + * @author liuhr + * @date 2025/3/28 + */ +@Data +@Accessors(chain = true) +public class ItemUpFromDirectoryDto { + + /** 药品单位 */ + private String unitCode; + + /** 购入价 */ + private BigDecimal purchasePrice; + + /** 零售价 */ + private BigDecimal retailPrice; + + /** 最高零售价 */ + private BigDecimal maximumRetailPrice; + + /** 名称 */ + private String chargeName; + + /** 状态 */ + private Integer statusEnum; + + /** 机构ID */ + private Long orgId; + + /** 代码 */ + private String instanceTable; + + /** 关联项目 */ + private Long instanceId; + + /** 有效时间开始 */ + private Date effectiveStart; + + /** 财务类别 */ + private String typeCode; + + /** 医保类别 */ + private String ybType; + + /** 是否使用详细价格规则 */ + private Integer conditionFlag; + + /** 基础价格 */ + private BigDecimal price; + + /** 费用定价主键ID */ + private Long definitionId; + + /** 条件 */ + private String conditionCode; + + /** 命中值 */ + private String conditionValue; + + /** 价格 */ + private BigDecimal amount; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageDto.java index 039f653c..3623e7cb 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageDto.java @@ -6,11 +6,12 @@ import java.util.Date; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.openhis.common.annotation.Dict; -import com.openhis.common.enums.PublicationStatus; import lombok.Data; import lombok.experimental.Accessors; +import javax.validation.constraints.NotNull; + /** * 药品目录Dto * @@ -30,15 +31,25 @@ public class MedicationManageDto { private Long medicationDefId; /** 药品状态 */ -// private PublicationStatus statusEnum; private Integer statusEnum; private String statusEnum_enumText; /** 所属科室 */ + @Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) private Long orgId; + private String orgId_dictText; + + /** 所在位置 */ + @Dict(dictTable = "adm_location", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) + private Long locationId; + private String locationId_dictText; /** 剂型 */ + @Dict(dictCode = "dose_form_code") private String doseFormCode; + private String doseFormCode_dictText; /** 规格 */ private String totalVolume; @@ -60,16 +71,22 @@ public class MedicationManageDto { private Date expirationDate; /** 用法 */ + @Dict(dictCode = "method_code") private String methodCode; + private String methodCode_dictText; /** 用药频次 */ + @Dict(dictCode = "rate_code") private String rateCode; + private String rateCode_dictText; /** 单次剂量 */ private BigDecimal dose; /** 剂量单位 */ + @Dict(dictCode = "unit_code") private String doseUnitCode; + private String doseUnitCode_dictText; /** 单次最大剂量 */ private BigDecimal maxUnit; @@ -77,6 +94,19 @@ public class MedicationManageDto { /** 药品定义 */ private String definition; + /** 用量限定 */ + private BigDecimal usageLimit; + + /** DDD值 */ + @Dict(dictCode = "ddd_code") + private String dddCode; + private String dddCode_dictText; + + /** DDD单位 */ + @Dict(dictCode = "unit_code") + private String dddUnitCode; + private String dddUnitCode_dictText; + /** 药品编号 */ private String busNo; @@ -100,8 +130,9 @@ public class MedicationManageDto { private String wbStr; /** 药品分类 */ - @Dict(dictCode = "medicine_category") - private Integer categoryCode; + @Dict(dictCode = "med_category_code") + private String categoryCode; + private String categoryCode_dictText; /** 商品名称 */ private String merchandiseName; @@ -113,28 +144,32 @@ public class MedicationManageDto { private String merchandiseWbStr; /** 药品单位 */ + @Dict(dictCode = "unit_code") private String unitCode; + private String unitCode_dictText; /** 最小单位 */ + @Dict(dictCode = "unit_code") private String minUnitCode; + private String minUnitCode_dictText; /** 所含耗材 */ private String comprisedText; - /** 成分 */ - private String ingredient; - /** 拆零比 */ private BigDecimal partPercent; /** 剂量形式 */ + @Dict(dictCode = "dose_from_code") private Integer doseFrom; + private String doseFrom_dictText; /** 批准文号 */ private String approvalNumber; /** 医保是否对码 */ private Integer ybMatchFlag; + private String ybMatchFlag_enumText;; /** 医保编码 */ private String ybNo; @@ -143,31 +178,106 @@ public class MedicationManageDto { private String pharmacologyCategoryCode; /** 是否皮试 */ - @Dict(dictCode = "sys_yes_no") private Integer skinTestFlag; + private String skinTestFlag_enumText; /** 是否为注射药物 */ - @Dict(dictCode = "sys_yes_no") private Integer injectFlag; + private String injectFlag_enumText; /** 生产厂家 */ + @JsonSerialize(using = ToStringSerializer.class) private Long manufacturerId; /** 供应商 */ + @Dict(dictTable = "adm_supplier", dictCode = "id", dictText = "name") + @JsonSerialize(using = ToStringSerializer.class) private Long supplyId; + private String supplyId_dictText; /** 是否限制使用 */ - @Dict(dictCode = "sys_yes_no") private Integer restrictedFlag; + private String restrictedFlag_enumText; /** 限制使用范围 */ private String restrictedScope; /** 儿童用药标志 */ - @Dict(dictCode = "sys_yes_no") private Integer childrenFlag; + private String childrenFlag_enumText; /** 产品特性 */ private Integer characteristic; + private String characteristic_enumText; + + /** 贯标国家编码 */ + private String nationalDrugCode; + + /** 拆分属性 */ + private Integer partAttributeEnum; + private String partAttributeEnum_enumText; + + /** 抗生素分类 */ + @Dict(dictCode = "antibiotic_type_code") + private String antibioticCode; + private String antibioticCode_dictText; + + /** 权限限制 */ + private Integer restrictedEnum; + private String restrictedEnum_enumText; + + /** 是否自制 */ + private Integer selfFlag; + private String selfFlag_enumText; + + /** 是否抗生素 */ + private Integer antibioticFlag; + private String antibioticFlag_enumText; + + /** 基药标识 */ + private Integer basicFlag; + private String basicFlag_enumText; + + /** 生产厂商文本 */ + private String manufacturerText; + + /** 当前库存数量(常规单位) */ + private String baseQuantity; + + /** 当前库存数量(最小单位数量) */ + private String minQuantity; + + /** 售价 */ + private BigDecimal price; + + /** 单次最小用药频次 */ + private String minRateCode; + + /** 单次最大用药频次 */ + private String maxRateCode; + + /** 医保类别 */ + private String ybType; + + /** 财务类别 */ + @Dict(dictCode = "fin_type_code") + private String typeCode; + private String typeCode_dictText; + + /** 成分 */ + private String ingredient; + + /** 购入价 */ + private BigDecimal purchasePrice; + + /** 零售价 */ + private BigDecimal retailPrice; + + /** 最高零售价 */ + private BigDecimal maximumRetailPrice; + + /** 住院临时医嘱拆分属性 */ + private Integer thoPartAttributeEnum; + private String thoPartAttributeEnum_enumText; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageInitDto.java index 053b9afd..1614d5ff 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageInitDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageInitDto.java @@ -1,7 +1,10 @@ package com.openhis.web.datadictionary.dto; +import java.util.ArrayList; import java.util.List; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import lombok.experimental.Accessors; @@ -16,6 +19,20 @@ import lombok.experimental.Accessors; public class MedicationManageInitDto { private List statusFlagOptions; private List domainFlagOptions; + // 供应商 + private List supplierListOptions; + // 药品类型 + private List medicationCategoryCodeOptions; + // 单位编码 + private List unitCodeOptions; + // 是/否 状态 + private List statusWeatherOptions; + // 权限限制 + private List statusRestrictedOptions; + // 拆分属性 + private List partAttributeEnumOptions; + //住院临时医嘱拆分属性 + private List tempOrderSplitPropertyEnumOptions; /** * 状态 @@ -44,4 +61,36 @@ public class MedicationManageInitDto { this.info = info; } } + + /** + * 供应商 + */ + @Data + public static class supplierListOption { + + @JsonSerialize(using = ToStringSerializer.class) + private Long value; + private String label; + + public supplierListOption(Long value, String label) { + this.value = value; + this.label = label; + } + } + + /** + * 药品类型 + */ + @Data + public static class dictCategoryCode { + private String value; + private String info; + private List children = new ArrayList<>(); + + public dictCategoryCode(String value, String info) { + this.value = value; + this.info = info; + } + } + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java index 61d48ebc..aa77d98d 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationManageUpDto.java @@ -4,10 +4,13 @@ import java.math.BigDecimal; import java.util.Date; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; import lombok.Data; import lombok.experimental.Accessors; @@ -30,8 +33,13 @@ public class MedicationManageUpDto { private Long medicationDefId; /** 所属科室 */ + @JsonSerialize(using = ToStringSerializer.class) private Long orgId; + /** 所在位置 */ + @JsonSerialize(using = ToStringSerializer.class) + private Long locationId; + /** 剂型 */ private String doseFormCode; @@ -48,9 +56,11 @@ public class MedicationManageUpDto { private String lotNumber; /** 生效日期 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") private Date effectiveDate; /** 到期日期 */ + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") private Date expirationDate; /** 用法 */ @@ -63,7 +73,10 @@ public class MedicationManageUpDto { private BigDecimal dose; /** 剂量单位 */ + @Dict(dictCode = "unit_code") + @NotBlank(message = "剂量单位不能为空") private String doseUnitCode; + private String doseUnitCode_dictText; /** 单次最大剂量 */ private BigDecimal maxUnit; @@ -72,7 +85,6 @@ public class MedicationManageUpDto { private String definition; /** 药品编号 */ - @NotBlank(message = "药品编号不能为空") private String busNo; /** 药品名称 */ @@ -95,7 +107,7 @@ public class MedicationManageUpDto { private String wbStr; /** 药品分类 */ - private Integer categoryCode; + private String categoryCode; /** 商品名称 */ private String merchandiseName; @@ -107,7 +119,9 @@ public class MedicationManageUpDto { private String merchandiseWbStr; /** 药品单位 */ + @Dict(dictCode = "unit_code") private String unitCode; + private String unitCode_dictText; /** 最小单位 */ private String minUnitCode; @@ -122,7 +136,9 @@ public class MedicationManageUpDto { private BigDecimal partPercent; /** 剂量形式 */ + @Dict(dictCode = "dose_from_code") private Integer doseFrom; + private String doseFrom_dictText; /** 批准文号 */ private String approvalNumber; @@ -143,9 +159,14 @@ public class MedicationManageUpDto { private Integer injectFlag; /** 生产厂家 */ + @JsonSerialize(using = ToStringSerializer.class) private Long manufacturerId; + /** 生产厂商文本 */ + private String manufacturerText; + /** 供应商 */ + @JsonSerialize(using = ToStringSerializer.class) private Long supplyId; /** 是否限制使用 */ @@ -160,4 +181,68 @@ public class MedicationManageUpDto { /** 产品特性 */ private Integer characteristic; + /** 购入价 */ + @NotNull(message = "购入价不能为空") + private BigDecimal purchasePrice; + + /** 零售价 */ + @NotNull(message = "零售价不能为空") + private BigDecimal retailPrice; + + /** 最高零售价 */ + @NotNull(message = "最高零售价不能为空") + private BigDecimal maximumRetailPrice; + + /** 医保类别 */ + private String ybType; + + /** 财务类别 */ + @Dict(dictCode = "fin_type_code") + private String typeCode; + private String typeCode_dictText; + + /** 单次最小用药频次 */ + private String minRateCode; + + /** 单次最大用药频次 */ + private String maxRateCode; + + /** 药品状态 */ + private Integer statusEnum; + private String statusEnum_enumText; + + /** 拆分属性 */ + private Integer partAttributeEnum; + + /** 贯标国家编码 */ + private String nationalDrugCode; + + /** 是否抗生素 */ + private Integer antibioticFlag; + + /** 是否自制 */ + private Integer selfFlag; + + /** DDD值 */ + private String dddCode; + + /** DDD单位 */ + private String dddUnitCode; + + /** 用量限定 */ + private BigDecimal usageLimit; + + /** 抗生素分类 */ + @Dict(dictCode = "antibiotic_type_code") + private String antibioticCode; + private String antibioticCode_dictText; + + /** 权限限制 */ + private Integer restrictedEnum; + + /** 基药标识 */ + private Integer basicFlag; + + /** 住院临时医嘱拆分属性 */ + private Integer thoPartAttributeEnum; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationSearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationSearchParam.java new file mode 100644 index 00000000..a8f2c5d2 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/MedicationSearchParam.java @@ -0,0 +1,22 @@ +package com.openhis.web.datadictionary.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 药品查询信息 + * + * @author liuhr + * @date 2025/3/27 + */ +@Data +@Accessors(chain = true) +public class MedicationSearchParam { + + /** 医保是否对码 */ + private Integer ybMatchFlag; + /** 药品状态 */ + private Integer statusEnum; + /** 药品分类 */ + private String categoryCode; +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/SupplierDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/SupplierDto.java index c4f145c5..b2169fd5 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/SupplierDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/dto/SupplierDto.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; import lombok.Data; import lombok.experimental.Accessors; @@ -35,6 +36,7 @@ public class SupplierDto { /** 类型 */ private Integer typeEnum; + private String typeEnum_enumText; /** 地址 */ private String address; @@ -57,5 +59,7 @@ public class SupplierDto { /** 机构编号 */ @JsonSerialize(using = ToStringSerializer.class) + @Dict(dictTable = "adm_organization",dictCode = "id",dictText = "name") private Long orgId; + private String orgId_dictText; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/mapper/ActivityDefinitionManageMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/mapper/ActivityDefinitionManageMapper.java new file mode 100644 index 00000000..5a4f0937 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/mapper/ActivityDefinitionManageMapper.java @@ -0,0 +1,40 @@ +package com.openhis.web.datadictionary.mapper; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto; + +/** + * 诊疗定义管理 + * + * @author liuhr + * @date 2025/3/28 + */ +@Repository +public interface ActivityDefinitionManageMapper { + + /** + * 诊疗目录分页查询 + * + * @param page 分页参数 + * @param queryWrapper 查询条件 + * @return 器材记录 + */ + IPage getDiseaseTreatmentPage(@Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + /** + * 诊疗详情 + * + * @param id 诊疗ID + * @param tenantId 租户 + * @return + */ + DiagnosisTreatmentDto getDiseaseTreatmentOne(@Param("id") Long id, @Param("tenantId") Integer tenantId); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/mapper/DeviceManageMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/mapper/DeviceManageMapper.java new file mode 100644 index 00000000..b6cabe7e --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/mapper/DeviceManageMapper.java @@ -0,0 +1,42 @@ +package com.openhis.web.datadictionary.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.datadictionary.dto.DeviceManageDto; +import com.openhis.web.datadictionary.dto.MedicationManageDto; +import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto; +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +/** + * 器材目录 + * + * @author Wuser + * @date 2025/3/26 + */ +@Repository +public interface DeviceManageMapper { + + /** + * 器材目录分页查询 + * + * @param page 分页参数 + * @param queryWrapper 查询条件 + * @return 器材记录 + */ + IPage getDevicePage( + @Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + /** + * 器材详情 + * + * @param id 器材ID + * @param tenantId 租户 + * @return + */ + DeviceManageDto getOne(@Param("id") Long id, @Param("tenantId") Integer tenantId); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/mapper/MedicationManageSearchMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/mapper/MedicationManageSearchMapper.java index 47ecd5af..8546160c 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/mapper/MedicationManageSearchMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/datadictionary/mapper/MedicationManageSearchMapper.java @@ -2,6 +2,11 @@ package com.openhis.web.datadictionary.mapper; import java.util.List; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @@ -17,35 +22,18 @@ import com.openhis.web.datadictionary.dto.MedicationManageDto; */ @Repository public interface MedicationManageSearchMapper extends BaseMapper { - /** - * 药品目录分页查询 - * - * @param searchKey 模糊查询条件 - * @param ybMatchFlag 是否对码 - * @param statusEnum 状态 - * @param categoryCode 分类 - * @param tenantId 租户 - * @param pageSize - * @param offset - * @return - */ - List getPage(@Param("searchKey") String searchKey, @Param("ybMatchFlag") Integer ybMatchFlag, - @Param("statusEnum") Integer statusEnum, @Param("categoryCode") String categoryCode, - @Param("tenantId") Integer tenantId, @Param("pageSize") Integer pageSize, @Param("offset") Integer offset); /** * 药品目录分页查询 - * - * @param searchKey 模糊查询条件 - * @param ybMatchFlag 是否对码 - * @param statusEnum 状态 - * @param categoryCode 分类 - * @param tenantId 租户 + * + * @param page 分页 + * @param queryWrapper 查询条件 * @return */ - Long getPageCount(@Param("searchKey") String searchKey, @Param("ybMatchFlag") Integer ybMatchFlag, - @Param("statusEnum") Integer statusEnum, @Param("categoryCode") String categoryCode, - @Param("tenantId") Integer tenantId); + IPage getPage( + @Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + /** * 药品详情 diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationAdviceAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationAdviceAppService.java index 6af98657..8243acb7 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationAdviceAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationAdviceAppService.java @@ -1,7 +1,10 @@ package com.openhis.web.doctorstation.appservice; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.core.common.core.domain.R; import com.openhis.web.doctorstation.dto.AdviceBaseDto; +import com.openhis.web.doctorstation.dto.AdviceSaveDto; +import com.openhis.web.doctorstation.dto.AdviceSaveParam; /** * 医生站-医嘱/处方 应用Service @@ -21,4 +24,12 @@ public interface IDoctorStationAdviceAppService { IPage getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, String searchKey, Long locationId, Integer pageNo, Integer pageSize); + /** + * 门诊保存医嘱 + * + * @param adviceSaveParam 医嘱表单信息 + * @return 结果 + */ + R saveAdvice(AdviceSaveParam adviceSaveParam); + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java index 745d5cee..42a021c0 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationDiagnosisAppService.java @@ -74,4 +74,20 @@ public interface IDoctorStationDiagnosisAppService { */ R getConditionDefinitionBusinessClass(Long patientId); + /** + * 查询就诊诊断信息 + * + * @param encounterId 就诊id + * @return 就诊诊断信息 + */ + R getEncounterDiagnosis(Long encounterId); + + /** + * 删除就诊诊断信息 + * + * @param conditionId 诊断ID + * @return 结果 + */ + R delEncounterDiagnosis(Long conditionId); + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java index 32a18f44..d422e4ac 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/IDoctorStationEmrAppService.java @@ -52,4 +52,10 @@ public interface IDoctorStationEmrAppService { */ R deleteEmrTemplate(Long id); + /** + * 获取病历详情 + * @param encounterId 就诊id + * @return 病历详情 + */ + R getEmrDetail(Long encounterId); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java index ffa188be..c347dc02 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationAdviceAppServiceImpl.java @@ -1,9 +1,6 @@ package com.openhis.web.doctorstation.appservice.impl; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; import javax.annotation.Resource; @@ -13,16 +10,27 @@ import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.core.common.core.domain.R; +import com.core.common.utils.AssignSeqUtil; +import com.core.common.utils.MessageUtils; +import com.openhis.administration.domain.ChargeItem; +import com.openhis.administration.domain.OrganizationLocation; +import com.openhis.administration.service.IChargeItemService; +import com.openhis.administration.service.IOrganizationLocationService; import com.openhis.common.constant.CommonConstants; -import com.openhis.common.enums.ActivityType; -import com.openhis.common.enums.ConditionCode; +import com.openhis.common.constant.PromptMsgConstant; +import com.openhis.common.enums.*; import com.openhis.common.utils.EnumUtils; import com.openhis.common.utils.HisQueryUtils; +import com.openhis.medication.domain.MedicationRequest; +import com.openhis.medication.service.IMedicationRequestService; import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService; -import com.openhis.web.doctorstation.dto.AdviceBaseDto; -import com.openhis.web.doctorstation.dto.AdviceInventoryDto; -import com.openhis.web.doctorstation.dto.AdvicePriceDto; +import com.openhis.web.doctorstation.dto.*; import com.openhis.web.doctorstation.mapper.DoctorStationAdviceAppMapper; +import com.openhis.workflow.domain.DeviceRequest; +import com.openhis.workflow.domain.ServiceRequest; +import com.openhis.workflow.service.IDeviceRequestService; +import com.openhis.workflow.service.IServiceRequestService; /** * 医生站-医嘱/处方 应用实现类 @@ -30,9 +38,27 @@ import com.openhis.web.doctorstation.mapper.DoctorStationAdviceAppMapper; @Service public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAppService { + @Resource + AssignSeqUtil assignSeqUtil; + @Resource DoctorStationAdviceAppMapper doctorStationAdviceAppMapper; + @Resource + IMedicationRequestService iMedicationRequestService; + + @Resource + IDeviceRequestService iDeviceRequestService; + + @Resource + IServiceRequestService iServiceRequestService; + + @Resource + IChargeItemService iChargeItemService; + + @Resource + IOrganizationLocationService iOrganizationLocationService; + /** * 查询医嘱信息 * @@ -52,7 +78,7 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp IPage adviceBaseInfo = doctorStationAdviceAppMapper.getAdviceBaseInfo(new Page<>(pageNo, pageSize), CommonConstants.TableName.MED_MEDICATION_DEFINITION, CommonConstants.TableName.ADM_DEVICE_DEFINITION, - CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, queryWrapper); + CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, DeviceCategory.SINGLE_USE.getCode(), queryWrapper); List adviceBaseDtoList = adviceBaseInfo.getRecords(); // 医嘱定义ID集合 List adviceDefinitionIdList = @@ -63,73 +89,319 @@ public class DoctorStationAdviceAppServiceImpl implements IDoctorStationAdviceAp // 医嘱库存集合 List adviceInventory = doctorStationAdviceAppMapper.getAdviceInventory(locationId, adviceDefinitionIdList, CommonConstants.SqlCondition.ABOUT_INVENTORY_TABLE_STR); + // TODO: 预减库存待处理 + // 费用定价子表信息 List childCharge = doctorStationAdviceAppMapper - .getChildCharge(ConditionCode.UNIT_PRODUCT_BATCH_NUM.getInfo(), chargeItemDefinitionIdList); + .getChildCharge(ConditionCode.UNIT_PRODUCT_BATCH_NUM.getCode(), chargeItemDefinitionIdList); // 费用定价主表信息 List mainCharge = doctorStationAdviceAppMapper.getMainCharge(chargeItemDefinitionIdList); - // 药品和耗材 - List medicationAndDeviceList = adviceBaseDtoList.stream() - .filter(e -> CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(e.getAdviceTableName()) - || CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(e.getAdviceTableName())) - .collect(Collectors.toList()); - // 药品和耗材-赋值 + String unitCode = ""; // 包装单位 - String minUnitCode; // 小单位 Long chargeItemDefinitionId; // 费用定价主表ID - for (AdviceBaseDto baseDto : medicationAndDeviceList) { - // 每一条医嘱的库存集合信息 - List inventoryList = - adviceInventory.stream().filter(e -> baseDto.getAdviceDefinitionId().equals(e.getItemId()) - && baseDto.getAdviceTableName().equals(e.getItemTable())).collect(Collectors.toList()); - // 库存信息 - baseDto.setInventoryList(inventoryList); - - unitCode = baseDto.getUnitCode(); - minUnitCode = baseDto.getMinUnitCode(); - chargeItemDefinitionId = baseDto.getChargeItemDefinitionId(); - - List priceDtoList = new ArrayList<>(); - // 库存信息里取 单位,产品批号 去匹配价格 - for (AdviceInventoryDto adviceInventoryDto : inventoryList) { - Long finalChargeItemDefinitionId = chargeItemDefinitionId; - String finalUnitCode = unitCode; - String finalMinUnitCode = minUnitCode; - // 匹配包装单位 - List advicePrice1 = childCharge.stream() - .filter(e -> e.getDefinitionId().equals(finalChargeItemDefinitionId) && e.getConditionValue() - .equals(String.format(CommonConstants.Common.COMMA_FORMAT, finalUnitCode, - adviceInventoryDto.getLotNumber()))) - .peek(e -> e.setUnitCode(finalUnitCode)) // 设置 unitCode - .collect(Collectors.toList()); - // 匹配最小单位 - List advicePrice2 = childCharge.stream() - .filter(e -> e.getDefinitionId().equals(finalChargeItemDefinitionId) && e.getConditionValue() - .equals(String.format(CommonConstants.Common.COMMA_FORMAT, finalMinUnitCode, - adviceInventoryDto.getLotNumber()))) - .peek(e -> e.setUnitCode(finalMinUnitCode)) // 设置 unitCode - .collect(Collectors.toList()); - priceDtoList.addAll(advicePrice1); - priceDtoList.addAll(advicePrice2); + for (AdviceBaseDto baseDto : adviceBaseDtoList) { + // 药品和耗材 + if (CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(baseDto.getAdviceTableName()) + || CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(baseDto.getAdviceTableName())) { + // 每一条医嘱的库存集合信息 , 包装单位库存前端计算 + List inventoryList = + adviceInventory.stream().filter(e -> baseDto.getAdviceDefinitionId().equals(e.getItemId()) + && baseDto.getAdviceTableName().equals(e.getItemTable())).collect(Collectors.toList()); + // 库存信息 + baseDto.setInventoryList(inventoryList); + unitCode = baseDto.getUnitCode(); + chargeItemDefinitionId = baseDto.getChargeItemDefinitionId(); + List priceDtoList = new ArrayList<>(); + // 库存信息里取 命中条件 去匹配价格 + for (AdviceInventoryDto adviceInventoryDto : inventoryList) { + Long finalChargeItemDefinitionId = chargeItemDefinitionId; + String finalUnitCode = unitCode; + // 匹配包装单位 + List advicePrice1 = childCharge.stream() + .filter(e -> e.getDefinitionId().equals(finalChargeItemDefinitionId) + && e.getConditionValue().equals(adviceInventoryDto.getLotNumber())) + .peek(e -> e.setUnitCode(finalUnitCode)) // 设置 unitCode + .collect(Collectors.toList()); + priceDtoList.addAll(advicePrice1); + } + // 价格信息 + baseDto.setPriceList(priceDtoList); + } + // 诊疗活动 + else if (CommonConstants.TableName.WOR_ACTIVITY_DEFINITION.equals(baseDto.getAdviceTableName())) { + List priceList = + mainCharge.stream().filter(e -> baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId())) + .collect(Collectors.toList()); + // 价格信息 + baseDto.setPriceList(priceList); + // 活动类型 + baseDto + .setActivityType_enumText(EnumUtils.getInfoByValue(ActivityType.class, baseDto.getActivityType())); } - // 价格信息 - baseDto.setPriceList(priceDtoList); - } - // 诊疗 - List activityList = adviceBaseDtoList.stream() - .filter(e -> CommonConstants.TableName.WOR_ACTIVITY_DEFINITION.equals(e.getAdviceTableName())) - .collect(Collectors.toList()); - // 诊疗-赋值 - for (AdviceBaseDto baseDto : activityList) { - // 活动类型 - baseDto.setActivityType_enumText(EnumUtils.getInfoByValue(ActivityType.class, baseDto.getActivityType())); - List priceList = - mainCharge.stream().filter(e -> baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId())) - .collect(Collectors.toList()); - // 价格信息 - baseDto.setPriceList(priceList); } + return adviceBaseInfo; + + // 下面的注释不要删除 2025.03.27 + // // 药品和耗材 + // List medicationAndDeviceList = adviceBaseDtoList.stream() + // .filter(e -> CommonConstants.TableName.MED_MEDICATION_DEFINITION.equals(e.getAdviceTableName()) + // || CommonConstants.TableName.ADM_DEVICE_DEFINITION.equals(e.getAdviceTableName())) + // .collect(Collectors.toList()); + // // 药品和耗材-赋值 + // String unitCode = ""; // 包装单位 + // String minUnitCode; // 小单位 + // Long chargeItemDefinitionId; // 费用定价主表ID + // for (AdviceBaseDto baseDto : medicationAndDeviceList) { + // // 每一条医嘱的库存集合信息 + // List inventoryList = + // adviceInventory.stream().filter(e -> baseDto.getAdviceDefinitionId().equals(e.getItemId()) + // && baseDto.getAdviceTableName().equals(e.getItemTable())).collect(Collectors.toList()); + // // 库存信息 + // baseDto.setInventoryList(inventoryList); + // + // unitCode = baseDto.getUnitCode(); + // minUnitCode = baseDto.getMinUnitCode(); + // chargeItemDefinitionId = baseDto.getChargeItemDefinitionId(); + // + // List priceDtoList = new ArrayList<>(); + // // 库存信息里取 单位,产品批号 去匹配价格 + // for (AdviceInventoryDto adviceInventoryDto : inventoryList) { + // Long finalChargeItemDefinitionId = chargeItemDefinitionId; + // String finalUnitCode = unitCode; + // String finalMinUnitCode = minUnitCode; + // // 匹配包装单位 + // List advicePrice1 = childCharge.stream() + // .filter(e -> e.getDefinitionId().equals(finalChargeItemDefinitionId) && e.getConditionValue() + // .equals(String.format(CommonConstants.Common.COMMA_FORMAT, finalUnitCode, + // adviceInventoryDto.getLotNumber()))) + // .peek(e -> e.setUnitCode(finalUnitCode)) // 设置 unitCode + // .collect(Collectors.toList()); + // // 匹配最小单位 + // List advicePrice2 = childCharge.stream() + // .filter(e -> e.getDefinitionId().equals(finalChargeItemDefinitionId) && e.getConditionValue() + // .equals(String.format(CommonConstants.Common.COMMA_FORMAT, finalMinUnitCode, + // adviceInventoryDto.getLotNumber()))) + // .peek(e -> e.setUnitCode(finalMinUnitCode)) // 设置 unitCode + // .collect(Collectors.toList()); + // priceDtoList.addAll(advicePrice1); + // priceDtoList.addAll(advicePrice2); + // } + // // 价格信息 + // baseDto.setPriceList(priceDtoList); + // } + // // 诊疗 + // List activityList = adviceBaseDtoList.stream() + // .filter(e -> CommonConstants.TableName.WOR_ACTIVITY_DEFINITION.equals(e.getAdviceTableName())) + // .collect(Collectors.toList()); + // // 诊疗-赋值 + // for (AdviceBaseDto baseDto : activityList) { + // // 活动类型 + // baseDto.setActivityType_enumText(EnumUtils.getInfoByValue(ActivityType.class, baseDto.getActivityType())); + // List priceList = + // mainCharge.stream().filter(e -> baseDto.getChargeItemDefinitionId().equals(e.getDefinitionId())) + // .collect(Collectors.toList()); + // // 价格信息 + // baseDto.setPriceList(priceList); + // } + + } + + /** + * 门诊保存医嘱 + * + * @param adviceSaveParam 医嘱表单信息 + * @return 结果 + */ + @Override + public R saveAdvice(AdviceSaveParam adviceSaveParam) { + // 医嘱分类信息 + List adviceSaveList = adviceSaveParam.getAdviceSaveList(); + // TODO: 保存医嘱时规则校验;待做 + // 药品 + List medicineList = adviceSaveList.stream() + .filter(e -> ItemType.MEDICINE.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); + // 耗材 + List deviceList = adviceSaveList.stream() + .filter(e -> ItemType.DEVICE.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); + // 诊疗活动 + List activityList = adviceSaveList.stream() + .filter(e -> ItemType.ACTIVITY.getValue().equals(e.getAdviceType())).collect(Collectors.toList()); + // 生成处方号 , 只有开了药品才有处方号 + String prescriptionNo = ""; + if (medicineList.size() > 0) { + // TODO: 药品分方;待做 + prescriptionNo = assignSeqUtil.getSeq(AssignSeqEnum.PRESCRIPTION_NO.getPrefix(), 8); + } + // 声明费用项 + ChargeItem chargeItem; + // 保存药品请求 + MedicationRequest medicationRequest; + for (AdviceSaveDto adviceSaveDto : medicineList) { + medicationRequest = new MedicationRequest(); + medicationRequest.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 10)); + medicationRequest.setPrescriptionNo(prescriptionNo); // 处方号 + medicationRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量 + medicationRequest.setExecuteNum(adviceSaveDto.getExecuteNum()); // 执行次数 + medicationRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码 + medicationRequest.setLotNumber(adviceSaveDto.getLotNumber()); // 产品批号 + medicationRequest.setStatusEnum(adviceSaveDto.getStatusEnum()); // 请求状态,默认-待发送 + medicationRequest.setCategoryEnum(adviceSaveDto.getCategoryEnum()); // 请求类型,默认-门诊 + medicationRequest.setMedicationId(adviceSaveDto.getAdviceDefinitionId());// 医嘱定义id + medicationRequest.setPatientId(adviceSaveDto.getPatientId()); // 患者 + medicationRequest.setPractitionerId(adviceSaveDto.getPractitionerId()); // 开方医生 + medicationRequest.setOrgId(adviceSaveDto.getOrgId()); // 开方人科室 + // 查询机构位置关系 + OrganizationLocation orgLocByOrgIdAndCategoryCode = iOrganizationLocationService + .getOrgLocByOrgIdAndCategoryCode(adviceSaveDto.getOrgId(), adviceSaveDto.getCategoryCode()); + if (orgLocByOrgIdAndCategoryCode != null) { + // 发放药房 + medicationRequest.setPerformLocation(orgLocByOrgIdAndCategoryCode.getDefLocationId()); + } + // medicationRequest.setLocationId(adviceSaveDto.getLocationId()); // 请求发起的位置 + medicationRequest.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id + medicationRequest.setConditionId(adviceSaveDto.getConditionId()); // 诊断id + medicationRequest.setTherapyEnum(adviceSaveDto.getTherapyEnum()); // 治疗类型,默认-临时 + medicationRequest.setMethodCode(adviceSaveDto.getMethodCode()); // 用法 + medicationRequest.setRateCode(adviceSaveDto.getRateCode()); // 用药频次 + medicationRequest.setDose(adviceSaveDto.getDose()); // 单次剂量 + medicationRequest.setDoseUnitCode(adviceSaveDto.getDoseUnitCode()); // 剂量单位 + medicationRequest.setDispensePerDuration(adviceSaveDto.getDispensePerDuration()); // 每次发药供应天数 + medicationRequest.setSkinTestFlag(adviceSaveDto.getSkinTestFlag()); // 皮试标记 + medicationRequest.setGroupId(adviceSaveDto.getGroupId());// 分组id + // medicationRequest.setPackageId(adviceSaveDto.getPackageId()); // 组套id + + iMedicationRequestService.save(medicationRequest); + + // 保存药品费用项 + chargeItem = new ChargeItem(); + chargeItem.setStatusEnum(ChargeItemStatus.PLANNED.getValue()); // 默认-待收费 + chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(medicationRequest.getBusNo())); + chargeItem.setPrescriptionNo(prescriptionNo); // 处方号 + chargeItem.setPatientId(adviceSaveDto.getPatientId()); // 患者 + chargeItem.setContextEnum(adviceSaveDto.getAdviceType()); // 类型 + chargeItem.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id + chargeItem.setDefinitionId(adviceSaveDto.getDefinitionId()); // 费用定价ID + chargeItem.setDefDetailId(adviceSaveDto.getDefinitionDetailId()); // 定价子表主键 + chargeItem.setEntererId(adviceSaveDto.getPractitionerId());// 开立人ID + chargeItem.setEnteredDate(new Date()); // 开立时间 + chargeItem.setServiceTable("med_medication_request");// 医疗服务类型 + chargeItem.setServiceId(medicationRequest.getId()); // 医疗服务ID + chargeItem.setProductTable(adviceSaveDto.getAdviceTableName());// 产品所在表 + chargeItem.setProductId(adviceSaveDto.getAdviceDefinitionId());// 收费项id + chargeItem.setAccountId(adviceSaveDto.getAccountId());// 关联账户ID + + chargeItem.setQuantityValue(adviceSaveDto.getQuantity()); // 数量 + chargeItem.setQuantityUnit(adviceSaveDto.getUnitCode()); // 单位 + chargeItem.setUnitPrice(adviceSaveDto.getUnitPrice()); // 单价 + chargeItem.setTotalPrice(adviceSaveDto.getTotalPrice()); // 总价 + + iChargeItemService.save(chargeItem); + } + + // 保存耗材请求 + DeviceRequest deviceRequest; + for (AdviceSaveDto adviceSaveDto : deviceList) { + deviceRequest = new DeviceRequest(); + deviceRequest.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 10)); + // deviceRequest.setPrescriptionNo(prescriptionNo); // 耗材不需要处方号 + deviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量 + deviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码 + deviceRequest.setLotNumber(adviceSaveDto.getLotNumber());// 产品批号 + deviceRequest.setStatusEnum(adviceSaveDto.getStatusEnum()); // 请求状态,默认-待发送 + deviceRequest.setCategoryEnum(adviceSaveDto.getCategoryEnum()); // 请求类型,默认-门诊 + deviceRequest.setDeviceDefId(adviceSaveDto.getAdviceDefinitionId());// 耗材定义id + deviceRequest.setPatientId(adviceSaveDto.getPatientId()); // 患者 + deviceRequest.setRequesterId(adviceSaveDto.getPractitionerId()); // 开方医生 + deviceRequest.setOrgId(adviceSaveDto.getOrgId());// 开方人科室 + // 查询机构位置关系 + OrganizationLocation orgLocByOrgIdAndCategoryCode = iOrganizationLocationService + .getOrgLocByOrgIdAndCategoryCode(adviceSaveDto.getOrgId(), adviceSaveDto.getCategoryCode()); + if (orgLocByOrgIdAndCategoryCode != null) { + // 发放耗材房 + deviceRequest.setPerformLocation(orgLocByOrgIdAndCategoryCode.getDefLocationId()); + } + // deviceRequest.setLocationId(adviceSaveDto.getLocationId()); 请求发起的位置 + deviceRequest.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id + // deviceRequest.setPackageId(adviceSaveDto.getPackageId()); // 组套id + // deviceRequest.setActivityId(adviceSaveDto.getActivityId()); + + iDeviceRequestService.save(deviceRequest); + + // 保存耗材费用项 + chargeItem = new ChargeItem(); + chargeItem.setStatusEnum(ChargeItemStatus.PLANNED.getValue()); // 默认-待收费 + chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(deviceRequest.getBusNo())); + chargeItem.setPrescriptionNo(prescriptionNo); // 处方号 + chargeItem.setPatientId(adviceSaveDto.getPatientId()); // 患者 + chargeItem.setContextEnum(adviceSaveDto.getAdviceType()); // 类型 + chargeItem.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id + chargeItem.setDefinitionId(adviceSaveDto.getDefinitionId()); // 费用定价ID + chargeItem.setDefDetailId(adviceSaveDto.getDefinitionDetailId()); // 定价子表主键 + chargeItem.setEntererId(adviceSaveDto.getPractitionerId());// 开立人ID + chargeItem.setEnteredDate(new Date()); // 开立时间 + chargeItem.setServiceTable("wor_device_request");// 医疗服务类型 + chargeItem.setServiceId(deviceRequest.getId()); // 医疗服务ID + chargeItem.setProductTable(adviceSaveDto.getAdviceTableName());// 产品所在表 + chargeItem.setProductId(adviceSaveDto.getAdviceDefinitionId());// 收费项id + chargeItem.setAccountId(adviceSaveDto.getAccountId());// 关联账户ID + + chargeItem.setQuantityValue(adviceSaveDto.getQuantity()); // 数量 + chargeItem.setQuantityUnit(adviceSaveDto.getUnitCode()); // 单位 + chargeItem.setUnitPrice(adviceSaveDto.getUnitPrice()); // 单价 + chargeItem.setTotalPrice(adviceSaveDto.getTotalPrice()); // 总价 + + iChargeItemService.save(chargeItem); + } + + // 保存诊疗项目请求 + ServiceRequest serviceRequest; + for (AdviceSaveDto adviceSaveDto : activityList) { + serviceRequest = new ServiceRequest(); + serviceRequest.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 10)); + // serviceRequest.setPrescriptionNo(prescriptionNo); // 诊疗不需要处方号 + serviceRequest.setBasedOnTable(CommonConstants.TableName.WOR_ACTIVITY_DEFINITION); + serviceRequest.setBasedOnId(adviceSaveDto.getAdviceDefinitionId()); + serviceRequest.setQuantity(adviceSaveDto.getQuantity()); // 请求数量 + serviceRequest.setUnitCode(adviceSaveDto.getUnitCode()); // 请求单位编码 + serviceRequest.setStatusEnum(adviceSaveDto.getStatusEnum());// 请求状态,默认-待发送 + serviceRequest.setCategoryEnum(adviceSaveDto.getCategoryEnum()); // 请求类型,默认-门诊 + serviceRequest.setActivityId(adviceSaveDto.getAdviceDefinitionId());// 诊疗定义id + serviceRequest.setPatientId(adviceSaveDto.getPatientId()); // 患者 + serviceRequest.setRequesterId(adviceSaveDto.getPractitionerId()); // 开方医生 + serviceRequest.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id + + iServiceRequestService.save(serviceRequest); + + // 保存诊疗费用项 + chargeItem = new ChargeItem(); + chargeItem.setStatusEnum(ChargeItemStatus.PLANNED.getValue()); // 默认-待收费 + chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(serviceRequest.getBusNo())); + chargeItem.setPrescriptionNo(prescriptionNo); // 处方号 + chargeItem.setPatientId(adviceSaveDto.getPatientId()); // 患者 + chargeItem.setContextEnum(adviceSaveDto.getAdviceType()); // 类型 + chargeItem.setEncounterId(adviceSaveDto.getEncounterId()); // 就诊id + chargeItem.setDefinitionId(adviceSaveDto.getDefinitionId()); // 费用定价ID + chargeItem.setDefDetailId(adviceSaveDto.getDefinitionDetailId()); // 定价子表主键 + chargeItem.setEntererId(adviceSaveDto.getPractitionerId());// 开立人ID + chargeItem.setEnteredDate(new Date()); // 开立时间 + chargeItem.setServiceTable("wor_service_request");// 医疗服务类型 + chargeItem.setServiceId(serviceRequest.getId()); // 医疗服务ID + chargeItem.setProductTable(adviceSaveDto.getAdviceTableName());// 产品所在表 + chargeItem.setProductId(adviceSaveDto.getAdviceDefinitionId());// 收费项id + chargeItem.setAccountId(adviceSaveDto.getAccountId());// 关联账户ID + + chargeItem.setQuantityValue(adviceSaveDto.getQuantity()); // 数量 + chargeItem.setQuantityUnit(adviceSaveDto.getUnitCode()); // 单位 + chargeItem.setUnitPrice(adviceSaveDto.getUnitPrice()); // 单价 + chargeItem.setTotalPrice(adviceSaveDto.getTotalPrice()); // 总价 + + iChargeItemService.save(chargeItem); + } + + // TODO: 此处调用请求发放接口 + + return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"门诊医嘱"})); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java index 205b926c..5bdc12ec 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationDiagnosisAppServiceImpl.java @@ -26,10 +26,7 @@ import com.openhis.clinical.service.IConditionService; import com.openhis.clinical.service.IDiagnosisBelongBindingService; import com.openhis.common.constant.CommonConstants; import com.openhis.common.constant.PromptMsgConstant; -import com.openhis.common.enums.BindingType; -import com.openhis.common.enums.ConditionDefinitionSource; -import com.openhis.common.enums.PublicationStatus; -import com.openhis.common.enums.Whether; +import com.openhis.common.enums.*; import com.openhis.common.utils.EnumUtils; import com.openhis.common.utils.HisPageUtils; import com.openhis.common.utils.HisQueryUtils; @@ -66,6 +63,10 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn */ @Override public R addDiagnosisBelongBinding(DiagnosisBelongBindingDto diagnosisBelongBindingDto) { + // 如果绑定类型是个人,objectId 存储当前登录账号id + if (BindingType.PERSONAL.getValue().equals(diagnosisBelongBindingDto.getBindingEnum())) { + diagnosisBelongBindingDto.setObjectId(SecurityUtils.getLoginUser().getUserId()); + } DiagnosisBelongBinding diagnosisBelongBinding = new DiagnosisBelongBinding(); BeanUtils.copyProperties(diagnosisBelongBindingDto, diagnosisBelongBinding); // 校验是否重复新增 @@ -88,6 +89,10 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn */ @Override public R updateDiagnosisBelongBinding(DiagnosisBelongBindingDto diagnosisBelongBindingDto) { + // 如果绑定类型是个人,objectId 存储当前登录账号id + if (BindingType.PERSONAL.getValue().equals(diagnosisBelongBindingDto.getBindingEnum())) { + diagnosisBelongBindingDto.setObjectId(SecurityUtils.getLoginUser().getUserId()); + } DiagnosisBelongBinding diagnosisBelongBinding = new DiagnosisBelongBinding(); BeanUtils.copyProperties(diagnosisBelongBindingDto, diagnosisBelongBinding); // 校验是否重复编辑 @@ -240,6 +245,46 @@ public class DoctorStationDiagnosisAppServiceImpl implements IDoctorStationDiagn return R.ok(conditionDefinitionBusinessClass); } + /** + * 查询就诊诊断信息 + * + * @param encounterId 就诊id + * @return 就诊诊断信息 + */ + @Override + public R getEncounterDiagnosis(Long encounterId) { + List encounterDiagnosis = doctorStationDiagnosisAppMapper.getEncounterDiagnosis(encounterId); + for (DiagnosisQueryDto diagnosis : encounterDiagnosis) { + // 中医诊断/西医诊断 + if (ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_DIAGNOSIS.getValue() + .equals(diagnosis.getSourceEnum()) + || ConditionDefinitionSource.TRADITIONAL_CHINESE_MEDICINE_SYNDROME_CATALOG.getValue() + .equals(diagnosis.getSourceEnum())) { + diagnosis.setTypeName(CommonConstants.BusinessName.TCM_DIAGNOSIS); + } else { + diagnosis.setTypeName(CommonConstants.BusinessName.WESTERN_MEDICINE_DIAGNOSIS); + } + // 验证状态 + diagnosis.setVerificationStatusEnum_enumText( + EnumUtils.getInfoByValue(ConditionVerificationStatus.class, diagnosis.getVerificationStatusEnum())); + } + return R.ok(encounterDiagnosis); + } + + /** + * 删除就诊诊断信息 + * + * @param conditionId 诊断ID + * @return 结果 + */ + @Override + public R delEncounterDiagnosis(Long conditionId) { + iConditionService.removeById(conditionId); + iEncounterDiagnosisService + .remove(new LambdaQueryWrapper().eq(EncounterDiagnosis::getConditionId, conditionId)); + return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"就诊诊断信息"})); + } + /** * 处理诊断定义元数据 * diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java index 3520e9f8..535b2627 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationEmrAppServiceImpl.java @@ -13,8 +13,11 @@ import org.springframework.stereotype.Service; import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.TypeReference; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.core.common.core.domain.R; +import com.core.common.utils.SecurityUtils; +import com.openhis.common.enums.BindingType; import com.openhis.document.domain.Emr; import com.openhis.document.domain.EmrDetail; import com.openhis.document.domain.EmrDict; @@ -56,7 +59,16 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi Emr emr = new Emr(); BeanUtils.copyProperties(patientEmrDto, emr); String contextStr = patientEmrDto.getContextJson().toString(); - boolean saveSuccess = emrService.save(emr.setContextJson(contextStr)); + Emr patientEmr = emrService.getOne(new LambdaQueryWrapper().eq(Emr::getEncounterId, emr.getEncounterId())); + boolean saveSuccess; + // 如果已经保存病历,再次保存走更新 + if (patientEmr != null) { + saveSuccess = emrService.update(new LambdaUpdateWrapper().eq(Emr::getEncounterId, emr.getEncounterId()) + .set(Emr::getContextJson, contextStr)); + } else { + saveSuccess = + emrService.save(emr.setContextJson(contextStr).setRecordId(SecurityUtils.getLoginUser().getUserId())); + } if (!saveSuccess) { return R.fail(); } @@ -69,14 +81,18 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi // 遍历病历内容map for (Map.Entry entry : emrContextMap.entrySet()) { EmrDetail emrDetail = new EmrDetail(); - emrDetail.setEmrId(emr.getId()); if (!emrDictList.isEmpty() && emrDictList.contains(entry.getKey())) { + emrDetail.setEmrId(emr.getId()); emrDetail.setEmrKey(entry.getKey()); emrDetail.setEmrValue(entry.getValue()); } emrDetailList.add(emrDetail); } - boolean save = emrDetailService.saveBatch(emrDetailList); + boolean save = true; + if (!emrDictList.isEmpty()) { + save = emrDetailService.saveBatch(emrDetailList); + } + return save ? R.ok() : R.fail(); } @@ -95,6 +111,18 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi return R.ok(page); } + /** + * 获取病历详情 + * + * @param encounterId 就诊id + * @return 病历详情 + */ + @Override + public R getEmrDetail(Long encounterId) { + Emr emrDetail = emrService.getOne(new LambdaQueryWrapper().eq(Emr::getEncounterId, encounterId)); + return R.ok(emrDetail); + } + /** * 保存病历模板 * @@ -104,7 +132,11 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi @Override public R addEmrTemplate(EmrTemplateDto emrTemplateDto) { EmrTemplate emrTemplate = new EmrTemplate(); + String contextStr = emrTemplateDto.getContextJson().toString(); BeanUtils.copyProperties(emrTemplateDto, emrTemplate); + // todo 获取当前登录用户的科室id + emrTemplate.setUserId(SecurityUtils.getLoginUser().getUserId()); + emrTemplate.setContextJson(contextStr); return emrTemplateService.save(emrTemplate) ? R.ok() : R.fail(); } @@ -119,9 +151,14 @@ public class DoctorStationEmrAppServiceImpl implements IDoctorStationEmrAppServi @Override public R getEmrTemplate(EmrTemplateDto emrTemplateDto, Integer pageNo, Integer pageSize) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.like(EmrTemplate::getTemplateName, emrTemplateDto.getTemplateName()) - .eq(EmrTemplate::getUseScopeCode, emrTemplateDto.getUseScopeCode()) - .eq(EmrTemplate::getUserId, emrTemplateDto.getUserId()); + queryWrapper + .eq(EmrTemplate::getUseScopeCode, emrTemplateDto.getUseScopeCode()); + if (emrTemplateDto.getTemplateName() != null){ + queryWrapper.like(EmrTemplate::getTemplateName, emrTemplateDto.getTemplateName()); + } + if (BindingType.PERSONAL.getValue().toString().equals(emrTemplateDto.getUseScopeCode())) { + queryWrapper.eq(EmrTemplate::getUserId, SecurityUtils.getLoginUser().getUserId()); + } Page emrTemplatePage = emrTemplateService.page(new Page<>(pageNo, pageSize), queryWrapper); return R.ok(emrTemplatePage); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java index 90408bb5..b78f4427 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/appservice/impl/DoctorStationMainAppServiceImpl.java @@ -53,6 +53,7 @@ public class DoctorStationMainAppServiceImpl implements IDoctorStationMainAppSer // TODO: userId(当前登录账号ID) 和 currentUserOrganizationId(当前登录账号所属的科室ID) 待补充 // 当前登录账号ID Long userId = SecurityUtils.getLoginUser().getUserId(); + Long currentUserOrganizationId = SecurityUtils.getLoginUser().getOrgId(); IPage patientInfo = doctorStationMainAppMapper.getPatientInfo(new Page<>(pageNo, pageSize), ParticipantType.ADMITTER.getCode(), ClinicalStatus.INACTIVE.getValue(), null, null, queryWrapper); patientInfo.getRecords().forEach(e -> { diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationAdviceController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationAdviceController.java index 4817d37a..78d61f83 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationAdviceController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationAdviceController.java @@ -3,14 +3,12 @@ */ package com.openhis.web.doctorstation.controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.core.common.core.domain.R; import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService; import com.openhis.web.doctorstation.dto.AdviceBaseDto; +import com.openhis.web.doctorstation.dto.AdviceSaveParam; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -39,11 +37,22 @@ public class DoctorStationAdviceController { @GetMapping(value = "/advice-base-info") public R getAdviceBaseInfo(AdviceBaseDto adviceBaseDto, @RequestParam(value = "searchKey", defaultValue = "") String searchKey, - @RequestParam(value = "locationId",required = false) Long locationId, + @RequestParam(value = "locationId", required = false) Long locationId, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { return R.ok( iDoctorStationAdviceAppService.getAdviceBaseInfo(adviceBaseDto, searchKey, locationId, pageNo, pageSize)); } + /** + * 门诊保存医嘱 + * + * @param adviceSaveParam 医嘱表单信息 + * @return 结果 + */ + @PostMapping(value = "/save-advice") + public R saveAdvice(@RequestBody AdviceSaveParam adviceSaveParam) { + return iDoctorStationAdviceAppService.saveAdvice(adviceSaveParam); + } + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java index 51f935d6..4df2744d 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationDiagnosisController.java @@ -147,4 +147,27 @@ public class DoctorStationDiagnosisController { return iDoctorStationDiagnosisAppService.getConditionDefinitionBusinessClass(patientId); } + /** + * 查询就诊诊断信息 + * + * @param encounterId 就诊id + * @return 就诊诊断信息 + */ + @GetMapping(value = "/get-encounter-diagnosis") + public R getEncounterDiagnosis(@RequestParam Long encounterId) { + return iDoctorStationDiagnosisAppService.getEncounterDiagnosis(encounterId); + } + + /** + * 删除就诊诊断信息 + * + * @param conditionId 诊断ID + * @return 结果 + */ + @DeleteMapping(value = "/encounter-diagnosis") + public R delEncounterDiagnosis(@RequestParam Long conditionId) { + return iDoctorStationDiagnosisAppService.delEncounterDiagnosis(conditionId); + } + + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java index 841a0655..e3128a14 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/controller/DoctorStationEmrController.java @@ -51,6 +51,17 @@ public class DoctorStationEmrController { return iDoctorStationEmrAppService.getPatientEmrHistory(patientEmrDto, pageNo, pageSize); } + /** + * 获取患者病历详情 + * + * @param encounterId 就诊id + * @return 病历详情 + */ + @GetMapping("/emr-detail") + public R getEmrDetail(@RequestParam(value = "encounterId") Long encounterId) { + return iDoctorStationEmrAppService.getEmrDetail(encounterId); + } + /** * 保存病历模板 * @@ -84,7 +95,7 @@ public class DoctorStationEmrController { * @return 操作结果 */ @DeleteMapping("emr-template") - public R deleteEmrTemplate(@RequestParam Long id) { + public R deleteEmrTemplate(@RequestParam(value = "id") Long id) { return iDoctorStationEmrAppService.deleteEmrTemplate(id); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceBaseDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceBaseDto.java index 4e3d9793..c61768b4 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceBaseDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceBaseDto.java @@ -1,5 +1,6 @@ package com.openhis.web.doctorstation.dto; +import java.math.BigDecimal; import java.util.List; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @@ -17,7 +18,18 @@ import lombok.experimental.Accessors; public class AdviceBaseDto { /** 医嘱类型 */ - private String adviceType; // 1:药品 , 2: 耗材 , 3:项目 + private Integer adviceType; // 1:药品 , 2: 耗材 , 3:项目 + + /** + * 医嘱详细分类 + */ + private String categoryCode; + + /** 拆零比 */ + private BigDecimal partPercent; + + /** 拆分属性 */ + private Integer partAttributeEnum; /** 医嘱定义ID */ @JsonSerialize(using = ToStringSerializer.class) diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceInventoryDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceInventoryDto.java index 7c6f5530..412a02e8 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceInventoryDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceInventoryDto.java @@ -23,16 +23,16 @@ public class AdviceInventoryDto { @JsonSerialize(using = ToStringSerializer.class) private Long itemId; - /** 当前库存数量(包装单位) */ - private BigDecimal baseQuantity; - - /** 包装单位 */ - @Dict(dictCode = "unit_code") - private String baseUnitCode; - private String baseUnitCode_dictText; - - /** 当前库存数量(最小单位) */ - private BigDecimal minQuantity; +// /** 当前库存数量(包装单位) */ +// private BigDecimal baseQuantity; +// +// /** 包装单位 */ +// @Dict(dictCode = "unit_code") +// private String baseUnitCode; +// private String baseUnitCode_dictText; +// +// /** 当前库存数量(最小单位) */ +// private BigDecimal minQuantity; /** 最小单位 */ @Dict(dictCode = "unit_code") diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdvicePriceDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdvicePriceDto.java index 1e237789..02c3f0fb 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdvicePriceDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdvicePriceDto.java @@ -25,6 +25,10 @@ public class AdvicePriceDto { @JsonSerialize(using = ToStringSerializer.class) private Long definitionId; + /** 费用定价子表ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long definitionDetailId; + /** 命中条件 */ private String conditionCode; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java index e102b8ec..095278c8 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/AdviceSaveDto.java @@ -1,9 +1,13 @@ package com.openhis.web.doctorstation.dto; +import java.math.BigDecimal; + +import com.core.common.utils.SecurityUtils; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.openhis.common.enums.EncounterClass; import com.openhis.common.enums.RequestStatus; +import com.openhis.common.enums.TherapyTimeType; import lombok.Data; import lombok.experimental.Accessors; @@ -16,7 +20,18 @@ import lombok.experimental.Accessors; public class AdviceSaveDto { /** 医嘱类型 */ - private String adviceType; // 1:药品 , 2: 耗材 , 3:项目 + private Integer adviceType; // 1:药品 , 2: 耗材 , 3:项目 + + /** + * 医嘱详细分类 + */ + private String categoryCode; + + /** 拆零比 */ + private BigDecimal partPercent; + + /** 拆分属性 */ + private Integer partAttributeEnum; /** 执行次数 */ private Integer executeNum; // 当医嘱类型为药品时,选填 @@ -27,9 +42,26 @@ public class AdviceSaveDto { /** 请求数量 */ private Integer quantity; + /** 每次发药供应天数 */ + private Integer dispensePerDuration; + /** 请求单位编码 */ private String unitCode; + /** 单价 */ + private BigDecimal unitPrice; + + /** 总价 */ + private BigDecimal totalPrice; + + /** 费用定价主表ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long definitionId; + + /** 费用定价子表ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long definitionDetailId; + /** 产品批号 */ private String lotNumber; @@ -45,6 +77,11 @@ public class AdviceSaveDto { @JsonSerialize(using = ToStringSerializer.class) private Long adviceDefinitionId; + /** + * 医嘱对应表名 + */ + private String adviceTableName; + /** 患者 */ @JsonSerialize(using = ToStringSerializer.class) private Long patientId; @@ -53,10 +90,14 @@ public class AdviceSaveDto { @JsonSerialize(using = ToStringSerializer.class) private Long practitionerId; - /** 所属位置 */ + /** 请求发起的位置 */ @JsonSerialize(using = ToStringSerializer.class) private Long locationId; + /** 发放位置 */ + @JsonSerialize(using = ToStringSerializer.class) + private Long performLocation; + /** 所属科室 */ @JsonSerialize(using = ToStringSerializer.class) private Long orgId; @@ -65,13 +106,51 @@ public class AdviceSaveDto { @JsonSerialize(using = ToStringSerializer.class) private Long encounterId; + /** + * 账户id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long accountId; + + /** + * 诊断ID + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long conditionId; + + /** 治疗类型 */ + private Integer therapyEnum; + + /** 用法 */ + private String methodCode; + + /** 用药频次 */ + private String rateCode; + + /** 单次剂量 */ + private BigDecimal dose; + + /** 剂量单位 */ + private String doseUnitCode; + + /** + * 皮试标志 1:是 , 0:否 + */ + private Integer skinTestFlag; + + /** + * 分组id , 一组药品共用一个id,前端传过来 + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long groupId; + /** 组套id */ @JsonSerialize(using = ToStringSerializer.class) - private Long packageId; // 该参数先预留出来 + private Long packageId; /** 活动(项目)定义id */ @JsonSerialize(using = ToStringSerializer.class) - private Long activityId; // 该参数先预留出来 + private Long activityId; /** * 设置默认值 @@ -79,6 +158,9 @@ public class AdviceSaveDto { public AdviceSaveDto() { this.statusEnum = RequestStatus.DRAFT.getValue(); this.categoryEnum = EncounterClass.AMB.getValue(); + this.therapyEnum = TherapyTimeType.TEMPORARY.getValue(); + this.practitionerId = SecurityUtils.getLoginUser().getPractitionerId(); + this.orgId = SecurityUtils.getLoginUser().getOrgId(); // 开方人科室 } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DiagnosisQueryDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DiagnosisQueryDto.java new file mode 100644 index 00000000..8bf95bcb --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/DiagnosisQueryDto.java @@ -0,0 +1,52 @@ +package com.openhis.web.doctorstation.dto; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 诊断查询 dto + * + * @author system + * @date 2025-02-20 + */ +@Data +@Accessors(chain = true) +public class DiagnosisQueryDto { + + /** + * 诊断ID + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long conditionId; + + /** + * 诊断定义id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long definitionId; + + /** 所属分类 */ + private Integer sourceEnum; + /** + * 诊断类型(中医诊断或西医诊断) + */ + private String typeName; + + /** 诊断名称 */ + private String name; + + /** + * 主诊断标记 (1:是,0:否) + */ + private Integer maindiseFlag; + + /** + * 验证状态 + */ + private Integer verificationStatusEnum; + private String verificationStatusEnum_enumText; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/EmrTemplateDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/EmrTemplateDto.java index 7d56fc28..1bc1f0e4 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/EmrTemplateDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/EmrTemplateDto.java @@ -3,6 +3,7 @@ */ package com.openhis.web.doctorstation.dto; +import com.alibaba.fastjson2.JSONObject; import lombok.Data; import lombok.experimental.Accessors; @@ -26,7 +27,7 @@ public class EmrTemplateDto implements Serializable { private String templateName; /** 模板类型 */ - private String templateTypeEnum; + private String templateTypeCode; /** 使用范围 */ @NotBlank @@ -36,6 +37,6 @@ public class EmrTemplateDto implements Serializable { private Long userId; /** 病历内容 */ - private String contextJson; + private JSONObject contextJson; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/PatientEmrDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/PatientEmrDto.java index 50c73b8e..4aa902a5 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/PatientEmrDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/PatientEmrDto.java @@ -36,7 +36,6 @@ public class PatientEmrDto implements Serializable { private String emrStatus; /** 记录人 */ - @NotNull private Long recordId; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/PatientInfoDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/PatientInfoDto.java index 7b6bf160..7723395d 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/PatientInfoDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/PatientInfoDto.java @@ -4,6 +4,7 @@ import java.util.Date; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.openhis.common.annotation.Dict; import lombok.Data; import lombok.experimental.Accessors; @@ -27,6 +28,12 @@ public class PatientInfoDto { @JsonSerialize(using = ToStringSerializer.class) private Long patientId; + /** + * 账户id + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long accountId; + /** * 患者姓名 */ @@ -70,4 +77,14 @@ public class PatientInfoDto { */ private Integer allergyHistoryFlag; + /** + * 挂号时间 + */ + private Date registerTime; + + /** 账户类型编码 */ + @Dict(dictCode = "account_code") + private String typeCode; + private String typeCode_dictText; + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/SaveDiagnosisChildParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/SaveDiagnosisChildParam.java index 2c030ee0..0e57bb4f 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/SaveDiagnosisChildParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/dto/SaveDiagnosisChildParam.java @@ -40,6 +40,7 @@ public class SaveDiagnosisChildParam { /** * 诊断ID - 用于存储 adm_encounter_diagnosis表 */ + @JsonSerialize(using = ToStringSerializer.class) private Long conditionId; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationAdviceAppMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationAdviceAppMapper.java index 4b9c83af..1eeb50da 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationAdviceAppMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationAdviceAppMapper.java @@ -26,12 +26,13 @@ public interface DoctorStationAdviceAppMapper { * @param medicationTableName 药品定义表名 * @param deviceTableName 耗材定义表名 * @param activityTableName 诊疗定义表名 + * @param singleUse 单次消耗类 (耗材只查这类) * @param queryWrapper 查询条件 * @return 医嘱信息 */ IPage getAdviceBaseInfo(@Param("page") Page page, @Param("medicationTableName") String medicationTableName, @Param("deviceTableName") String deviceTableName, - @Param("activityTableName") String activityTableName, + @Param("activityTableName") String activityTableName, @Param("singleUse") String singleUse, @Param(Constants.WRAPPER) QueryWrapper queryWrapper); /** diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationDiagnosisAppMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationDiagnosisAppMapper.java index 5a958e1c..e85a6781 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationDiagnosisAppMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/doctorstation/mapper/DoctorStationDiagnosisAppMapper.java @@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.openhis.web.doctorstation.dto.ConditionDefinitionMetadata; import com.openhis.web.doctorstation.dto.DiagnosisBelongBindingDto; +import com.openhis.web.doctorstation.dto.DiagnosisQueryDto; /** * 医生站-诊断 应用Mapper @@ -73,4 +74,12 @@ public interface DoctorStationDiagnosisAppMapper { List getOrganizationList(@Param("statusEnum") Integer statusEnum, @Param("bindingEnum") Integer bindingEnum, @Param("currentUserOrganizationId") Long currentUserOrganizationId); + /** + * 查询就诊诊断信息 + * + * @param encounterId 就诊id + * @return 就诊诊断信息 + */ + List getEncounterDiagnosis(@Param("encounterId") Long encounterId); + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/IInventoryDetailsAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/IInventoryDetailsAppService.java new file mode 100644 index 00000000..47e8b500 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/IInventoryDetailsAppService.java @@ -0,0 +1,71 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.appservice; + +import javax.servlet.http.HttpServletRequest; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.openhis.web.inventorymanage.dto.*; + +/** + * 采购入库明细查询 service + * + * @author + * @date 2025-03-10 + */ +public interface IInventoryDetailsAppService { + + /** + * 采购入库查询 + * + * @param purchaseInSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param searchKey 模糊查询关键字 + * @param request 请求数据 + * @return 采购入库查询分页列表 + */ + IPage purchaseInGetPage(PurchaseInSearchParam purchaseInSearchParam, String searchKey, + Integer pageNo, Integer pageSize, HttpServletRequest request); + + /** + * 领用出库查询 + * + * @param requisitionOutSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param searchKey 模糊查询关键字 + * @param request 请求数据 + * @return 领用出库查询分页列表 + */ + IPage requisitionOutGetPage(RequisitionOutSearchParam requisitionOutSearchParam, + String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request); + + /** + * 商品调拨查询 + * + * @param requisitionOutSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param searchKey 模糊查询关键字 + * @param request 请求数据 + * @return 商品调拨查询分页列表 + */ + IPage inventoryTransferGetPage(RequisitionOutSearchParam requisitionOutSearchParam, + String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request); + + /** + * 商品盘点查询 + * + * @param requisitionOutSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param searchKey 模糊查询关键字 + * @param request 请求数据 + * @return 商品盘点查询分页列表 + */ + IPage inventoryStockTakeGetPage(RequisitionOutSearchParam requisitionOutSearchParam, + String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/InventoryDetailsAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/InventoryDetailsAppServiceImpl.java new file mode 100644 index 00000000..d78768a9 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/InventoryDetailsAppServiceImpl.java @@ -0,0 +1,138 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.appservice.impl; + +import java.util.Arrays; +import java.util.HashSet; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.common.utils.HisQueryUtils; +import com.openhis.web.inventorymanage.appservice.IInventoryDetailsAppService; +import com.openhis.web.inventorymanage.dto.*; +import com.openhis.web.inventorymanage.mapper.InventoryDetailsMapper; + +/** + * 采购入库明细查询 impl + * + * @author + * @date 2025-03-10 + */ +@Service +public class InventoryDetailsAppServiceImpl implements IInventoryDetailsAppService { + + @Autowired + private InventoryDetailsMapper inventoryDetailsMapper; + + /** + * 采购入库明细查询 + * + * @param purchaseInSearchParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param request 请求数据 + * @return 采购入库明细分页列表 + */ + @Override + public IPage purchaseInGetPage(PurchaseInSearchParam purchaseInSearchParam, String searchKey, + Integer pageNo, Integer pageSize, HttpServletRequest request) { + + // 构建查询条件 + // QueryWrapper queryWrapper = + // HisQueryUtils.buildQueryWrapper(inventorySearchParam, searchKey, searchFields, request); + // 查询入库单据分页列表 + // Page inventoryReceiptPage = purchaseInventoryMapper.selectInventoryReceiptPage( + // new Page<>(pageNo, pageSize), queryWrapper, SupplyType.PURCHASE_INVENTORY.getValue()); + // return R.ok(inventoryReceiptPage); + + QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(purchaseInSearchParam, + searchKey, new HashSet<>(Arrays.asList("bus_no", "item_name", "item_no")), request); + Page purchaseInInfo = + inventoryDetailsMapper.selectPurchaseInDetailsPage(new Page<>(pageNo, pageSize), queryWrapper); + + return purchaseInInfo; + } + + /** + * 领用出库明细查询 + * + * @param requisitionOutSearchParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param request 请求数据 + * @return 领用出库明细分页列表 + */ + @Override + public IPage requisitionOutGetPage(RequisitionOutSearchParam requisitionOutSearchParam, + String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) { + + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(requisitionOutSearchParam, searchKey, + new HashSet<>(Arrays.asList("bus_no", "item_name", "item_no")), request); + + Page requisitionOutInfo = + inventoryDetailsMapper.selectRequisitionOutDetailsPage(new Page<>(pageNo, pageSize), queryWrapper); + + return requisitionOutInfo; + } + + /** + * 商品调拨明细查询 + * + * @param requisitionOutSearchParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param request 请求数据 + * @return 商品调拨明细分页列表 + */ + @Override + public IPage inventoryTransferGetPage( + RequisitionOutSearchParam requisitionOutSearchParam, String searchKey, Integer pageNo, Integer pageSize, + HttpServletRequest request) { + + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(requisitionOutSearchParam, searchKey, + new HashSet<>(Arrays.asList("bus_no", "item_name", "item_no")), request); + + Page inventoryTransferInfo = + inventoryDetailsMapper.selectInventoryTransferDetailsPage(new Page<>(pageNo, pageSize), queryWrapper); + + return inventoryTransferInfo; + } + + /** + * 商品调拨明细查询 + * + * @param requisitionOutSearchParam 查询条件 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param request 请求数据 + * @return 商品调拨明细分页列表 + */ + @Override + public IPage inventoryStockTakeGetPage( + RequisitionOutSearchParam requisitionOutSearchParam, String searchKey, Integer pageNo, Integer pageSize, + HttpServletRequest request) { + + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(requisitionOutSearchParam, searchKey, + new HashSet<>(Arrays.asList("bus_no", "item_name", "item_no")), request); + + Page inventoryStockTakeInfo = + inventoryDetailsMapper.selectInventoryStockTakeDetailsPage(new Page<>(pageNo, pageSize), queryWrapper); + + return inventoryStockTakeInfo; + } + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/PurchaseInventoryAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/PurchaseInventoryAppServiceImpl.java index 19de1953..c7982cba 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/PurchaseInventoryAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/PurchaseInventoryAppServiceImpl.java @@ -26,7 +26,10 @@ import com.openhis.administration.service.IPractitionerService; import com.openhis.administration.service.ISupplierService; import com.openhis.common.constant.CommonConstants; import com.openhis.common.constant.PromptMsgConstant; -import com.openhis.common.enums.*; +import com.openhis.common.enums.AssignSeqEnum; +import com.openhis.common.enums.SupplyCategory; +import com.openhis.common.enums.SupplyStatus; +import com.openhis.common.enums.SupplyType; import com.openhis.common.utils.EnumUtils; import com.openhis.common.utils.HisQueryUtils; import com.openhis.web.inventorymanage.appservice.IPurchaseInventoryAppService; @@ -83,18 +86,14 @@ public class PurchaseInventoryAppServiceImpl implements IPurchaseInventoryAppSer List supplierListOptions = supplierList.stream() .map(supplier -> new PurchaseInventoryInitDto.supplierListOption(supplier.getId(), supplier.getName())) .collect(Collectors.toList()); - // 入库项目类型 - List itemTypeOptions = Stream.of(ItemType.values()) - .map(itemType -> new PurchaseInventoryInitDto.itemTypeOption(itemType.getValue(), itemType.getInfo())) - .collect(Collectors.toList()); // 审批状态 List supplyStatusOptions = Stream.of(SupplyStatus.values()) .map(supplyStatus -> new PurchaseInventoryInitDto.supplyStatusOption(supplyStatus.getValue(), supplyStatus.getInfo())) .collect(Collectors.toList()); - initDto.setSupplierListOptions(supplierListOptions).setItemTypeOptions(itemTypeOptions) - .setPractitionerListOptions(practitionerListOptions).setSupplyStatusOptions(supplyStatusOptions); + initDto.setSupplierListOptions(supplierListOptions).setPractitionerListOptions(practitionerListOptions) + .setSupplyStatusOptions(supplyStatusOptions); return R.ok(initDto); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java index e6a4c820..d0b9fbc7 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/appservice/impl/ReceiptApprovalAppServiceImpl.java @@ -197,9 +197,9 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService for (SupplyItemDetailDto supplyItemDetailDto : supplyItemDetailList) { // 根据产品批号,仓库和仓位 查询库存表信息 - InventoryItem inventoryItem = inventoryItemService.selectInventoryByLotNumber( - supplyItemDetailDto.getLotNumber(),supplyItemDetailDto.getSourceLocationId(), - supplyItemDetailDto.getPurposeLocationStoreId()); + InventoryItem inventoryItem = + inventoryItemService.selectInventoryByLotNumber(supplyItemDetailDto.getLotNumber(), + supplyItemDetailDto.getSourceLocationId(), supplyItemDetailDto.getPurposeLocationStoreId()); // 包装数量 BigDecimal baseQuantity = inventoryItem.getBaseQuantity(); @@ -209,23 +209,24 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getUnitCode())) { baseQuantity = baseQuantity.min(supplyItemDetailDto.getItemQuantity()); - minQuantity = minQuantity.min(supplyItemDetailDto.getPartPercent() - .multiply(supplyItemDetailDto.getItemQuantity())); + minQuantity = minQuantity + .min(supplyItemDetailDto.getPartPercent().multiply(supplyItemDetailDto.getItemQuantity())); } else if (supplyItemDetailDto.getItemUnit().equals(supplyItemDetailDto.getMinUnitCode())) { - baseQuantity = baseQuantity.min(supplyItemDetailDto.getItemQuantity().divide( - supplyItemDetailDto.getPartPercent(),RoundingMode.HALF_UP)); + baseQuantity = baseQuantity.min(supplyItemDetailDto.getItemQuantity() + .divide(supplyItemDetailDto.getPartPercent(), RoundingMode.HALF_UP)); minQuantity = minQuantity.min(supplyItemDetailDto.getItemQuantity()); } // 更新库存数量 - inventoryItemService.updateInventoryQuantity(inventoryItem.getId(),baseQuantity,minQuantity,loginUser,now); + inventoryItemService.updateInventoryQuantity(inventoryItem.getId(), baseQuantity, minQuantity, + loginUser, now); } // 将供应项目的详细信息装配为库存项目和采购账单 Pair, List> listPair = - InventoryManageAssembler.assembleChargeAndInventory(supplyItemDetailList, now, loginUser); + InventoryManageAssembler.assembleChargeAndInventory(supplyItemDetailList, now, loginUser); // 入库 inventoryItemService.stockIn(listPair.getRight()); @@ -295,6 +296,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService List chargeDetailList) { List resultList = new ArrayList<>(); + // todo:同一批次不能改价 // 将各个项目的定价信息按项目id分组 Map> chargeDetailGroup = chargeDetailList.stream().collect(Collectors.groupingBy(ItemChargeDetailDto::getInstanceId)); @@ -356,7 +358,7 @@ public class ReceiptApprovalAppServiceImpl implements IReceiptApprovalAppService */ private ChargeItemDefDetail addChargeItemDefApp(String conditionValue, BigDecimal sellPrice, Long definitionId) { ChargeItemDefDetail chargeItemDefDetail = new ChargeItemDefDetail(); - // todo:命中条件或建成字典枚举,此处为批次号,单位 + // todo:命中条件或建成字典枚举,此处为批次号,单位,优先级加一 chargeItemDefDetail // 命中值 .setConditionValue(conditionValue) diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/assembler/InventoryManageAssembler.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/assembler/InventoryManageAssembler.java index 39773586..2ee16b50 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/assembler/InventoryManageAssembler.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/assembler/InventoryManageAssembler.java @@ -48,7 +48,7 @@ public class InventoryManageAssembler { // 收费项id:供应物品id .setProductId(supplyItemDetailDto.getItemId()) // 物品数量 - .setQuantityValue(supplyItemDetailDto.getItemQuantity().longValue()) + .setQuantityValue(supplyItemDetailDto.getItemQuantity().intValue()) // 物品单位 .setQuantityUnit(supplyItemDetailDto.getItemUnit()) // 原价 diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/InventoryDetailsController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/InventoryDetailsController.java new file mode 100644 index 00000000..8a494e89 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/InventoryDetailsController.java @@ -0,0 +1,111 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.controller; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.core.common.core.domain.R; +import com.openhis.web.inventorymanage.appservice.IInventoryDetailsAppService; +import com.openhis.web.inventorymanage.dto.PurchaseInSearchParam; +import com.openhis.web.inventorymanage.dto.RequisitionOutSearchParam; + +import lombok.extern.slf4j.Slf4j; + +/** + * 库存相关明细查询 controller + * + * @author + * @date 2025-03-10 + */ +@RestController +@RequestMapping("/inventory-manage-details") +@Slf4j +public class InventoryDetailsController { + + @Autowired + private IInventoryDetailsAppService inventoryDetailsAppService; + + /** + * 采购入库明细查询 + * + * @param purchaseInSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param searchKey 模糊查询关键字 + * @param request 请求数据 + * @return 采购入库分页列表 + */ + @GetMapping(value = "/purchase-in") + public R purchaseInQueryGetPage(PurchaseInSearchParam purchaseInSearchParam, + @RequestParam(name = "searchKey", defaultValue = "") String searchKey, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { + return R.ok( + inventoryDetailsAppService.purchaseInGetPage(purchaseInSearchParam, searchKey, pageNo, pageSize, request)); + } + + /** + * 领用出库明细查询 + * + * @param requisitionOutSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param searchKey 模糊查询关键字 + * @param request 请求数据 + * @return 采购入库分页列表 + */ + @GetMapping(value = "/requisition-out") + public R RequisitionOutQueryGetPage(RequisitionOutSearchParam requisitionOutSearchParam, + @RequestParam(name = "searchKey", defaultValue = "") String searchKey, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { + return R.ok(inventoryDetailsAppService.requisitionOutGetPage(requisitionOutSearchParam, searchKey, pageNo, + pageSize, request)); + } + + /** + * 商品调拨明细查询 + * + * @param requisitionOutSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param searchKey 模糊查询关键字 + * @param request 请求数据 + * @return 商品调拨分页列表 + */ + @GetMapping(value = "/inventory-transfer") + public R InventoryTransferQueryGetPage(RequisitionOutSearchParam requisitionOutSearchParam, + @RequestParam(name = "searchKey", defaultValue = "") String searchKey, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { + return R.ok(inventoryDetailsAppService.inventoryTransferGetPage(requisitionOutSearchParam, searchKey, pageNo, + pageSize, request)); + } + + /** + * 商品盘点明细查询 + * + * @param requisitionOutSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param searchKey 模糊查询关键字 + * @param request 请求数据 + * @return 商品盘点分页列表 + */ + @GetMapping(value = "/inventory-stock-take") + public R InventoryStockTakeQueryGetPage(RequisitionOutSearchParam requisitionOutSearchParam, + @RequestParam(name = "searchKey", defaultValue = "") String searchKey, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { + return R.ok(inventoryDetailsAppService.inventoryStockTakeGetPage(requisitionOutSearchParam, searchKey, pageNo, + pageSize, request)); + } + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/PurchaseInventoryController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/PurchaseInventoryController.java index dcced6ff..dc094629 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/PurchaseInventoryController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/controller/PurchaseInventoryController.java @@ -98,7 +98,7 @@ public class PurchaseInventoryController { * @return 操作结果 */ @PutMapping("/submit-approval") - public R submitApproval(@RequestParam String busNo) { + public R submitApproval(@RequestBody String busNo) { return purchaseInventoryAppService.submitApproval(busNo); } @@ -109,7 +109,7 @@ public class PurchaseInventoryController { * @return 操作结果 */ @PutMapping("/withdraw-approval") - public R withdrawApproval(@RequestParam String busNo) { + public R withdrawApproval(@RequestBody String busNo) { return purchaseInventoryAppService.withdrawApproval(busNo); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventorySearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventorySearchParam.java index 940be571..596433fa 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventorySearchParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventorySearchParam.java @@ -3,7 +3,7 @@ */ package com.openhis.web.inventorymanage.dto; -import java.io.Serializable; +import java.util.Date; import lombok.Data; import lombok.experimental.Accessors; @@ -16,9 +16,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class InventorySearchParam implements Serializable { - - private static final long serialVersionUID = 1L; +public class InventorySearchParam { /** 状态 */ private Integer statusEnum; @@ -28,4 +26,9 @@ public class InventorySearchParam implements Serializable { /** 经手人 */ private Long practitionerId; + + /** + * 单据时间 + */ + private Date occurrenceTime; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryStockTakeDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryStockTakeDetailDto.java new file mode 100644 index 00000000..f6a72d7a --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryStockTakeDetailDto.java @@ -0,0 +1,90 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 商品盘点 + * + * @author + * @date 2025-03-15 + */ +@Data +@Accessors(chain = true) +public class InventoryStockTakeDetailDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** 单据号 */ + private String busNo; + + /** 状态 */ + private String statusEnum; + + /** 项目类型 */ + private String itemTable; + + /** 物品编码 */ + private Long itemNo; + + /** 项目名称 */ + private String itemName; + + /** 项目规格 */ + private String itemVolume; + + /** 产品批号 */ + private String lotNumber; + + /** 厂家产地 */ + private String manufacturerId; + + /** 物品计量单位 */ + private String unitCode; + + /** 盘前数量 */ + private BigDecimal itemQuantity; + + /** 盘后数量 */ + private BigDecimal itemQuantity1; + + /** 盈亏数量 */ + + /** 盈亏原因 */ + + /** 目的仓库类型 */ + private Integer purposeTypeEnum; + + /** 目的仓库 */ + private String purposeName; + + /** 目的仓位 */ + private String purposeStoreName; + + /** 审批时间 */ + private Date approvalTime; + + /** 申请人 */ + private String applicantName; + + /** 审批人 */ + private String approveName; + + /** 租户ID */ + private Integer tenantId; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryTransferDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryTransferDetailDto.java new file mode 100644 index 00000000..2b26be6b --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/InventoryTransferDetailDto.java @@ -0,0 +1,101 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 商品调拨 + * + * @author + * @date 2025-03-15 + */ +@Data +@Accessors(chain = true) +public class InventoryTransferDetailDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** 单据号 */ + private String busNo; + + /** 状态 */ + private String statusEnum; + + /** 项目类型 */ + private String itemTable; + + /** 物品编码 */ + private Long itemNo; + + /** 项目名称 */ + private String itemName; + + /** 项目规格 */ + private String itemVolume; + + /** 产品批号 */ + private String lotNumber; + + /** 厂家产地 */ + private String manufacturerId; + + /** 调拨数量 */ + private BigDecimal itemQuantity; + + /** 物品计量单位 */ + private String unitCode; + + /** 采购单价 */ + private BigDecimal price; + + /** 合计金额 总价 */ + private BigDecimal totalPrice; + + /** 源仓库类型 */ + private Integer sourceTypeEnum; + + /** 源仓库 */ + private String sourceName; + + /** 源仓位 */ + private String sourceStoreName; + + /** 目的仓库类型 */ + private Integer purposeTypeEnum; + + /** 目的仓库 */ + private String purposeName; + + /** 目的仓位 */ + private String purposeStoreName; + + /** 审批时间 */ + private Date approvalTime; + + /** 有效期至 */ + private Date occurrenceTime; + + /** 申请人 */ + private String applicantName; + + /** 审批人 */ + private String approveName; + + /** 租户ID */ + private Integer tenantId; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ItemChargeDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ItemChargeDetailDto.java index f846f247..959656c7 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ItemChargeDetailDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ItemChargeDetailDto.java @@ -3,7 +3,6 @@ */ package com.openhis.web.inventorymanage.dto; -import java.io.Serializable; import java.math.BigDecimal; import lombok.Data; @@ -17,9 +16,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class ItemChargeDetailDto implements Serializable { - - private static final long serialVersionUID = 1L; +public class ItemChargeDetailDto { /** 费用定价主键ID */ private Long definitionId; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductStocktakingDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductStocktakingDto.java index a5c1fcbb..a7c36f66 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductStocktakingDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ProductStocktakingDto.java @@ -3,7 +3,6 @@ */ package com.openhis.web.inventorymanage.dto; -import java.io.Serializable; import java.util.Date; import javax.validation.constraints.Min; @@ -25,9 +24,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class ProductStocktakingDto implements Serializable { - - private static final long serialVersionUID = 1L; +public class ProductStocktakingDto { /** ID */ @TableId(type = IdType.ASSIGN_ID) diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInDetailDto.java new file mode 100644 index 00000000..8f047678 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInDetailDto.java @@ -0,0 +1,89 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 采购入库 + * + * @author + * @date 2025-03-10 + */ +@Data +@Accessors(chain = true) +public class PurchaseInDetailDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** 单据号 */ + private String busNo; + + /** 状态 */ + private String statusEnum; + + /** 项目类型 */ + private String itemTable; + + /** 物品编码 */ + private Long itemNo; + + /** 项目名称 */ + private String itemName; + + /** 项目规格 */ + private String itemVolume; + + /** 产品批号 */ + private String lotNumber; + + /** 供应商 */ + private String supName; + + /** 数量 */ + private BigDecimal itemQuantity; + + /** 单价 */ + private BigDecimal price; + + /** 总价 */ + private BigDecimal totalPrice; + + /** 物品计量单位 */ + private String unitCode; + + /** 目的仓库 */ + private String locName; + + /** 目的仓位 */ + private String locstoreName; + + /** 审批时间 */ + private Date approvalTime; + + /** 期望时间 */ + private Date occurrenceTime; + + /** 申请人 */ + private String applicantName; + + /** 审批人 */ + private String approverName; + + /** 租户ID */ + private Integer tenantId; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInSearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInSearchParam.java new file mode 100644 index 00000000..3590ef08 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInSearchParam.java @@ -0,0 +1,35 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import java.io.Serializable; + +import org.hibernate.validator.constraints.Length; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 采购入库分页查询条件 + * + * @author + * @date 2025-03-10 + */ +@Data +@Accessors(chain = true) +public class PurchaseInSearchParam implements Serializable { + + /** 单据号 */ + @Length(max = 255) + private String busNo; + + /** 项目编码 */ + @Length(max = 255) + private String id; + + /** 项目类型 */ + // @Length(max = 255) + // private String busNo; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryDto.java index 5213d0f5..5413a11f 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryDto.java @@ -3,7 +3,6 @@ */ package com.openhis.web.inventorymanage.dto; -import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -26,15 +25,16 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class PurchaseInventoryDto implements Serializable { - - private static final long serialVersionUID = 1L; +public class PurchaseInventoryDto { /** ID */ @TableId(type = IdType.ASSIGN_ID) @JsonSerialize(using = ToStringSerializer.class) private Long id; + /** 单据号 */ + private String busNo; + /** 项目 */ private String itemTable; @@ -71,7 +71,7 @@ public class PurchaseInventoryDto implements Serializable { private Long purposeLocationStoreId; /** 申请人 */ - @NotNull + // @NotNull private Long applicantId; /** 经手人 */ diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryInitDto.java index 44c309e0..8a768786 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryInitDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/PurchaseInventoryInitDto.java @@ -33,11 +33,6 @@ public class PurchaseInventoryInitDto { */ private List practitionerListOptions; - /** - * 入库项目类型 - */ - private List itemTypeOptions; - /** * 审批状态 */ @@ -89,7 +84,7 @@ public class PurchaseInventoryInitDto { * 入库项目类型 */ @Data - public static class supplyStatusOption { + public static class supplyStatusOption { private Integer value; private String label; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptApprovalSearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptApprovalSearchParam.java index 1877a110..74a19413 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptApprovalSearchParam.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptApprovalSearchParam.java @@ -3,8 +3,6 @@ */ package com.openhis.web.inventorymanage.dto; -import java.io.Serializable; - import lombok.Data; import lombok.experimental.Accessors; @@ -16,9 +14,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class ReceiptApprovalSearchParam implements Serializable { - - private static final long serialVersionUID = 1L; +public class ReceiptApprovalSearchParam { /** 状态 */ private Integer statusEnum; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptDetailDto.java index c4173960..6bc21ee3 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptDetailDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptDetailDto.java @@ -3,7 +3,6 @@ */ package com.openhis.web.inventorymanage.dto; -import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -24,9 +23,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class ReceiptDetailDto implements Serializable { - - private static final long serialVersionUID = 1L; +public class ReceiptDetailDto { /** ID */ @TableId(type = IdType.ASSIGN_ID) diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptPageDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptPageDto.java index ddb27686..260b79bd 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptPageDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/ReceiptPageDto.java @@ -3,7 +3,6 @@ */ package com.openhis.web.inventorymanage.dto; -import java.io.Serializable; import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; @@ -23,9 +22,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class ReceiptPageDto implements Serializable { - - private static final long serialVersionUID = 1L; +public class ReceiptPageDto { /** ID */ @TableId(type = IdType.ASSIGN_ID) @@ -70,6 +67,6 @@ public class ReceiptPageDto implements Serializable { private Date applyTime; /** 制单日期 */ - private Date createTime; + private Date occurrenceTime; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/RequisitionOutDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/RequisitionOutDetailDto.java new file mode 100644 index 00000000..96722923 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/RequisitionOutDetailDto.java @@ -0,0 +1,89 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 领用出库 + * + * @author + * @date 2025-03-15 + */ +@Data +@Accessors(chain = true) +public class RequisitionOutDetailDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** 单据号 */ + private String busNo; + + /** 状态 */ + private String statusEnum; + + /** 项目类型 */ + private String itemTable; + + /** 物品编码 */ + private Long itemNo; + + /** 项目名称 */ + private String itemName; + + /** 项目规格 */ + private String itemVolume; + + /** 项目规格 */ + private String itemId; + + /** 数量 */ + private BigDecimal itemQuantity; + + /** 物品计量单位 */ + private String unitCode; + + /** 产品批号 */ + private String lotNumber; + + /** 采购批次流水号 */ + private String xxxNo; + + /** 目的仓库 */ + private String locName; + + /** 目的仓位 */ + private String locstoreName; + + /** 制单时间 */ + private Date applyTime; + + /** 审批时间 */ + private Date approvalTime; + + /** 领用部门 */ + private String xxxxxOrg; + + /** 申请人 */ + private String applicantName; + + /** 审批人 */ + private String approverName; + + /** 租户ID */ + private Integer tenantId; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/RequisitionOutSearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/RequisitionOutSearchParam.java new file mode 100644 index 00000000..082d6c24 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/RequisitionOutSearchParam.java @@ -0,0 +1,35 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.dto; + +import java.io.Serializable; + +import org.hibernate.validator.constraints.Length; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 领用出库分页查询条件 + * + * @author + * @date 2025-03-15 + */ +@Data +@Accessors(chain = true) +public class RequisitionOutSearchParam implements Serializable { + + /** 单据号 */ + @Length(max = 255) + private String busNo; + + /** 项目编码 */ + @Length(max = 255) + private String id; + + /** 项目类型 */ + // @Length(max = 255) + // private String busNo; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/SupplyItemDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/SupplyItemDetailDto.java index 755254f3..e69a868f 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/SupplyItemDetailDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/dto/SupplyItemDetailDto.java @@ -3,7 +3,6 @@ */ package com.openhis.web.inventorymanage.dto; -import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -21,9 +20,7 @@ import lombok.experimental.Accessors; */ @Data @Accessors(chain = true) -public class SupplyItemDetailDto implements Serializable { - - private static final long serialVersionUID = 1L; +public class SupplyItemDetailDto { /** ID */ @JsonSerialize(using = ToStringSerializer.class) diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/mapper/InventoryDetailsMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/mapper/InventoryDetailsMapper.java new file mode 100644 index 00000000..2d436efd --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/inventorymanage/mapper/InventoryDetailsMapper.java @@ -0,0 +1,64 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.inventorymanage.mapper; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.inventorymanage.dto.*; + +/** + * 采购入库查询用 mapper + * + * @author + * @date 2025-03-10 + */ +@Repository +public interface InventoryDetailsMapper { + + /** + * 查询采购入库分页列表 + * + * @param page 分页 + * @param queryWrapper 查询条件 + * @return 采购入库分页列表 + */ + Page selectPurchaseInDetailsPage(@Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + /** + * 查询领用出库分页列表 + * + * @param page 分页 + * @param queryWrapper 查询条件 + * @return 领用出库分页列表 + */ + Page selectRequisitionOutDetailsPage(@Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + /** + * 查询商品调拨分页列表 + * + * @param page 分页 + * @param queryWrapper 查询条件 + * @return 商品调拨分页列表 + */ + Page selectInventoryTransferDetailsPage( + @Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + /** + * 查询商品盘点分页列表 + * + * @param page 分页 + * @param queryWrapper 查询条件 + * @return 商品盘点分页列表 + */ + Page selectInventoryStockTakeDetailsPage( + @Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientInfusionRecordService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientInfusionRecordService.java index f918a6ec..3c15dcb1 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientInfusionRecordService.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/IOutpatientInfusionRecordService.java @@ -2,10 +2,11 @@ package com.openhis.web.outpatientmanage.appservice; import java.util.List; +import javax.servlet.http.HttpServletRequest; + import com.baomidou.mybatisplus.core.metadata.IPage; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto; -import com.openhis.web.outpatientmanage.dto.OutpatientInfusionSearchParam; /** * 门诊管理——输液实现类 @@ -18,13 +19,13 @@ public interface IOutpatientInfusionRecordService { /** * 获取门诊输液记录的患者列表 * - * @param outpatientInfusionSearchParam 门诊输液记录的患者列表查询参数 + * @param searchKey 模糊查询关键字 * @param pageNo 当前页 * @param pageSize 每页多少条 * @return 分页查询 */ - IPage getOutpatientInfusionPatientList( - OutpatientInfusionSearchParam outpatientInfusionSearchParam, Integer pageNo, Integer pageSize); + IPage getOutpatientInfusionPatientList(String searchKey, Integer pageNo, + Integer pageSize, HttpServletRequest request); /** * 点击患者,查询该患者的输液记录 @@ -33,7 +34,7 @@ public interface IOutpatientInfusionRecordService { * @return 当前患者门诊输液待执行列表 */ List - getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto); + getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto, HttpServletRequest request); /** * 执行患者门诊输液 @@ -54,11 +55,10 @@ public interface IOutpatientInfusionRecordService { /** * 门诊输液执行历史记录查询 * - * @param beginTime 开始时间 - * @param endTime 结束时间 + * @param patientId 患者ID * @param historyFlag 查询的是否为执行履历 * @return 门诊输液记录列表 */ - List getPatientInfusionPerformRecord(String beginTime, String endTime,boolean historyFlag); + List getPatientInfusionPerformRecord(Long patientId,HttpServletRequest request, boolean historyFlag); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientInfusionRecordServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientInfusionRecordServiceImpl.java index af74229b..0ee18760 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientInfusionRecordServiceImpl.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/appservice/impl/OutpatientInfusionRecordServiceImpl.java @@ -1,16 +1,17 @@ package com.openhis.web.outpatientmanage.appservice.impl; -import java.time.LocalDateTime; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -25,7 +26,6 @@ import com.openhis.administration.service.IPractitionerRoleService; import com.openhis.administration.service.IPractitionerService; import com.openhis.common.constant.CommonConstants; import com.openhis.common.enums.AdministrativeGender; -import com.openhis.common.enums.ClinicalStatus; import com.openhis.common.enums.EventStatus; import com.openhis.common.enums.Whether; import com.openhis.common.utils.EnumUtils; @@ -33,7 +33,6 @@ import com.openhis.common.utils.HisQueryUtils; import com.openhis.web.outpatientmanage.appservice.IOutpatientInfusionRecordService; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto; -import com.openhis.web.outpatientmanage.dto.OutpatientInfusionSearchParam; import com.openhis.web.outpatientmanage.mapper.OutpatientManageMapper; import com.openhis.workflow.domain.ServiceRequest; import com.openhis.workflow.mapper.ServiceRequestMapper; @@ -67,49 +66,21 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR /** * 获取门诊输液记录的患者列表 * - * @param outpatientInfusionSearchParam 门诊输液记录的患者列表查询参数 + * @param searchKey 模糊查询关键字 * @param pageNo 当前页 * @param pageSize 每页多少条 * @return 分页查询 */ @Override - public IPage getOutpatientInfusionPatientList( - OutpatientInfusionSearchParam outpatientInfusionSearchParam, Integer pageNo, Integer pageSize) { - - LocalDateTime beginTime; - LocalDateTime endTime; - String searchKey; - // 搜索key为空 - if (outpatientInfusionSearchParam == null) { - searchKey = null; - } else { - searchKey = outpatientInfusionSearchParam.getSearchKey(); - } - // 任意开始结束时间为空,默认查询当天日期记录 - if (outpatientInfusionSearchParam.getBeginTime() == null - || outpatientInfusionSearchParam.getEndTime() == null) { - beginTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), true); - endTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), false); - } else {// 时间不空,删选时间 - beginTime = DateUtils.startDayOrEndDay(outpatientInfusionSearchParam.getBeginTime(), true); - endTime = DateUtils.startDayOrEndDay(outpatientInfusionSearchParam.getEndTime(), false); - } + public IPage getOutpatientInfusionPatientList(String searchKey, Integer pageNo, + Integer pageSize, HttpServletRequest request) { // 构建查询条件 - QueryWrapper queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey, - new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientBusNo, - CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.PatientName)), - null); - // based_on_id 是为空的 - queryWrapper.eq(CommonConstants.FieldName.basedOnId, null); - // 状态是未完成的 - queryWrapper.in(CommonConstants.FieldName.requestStatus, EventStatus.IN_PROGRESS.getValue(), - EventStatus.NOT_DONE.getValue()); - // 添加时间段查询条件 - if (beginTime != null && endTime != null) { - queryWrapper.ge(CommonConstants.FieldName.createTime, beginTime); - queryWrapper.le(CommonConstants.FieldName.createTime, endTime); - } + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(new OutpatientInfusionPatientDto(), searchKey, + new HashSet<>(Arrays.asList(CommonConstants.FieldName.PatientBusNo, + CommonConstants.FieldName.EncounterBusNo, CommonConstants.FieldName.PatientName)), + request); IPage outpatientInfusionPatientDto = outpatientManageMapper.getOutpatientInfusionPatient(new Page<>(pageNo, pageSize), queryWrapper); @@ -118,7 +89,7 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR // 性别 e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); // 计算年龄 - e.setAgeString(AgeCalculatorUtil.getAge(e.getBirthDate())); + e.setAgeString(AgeCalculatorUtil.getAge(DateUtils.parseDate(e.getBirthDate()))); }); return outpatientInfusionPatientDto; @@ -131,25 +102,45 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR * @return 当前患者门诊输液待执行列表 */ @Override - public List - getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto) { + public List getPatientInfusionRecord( + OutpatientInfusionPatientDto outpatientInfusionPatientDto, HttpServletRequest request) { - if (outpatientInfusionPatientDto == null && outpatientInfusionPatientDto.getPatientId() != null) { + // 参数不能为空 + if (outpatientInfusionPatientDto == null) { + return null; + } else if (outpatientInfusionPatientDto.getPatientId() == null) { return null; } - // 创建查询包装器 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(OutpatientInfusionRecordDto::getPatientId, outpatientInfusionPatientDto.getPatientId()); - // based_on_id 是为空的 - queryWrapper.eq(OutpatientInfusionRecordDto::getBasedOnId, null); - // 状态是未完成的 - queryWrapper.in(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.IN_PROGRESS.getValue(), - EventStatus.NOT_DONE.getValue()); - // 从数据库获取输液记录列表 - List infusionList = - outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper); - return infusionList; + // 构建查询条件 + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(null, null, null, request); + + queryWrapper.eq(CommonConstants.FieldName.PatientId, outpatientInfusionPatientDto.getPatientId()); + // based_on_id 是为空的 + queryWrapper.isNull(CommonConstants.FieldName.BasedOnId); + // 状态是未完成的 + queryWrapper.eq(CommonConstants.FieldName.RequestStatus, EventStatus.IN_PROGRESS.getValue()); + + // 默认显示100条 + IPage OutpatientInfusionRecordPage = + outpatientManageMapper.getOutpatientInfusionRecord(new Page<>(1, 100), queryWrapper); + + List infusionPerformList = OutpatientInfusionRecordPage.getRecords(); + + // 遍历列表并处理每个记录 + infusionPerformList.forEach(e -> { + // 性别 + e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); + // 药品状态 + e.setMedicationStatusEnum_enumText( + EnumUtils.getInfoByValue(EventStatus.class, e.getMedicationStatusEnum())); + // 皮试标志 + e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag())); + + }); + + return infusionPerformList; } /** @@ -173,76 +164,152 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR Map> groupedRecords = outpatientInfusionRecordDtoList.stream() .collect(Collectors.groupingBy(OutpatientInfusionRecordDto::getGroupId)); + // 按 serviceId 分组 + Map> serviceRecords = outpatientInfusionRecordDtoList.stream() + .collect(Collectors.groupingBy(OutpatientInfusionRecordDto::getServiceId)); + + // 构造批量插入的 ServiceRequest 列表 + List serviceRequests = new ArrayList<>(); + // 遍历每个分组 for (Map.Entry> entry : groupedRecords.entrySet()) { List groupRecords = entry.getValue(); // 获取组内药品个数 - Long groupCount = outpatientManageMapper.countMedicationExecuteNum(groupRecords.get(0).getServiceId(), null, + Long groupCount = outpatientManageMapper.countExecuteNumOrGroupNum(groupRecords.get(0).getServiceId(), null, groupRecords.get(0).getGroupId(), false); + // 检查组内药品是否全部选中 if (groupCount != groupRecords.size()) { return false; } - // 构造批量插入的 ServiceRequest 列表 - List serviceRequests = new ArrayList<>(); for (OutpatientInfusionRecordDto record : groupRecords) { - String prefixBusNo = record.getBusNo() + "." + record.getGroupId() + "." + record.getMedicationId(); + + // 判断当前组药品状态不是已领药,有未领药的数据,跳过执行下一组数据 + if (!(record.getMedicationStatusEnum() == EventStatus.COMPLETED.getValue())) { + // 跳过当前分组的剩余处理,继续下一个分组 + break; + } + + String prefixBusNo = record.getBusNo() + CommonConstants.Common.DASH + record.getGroupId() + + CommonConstants.Common.DASH + record.getMedicationId(); // 获取执行次数 Long exeCount = - outpatientManageMapper.countMedicationExecuteNum(record.getServiceId(), prefixBusNo, null, true); + outpatientManageMapper.countExecuteNumOrGroupNum(record.getServiceId(), prefixBusNo, null, true); if (exeCount < record.getExecuteNum()) { ServiceRequest serviceRequest = new ServiceRequest(); serviceRequest.setPrescriptionNo(record.getPrescriptionNo()) - .setBusNo(AssignSeqUtil.formatString(prefixBusNo, exeCount, 3)) + .setBusNo(AssignSeqUtil.formatString(prefixBusNo, exeCount + 1, 3)) .setBasedOnId(record.getServiceId()).setStatusEnum(EventStatus.COMPLETED.getValue()) .setActivityId(record.getActivityId()).setPatientId(record.getPatientId()) .setEncounterId(record.getEncounterId()).setPerformerId(practitioner.getId()) .setPerformerTypeCode(practitionerRole.getRoleCode()) - .setOccurrenceStartTime(DateUtils.getNowDate()) + .setOccurrenceStartTime(DateUtils.getNowDate()).setRequesterId(practitioner.getId()) .setOccurrenceEndTime(DateUtils.addDateMinute(DateUtils.getNowDate(), 30)); serviceRequests.add(serviceRequest); } } - // 使用 MyBatis-Plus 的 saveBatch 方法批量插入 - if (!serviceRequestService.saveBatch(serviceRequests)) { - return false; // 如果批量插入失败,返回 false - } - // 更新分组中每个记录的状态 - for (OutpatientInfusionRecordDto record : groupRecords) { - String prefixBusNo = record.getBusNo() + "." + record.getGroupId() + "." + record.getMedicationId(); - // 获取执行次数 - Long exeCount = - outpatientManageMapper.countMedicationExecuteNum(record.getServiceId(), prefixBusNo, null, true); - - // 执行完毕后,更新执行服务请求表的状态 - if (exeCount.equals(record.getExecuteNum())) { - if (!updateRecordStatus(record.getServiceId())) { - return false; // 如果更新状态失败,返回 false - } - } - } } - // 所有分组都执行成功 + + // 使用 MyBatis-Plus 的 saveBatch 方法批量插入 + if (!serviceRequestService.saveBatch(serviceRequests)) { + return false; // 如果批量插入失败,返回 false + } + // 批量更新执行状态 + List serviceIds = checkServiceRequestIsCompleted(); + int updateRes = batchUpdateRecordStatus(serviceIds); + + // 如果更新失败,返回 false + if (updateRes == 0) { + return false; + } + return true; + } /** - * 更新执行状态 + * 检查该条服务申请的所有输液信息都完成 * - * @param serviceId 服务请求ID + * @return 更新的ID集合 + */ + public List checkServiceRequestIsCompleted() { + + //获取全部执行输液记录 + List patientInfusionList =getPatientInfusionPerformRecord(null,null,false); + // 按 serviceId 分组 + Map> servicePatientInfusionList = patientInfusionList.stream() + .collect(Collectors.groupingBy(OutpatientInfusionRecordDto::getServiceId)); + + // 存储更新的serviceId + List serviceIds = new ArrayList<>(); + + // 遍历每个分组 + for (Map.Entry> entry : servicePatientInfusionList.entrySet()) { + // 获取当前分组的 serviceId + Long serviceId = entry.getKey(); + // 获取当前分组的记录列表 + List groupRecords = entry.getValue(); + + // 创建一个数组来记录每个记录是否满足条件 + int[] flags = new int[groupRecords.size()]; + int index = 0; // 用于记录当前索引 + + for (OutpatientInfusionRecordDto record : groupRecords) { + String prefixBusNo = record.getBusNo() + CommonConstants.Common.DASH + record.getGroupId() + + CommonConstants.Common.DASH + record.getMedicationId(); + // 获取执行次数 + Long exeCount = outpatientManageMapper.countExecuteNumOrGroupNum(serviceId, prefixBusNo, null, true); + + // 判断是否满足条件 + if (exeCount != null && exeCount.longValue() == record.getExecuteNum().longValue()) { + flags[index] = 1; // 如果满足条件,设置为 1 + } else { + flags[index] = 0; // 如果不满足条件,设置为 0 + } + index++; + } + + // 使用与运算判断最终结果 + int result = 1; + for (int flag : flags) { + result &= flag; // 与运算 + } + + // 如果最终结果为 1,表示所有记录都满足条件,即当前服务请求的数据全部被执行 + if (result == 1) { + serviceIds.add(serviceId); + return serviceIds; + } + + } + + return null; + } + + /** + * 批量更新执行状态 + * + * @param serviceIds 服务请求ID列表 * @return 修改成功/失败 */ - public boolean updateRecordStatus(Long serviceId) { + public int batchUpdateRecordStatus(List serviceIds) { + if (serviceIds == null || serviceIds.isEmpty()) { + // 返回-1,表示不更新 + return -1; + } + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); - updateWrapper.eq(ServiceRequest::getId, serviceId).set(ServiceRequest::getStatusEnum, + // 使用 IN 条件匹配多个 serviceId + updateWrapper.in(ServiceRequest::getId, serviceIds).set(ServiceRequest::getStatusEnum, EventStatus.COMPLETED.getValue()); int countUpdate = serviceRequestMapper.update(null, updateWrapper); - return countUpdate > 0; + // 如果更新的记录数大于 0 + return countUpdate; } /** @@ -260,71 +327,110 @@ public class OutpatientInfusionRecordServiceImpl implements IOutpatientInfusionR DateUtils.parseDate(outpatientInfusionRecordDto.getOccurrenceEndTime())); int countUpdate = serviceRequestMapper.update(null, updateWrapper); - return countUpdate < 0 ? false : true; + return countUpdate >= 0; } /** * 显示门诊输液执行记录查询 * - * @param beginTime 开始时间 - * @param endTime 结束时间 + * @param patientId 患者输液信息 * @param historyFlag 查询的是否为执行履历 - * @return 门诊输液执行记录查询 + * @return 返回门诊输液执行记录查询 */ @Override - public List getPatientInfusionPerformRecord(String beginTime, String endTime, + public List getPatientInfusionPerformRecord(Long patientId,HttpServletRequest request, boolean historyFlag) { - LocalDateTime beginDateTime; - LocalDateTime endDateTime; - // 筛选时间不传,默认当天记录 - if (beginTime == null || endTime == null) { - beginDateTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), true); - endDateTime = DateUtils.startDayOrEndDay(DateUtils.getDate(), false); - } else { - beginDateTime = DateUtils.startDayOrEndDay(beginTime, true); - endDateTime = DateUtils.startDayOrEndDay(endTime, false); - } + // 构建查询条件 + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(null, null, null, request); - // 创建查询包装器 - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); // 执行历史查询的条件 if (historyFlag) { // based_on_id 不为空,此条件筛选出执行履历 - queryWrapper.isNotNull(OutpatientInfusionRecordDto::getBasedOnId); + queryWrapper.isNotNull(CommonConstants.FieldName.BasedOnId); // 状态是已完成 - queryWrapper.eq(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.COMPLETED.getValue()); + queryWrapper.eq(CommonConstants.FieldName.RequestStatus, EventStatus.COMPLETED.getValue()); + //筛选当前ID的患者历史执行记录 + queryWrapper.eq(CommonConstants.FieldName.PatientId,patientId); + //执行次数大于0 + queryWrapper.gt("done_num", 0); + +// List infusionPerformList = editRecords(queryWrapper); +// List medicationIds = checkServiceRequestIsCompleted(infusionPerformList); +// // 未产生执行历史 +// if (medicationIds == null || medicationIds.isEmpty()) { +// return infusionPerformList; +// } +// // 筛选一下执行的药品 +// queryWrapper.in(CommonConstants.FieldName.MedicationId, medicationIds); + return editRecords(queryWrapper); // 门诊输液待执行记录查询 } else { - // based_on_id 为空,此条件筛选控制不显示执行履历 - queryWrapper.isNull(OutpatientInfusionRecordDto::getBasedOnId); - // 状态是进行中 - queryWrapper.eq(OutpatientInfusionRecordDto::getRequestStatus, EventStatus.IN_PROGRESS.getValue()); - } - // 时间筛选 - queryWrapper.ge(OutpatientInfusionRecordDto::getCreateTime, beginDateTime); - queryWrapper.le(OutpatientInfusionRecordDto::getCreateTime, endDateTime); - // 从数据库获取输液记录列表 - List infusionPerformList = - outpatientManageMapper.getOutpatientInfusionRecord(queryWrapper); + // based_on_id 为空,此条件筛选控制不显示执行履历 + queryWrapper.isNull(CommonConstants.FieldName.BasedOnId); + // 状态是进行中 + queryWrapper.eq(CommonConstants.FieldName.RequestStatus, EventStatus.IN_PROGRESS.getValue()); + //筛选当前ID的患者历史执行记录 + queryWrapper.eq(CommonConstants.FieldName.PatientId,patientId); + + return editRecords(queryWrapper); + } + + } + + /** + * 执行完成后,显示执行历史 + * + * @param infusionPerformList 执行历史输液列表 + * @return medicationIds 返回药品id集合 + */ + public List checkServiceRequestIsCompleted(List infusionPerformList) { + + List medicationIds = new ArrayList<>(); + infusionPerformList.forEach(e -> { + + // 使用正则表达式匹配 . 前面的第一个数字 + String regex = "(\\d+)\\."; + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(e.getBusNo()); + + if (matcher.find()) { + // 获取匹配的第一个数字 + medicationIds.add(Long.valueOf(matcher.group(1))); // 添加到 List 中 + } + }); + + return medicationIds; + + } + + /** + * 显示门诊输液执行记录查询 + * + * @param queryWrapper 查询条件 + * @return 返回门诊输液执行记录查询 + */ + public List editRecords(QueryWrapper queryWrapper) { + + // 默认显示100条 + IPage OutpatientInfusionRecordPage = + outpatientManageMapper.getOutpatientInfusionRecord(new Page<>(1, 100), queryWrapper); + List infusionPerformList = OutpatientInfusionRecordPage.getRecords(); // 遍历列表并处理每个记录 infusionPerformList.forEach(e -> { // 性别 e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum())); // 药品状态 - e.setClinicalStatusEnum_enumText(EnumUtils.getInfoByValue(EventStatus.class, e.getMedicationStatusEnum())); + e.setMedicationStatusEnum_enumText( + EnumUtils.getInfoByValue(EventStatus.class, e.getMedicationStatusEnum())); // 皮试标志 e.setSkinTestFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getSkinTestFlag())); - // 只有皮试药品才显示皮试结果 - if (e.getSkinTestFlag() == Whether.YES.getValue()) { - // 皮试结果 - e.setMedicationStatusEnum_enumText( - EnumUtils.getInfoByValue(ClinicalStatus.class, e.getClinicalStatusEnum())); - } + }); return infusionPerformList; diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientInfusionRecordController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientInfusionRecordController.java index 59ddd293..95543e1a 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientInfusionRecordController.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/controller/OutpatientInfusionRecordController.java @@ -2,6 +2,8 @@ package com.openhis.web.outpatientmanage.controller; import java.util.List; +import javax.servlet.http.HttpServletRequest; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -10,9 +12,7 @@ import com.core.common.core.domain.R; import com.core.common.utils.MessageUtils; import com.openhis.common.constant.PromptMsgConstant; import com.openhis.web.outpatientmanage.appservice.IOutpatientInfusionRecordService; -import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto; import com.openhis.web.outpatientmanage.dto.OutpatientInfusionRecordDto; -import com.openhis.web.outpatientmanage.dto.OutpatientInfusionSearchParam; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -35,29 +35,32 @@ public class OutpatientInfusionRecordController { /** * 查询门诊输液的患者列表 * - * @param outpatientInfusionSearchParam 查询参数 + * @param searchKey 模糊查询关键字 + * @param pageNo 当前页 + * @param pageSize 每页多少条 * @return 返回门诊输液的患者列表 */ @GetMapping(value = "/infusion-patient-list") - public R getOutpatientInfusionPatientList(OutpatientInfusionSearchParam outpatientInfusionSearchParam, + public R getOutpatientInfusionPatientList(@RequestParam(value = "searchKey", defaultValue = "") String searchKey, @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, - @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { - return R.ok(outpatientInfusionRecordService.getOutpatientInfusionPatientList(outpatientInfusionSearchParam, - pageNo, pageSize)); + return R + .ok(outpatientInfusionRecordService.getOutpatientInfusionPatientList(searchKey, pageNo, pageSize, request)); } - /** - * 点击患者,查询该患者的输液记录 - * - * @param outpatientInfusionPatientDto 患者输液信息 - * @return 当前患者门诊输液待执行列表 - */ - @GetMapping(value = "/patient-infusion-record") - public R getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto) { - - return R.ok(outpatientInfusionRecordService.getPatientInfusionRecord(outpatientInfusionPatientDto)); - } + // /** + // * 点击患者,查询该患者的输液记录 + // * + // * @param outpatientInfusionPatientDto 患者输液信息 + // * @return 当前患者门诊输液待执行列表 + // */ + // @GetMapping(value = "/patient-infusion-record") + // public R getPatientInfusionRecord(OutpatientInfusionPatientDto outpatientInfusionPatientDto, + // HttpServletRequest request) { + // + // return R.ok(outpatientInfusionRecordService.getPatientInfusionRecord(outpatientInfusionPatientDto, request)); + // } /** * 批量执行患者门诊输液 @@ -94,29 +97,27 @@ public class OutpatientInfusionRecordController { /** * 门诊输液待执行记录查询 * - * @param beginTime 开始时间 - * @param endTime 结束时间 + * @param patientId 患者ID * @return 门诊输液待执行记录列表 */ @GetMapping(value = "/infusion-wait-perform-record") - public R getPatientInfusionRecords(@RequestParam(required = false) String beginTime, - @RequestParam(required = false) String endTime) { + public R getPatientInfusionRecords(@RequestParam(value = "patientId", required = false) Long patientId, + HttpServletRequest request) { - return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(beginTime, endTime, false)); + return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(patientId, request, false)); } /** * 门诊输液执行历史记录查询 * - * @param beginTime 开始时间 - * @param endTime 结束时间 + * @param patientId 患者ID * @return 门诊输液执行历史记录列表 */ @GetMapping(value = "/infusion-perform-record") - public R getPatientInfusionPerformRecord(@RequestParam(required = false) String beginTime, - @RequestParam(required = false) String endTime) { + public R getPatientInfusionPerformRecord(@RequestParam(value = "patientId", required = false) Long patientId, + HttpServletRequest request) { - return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(beginTime, endTime, true)); + return R.ok(outpatientInfusionRecordService.getPatientInfusionPerformRecord(patientId, request, true)); } } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionPatientDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionPatientDto.java index 00a29224..a1e917e6 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionPatientDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionPatientDto.java @@ -1,10 +1,12 @@ package com.openhis.web.outpatientmanage.dto; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import lombok.experimental.Accessors; +import javax.validation.constraints.NotNull; import java.util.Date; /** @@ -42,7 +44,7 @@ public class OutpatientInfusionPatientDto { private String genderEnum_enumText; /** 病人生日 */ - private Date birthDate; + private String birthDate; /** 病人身份证号 */ private String idCard; @@ -50,4 +52,7 @@ public class OutpatientInfusionPatientDto { /** 病人年龄 */ private String ageString; + /** 开单时间 */ + private String createTime; + } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionRecordDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionRecordDto.java index d53f37a1..c2421c67 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionRecordDto.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionRecordDto.java @@ -1,7 +1,6 @@ package com.openhis.web.outpatientmanage.dto; import java.math.BigDecimal; -import java.util.Date; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; @@ -64,6 +63,9 @@ public class OutpatientInfusionRecordDto { /** 住院执行次数 */ private Integer executeNum; + /** 已经行次数 */ + private Integer doneNum; + /** 分组id */ @JsonSerialize(using = ToStringSerializer.class) private Long groupId; @@ -83,8 +85,8 @@ public class OutpatientInfusionRecordDto { /** 发放科室 */ @Dict(dictCode = "id", dictTable = "adm_organization", dictText = "name") @JsonSerialize(using = ToStringSerializer.class) - private Long orgId; - private String orgId_dictText; + private Long performOrg; + private String performOrg_dictText; /** 预计执行时间 */ private String occurrenceStartTime; @@ -93,13 +95,14 @@ public class OutpatientInfusionRecordDto { private String occurrenceEndTime; /** 药品ID */ + @JsonSerialize(using = ToStringSerializer.class) private Long medicationId; /** 药品信息 */ private String medicationInformation; /** 药品数量 */ - private BigDecimal medicationAntity; + private BigDecimal medicationQuantity; /** 用药频次 */ private String rateCode; @@ -118,11 +121,7 @@ public class OutpatientInfusionRecordDto { private Integer skinTestFlag; private String skinTestFlag_enumText; - /** 皮试结果 */ - private Integer clinicalStatusEnum; - private String clinicalStatusEnum_enumText; - /** 开单时间 */ - private Date createTime; + private String createTime; } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionSearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionSearchParam.java deleted file mode 100644 index a0869482..00000000 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/dto/OutpatientInfusionSearchParam.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.openhis.web.outpatientmanage.dto; - -import lombok.Data; - -/** - * 门诊输液记录查询体体条件类 - * - * @author liuhr - * @date 2025/3/12 - */ -@Data -public class OutpatientInfusionSearchParam { - - /** 病人ID/门诊号/病人姓名 */ - private String searchKey; - - /** 筛选开始时间 */ - private String beginTime; - - /** 筛选结束时间 */ - private String endTime; - -} - diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/mapper/OutpatientManageMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/mapper/OutpatientManageMapper.java index e5bd3d49..ba2d00c1 100644 --- a/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/mapper/OutpatientManageMapper.java +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/outpatientmanage/mapper/OutpatientManageMapper.java @@ -1,7 +1,9 @@ package com.openhis.web.outpatientmanage.mapper; +import java.util.Date; import java.util.List; +import com.openhis.workflow.domain.ServiceRequest; import org.apache.ibatis.annotations.Param; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -57,11 +59,13 @@ public interface OutpatientManageMapper { /** * 门诊输液记录查询 * + * @param page 分页参数,默认100条记录 * @param queryWrapper 查询条件 * @return 门诊输液记录列表 */ - List getOutpatientInfusionRecord( - @Param(Constants.WRAPPER) LambdaQueryWrapper queryWrapper); + IPage getOutpatientInfusionRecord( + @Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); /** * 查询药品已执行数量/查询同组内药品数量 @@ -72,7 +76,7 @@ public interface OutpatientManageMapper { * @param flag 控制查询条件 * @return 查询个数 */ - long countMedicationExecuteNum(@Param("paramId") Long paramId, @Param("prefixBusNo") String prefixBusNo, + long countExecuteNumOrGroupNum(@Param("paramId") Long paramId, @Param("prefixBusNo") String prefixBusNo, @Param("groupId") Long groupId, @Param("flag") boolean flag); } diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/appservice/IPaymentRecService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/appservice/IPaymentRecService.java new file mode 100644 index 00000000..d1da6748 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/appservice/IPaymentRecService.java @@ -0,0 +1,50 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.payment.appservice; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.core.common.core.domain.R; +import com.openhis.financial.domain.PaymentRecDetail; +import com.openhis.financial.domain.PaymentReconciliation; +import com.openhis.web.outpatientmanage.dto.OutpatientSkinTestRecordDto; +import com.openhis.web.payment.dto.PaymentDetailDto; +import com.openhis.web.payment.dto.PaymentDto; + +import javax.servlet.http.HttpServletRequest; +import java.util.List; + +/** + * 付款应用层Service + * + * @author SunJQ + * @date 2025-03-29 + */ +public interface IPaymentRecService { + /** + * 付款 + * @param paymentDto + * @return + */ + R savePayment(PaymentDto paymentDto); + /** + * 取消付款 + * @param paymentDto + * @return + */ + R cancelPayment(PaymentDto paymentDto); + + /** + * 支付列表 + * @param searchKey + * @param pageNo + * @param pageSize + * @param request + * @return + */ + IPage getPage(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request); + + List getDetail(PaymentDto paymentDto); + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/appservice/impl/PaymentRecServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/appservice/impl/PaymentRecServiceImpl.java new file mode 100644 index 00000000..d805abf2 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/appservice/impl/PaymentRecServiceImpl.java @@ -0,0 +1,167 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.payment.appservice.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.core.common.core.domain.R; +import com.core.common.utils.AgeCalculatorUtil; +import com.core.common.utils.AssignSeqUtil; +import com.core.common.utils.DateUtils; +import com.core.common.utils.MessageUtils; +import com.core.common.utils.bean.BeanUtils; +import com.openhis.common.constant.CommonConstants; +import com.openhis.common.constant.PromptMsgConstant; +import com.openhis.common.enums.*; +import com.openhis.common.utils.EnumUtils; +import com.openhis.common.utils.HisQueryUtils; +import com.openhis.financial.domain.Contract; +import com.openhis.financial.domain.PaymentRecDetail; +import com.openhis.financial.domain.PaymentReconciliation; +import com.openhis.financial.service.IContractService; +import com.openhis.financial.service.IPaymentRecDetailService; +import com.openhis.financial.service.IPaymentReconciliationService; +import com.openhis.web.outpatientmanage.dto.OutpatientInfusionPatientDto; +import com.openhis.web.payment.appservice.IPaymentRecService; +import com.openhis.web.payment.dto.PaymentDetailDto; +import com.openhis.web.payment.dto.PaymentDto; +import com.openhis.web.payment.mapper.PaymentMapper; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; + +/** + * 付款应用层Service + * + * @author SunJQ + * @date 2025-03-29 + */ +@Component +public class PaymentRecServiceImpl implements IPaymentRecService { + @Resource + IPaymentReconciliationService paymentReconciliationService; + @Resource + IPaymentRecDetailService paymentRecDetailService; + @Resource + IContractService contractService; + @Resource + AssignSeqUtil assignSeqUtil; + @Resource + PaymentMapper paymentMapper; + + @Override + @Transactional + public R savePayment(PaymentDto paymentDto) { + Contract contract = contractService.getOne(new LambdaQueryWrapper().eq(Contract::getBusNo, paymentDto.getContractNo())); + if (contract == null) { + //todo:sjq 返回提示信息 + R.fail(); + } + Category categoryEnum = Category.getByValue(contract.getCategoryEnum()); + //todo:sjq 医保支付与普通门诊支付多2207操作 + switch (categoryEnum) { + case SELF: + case PUBLIC: + return normalCharge(paymentDto); + case PROVINCIAL_INSURANCE: + case MUNICIPAL_INSURANCE: + return insuranceCharge(paymentDto); + } + return null; + } + + /** + * 医保支付 + * @param paymentDto + * @return + */ + private R insuranceCharge(PaymentDto paymentDto) { + normalCharge(paymentDto); + //todo:sjq 调用2207 + + return R.ok(); + } + + /** + * 自费支付 + * @param paymentDto + * @return + */ + private R normalCharge(PaymentDto paymentDto) { + //获取参数 + List paymentDetails = paymentDto.getPaymentDetails(); + PaymentReconciliation paymentReconciliation = new PaymentReconciliation(); + BigDecimal sum = BigDecimal.ZERO; + //数额校验 + ArrayList paymentRecDetails = new ArrayList<>(); + for (PaymentDetailDto paymentDetail : paymentDetails) { + PaymentRecDetail paymentRecDetail = new PaymentRecDetail(); + BeanUtils.copyProperties(paymentDetail,paymentRecDetail); + paymentRecDetail.setPredecessorId(paymentReconciliation.getId()); + paymentRecDetail.setAccountId(paymentDetail.getAccountId()==null?0:paymentDetail.getAccountId()); + paymentRecDetail.setResultEnum(PaymentResult.PAID.getValue()); + paymentRecDetails.add(paymentRecDetail); + sum = sum.add(paymentRecDetail.getAmount()); + } + if(sum.compareTo(paymentReconciliation.getTenderedAmount()) != 0){ + //todo:sjq 返回文字提示:实收金额合计不等于应收金额 + return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null)); + } + + BeanUtils.copyProperties(paymentDto, paymentReconciliation); + paymentReconciliation.setStatusEnum(PaymentStatus.SUCCESS.getValue()) + .setPaymentNo(assignSeqUtil.getSeqByDay(AssignSeqEnum.PAYMENT_NO.getPrefix(), 20)) + .setPaymentEnum(PaymentType.PAY.getValue()); + + //保存付款 + paymentReconciliationService.save(paymentReconciliation); + + //保存付款详情 + paymentRecDetailService.saveBatch(paymentRecDetails); + return R.ok(); + } + + @Override + public R cancelPayment(PaymentDto paymentDto) { + //todo:sjq 退费方法 + return null; + } + + @Override + public IPage getPage(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request) { + // 构建查询条件 + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(new PaymentDto(), searchKey, + new HashSet<>(Arrays.asList(CommonConstants.FieldName.encouterId, + CommonConstants.FieldName.contractNo, CommonConstants.FieldName.paymentNo)), + request); + + IPage paymentDtoIPage = + paymentMapper.getPage(new Page<>(pageNo, pageSize), queryWrapper); + + //todo:sjq 1.是否联表查询患者名字,收款员姓名等信息 2.赋值 +// paymentDtoIPage.getRecords().forEach(e -> { +// // 性别 +// e.setKindEnum_enumText(EnumUtils.getInfoByValue(PaymentKind.class, e.getKindEnum())); +// // 计算年龄 +// e.setAgeString(AgeCalculatorUtil.getAge(DateUtils.parseDate(e.getBirthDate()))); +// }); + + return paymentDtoIPage; + } + + @Override + public List getDetail(PaymentDto paymentDto) { + return paymentMapper.getPaymentDetailList(paymentDto.getId()); + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/controller/PaymentReconciliationController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/controller/PaymentReconciliationController.java new file mode 100644 index 00000000..16b5f9fe --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/controller/PaymentReconciliationController.java @@ -0,0 +1,80 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.payment.controller; + +import com.core.common.core.domain.R; +import com.core.common.utils.MessageUtils; +import com.openhis.common.constant.PromptMsgConstant; +import com.openhis.web.payment.appservice.IPaymentRecService; +import com.openhis.web.payment.dto.PaymentDto; +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletRequest; + +/** + * 付款管理 + * + * @author SunJQ + * @date 2025-03-29 + */ +@RestController +@RequestMapping("/payment/payment") +@Slf4j +@AllArgsConstructor +public class PaymentReconciliationController { + + @Autowired + private IPaymentRecService paymentReconciliationService; + + /** + * 付款 + * + * @param paymentDto 付款实体 + */ + @PostMapping("/charge") + public R savePayment(@Validated @RequestBody PaymentDto paymentDto) { + return paymentReconciliationService.savePayment(paymentDto); + } + + /** + * 取消付款 + * + * @param paymentDto 付款实体 + */ + @PostMapping("/uncharge") + public R cancelPayment(@RequestBody PaymentDto paymentDto) { + return paymentReconciliationService.cancelPayment(paymentDto); + } + + /** + * 支付列表 + * @param searchKey + * @param pageNo + * @param pageSize + * @param request + * @return + */ + @PostMapping("/page") + public R paymentPage(@RequestParam(value = "searchKey", defaultValue = "") String searchKey, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request){ + return R + .ok(paymentReconciliationService.getPage(searchKey, pageNo, pageSize, request)); + } + + /** + * 支付详情 + * @param paymentDto + * @return + */ + @PostMapping("/detail") + public R paymentDetail(@RequestBody PaymentDto paymentDto){ + return R.ok(paymentReconciliationService.getDetail(paymentDto)); + } + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/dto/PaymentDetailDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/dto/PaymentDetailDto.java new file mode 100644 index 00000000..8d510a28 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/dto/PaymentDetailDto.java @@ -0,0 +1,45 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.payment.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * 支付详情 + * + * @author SunJQ + * @date 2025-03-29 + */ +@Data +@Accessors(chain = true) +public class PaymentDetailDto { + + /** 付款类型 */ + private Integer targetEnum; + + /** 账户 */ + private Long accountId; + + /** 账户类型 */ + private Integer accountEnum; + + /** 支付类型 */ + private Integer payEnum; + + /** 支付类型等级 */ + private Integer payLevelEnum; + + /** 金额 */ + private BigDecimal amount; + + /** 找零 */ + private BigDecimal returnAmount; + + /** 交款 */ + private BigDecimal chargeAmount; + +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/dto/PaymentDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/dto/PaymentDto.java new file mode 100644 index 00000000..44027871 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/dto/PaymentDto.java @@ -0,0 +1,74 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.payment.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; +import java.util.List; + +/** + * 付款入参 + * + * @author SunJQ + * @date 2025-03-29 + */ +@Data +@Accessors(chain = true) +public class PaymentDto { + + /** + * id + */ + private Long id; + + /** 发起支付的工作流程类别 */ + @NotNull + private Integer kindEnum; + private String kindEnum_enumText; + + /** 付款类别 */ + @NotNull + private Integer paymentEnum; + private String paymentEnum_enumText; + + /** 收款员 */ + private Long entererId; + + /** 支付的患者ID */ + @NotNull + private Long patientId; + + /** 应收金额 */ + @NotNull + private BigDecimal tenderedAmount; + + /** 找零金额 */ + @NotNull + private BigDecimal returnedAmount; + + /** 付款总额 */ + @NotNull + private BigDecimal displayAmount; + + /** 合同编码 */ + @NotNull + private String contractNo; + + /** 就诊ID */ + @NotBlank + private Long encounterId; + + /** 收费项 */ + @NotBlank + private String chargeItemIds; + + /** 支付详细 */ + @NotEmpty + private List paymentDetails; +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/mapper/PaymentMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/mapper/PaymentMapper.java new file mode 100644 index 00000000..82906f1a --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/payment/mapper/PaymentMapper.java @@ -0,0 +1,36 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.payment.mapper; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.payment.dto.PaymentDetailDto; +import com.openhis.web.payment.dto.PaymentDto; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** + * 付款Dao + * + * @author SunJQ + * @date 2025-03-29 + */ +public interface PaymentMapper { + /** + * 付款列表 + * @param page + * @param queryWrapper + * @return + */ + IPage getPage(Page page, QueryWrapper queryWrapper); + + /** + * 付款详情 + * @param id + * @return + */ + List getPaymentDetailList(@Param("id") Long id); +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/IWesternMedicineDispenseAppService.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/IWesternMedicineDispenseAppService.java new file mode 100644 index 00000000..c4b75ec5 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/IWesternMedicineDispenseAppService.java @@ -0,0 +1,59 @@ +package com.openhis.web.pharmacymanage.appservice; + +import javax.servlet.http.HttpServletRequest; + +import com.core.common.core.domain.R; +import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam; + +/** + * 处方管理 应用实现接口 + * + * @author wangyang + * @date 2025/3/18 + */ +public interface IWesternMedicineDispenseAppService { + + /** + * 页面初始化 + * + * @return 初始化信息 + */ + R init(); + + /** + * 分页查询就诊病人列表 + * + * @param encounterInfoSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param request 请求数据 + * @return 就诊病人分页列表 + */ + R getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, Integer pageNo, Integer pageSize, + HttpServletRequest request); + + /** + * 查询处方单列表 + * + * @param encounterId 就诊号 + * @return 处方单列表 + */ + R getPrescriptionInfo(Long encounterId); + + /** + * 处方单核对发药 + * + * @param prescriptionNo 处方号 + * @return 处理结果 + */ + R medicineDispense(String prescriptionNo); + + /** + * 处方单作废 + * + * @param prescriptionNo 处方号 + * @param notPerformedReasonEnum 未发药原因 + * @return 处理结果 + */ + R medicineCancel(String prescriptionNo, Integer notPerformedReasonEnum); +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/impl/IWesternMedicineDispenseAppServiceImpl.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/impl/IWesternMedicineDispenseAppServiceImpl.java new file mode 100644 index 00000000..8bc6f538 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/appservice/impl/IWesternMedicineDispenseAppServiceImpl.java @@ -0,0 +1,283 @@ +package com.openhis.web.pharmacymanage.appservice.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.core.common.core.domain.R; +import com.core.common.utils.*; +import com.openhis.administration.domain.Organization; +import com.openhis.administration.service.IOrganizationService; +import com.openhis.common.constant.PromptMsgConstant; +import com.openhis.common.enums.*; +import com.openhis.common.utils.EnumUtils; +import com.openhis.common.utils.HisQueryUtils; +import com.openhis.medication.domain.MedicationDispense; +import com.openhis.medication.service.IMedicationDispenseService; +import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService; +import com.openhis.web.pharmacymanage.dto.*; +import com.openhis.web.pharmacymanage.mapper.WesternMedicineDispenseMapper; +import com.openhis.workflow.domain.InventoryItem; +import com.openhis.workflow.service.IInventoryItemService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletRequest; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * 西药发放 应用实现类 + * + * @author wangyang + * @date 2025/3/14 + */ +@Service +public class IWesternMedicineDispenseAppServiceImpl implements IWesternMedicineDispenseAppService { + + @Autowired + private IOrganizationService iOrganizationService; + + @Autowired + IMedicationDispenseService iMedicationDispenseService; + + @Autowired + IInventoryItemService iInventoryItemService; + + @Autowired + WesternMedicineDispenseMapper westernMedicineDispenseMapper; + + /** + * 获取页面初始化信息 + * + * @return 初始化信息 + */ + @Override + public R init() { + + PageInitDto initDto = new PageInitDto(); + + // 获取科室下拉选列表 + List organizationList = iOrganizationService.getList(OrganizationClass.CLINIC.getValue()); + List organizationOptions = organizationList.stream() + .map(organization -> new PageInitDto.DepartmentOption(organization.getId(), + organization.getName())).collect(Collectors.toList()); + + // 未发药原因下拉选列表 + List notPerformedReasonOptions = + Stream.of(NotPerformedReasonEnum.values()).map(notPerformedReason -> + new PageInitDto.NotPerformedReasonOption(notPerformedReason.getValue(), + notPerformedReason.getInfo())).collect(Collectors.toList()); + + initDto.setDepartmentOptions(organizationOptions).setNotPerformedReasonOptions(notPerformedReasonOptions); + return R.ok(initDto); + } + + /** + * 分页查询就诊病人列表 + * + * @param encounterInfoSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param request 请求数据 + * @return 就诊病人列表 + */ + @Override + public R getEncounterInfoListPage(EncounterInfoSearchParam encounterInfoSearchParam, + Integer pageNo, + Integer pageSize, + HttpServletRequest request) { + + // 查询条件设定 + String condition = encounterInfoSearchParam.getCondition(); + encounterInfoSearchParam.setCondition(null); + if (StringUtils.isNotEmpty(condition)){ + Pattern pattern = Pattern.compile(".*\\d.*"); + Matcher matcher = pattern.matcher(condition); + if (matcher.find()){ + encounterInfoSearchParam.setIdCard(condition); + } else{ + encounterInfoSearchParam.setPatientName(condition); + } + } + + // 构建查询条件 + QueryWrapper queryWrapper = + HisQueryUtils.buildQueryWrapper(encounterInfoSearchParam,null,null, request); + + // 查询就诊病人列表 + Page encounterInfoPageDto = westernMedicineDispenseMapper.selectEncounterInfoListPage( + new Page<>(pageNo, pageSize), queryWrapper); + + // 个别项目设定 + encounterInfoPageDto.getRecords().forEach(prescriptionPatientInfoDto -> { + // 性别 + prescriptionPatientInfoDto.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, + prescriptionPatientInfoDto.getGenderEnum())); + }); + return R.ok(encounterInfoPageDto); + } + + /** + * 查询处方单列表 + * @param encounterId 就诊号 + * @return 处方单列表 + */ + @Override + public R getPrescriptionInfo(Long encounterId) { + + // 患者基本信息查询 + PrescriptionPatientInfoDto prescriptionPatientInfoDto = westernMedicineDispenseMapper. + selectPrescriptionPatientInfo(encounterId); + // 年龄 + prescriptionPatientInfoDto.setAge(AgeCalculatorUtil.getAge(prescriptionPatientInfoDto.getBirthDate())); + // 性别 + prescriptionPatientInfoDto.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, + prescriptionPatientInfoDto.getGenderEnum())); + // 合同类型 + if (StringUtils.isNotNull(prescriptionPatientInfoDto.getCategoryEnum())){ + prescriptionPatientInfoDto.setCategoryEnum_enumText(EnumUtils.getInfoByValue(FinCategory.class, + prescriptionPatientInfoDto.getCategoryEnum())); + } + // 处方单信息查询 + List prescriptionMedicineInfoList = westernMedicineDispenseMapper. + selectPrescriptionMedicineInfoList(encounterId); + // 计算合计金额 + if(!prescriptionMedicineInfoList.isEmpty()) { + double totalPrice = 0d; + for (PrescriptionMedicineInfoDto item : prescriptionMedicineInfoList) { + totalPrice += item.getTotalPrice().doubleValue(); + } + prescriptionPatientInfoDto.setTotalPrice(totalPrice); + } + PrescriptionInfoDto prescriptionInfoDto = new PrescriptionInfoDto(); + prescriptionInfoDto.setPrescriptionPatientInfoDto(prescriptionPatientInfoDto); + prescriptionInfoDto.setPrescriptionMedicineInfoDtoList(prescriptionMedicineInfoList); + return R.ok(prescriptionInfoDto); + } + + /** + * 处方单核对发药 + * @param prescriptionNo 处方号 + * @return 处理结果 + */ + @Override + public R medicineDispense(String prescriptionNo) { + + List medicationDispenseList = new ArrayList<>(); + List inventoryItemList = new ArrayList<>(); + boolean iMedicationDispenseUpdFlg = true; + boolean iInventoryItemUpdFlg = true; + + // 获取药品待发放和库存信息 + List dispenseInventoryList = westernMedicineDispenseMapper. + selectDispenseInventoryInfoByPrescriptionNo(prescriptionNo); + if(!dispenseInventoryList.isEmpty()){ + MedicationDispense medicationDispense; + InventoryItem inventoryItem; + for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) { + + // 药品发放表项目设定 + medicationDispense = new MedicationDispense(); + // id + medicationDispense.setId(dispenseInventoryDto.getDispenseId()); + // 药品发放状态 + medicationDispense.setStatusEnum(DispenseStatus.COMPLETED.getValue()); + // 状态变更时间 + medicationDispense.setStatusChangedTime(DateUtils.getNowDate()); + // 发药人 + medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId()); + // 已发药数量 + medicationDispense.setDispenseQuantity(dispenseInventoryDto.getDispenseQuantity()); + // 配药时间 + medicationDispense.setPrepareTime(DateUtils.getNowDate()); + // 发药时间 + medicationDispense.setDispenseTime(DateUtils.getNowDate()); + medicationDispenseList.add(medicationDispense); + + // 库存表项目设定 + inventoryItem = new InventoryItem(); + // 库存数量 + if (dispenseInventoryDto.getDispenseUnitCode().equals(dispenseInventoryDto. + getInventoryBaseUnitCode())) { + // id + inventoryItem.setId(dispenseInventoryDto.getInventoryId()); + // 包装数量 + inventoryItem.setBaseQuantity(dispenseInventoryDto.getInventoryBaseQuantity().subtract( + new BigDecimal(dispenseInventoryDto.getDispenseQuantity()))); + // 拆零数量(拆零比×包装数量) + inventoryItem.setMinQuantity(dispenseInventoryDto.getInventoryMinQuantity().subtract( + dispenseInventoryDto.getPartPercent().multiply( + new BigDecimal(dispenseInventoryDto.getDispenseQuantity())))); + } else if (dispenseInventoryDto.getDispenseUnitCode().equals(dispenseInventoryDto. + getInventoryMinUnitCode())) { + // id + inventoryItem.setId(dispenseInventoryDto.getInventoryId()); + // 拆零数量 + inventoryItem.setMinQuantity(dispenseInventoryDto.getInventoryMinQuantity().subtract( + new BigDecimal(dispenseInventoryDto.getDispenseQuantity()))); + // 包装数量(拆零数量÷拆零比) + inventoryItem.setBaseQuantity(dispenseInventoryDto.getInventoryBaseQuantity().subtract( + new BigDecimal(dispenseInventoryDto.getDispenseQuantity()). + divide(dispenseInventoryDto.getPartPercent(),RoundingMode.HALF_UP))); + } + inventoryItemList.add(inventoryItem); + } + // 药品发放更新 + iMedicationDispenseUpdFlg = iMedicationDispenseService.updateBatchById(medicationDispenseList); + + // 库存更新 + iInventoryItemUpdFlg = iInventoryItemService.updateBatchById(inventoryItemList); + } + return iMedicationDispenseUpdFlg && iInventoryItemUpdFlg ? + R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null)) + : R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null)); + } + + /** + * 作废 + * @param prescriptionNo 处方号 + * @param notPerformedReasonEnum 未发药原因 + * @return 处理结果 + */ + @Override + public R medicineCancel(String prescriptionNo, + Integer notPerformedReasonEnum) { + + List medicationDispenseList = new ArrayList<>(); + boolean iMedicationDispenseUpdFlg = true; + + // 获取药品待发放记录 + List dispenseInventoryList = westernMedicineDispenseMapper. + selectDispenseInventoryInfoByPrescriptionNo(prescriptionNo); + if(!dispenseInventoryList.isEmpty()){ + MedicationDispense medicationDispense; + for (DispenseInventoryDto dispenseInventoryDto : dispenseInventoryList) { + + // 药品发放表项目设定 + medicationDispense = new MedicationDispense(); + // id + medicationDispense.setId(dispenseInventoryDto.getDispenseId()); + // 药品发放状态 + medicationDispense.setStatusEnum(DispenseStatus.DECLINED.getValue()); + // 未发药原因 + medicationDispense.setNotPerformedReasonEnum(notPerformedReasonEnum); + // 状态变更时间 + medicationDispense.setStatusChangedTime(DateUtils.getNowDate()); + // 发药人 + medicationDispense.setPractitionerId(SecurityUtils.getLoginUser().getPractitionerId()); + medicationDispenseList.add(medicationDispense); + } + // 药品发放更新 + iMedicationDispenseUpdFlg = iMedicationDispenseService.updateBatchById(medicationDispenseList); + } + return iMedicationDispenseUpdFlg? + R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, null)) + : R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null)); + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/controller/WesternMedicineDispenseController.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/controller/WesternMedicineDispenseController.java new file mode 100644 index 00000000..85576931 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/controller/WesternMedicineDispenseController.java @@ -0,0 +1,90 @@ +package com.openhis.web.pharmacymanage.controller; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import com.core.common.core.domain.R; +import com.openhis.web.pharmacymanage.appservice.IWesternMedicineDispenseAppService; +import com.openhis.web.pharmacymanage.dto.EncounterInfoSearchParam; + +import lombok.AllArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +/** + * 西药发药 + * + * @author wangyang + * @date 2025/3/14 + */ +@RestController +@RequestMapping("/pharmacy-manage/western-medicine-dispense") +@Slf4j +@AllArgsConstructor +public class WesternMedicineDispenseController { + + @Autowired + public IWesternMedicineDispenseAppService iWesternMedicineDispenseService; + + /** + * 获取页面初始化信息 + * + * @return 初始化信息 + */ + @GetMapping(value = "/init") + public R medicineDispenseInit() { + return iWesternMedicineDispenseService.init(); + } + + /** + * 分页查询就诊病人列表 + * + * @param encounterInfoSearchParam 查询条件 + * @param pageNo 当前页码 + * @param pageSize 查询条数 + * @param request 请求数据 + * @return 就诊病人列表 + */ + @GetMapping("/encounter-list") + public R getEncounterInfoList(EncounterInfoSearchParam encounterInfoSearchParam, + @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) { + return iWesternMedicineDispenseService.getEncounterInfoListPage(encounterInfoSearchParam, pageNo, pageSize, + request); + } + + /** + * 处方单查询 + * + * @param encounterId 就诊Id + */ + @GetMapping("/prescription-list") + public R getPatientInfoList(@RequestParam(value = "encounterId") Long encounterId) { + return iWesternMedicineDispenseService.getPrescriptionInfo(encounterId); + } + + // todo:配药逻辑 + + /** + * 核对发药 + * + * @param prescriptionNo 处方号 + */ + @PutMapping("/medicine-dispense") + public R medicineDispense(@RequestParam(value = "prescriptionNo") String prescriptionNo) { + return iWesternMedicineDispenseService.medicineDispense(prescriptionNo); + } + + /** + * 作废 + * + * @param prescriptionNo 处方号 + * @param notPerformedReasonEnum 未发药原因 + */ + @PutMapping("/medicine-cancel") + public R medicineCancel(@RequestParam(value = "prescriptionNo") String prescriptionNo, + @RequestParam(value = "notPerformedReasonEnum") Integer notPerformedReasonEnum) { + return iWesternMedicineDispenseService.medicineCancel(prescriptionNo, notPerformedReasonEnum); + } +} \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/DispenseInventoryDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/DispenseInventoryDto.java new file mode 100644 index 00000000..8f545de7 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/DispenseInventoryDto.java @@ -0,0 +1,47 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import java.math.BigDecimal; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 药品发放和库存表连接信息 + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class DispenseInventoryDto { + + /** 药品发放表主键ID */ + private Long dispenseId; + + /** 请求单位编码 */ + private String dispenseUnitCode; + + /** 请求数量 */ + private Integer dispenseQuantity; + + /** 库存项目表主键ID */ + private Long inventoryId; + + /** 常规单位 */ + private String inventoryBaseUnitCode; + + /** 当前库存数量(常规单位) */ + private BigDecimal inventoryBaseQuantity; + + /** 最小单位 */ + private String inventoryMinUnitCode; + + /** 当前库存数量(最小单位数量) */ + private BigDecimal inventoryMinQuantity; + + /** 拆零比 */ + private BigDecimal partPercent; +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoPageDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoPageDto.java new file mode 100644 index 00000000..374b4f56 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoPageDto.java @@ -0,0 +1,41 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import java.io.Serializable; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 就诊人员列表 + * + * @author WangYang + * @date 2025-03-18 + */ +@Data +@Accessors(chain = true) +public class EncounterInfoPageDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 就诊ID */ + @JsonSerialize(using = ToStringSerializer.class) + private Long encounterId; + + /** 科室 */ + private String departmentName; + + /** 患者姓名 */ + private String patientName; + + /** 性别 */ + private Integer genderEnum; + private String genderEnum_enumText; + + /** 就诊日期 */ + private String encounterDate; +} \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoSearchParam.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoSearchParam.java new file mode 100644 index 00000000..76c6b31f --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/EncounterInfoSearchParam.java @@ -0,0 +1,32 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import java.io.Serializable; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 处方列表查询条件 + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class EncounterInfoSearchParam implements Serializable { + + /** 科室 */ + private Long departmentId; + + /** 患者姓名或者证件号 */ + private String condition; + + /** 患者姓名 */ + private String patientName; + + /** 证件号 */ + private String idCard; +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PageInitDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PageInitDto.java new file mode 100644 index 00000000..5d47ceb3 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PageInitDto.java @@ -0,0 +1,52 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import java.util.List; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class PageInitDto { + + /** 科室列表 */ + private List departmentOptions; + + /** 未发药原因 */ + private List notPerformedReasonOptions; + + @Data + public static class DepartmentOption { + + @JsonSerialize(using = ToStringSerializer.class) + private Long value; + private String label; + + public DepartmentOption(Long value, String label) { + this.value = value; + this.label = label; + } + } + + @Data + public static class NotPerformedReasonOption { + + private Integer value; + private String label; + + public NotPerformedReasonOption(Integer value, String label) { + this.value = value; + this.label = label; + } + } +} diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionInfoDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionInfoDto.java new file mode 100644 index 00000000..0272c80a --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionInfoDto.java @@ -0,0 +1,29 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import java.io.Serializable; +import java.util.List; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 处方信息 + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class PrescriptionInfoDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 患者基本信息 */ + private PrescriptionPatientInfoDto prescriptionPatientInfoDto; + + /** 处方药品信息 */ + List prescriptionMedicineInfoDtoList; +} \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionMedicineInfoDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionMedicineInfoDto.java new file mode 100644 index 00000000..c0d03d42 --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionMedicineInfoDto.java @@ -0,0 +1,83 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import lombok.Data; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 就诊人员列表 + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class PrescriptionMedicineInfoDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 科室 */ + private String departmentName; + + /** 开单医生 */ + private String doctorName; + + /** 项目类型 */ + private String itemType; + + /** 诊断名称 */ + private String conditionName; + + /** 处方号 */ + private String prescriptionNo; + + /** 药品名称 */ + private String medicineName; + + /** 规格 */ + private String totalVolume; + + /** 单次剂量 */ + private BigDecimal dose; + + /** 用药频次 */ + private String rateCode; + + /** 用法 */ + private String methodCode; + + /** 剂量单位 */ + private String doseUnitCode; + + /** 单次最大剂量 */ + private BigDecimal maxDose; + + /** 首次用量 */ + private BigDecimal firstDose; + + /** 首次持续时间 */ + private String firstDuration; + + /** 给药间隔 */ + private String dispenseInterval; + + /** 单次发药数 */ + private Integer dispensePerQuantity; + + /** 每次发药供应天数 */ + private Integer dispensePerDuration; + + /** 数量 */ + private Integer quantity; + + /** 单价 */ + private BigDecimal unitPrice; + + /** 金额 */ + private BigDecimal totalPrice; +} \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionPatientInfoDto.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionPatientInfoDto.java new file mode 100644 index 00000000..f21bfa4a --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/dto/PrescriptionPatientInfoDto.java @@ -0,0 +1,53 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.dto; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 患者基本信息 + * + * @author wangyang + * @date 2025-03-14 + */ +@Data +@Accessors(chain = true) +public class PrescriptionPatientInfoDto implements Serializable { + + private static final long serialVersionUID = 1L; + + /** 姓名 */ + private String patientName; + + /** 性别 */ + private Integer genderEnum; + private String genderEnum_enumText; + + /** 生日 */ + private Date birthDate; + + /** 年龄 */ + private String age; + + /** 合同类型 */ + private Integer categoryEnum; + private String categoryEnum_enumText; + + /** 证件号 */ + private String idCard; + + /** 就诊科室 */ + private String organizationName; + + /** 就诊日期 */ + private String encounterDate; + + /** 总金额 */ + private double totalPrice; +} \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/mapper/WesternMedicineDispenseMapper.java b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/mapper/WesternMedicineDispenseMapper.java new file mode 100644 index 00000000..0fcabf4c --- /dev/null +++ b/openhis-server/openhis-application/src/main/java/com/openhis/web/pharmacymanage/mapper/WesternMedicineDispenseMapper.java @@ -0,0 +1,53 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.web.pharmacymanage.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.openhis.web.pharmacymanage.dto.*; + +@Repository +public interface WesternMedicineDispenseMapper { + + /** + * 就诊病人列表分页查询 + * + * @param page 分页 + * @param queryWrapper 查询条件 + * @return 就诊病人列表 + */ + Page selectEncounterInfoListPage(@Param("page") Page page, + @Param(Constants.WRAPPER) QueryWrapper queryWrapper); + + /** + * 患者基本信息查询 + * + * @param encounterId 就诊号 + * @return 患者基本信息 + */ + PrescriptionPatientInfoDto selectPrescriptionPatientInfo(@Param("encounterId") Long encounterId); + + /** + * 处方单查询 + * + * @param encounterId 就诊号 + * @return 处方单列表 + */ + List selectPrescriptionMedicineInfoList(@Param("encounterId") Long encounterId); + + /** + * 待发药和库存信息查询 + * + * @param prescriptionNo 处方号 + * @return 待发药信息 + */ + List + selectDispenseInventoryInfoByPrescriptionNo(@Param("prescriptionNo") String prescriptionNo); +} diff --git a/openhis-server/openhis-application/src/main/resources/i18n/messages.properties b/openhis-server/openhis-application/src/main/resources/i18n/messages.properties index 31c39ddf..653376ce 100644 --- a/openhis-server/openhis-application/src/main/resources/i18n/messages.properties +++ b/openhis-server/openhis-application/src/main/resources/i18n/messages.properties @@ -31,9 +31,6 @@ no.update.permission=您没有修改数据的权限,请联系管理员添加 no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}] no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}] no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}] - - - apl.common.M00001={0}添加成功 apl.common.M00002={0}保存成功 apl.common.M00003={0}已经存在 @@ -43,4 +40,5 @@ apl.common.M00006=操作失败,该数据已被他人删除,请刷新后重试 apl.common.M00007=操作失败,该数据已被他人更改,请刷新后重试 apl.common.M00008=请勿重复提交 apl.common.M00009=查询成功 -apl.common.M00010=操作失败,请联系管理员 \ No newline at end of file +apl.common.M00010=操作失败,请联系管理员 +apl.chargeRefund.M00001=该收费单相关{0}已经发出,请先退药后再进行退费 \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/InventoryDetailsMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/InventoryDetailsMapper.xml new file mode 100644 index 00000000..7f5faa50 --- /dev/null +++ b/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/InventoryDetailsMapper.xml @@ -0,0 +1,212 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/PurchaseInventoryMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/PurchaseInventoryMapper.xml index 9af76e89..91b874ed 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/PurchaseInventoryMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/Inventorymanage/PurchaseInventoryMapper.xml @@ -5,23 +5,23 @@ + SELECT T3.tenant_id, + T3.user_id, + T3.practitioner_id, + T3.py_str, + T3.wb_str, + T3.user_name, + T3.nick_name, + T3.email, + T3.phonenumber, + T3.sex, + T3.status, + T3.remark, + T3.birth_date, + T3.address, + T3.yb_no, + T3.org_id + from ( + SELECT T1.tenant_id, + T1.id AS practitioner_id, + T1.user_id, + T1.py_str, + T1.wb_str, + T2.user_name, + T2.nick_name, + T2.email, + T2.phonenumber, + T2.sex, + T2.status, + T2.remark, + T1.birth_date, + T1.address, + T1.yb_no, + T1.org_id + FROM adm_practitioner AS T1 + LEFT JOIN sys_user AS T2 ON T2.user_id = T1.user_id + AND T2.delete_flag = '0' + WHERE T1.delete_flag = '0') AS T3 + ${ew.customSqlSegment} + + + + + + + + delete + from sys_user_role + where user_id = #{userId} + + + + delete + from adm_practitioner_role + where practitioner_id = #{practitionerId} + + + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml index 8a322737..2e9074f6 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientChargeAppMapper.xml @@ -4,22 +4,23 @@ diff --git a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml index 6cb71a77..ac8dfd6c 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/chargemanage/OutpatientRefundAppMapper.xml @@ -18,53 +18,154 @@ T2.account_id FROM fin_payment_reconciliation AS T1 LEFT JOIN adm_charge_item AS T2 - ON T2.id IN (T1.charge_item_ids) + -- 因为T2.id是long型,T1.charge_item_ids是例如 "1","2" 的string类型,所以需要先转类型再匹配 + ON T2.id::TEXT = ANY(string_to_array(T1.charge_item_ids, ',')) WHERE T1.encouter_id =#{encounterId} AND T1.status_enum IN (#{success},#{refundAll},#{refundPart}) AND T1.delete_flag = '0' + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml new file mode 100644 index 00000000..a615f28f --- /dev/null +++ b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/ActivityDefinitionManageMapper.xml @@ -0,0 +1,136 @@ + + + + + + + + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/DeviceManageMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/DeviceManageMapper.xml new file mode 100644 index 00000000..fb552fc1 --- /dev/null +++ b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/DeviceManageMapper.xml @@ -0,0 +1,169 @@ + + + + + + + + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/MedicationManageSearchMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/MedicationManageSearchMapper.xml index c137eacc..18e5c5da 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/MedicationManageSearchMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/datadictionary/MedicationManageSearchMapper.xml @@ -1,12 +1,89 @@ + + - + + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml index 7c378de7..d71ebabc 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationAdviceAppMapper.xml @@ -7,6 +7,9 @@ SELECT T1.definition_id, + T1.id AS definition_detail_id, T2.charge_name, T1.condition_value, T1.condition_code, diff --git a/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml index 568adb51..92f22d6e 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationDiagnosisAppMapper.xml @@ -78,7 +78,7 @@ + + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationMainAppMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationMainAppMapper.xml index 057d3474..1443f4a6 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationMainAppMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/doctorstation/DoctorStationMainAppMapper.xml @@ -14,7 +14,10 @@ T10.phone, T10.birth_date, T10.status_enum, - T10.allergy_history_flag + T10.allergy_history_flag, + T10.account_id, + T10.type_code, + T10.register_time from ( SELECT T1.tenant_id AS tenant_id, @@ -24,6 +27,8 @@ T3.NAME AS healthcare_name, T5.user_id AS practitioner_user_id, T5.NAME AS practitioner_name, + T6.id AS account_id, + T6.type_code AS type_code, T7.contract_name AS contract_name, T8.ID AS patient_id, T8.NAME AS patient_name, diff --git a/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml index bff580d1..73c5f42e 100644 --- a/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml +++ b/openhis-server/openhis-application/src/main/resources/mapper/outpatientmanage/OutpatientManageMapper.xml @@ -133,30 +133,32 @@ @@ -182,19 +185,22 @@ T1.request_status, T1.bus_no, T1.execute_num, + T1.done_num, T1.based_on_id, T1.activity_id, T1.prescription_no, T1.encounter_id, - T1.encounter_bus_No, + T1.encounter_bus_no, T1.patient_name, - T1.patient_bus_No, + T1.gender_enum, + T1.patient_bus_no, T1.patient_id, T1.medication_information, - T1.medication_antity, - T1.medication_status_Enum, + T1.medication_id, + T1.medication_quantity, + T1.medication_status_enum, + T1.rate_code, T1.group_id, - T1.clinical_status_enum, T1.skin_test_flag, T1.speed, T1.method_code, @@ -205,32 +211,41 @@ T1.occurrence_start_time, T1.occurrence_end_time, T1.create_time - from + FROM ( SELECT + sr.tenant_id, sr.id AS service_id, --服务申请管理ID sr.bus_no, -- 服务请求编码 sr.based_on_id, -- 请求基于什么的ID - sr.execute_num, -- 执行次数 sr.activity_id,--请求code,输液 sr.prescription_no, --处方号 sr.encounter_id , --就诊ID - sr.tenant_id, sr.status_enum AS request_status, --服务请求状态 - e.bus_no AS encounter_busNo, --就诊ID(前台显示用) + e.bus_no AS encounter_bus_no, --就诊ID(前台显示用) pt.name AS patient_name, --病人姓名 - pt.bus_no AS patient_busNo, --病人ID(前台显示用) + pt.gender_enum, --病人性别 + pt.bus_no AS patient_bus_no, --病人ID(前台显示用) sr.patient_id, --病人ID md.id AS medication_id, --药品ID md.name AS medication_information, --药品信息 - mr.antity AS medication_antity,--药品数量 - mr.status_enum AS medication_status_Enum, --药品状态 + mr.quantity AS medication_quantity,--药品数量 + mr.status_enum AS medication_status_enum, --药品状态 + mr.rate_code, --药品状态 + mr.execute_num, -- 总执行次数 mr.group_id, --注射药品组号 + (SELECT COUNT(*) + FROM wor_service_request wor + WHERE wor.based_on_id = sr.id + AND wor.bus_no LIKE '%-%' + AND CAST(md.id AS CHAR) = LEFT(split_part(wor.bus_no, '-', 3), POSITION('.' IN split_part(wor.bus_no, '-', 3)) - 1) --药品ID + AND mr.group_id = CAST(split_part(wor.bus_no, '-', 2) AS BIGINT)-- 组号ID + ) AS done_num ,-- 已执行次数 + mr.perform_org,--执行科室 CASE mr.skin_test_flag WHEN 1 THEN 1 ELSE 0 - END AS skin_test_flag ,--皮试标志 - ai.clinical_status_enum, --皮试检查结果 + END AS skin_test_flag ,--皮试标志 mr.speed, --输液速度 mr.method_code,--用法 mr.dose || ' '|| mr.dose_unit_code AS dose,--单次剂量,剂量单位 @@ -239,7 +254,7 @@ sr.performer_id, --执行护士 to_char(sr.occurrence_start_time, 'YYYY-MM-DD HH24:MI:SS') AS occurrence_start_time, --预计执行时间 to_char(sr.occurrence_end_time, 'YYYY-MM-DD HH24:MI:SS') AS occurrence_end_time, --预计结束时间 - mr.create_time --开单时间 + to_char(mr.create_time, 'YYYY-MM-DD HH24:MI:SS') AS create_time--开单时间 FROM wor_service_request sr LEFT JOIN adm_encounter e ON e.id = sr.encounter_id @@ -252,17 +267,16 @@ ad.bus_no = 'sy001' -- 输液检查的编号,todo:编号未定,后期修改 AND mr.infusion_flag = 1 - AND md.infusion_flag = 1 ORDER BY - mr.create_time desc,e.bus_no,pt.bus_no + create_time desc,e.bus_no,pt.bus_no ) AS T1 ${ew.customSqlSegment} - SELECT COUNT(*) FROM @@ -273,17 +287,18 @@ LEFT JOIN med_medication_request mr ON mr.prescription_no = sr.prescription_no LEFT JOIN med_medication m ON m.id = mr.medication_id LEFT JOIN med_medication_definition md ON md.id = m.medication_def_id - LEFT JOIN cli_allergy_intolerance ai ON ai.request_id = sr.id ad.bus_no = 'sy001' -- 输液检查的编号,todo:编号未定,后期修改 AND mr.infusion_flag = 1 - AND md.infusion_flag = 1 - AND sr.base_on_id = #{paramId} + AND sr.based_on_id = #{paramId} AND sr.bus_no LIKE CONCAT(#{prefixBusNo}, '%') + AND CAST(md.id AS CHAR) = LEFT(split_part(sr.bus_no, '-', 3), POSITION('.' IN split_part(sr.bus_no, '-', 3)) - 1) --药品ID + AND mr.group_id = CAST(split_part(sr.bus_no, '-', 2) AS BIGINT)-- 组号ID AND sr.status_enum = 6 --服务状态是已完成 + @@ -292,7 +307,6 @@ AND mr.group_id = #{groupId} AND sr.status_enum = 2 --服务状态是进行中 - diff --git a/openhis-server/openhis-application/src/main/resources/mapper/payment/PaymentMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/payment/PaymentMapper.xml new file mode 100644 index 00000000..629d3091 --- /dev/null +++ b/openhis-server/openhis-application/src/main/resources/mapper/payment/PaymentMapper.xml @@ -0,0 +1,95 @@ + + + + + + + \ No newline at end of file diff --git a/openhis-server/openhis-application/src/main/resources/mapper/pharmacymanage/WesternMedicineDispenseMapper.xml b/openhis-server/openhis-application/src/main/resources/mapper/pharmacymanage/WesternMedicineDispenseMapper.xml new file mode 100644 index 00000000..e3539018 --- /dev/null +++ b/openhis-server/openhis-application/src/main/resources/mapper/pharmacymanage/WesternMedicineDispenseMapper.xml @@ -0,0 +1,148 @@ + + + + + + + + \ No newline at end of file diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/CommonConstants.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/CommonConstants.java index 8de702bb..b797959b 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/CommonConstants.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/CommonConstants.java @@ -40,6 +40,11 @@ public class CommonConstants { * 3(用于字符串截位) */ Integer THREE = 3; + + /** + * 中杠 + */ + String DASH = "-"; } /** @@ -113,11 +118,15 @@ public class CommonConstants { */ String PatientBusNo = "patient_bus_no"; + /** + * 患者ID + */ + String PatientId = "patient_id"; + /** * 就诊号 */ String EncounterBusNo = "encounter_bus_no"; - /** * 身份证号 */ @@ -141,17 +150,37 @@ public class CommonConstants { /** * 请求状态 */ - String requestStatus = "request_status"; + String RequestStatus = "request_status"; /** * 创建时间 */ - String createTime = "create_time"; + String CreateTime = "create_time"; /** * 请求基于什么的ID */ - String basedOnId = "based_on_id"; + String BasedOnId = "based_on_id"; + + /** + * 药品id + */ + String MedicationId = "medication_id"; + + /** + * 就诊Id + */ + String encouterId = "encouter_id"; + + /** + * 合同编码 + */ + String contractNo = "contract_no"; + + /** + * 支付流水 + */ + String paymentNo = "payment_no"; } /** @@ -170,6 +199,25 @@ public class CommonConstants { String TCM_DIAGNOSIS = "中医诊断"; } + /** + * 字典字段名常量 + */ + public interface DictName { + /** + * 器材 + */ + String MED_CATEGORY_CODE = "med_category_code"; + /** + * 药品分类 + */ + String DEVICE_CATEGORY_CODE = "device_category_code"; + /** + * 诊疗分类 + */ + String DIAGNOSIS_CATEGORY_CODE = "activity_category_code"; + + } + /** * sql条件常量 */ diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/PromptMsgConstant.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/PromptMsgConstant.java index a67d431d..3d550099 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/PromptMsgConstant.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/constant/PromptMsgConstant.java @@ -70,4 +70,21 @@ public class PromptMsgConstant { String M00001 = "apl.inventory.M00001"; } + + /** + * 退费 + */ + public interface ChargeRefund { + + /** + * 该收费单相关{0}已经发出,请先退药后再进行退费 + */ + String M00001 = "apl.chargeRefund.M00001"; + + /** + * 该收费单相关诊疗项目已经执行,请等待医技科室审批完成后再进行退费 + */ + String M00002 = "apl.chargeRefund.M00002"; + + } } diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AdministrativeGender.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AdministrativeGender.java index f186bde9..c6bcb69d 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AdministrativeGender.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AdministrativeGender.java @@ -1,16 +1,23 @@ package com.openhis.common.enums; import com.baomidou.mybatisplus.annotation.EnumValue; + import lombok.AllArgsConstructor; import lombok.Getter; +/** + * 性别 0=男,1=女,2=未知(和若依框架保持一致) + */ @Getter @AllArgsConstructor public enum AdministrativeGender implements HisEnumInterface { - MALE(1, "male", "男性"), - FEMALE(2, "female", "女性"), - OTHER(3, "other", "其他"), - UNKNOWN(9, "unknown", "未知"); + + MALE(0, "male", "男性"), + + FEMALE(1, "female", "女性"), + + UNKNOWN(2, "unknown", "未知"); + @EnumValue private final Integer value; private final String code; diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java index 69c1576e..30bb37a0 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/AssignSeqEnum.java @@ -29,7 +29,7 @@ public enum AssignSeqEnum { /** * 处方号 */ - PRESCRIPTION_NO("4", "处方号", "P"), + PRESCRIPTION_NO("4", "处方号", "PR"), /** * 药品请求编码 @@ -49,7 +49,31 @@ public enum AssignSeqEnum { /** * 费用项目编码 */ - CHARGE_ITEM_NO("8", "费用项目编码", "CI"); + CHARGE_ITEM_NO("8", "费用项目编码", "CI"), + + /** + * 药品项目编码 + */ + MEDICATION_NUM("9", "药品项目编码", "MD"), + + /** + * 器材项目编码 + */ + DEVICE_NUM("10", "项目编码", "DD"), + + /** + * 支付编码 + */ + PAYMENT_NO("11", "支付编码", "SF"), + /** + * 诊疗项目编码 + */ + ACTIVITY_DEFINITION_NUM("11", "诊疗编码", "AD"), + + /** + * 诊断定义编码 + */ + CONDITION_DEFINITION_NUM("11", "诊断编码", "CD"); private final String code; private final String info; diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/Category.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/Category.java new file mode 100644 index 00000000..0b5ed798 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/Category.java @@ -0,0 +1,51 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * Category 合同类别(结算类别) + * + * @author SunJQ + * @date 2025-03-29 + */ +@Getter +@AllArgsConstructor +public enum Category { + + /** + * MEMBER_FIRST + */ + SELF(0, "自费"), + /** + * MEMBER_SECOND + */ + PROVINCIAL_INSURANCE(1, "MEMBER_SECOND"), + /** + * MEMBER_SECOND + */ + MUNICIPAL_INSURANCE(1, "MEMBER_SECOND"), + /** + * MEMBER_SECOND + */ + PUBLIC(1, "MEMBER_SECOND"); + @EnumValue + private Integer value; + private String description; + + public static Category getByValue(Integer value) { + if (value==null) { + return null; + } + for (Category val : values()) { + if (val.getValue().equals(value)) { + return val; + } + } + return null; + } +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemContext.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemContext.java index 21a38c0e..9b3c6499 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemContext.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemContext.java @@ -16,25 +16,25 @@ import lombok.Getter; @AllArgsConstructor public enum ChargeItemContext implements HisEnumInterface { - /** - * 采购 - */ - PURCHASE(1, "1", "采购"), - /** * 药品 */ - MEDICATION(2, "2", "药品"), + MEDICATION(1, "1", "药品"), /** * 耗材 */ - DEVICE(3, "3", "耗材"), + DEVICE(2, "2", "耗材"), /** * 项目 */ - ACTIVITY(4, "4", "项目"); + ACTIVITY(3, "3", "项目"), + + /** + * 采购 + */ + PURCHASE(4, "4", "采购"); private final Integer value; private final String code; diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemStatus.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemStatus.java index 4d5b2d68..1200feea 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemStatus.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ChargeItemStatus.java @@ -37,10 +37,25 @@ public enum ChargeItemStatus implements HisEnumInterface { */ ERROR(6, "entered-in-error", "错误"), + /** + * 退费中 + */ + REFUNDING(7, "refunding", "退费中"), + + /** + * 全部退费 + */ + REFUNDED(8, "refunded", "全部退费"), + + /** + * 部分退费 + */ + PART_REFUND(9, "part-refund", "部分退费"), + /** * 未知 */ - UNKNOWN(7, "unknown", "未知"); + UNKNOWN(10, "unknown", "未知"); private final Integer value; private final String code; diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ConditionCode.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ConditionCode.java index fdac0c47..8c81eae9 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ConditionCode.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ConditionCode.java @@ -12,7 +12,10 @@ import lombok.Getter; @AllArgsConstructor public enum ConditionCode implements HisEnumInterface { - UNIT_PRODUCT_BATCH_NUM(1, "unit_product_batch_num", "单位,产品批号"); + UNIT_PRODUCT_BATCH_NUM(1, "1", "产品批号"), + PROCUREMENT(2,"2","采购"), + UNIT(3,"3","单位"), + LIMIT(4,"4","限制"); @EnumValue private final Integer value; diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ContractCategory.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ContractCategory.java new file mode 100644 index 00000000..771e8c8d --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ContractCategory.java @@ -0,0 +1,50 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 合同类型 + * + * @author zwh + * @date 2025-03-29 + */ +@Getter +@AllArgsConstructor +public enum ContractCategory implements HisEnumInterface{ + + /** + * 自费 + */ + SELF_CHARGE(1, "1", "自费"), + + /** + * 公费 + */ + PUBLIC_CHARGE(2, "2", "公费"), + + /** + * 省医保 + */ + PROVINCIAL_INSURANCE(3, "3", "省医保"), + + /** + * 市医保 + */ + MUNICIPAL_INSURANCE(4, "4", "市医保"), + + /** + * 职工医保 + */ + WORKER_INSURANCE(5, "5", "职工医保"); + + @EnumValue + private final Integer value; + private final String code; + private final String info; +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DeviceCategory.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DeviceCategory.java index 82c62551..60f042e0 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DeviceCategory.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DeviceCategory.java @@ -6,17 +6,17 @@ import lombok.Getter; @Getter @AllArgsConstructor -public enum DeviceCategory { - ACTIVE (1, "active", "有源的"), - COMMUNICATING(2, "communicating", "通讯类"), - HOMEUSE(3, "communicating", "非院内使用"), - IMPLANTABLE(4, "implantable", "植入类"), - IN_VITRO(5, "in-vitro", "试管类"), - POINT_OF_CARE(6, "point-of-care", "床旁类"), - SINGLE_USE(7, "single-use", "单次消耗类"), - REUSABLE(8, "reusable", "可重用的"), - SOFTWARE(9, "software", "软件类"), - DME(10, "dme", "治疗设备"); +public enum DeviceCategory implements HisEnumInterface { + ACTIVE (1, "1", "有源的"), + COMMUNICATING(2, "2", "通讯类"), + HOMEUSE(3, "3", "非院内使用"), + IMPLANTABLE(4, "4", "植入类"), + IN_VITRO(5, "5", "试管类"), + POINT_OF_CARE(6, "6", "床旁类"), + SINGLE_USE(7, "7", "单次消耗类"), + REUSABLE(8, "8", "可重用的"), + SOFTWARE(9, "9", "软件类"), + DME(10, "10", "治疗设备"); @EnumValue private final Integer value; private final String code; diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DispenseStatus.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DispenseStatus.java new file mode 100644 index 00000000..deb87a9b --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/DispenseStatus.java @@ -0,0 +1,96 @@ +package com.openhis.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 药品请求状态 + * + * @author wangyang + * @date 2025-03-14 + */ +@Getter +@AllArgsConstructor +public enum DispenseStatus implements HisEnumInterface { + + /** + * 草稿 + */ + DRAFT(1, "DR", "草稿"), + + /** + * 待配药 + */ + PREPARATION(2, "PR", "待配药"), + + /** + * 待发药 + */ + IN_PROGRESS(3, "IN", "待发药"), + + /** + * 已发药 + */ + COMPLETED(4, "CO", "已发药"), + + /** + * 暂停 + */ + ON_HOLD(5, "ON", "暂停"), + + /** + * 停止 + */ + STOPPED(6, "ST", "停止"), + + /** + * 拒绝发药 + */ + DECLINED(7, "DE", "拒绝发药"), + + /** + * 已汇总 + */ + SUMMARIZED(8, "SR", "已汇总"), + + /** + * 部分发药 + */ + PART_COMPLETED(9, "PC", "部分发药"), + + /** + * 部分退药 + */ + PART_REFUND(10, "PR", "部分退药"), + + /** + * 退药中 + */ + IN_REFUND(11, "IR", "退药中"), + + /** + * 已退药 + */ + REFUNDED(12, "RE", "已退药"), + + /** + * 未知 + */ + UNKNOWN(13, "UN", "未知"); + + private Integer value; + private String code; + private String info; + + public static DispenseStatus getByValue(Integer value) { + if (value == null) { + return null; + } + for (DispenseStatus val : values()) { + if (val.getValue().equals(value)) { + return val; + } + } + return null; + } +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/FinCategory.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/FinCategory.java new file mode 100644 index 00000000..b127e8e3 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/FinCategory.java @@ -0,0 +1,41 @@ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum FinCategory implements HisEnumInterface { + + /** + * 自费 + */ + SELF_PAY(1, "1", "自费"), + + /** + * 省医保 + */ + PROVINCIAL_MEDICAL_INSURANCE(2, "2", "省医保"), + + /** + * 市医保 + */ + MUNICIPAL_MEDICAL_INSURANCE(3, "3", "市医保"); + + private Integer value; + private String code; + private String info; + + public static FinCategory getByValue(Integer value) { + if (value == null) { + return null; + } + for (FinCategory val : values()) { + if (val.getValue().equals(value)) { + return val; + } + } + return null; + } +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ItemType.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ItemType.java index 9c7d0f8b..5374c5ba 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ItemType.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/ItemType.java @@ -18,9 +18,9 @@ import lombok.Getter; public enum ItemType implements HisEnumInterface { /** - * 中药 + * 药品 */ - MEDICINE(1, "1", "中药"), + MEDICINE(1, "1", "药品"), /** * 耗材 diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReason.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReason.java new file mode 100644 index 00000000..7e941573 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReason.java @@ -0,0 +1,35 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 未执行原因 + * + * @author zwh + * @date 2025-03-29 + */ +@Getter +@AllArgsConstructor +public enum NotPerformedReason { + + /** + * 退费 + */ + REFUND(1, "1", "退费"), + + /** + * 异常 + */ + ERROR(9, "9", "异常"); + + @EnumValue + private final Integer value; + private final String code; + private final String info; +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReasonEnum.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReasonEnum.java new file mode 100644 index 00000000..e9eb5288 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/NotPerformedReasonEnum.java @@ -0,0 +1,136 @@ +package com.openhis.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 药品请求状态 + * + * @author wangyang + * @date 2025-03-14 + */ +@Getter +@AllArgsConstructor +public enum NotPerformedReasonEnum implements HisEnumInterface { + + /** + * 订单已停止 + */ + ORDER_STOPPED(1,"OS", "订单已停止"), + + /** + * 过时订单 + */ + OUTDATED_ORDER(2, "OO", "过时订单"), + + /** + * 不完整的数据 + */ + INCOMPLETE_DATA(3, "ID", "不完整的数据"), + + /** + * 产品不可用 + */ + PRODUCT_NOT_AVAILABLE(4, "PNA", "产品不可用"), + + /** + * 道德/宗教 + */ + MORAL_RELIGIOUS(5, "MR", "道德/宗教"), + + /** + * 无法提供护理 + */ + UNABLE_PROVIDE(6, "UP", "无法提供护理"), + + /** + * 先尝试其他治疗方法 + */ + OTHER_TREATMENT(7, "OT", "先尝试其他治疗方法"), + + /** + * 处方/请求需要澄清 + */ + PRESCRIPTION_REQUEST_CLARIFICATION(8, "PRC", "处方/请求需要澄清"), + + /** + * 药物水平过高 + */ + EXCESSIVE_DRUG_LEVELS(9, "EDL", "药物水平过高"), + + /** + * 入院 + */ + HOSPITALIZED(10, "HO", "入院"), + + /** + * 实验室干扰问题 + */ + LABORATORY_INTERFERENCE_ISSUE(11, "LII", "实验室干扰问题"), + + /** + * 患者不可用 + */ + PATIENT_UNAVAILABLE(12, "PU", "患者不可用"), + + /** + * 患者怀孕或哺乳 + */ + PATIENT_PREGNANT_BREASTFEEDING(13, "PPB", "患者怀孕或哺乳"), + + /** + * 过敏 + */ + ALLERGY(14, "AL", "过敏"), + + /** + * 药物与另一种药物相互作用 + */ + ANOTHER_DRUG(15, "AD", "药物与另一种药物相互作用"), + + /** + * 重复治疗 + */ + REPEAT_TREATMENT(16, "RT", "重复治疗"), + + /** + * 疑似不耐受 + */ + SUSPECTED_INTOLERANCE(17, "SI", "疑似不耐受"), + + /** + * 计划手术的患者 + */ + PATIENTS_PLANNING_SURGERY(18, "PPS", "计划手术的患者"), + + /** + * 冲洗 + */ + WASH(19, "WA", "冲洗"), + + /** + * 药物缺货 + */ + DRUG_SHORTAGE(20, "DS", "药物缺货"), + + /** + * 药物不可用 + */ + MEDICATION_NOT_AVAILABLE(21, "MNA", "药物不可用"); + + private Integer value; + private String code; + private String info; + + public static NotPerformedReasonEnum getByValue(Integer value) { + if (value == null) { + return null; + } + for (NotPerformedReasonEnum val : values()) { + if (val.getValue().equals(value)) { + return val; + } + } + return null; + } +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/Payment.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/Payment.java new file mode 100644 index 00000000..1ad2948c --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/Payment.java @@ -0,0 +1,169 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 支付类型 + * + * @author SunJQ + * @date 2025-03-29 + */ +@Getter +@AllArgsConstructor +public enum Payment { + + /** + * 现金支付 + */ + CASH(1, 1, "现金支付"), + + /** + * 微信支付 + */ + VX_PAY(2, 1, "微信支付"), + + /** + * 支付宝支付 + */ + ALI_PAY(3, 1, "支付宝支付"), + + /** + * 银联支付 + */ + UNION_PAY(4, 1, "银联支付"), + + /** + * 医保账户支付 + */ + YB_ZH_PAY(5, 1, "医保账户支付"), + + /** + * 医保统筹支付合计 + */ + YB_TC_SUM_PAY(6, 1, "医保统筹支付合计"), + + /** + * 医保统筹支付 + */ + YB_TC_PAY(7, 2, "医保统筹支付"), + + /** + * 医保公务员补助 + */ + YB_GWY_PAY(8, 2, "医保公务员补助"), + + /** + * 先行自付金额 + */ + XX_SELF_PAY(9, 2, "先行自付金额"), + + /** + * 全自费金额 + */ + ALL_SELF_PAY(10, 2, "先行自付金额"), + + /** + * 医疗工伤支付 + */ + YL_GS_PAY(11, 2, "医疗工伤支付"), + + /** + * 老红军支付 + */ + YB_HJ_PAY(12, 2, "老红军支付"), + + /** + * 离休人员医疗保障基金支付金额 + */ + YB_LTX_PAY(13, 2, "离休人员医疗保障基金支付金额"), + + /** + * 居民统筹 + */ + YB_JM_TC_PAY(14, 2, "居民统筹"), + /** + * 居民大病 + */ + YB_JM_DB_PAY(15, 2, "居民大病"), + /** + * 补充医疗补助基金支付金额 + */ + YB_BC_PAY(16, 2, "补充医疗补助基金支付金额"), + /** + * 其他扶贫报销金额 + */ + YB_OTHER_FP_PAY(17, 2, "其他扶贫报销金额"), + /** + * 健康扶贫医疗基金 + */ + YB_JK_FP_PAY(18, 2, "健康扶贫医疗基金"), + /** + * 精准脱贫保险金额 + */ + YB_JZ_TP_PAY(19, 2, "精准脱贫保险金额"), + /** + * 提交医保总额 + */ + YB_SUM_FEE(20, 2, "提交医保总额"), + /** + * 二乙医疗专项医疗基金支出 + */ + YB_EY_PAY(21, 2, "二乙医疗专项医疗基金支出"), + /** + * 慢特病支付 + */ + YB_TM_PAY(22, 2, "补充医疗补助基金支付金额"), + /** + * 定点医疗机构垫支 + */ + YB_ORG_PAY(23, 2, "定点医疗机构垫支"), + /** + * 起付线公务员返还 + */ + YB_RETURN_GWY_PAY(24, 2, "起付线公务员返还"), + /** + * 大额理赔金额 + */ + YB_DELP_PAY(25, 2, "大额理赔金额"), + /** + * 民政救助金额 + */ + YB_MZJZ_PAY(26, 2, "民政救助金额"), + /** + * 生育基金支付 + */ + BIRTH_TC_PAY_AMOUNT(27, 1, "生育基金支付"), + /** + * 生育账户支付 + */ + BIRTH_ZH_PAY_AMOUNT(28, 1, "生育账户支付"), + /** + * 符合范围金额 + */ + YB_FHFW_AMOUNT(29, 2, "符合范围金额"), + /** + * 财政兜底基金支出 + */ + YB_CZDD_AMOUNT(30, 2, "财政兜底基金支出"); + @EnumValue + private Integer value; + private Integer level; + private String info; + + public static Payment getByValue(Integer value) { + if (value == null) { + return null; + } + for (Payment val : values()) { + if (val.getValue().equals(value)) { + return val; + } + } + return null; + } +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentKind.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentKind.java new file mode 100644 index 00000000..0f2162a3 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentKind.java @@ -0,0 +1,48 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * PaymentKind (0: MEMBER_FIRST; 1: MEMBER_SECOND;) + * + * @author SunJQ + * @date 2025-03-29 + */ +@Getter +@AllArgsConstructor +public enum PaymentKind { + + /** + * 住院存款 + */ + HOSPITAL_DEPOSIT(0, "住院存款"), + /** + * 门诊收费 + */ + OUTPATIENT_CLINIC(1, "门诊收费"), + /** + * 住院费用 + */ + INPATIENT_CLINIC(2, "住院费用"); + + @EnumValue + private Integer value; + private String description; + + public static PaymentKind getByValue(String value) { + if(value==null){ + return null; + } + for (PaymentKind val : values()) { + if (val.getValue().equals(value)) { + return val; + } + } + return null; + } +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentResult.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentResult.java new file mode 100644 index 00000000..1a570606 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentResult.java @@ -0,0 +1,46 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * PaymentResult (0: MEMBER_FIRST; 1: MEMBER_SECOND;) + * + * @author SunJQ + * @date 2025-03-29 + */ +@Getter +@AllArgsConstructor +public enum PaymentResult { + + /** + * 未支付 + */ + UNPAID(0, "未支付"), + /** + * 已支付 + */ + PAID(1, "已支付"), + /** + * 已退费 + */ + refunded(-2, "已退费"); + + private Integer value; + private String description; + + public static PaymentResult getByValue(String value) { + if (value==null) { + return null; + } + for (PaymentResult val : values()) { + if (val.getValue().equals(value)) { + return val; + } + } + return null; + } +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentType.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentType.java new file mode 100644 index 00000000..bb73511f --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PaymentType.java @@ -0,0 +1,44 @@ +/* + * Copyright ©2023 CJB-CNIT Team. All rights reserved + */ +package com.openhis.common.enums; + + +import com.baomidou.mybatisplus.annotation.EnumValue; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * PaymentType (0: MEMBER_FIRST; 1: MEMBER_SECOND;) + * + * @author SunJQ + * @date 2025-03-29 + */ +@Getter +@AllArgsConstructor +public enum PaymentType { + + /** + * 付费 + */ + PAY(0, "付费"), + /** + * 退费 + */ + UN_PAY(1, "退费"); + @EnumValue + private Integer value; + private String description; + + public static PaymentType getByValue(String value) { + if(value==null){ + return null; + } + for (PaymentType val : values()) { + if (val.getValue().equals(value)) { + return val; + } + } + return null; + } +} diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PermissionLimit.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PermissionLimit.java new file mode 100644 index 00000000..55b118c9 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PermissionLimit.java @@ -0,0 +1,24 @@ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 权限限制 + * + * @author liuhr + * @date 2025/3/25 + */ +@Getter +@AllArgsConstructor +public enum PermissionLimit implements HisEnumInterface { + UNRESTRICTED(1, "unrestricted", "非限制使用"), + RESTRICTED(2, "restricted", "限制使用"), + SPECIAL(3, "special", "特殊使用"); + + @EnumValue + private final Integer value; + private final String code; + private final String info; +} \ No newline at end of file diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PractitionerRole.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PractitionerRoles.java similarity index 57% rename from openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PractitionerRole.java rename to openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PractitionerRoles.java index b9312351..a0242e62 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PractitionerRole.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/PractitionerRoles.java @@ -6,16 +6,19 @@ import lombok.AllArgsConstructor; import lombok.Getter; /** - * 参与者角色 + * 参与者角色 : 对应 sys_role表的角色标识 ; 需要补充业务数据时在该枚举类添加 */ @Getter @AllArgsConstructor -public enum PractitionerRole implements HisEnumInterface { +public enum PractitionerRoles implements HisEnumInterface { + DOCTOR(1, "doctor", "医生"), NURSE(2, "nurse", "护士"), - PHARMACIST(3, "pharmacist", "药师"); + PHARMACIST(3, "pharmacist", "药师"), + + LOCATION_ADMIN(4, "locationAdmin", "库房管理员"); @EnumValue private final Integer value; diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/RequestStatus.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/RequestStatus.java index 8fb13339..8364f7ff 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/RequestStatus.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/RequestStatus.java @@ -23,37 +23,42 @@ public enum RequestStatus implements HisEnumInterface { /** * 已发送 */ - COMPLETED(2, "completed", "已发送"), + ACTIVE(2, "active", "已发送"), + + /** + * 已完成 + */ + COMPLETED(3, "completed", "已完成"), /** * 暂停 */ - ON_HOLD(3, "on_hold", "暂停"), + ON_HOLD(4, "on_hold", "暂停"), /** - * 撤回 + * 取消 */ - CANCELLED(4, "cancelled", "撤回"), + CANCELLED(5, "cancelled", "取消"), /** * 停止 */ - STOPPED(5, "stopped", "停止"), + STOPPED(6, "stopped", "停止"), /** * 不可用 */ - ENDED(6, "ended", "不可用"), - - /** - * 未知 - */ - UNKNOWN(7, "unknown", "未知"), + ENDED(7, "ended", "不可用"), /** * 已汇总 */ - SUMMARIZED(8, "summarized", "已汇总"); + SUMMARIZED(8, "summarized", "已汇总"), + + /** + * 未知 + */ + UNKNOWN(9, "unknown", "未知"); @EnumValue private final Integer value; diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/SplitPropertyCode.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/SplitPropertyCode.java new file mode 100644 index 00000000..a81c02c4 --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/SplitPropertyCode.java @@ -0,0 +1,27 @@ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 拆分属性 + * + * @author liuhr + * @date 2025/3/27 + */ +@Getter +@AllArgsConstructor +public enum SplitPropertyCode implements HisEnumInterface { + + OUTPATIENT_MIN_UNIT_CEIL(1, "outpatient_min_unit_ceil", "门诊按最小单位每次量向上取整"), + OUTPATIENT_PACKAGE_NON_SPLITTABLE(2, "outpatient_package_non_splittable", "门诊按包装单位不可拆分"), + OUTPATIENT_MIN_UNIT_TOTAL_CEIL(3, "outpatient_min_unit_total_ceil", "门诊按最小单位总量向上取整"), + OUTPATIENT_PACKAGE_UNIT_CEIL(4, "outpatient_package_unit_ceil", "门诊按包装单位每次量向上取整"); + + @EnumValue + private final Integer value; + private final String code; + private final String info; +} \ No newline at end of file diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/SupplierType.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/SupplierType.java index b81be822..68bded60 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/SupplierType.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/SupplierType.java @@ -6,7 +6,7 @@ import lombok.Getter; @Getter @AllArgsConstructor -public enum SupplierType { +public enum SupplierType implements HisEnumInterface { DRAFT(1, "1", "生产商"), ACTIVE(2, "2", "供应商"); diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/TempOrderSplitPropertyCode.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/TempOrderSplitPropertyCode.java new file mode 100644 index 00000000..916f1e5d --- /dev/null +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/enums/TempOrderSplitPropertyCode.java @@ -0,0 +1,27 @@ +package com.openhis.common.enums; + +import com.baomidou.mybatisplus.annotation.EnumValue; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 住院临时医嘱拆分属性的枚举 + * + * @author liuhr + * + * @date 2025/3/28 + */ +@Getter +@AllArgsConstructor +public enum TempOrderSplitPropertyCode implements HisEnumInterface { + + TEMP_ORDER_MIN_UNIT_CEIL(1, "temp_order_min_unit_ceil", "临时医嘱按最小单位每次量向上取整"), + TEMP_ORDER_PACKAGE(2, "temp_order_package", "临时医嘱按包装单位开立"), + TEMP_ORDER_MIN_UNIT_TOTAL_CEIL(3, "temp_order_min_unit_total_ceil", "临时医嘱按最小单位总量向上取整"), + TEMP_ORDER_PACKAGE_UNIT_CEIL(4, "temp_order_package_unit_ceil", "临时医嘱按包装单位每次量向上取整"); + + @EnumValue + private final Integer value; + private final String code; + private final String info; +} \ No newline at end of file diff --git a/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisQueryUtils.java b/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisQueryUtils.java index 6ae19567..94435f47 100644 --- a/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisQueryUtils.java +++ b/openhis-server/openhis-common/src/main/java/com/openhis/common/utils/HisQueryUtils.java @@ -50,8 +50,7 @@ public class HisQueryUtils { for (Map.Entry entry : parameterMap.entrySet()) { String paramName = entry.getKey(); // 检查参数名是否以 "STime" 或 "ETime" 结尾 - if (paramName.endsWith(CommonConstants.Common.S_TIME) - || paramName.endsWith(CommonConstants.Common.E_TIME)) { + if (paramName.endsWith(CommonConstants.Common.S_TIME)) { // 提取字段名(去掉 "STime" 或 "ETime" 后缀) String fieldName = paramName.substring(0, paramName.length() - 5); // 驼峰转下划线 diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/BizUser.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/BizUser.java new file mode 100644 index 00000000..9980d0fa --- /dev/null +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/BizUser.java @@ -0,0 +1,70 @@ +package com.openhis.administration.domain; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.core.common.core.domain.HisBaseEntity; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 用户管理Entity实体 + * + * @author system + * @date 2025-02-20 + */ +@Data +@TableName("sys_user") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class BizUser extends HisBaseEntity { + + /** 用户ID */ + // @TableId(type = IdType.ASSIGN_ID) + private Long userId; + + /** 部门ID */ + private Long deptId; + + /** 用户账号 */ + private String userName; + + /** 用户昵称 */ + private String nickName; + + /** 用户类型 */ + private String userType; + + /** 用户邮箱 */ + private String email; + + /** 手机号码 */ + private String phonenumber; + + /** 用户性别 */ + private String sex; + + /** 用户头像 */ + private String avatar; + + /** 密码 */ + private String password; + + /** 帐号状态(0正常 1停用) */ + private String status; + + /** 删除标志(0代表存在 2代表删除) */ + private String delFlag; + + /** 最后登录IP */ + private String loginIp; + + /** 最后登录时间 */ + private Date loginDate; + + /** 备注 */ + private String remark; + +} diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/BizUserRole.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/BizUserRole.java new file mode 100644 index 00000000..6c9af566 --- /dev/null +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/BizUserRole.java @@ -0,0 +1,27 @@ +package com.openhis.administration.domain; + +import com.baomidou.mybatisplus.annotation.TableName; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 用户角色Entity实体 + * + * @author system + * @date 2025-02-20 + */ +@Data +@TableName("sys_user_role") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +public class BizUserRole { + + /** 用户ID */ + private Long userId; + + /** 角色ID */ + private Long roleId; + +} diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItem.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItem.java index 61a428fe..72166324 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItem.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItem.java @@ -62,7 +62,7 @@ public class ChargeItem extends HisBaseEntity { private Long costOrgId; /** 数量 */ - private Long quantityValue; + private Integer quantityValue; /** 单位 */ private String quantityUnit; diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItemDefinition.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItemDefinition.java index fb63ec88..7bb64a9c 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItemDefinition.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/ChargeItemDefinition.java @@ -36,7 +36,7 @@ public class ChargeItemDefinition extends HisBaseEntity { private String title; /** 状态 */ - private PublicationStatus statusEnum; + private Integer statusEnum; /** 机构ID */ private Long orgId; diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/DeviceDefinition.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/DeviceDefinition.java index 30b4c780..ff9b7c27 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/DeviceDefinition.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/DeviceDefinition.java @@ -42,7 +42,7 @@ public class DeviceDefinition extends HisBaseEntity { private String wbStr; /** 器材分类 */ - private DeviceCategory categoryEnum; + private String categoryCode; /** 器材种类 */ private String typeCode; @@ -87,11 +87,14 @@ public class DeviceDefinition extends HisBaseEntity { private Integer ybMatchFlag; /** 状态 */ - private PublicationStatus statusEnum; + private Integer statusEnum; /** 生产厂家 */ private Long manufacturerId; + /** 生产厂家 */ + private String manufacturerText; + /** 供应商 */ private Long supplyId; @@ -101,9 +104,6 @@ public class DeviceDefinition extends HisBaseEntity { /** 适用范围 */ private String jurisdiction; - /** 执行科室 */ - private Long ruleId; - /** 器材版本 */ private String version; diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/OrganizationLocation.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/OrganizationLocation.java index 623a8a45..a1196c60 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/OrganizationLocation.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/OrganizationLocation.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.core.common.core.domain.HisBaseEntity; +import com.openhis.common.annotation.Dict; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -40,8 +41,9 @@ public class OrganizationLocation extends HisBaseEntity { /** 默认执行科室 */ private Long defOrganizationId; - /** 药品类别 */ - private String medCategoryCode; + /** 发放类别 */ + @Dict(dictCode = "distribution_category_code") + private String distributionCategoryCode; /** 开始时间 */ private Date startTime; diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/Practitioner.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/Practitioner.java index a5c3c168..ee47e373 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/Practitioner.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/Practitioner.java @@ -80,6 +80,9 @@ public class Practitioner extends HisBaseEntity { /** 医保码 */ private String ybNo; + /** 机构id */ + private Long orgId; + /** 系统用户id */ private Long userId; diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/Supplier.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/Supplier.java index 991f6652..6bdca327 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/Supplier.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/domain/Supplier.java @@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.core.common.core.domain.HisBaseEntity; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -26,6 +28,7 @@ public class Supplier extends HisBaseEntity { /** ID */ @TableId(type = IdType.ASSIGN_ID) + @JsonSerialize(using = ToStringSerializer.class) private Long id; /** 编号 */ diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/mapper/BizUserMapper.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/mapper/BizUserMapper.java new file mode 100644 index 00000000..d31ae0ac --- /dev/null +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/mapper/BizUserMapper.java @@ -0,0 +1,17 @@ +package com.openhis.administration.mapper; + +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.openhis.administration.domain.BizUser; + +/** + * 用户管理Mapper接口 + * + * @author system + * @date 2025-02-20 + */ +@Repository +public interface BizUserMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/mapper/BizUserRoleMapper.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/mapper/BizUserRoleMapper.java new file mode 100644 index 00000000..28773514 --- /dev/null +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/mapper/BizUserRoleMapper.java @@ -0,0 +1,18 @@ +package com.openhis.administration.mapper; + +import com.openhis.administration.domain.BizUserRole; +import org.springframework.stereotype.Repository; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.openhis.administration.domain.BizUser; + +/** + * 用户角色Mapper接口 + * + * @author system + * @date 2025-02-20 + */ +@Repository +public interface BizUserRoleMapper extends BaseMapper { + +} \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IBizUserRoleService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IBizUserRoleService.java new file mode 100644 index 00000000..a8f0e80f --- /dev/null +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IBizUserRoleService.java @@ -0,0 +1,14 @@ +package com.openhis.administration.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.openhis.administration.domain.BizUserRole; + +/** + * 用户角色Service接口 + * + * @author system + * @date 2025-02-20 + */ +public interface IBizUserRoleService extends IService { + +} \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IBizUserService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IBizUserService.java new file mode 100644 index 00000000..d1cd92d2 --- /dev/null +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IBizUserService.java @@ -0,0 +1,14 @@ +package com.openhis.administration.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.openhis.administration.domain.BizUser; + +/** + * 用户管理Service接口 + * + * @author system + * @date 2025-02-20 + */ +public interface IBizUserService extends IService { + +} \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IChargeItemService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IChargeItemService.java index 5b7b3600..a0bd9684 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IChargeItemService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IChargeItemService.java @@ -43,4 +43,11 @@ public interface IChargeItemService extends IService { * @return 收费信息 */ List getChargeItemInfo(List chargeItemIdList); + + /** + * 更新收费状态:已退费 + * + * @param chargeItemIdList 收费id列表 + */ + void updateRefundChargeStatus(List chargeItemIdList); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationLocationService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationLocationService.java index 67b4b928..efc99be6 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationLocationService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationLocationService.java @@ -9,4 +9,15 @@ import com.openhis.administration.domain.OrganizationLocation; * @author system * @date 2025-02-25 */ -public interface IOrganizationLocationService extends IService {} \ No newline at end of file +public interface IOrganizationLocationService extends IService { + + /** + * 查询机构位置关系 + * + * @param orgId 机构id + * @param categoryCode 发放类型 + * @return机构位置关系 + */ + OrganizationLocation getOrgLocByOrgIdAndCategoryCode(Long orgId, String categoryCode); + +} \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationService.java index dd66aa3b..d868ba68 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/IOrganizationService.java @@ -3,6 +3,8 @@ package com.openhis.administration.service; import com.baomidou.mybatisplus.extension.service.IService; import com.openhis.administration.domain.Organization; +import java.util.List; + /** * 机构管理Service接口 * @@ -27,4 +29,11 @@ public interface IOrganizationService extends IService { */ boolean inactiveOrg(Long orgId); + /** + * 获取机构下拉列表 + * + * @param classEnum 机构分类 + * @return 机构下拉列表 + */ + List getList(Integer classEnum); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/BizUserRoleServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/BizUserRoleServiceImpl.java new file mode 100644 index 00000000..63e75825 --- /dev/null +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/BizUserRoleServiceImpl.java @@ -0,0 +1,19 @@ +package com.openhis.administration.service.impl; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.openhis.administration.domain.BizUserRole; +import com.openhis.administration.mapper.BizUserRoleMapper; +import com.openhis.administration.service.IBizUserRoleService; + +/** + * 用户角色Service业务层处理 + * + * @author system + * @date 2025-02-20 + */ +@Service +public class BizUserRoleServiceImpl extends ServiceImpl implements IBizUserRoleService { + +} \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/BizUserServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/BizUserServiceImpl.java new file mode 100644 index 00000000..fc108152 --- /dev/null +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/BizUserServiceImpl.java @@ -0,0 +1,19 @@ +package com.openhis.administration.service.impl; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.openhis.administration.domain.BizUser; +import com.openhis.administration.mapper.BizUserMapper; +import com.openhis.administration.service.IBizUserService; + +/** + * 用户管理Service业务层处理 + * + * @author system + * @date 2025-02-20 + */ +@Service +public class BizUserServiceImpl extends ServiceImpl implements IBizUserService { + +} \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemDefDetailServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemDefDetailServiceImpl.java index 67aa037a..6da90303 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemDefDetailServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemDefDetailServiceImpl.java @@ -31,6 +31,7 @@ public class ChargeItemDefDetailServiceImpl extends ServiceImpl 0; } } else { diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java index d673a38f..4a92fc44 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/ChargeItemServiceImpl.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.openhis.administration.domain.ChargeItem; import com.openhis.administration.mapper.ChargeItemMapper; import com.openhis.administration.service.IChargeItemService; +import com.openhis.common.enums.ChargeItemStatus; import lombok.AllArgsConstructor; @@ -56,8 +57,8 @@ public class ChargeItemServiceImpl extends ServiceImpl() - .eq(ChargeItem::getEncounterId, encounterId).set(ChargeItem::getAccountId, accountId)); + int update = baseMapper.update(new ChargeItem().setAccountId(accountId), + new LambdaUpdateWrapper().eq(ChargeItem::getEncounterId, encounterId)); return update > 0; } @@ -71,4 +72,15 @@ public class ChargeItemServiceImpl extends ServiceImpl getChargeItemInfo(List chargeItemIdList) { return baseMapper.selectBatchIds(chargeItemIdList); } + + /** + * 更新收费状态:已退费 + * + * @param chargeItemIdList 收费id列表 + */ + @Override + public void updateRefundChargeStatus(List chargeItemIdList) { + baseMapper.update(new ChargeItem().setStatusEnum(ChargeItemStatus.REFUNDED.getValue()), + new LambdaUpdateWrapper().in(ChargeItem::getId, chargeItemIdList)); + } } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationLocationServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationLocationServiceImpl.java index f1309d10..9163d5e3 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationLocationServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationLocationServiceImpl.java @@ -1,7 +1,10 @@ package com.openhis.administration.service.impl; +import java.util.Date; + import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.openhis.administration.domain.OrganizationLocation; import com.openhis.administration.mapper.OrganizationLocationMapper; @@ -17,4 +20,20 @@ import com.openhis.administration.service.IOrganizationLocationService; public class OrganizationLocationServiceImpl extends ServiceImpl implements IOrganizationLocationService { + /** + * 查询机构位置关系 + * + * @param orgId 机构id + * @param categoryCode 发放类型 + * @return机构位置关系 + */ + @Override + public OrganizationLocation getOrgLocByOrgIdAndCategoryCode(Long orgId, String categoryCode) { + OrganizationLocation organizationLocation = baseMapper + .selectOne(new LambdaQueryWrapper().eq(OrganizationLocation::getOrganizationId, orgId) + .eq(OrganizationLocation::getDistributionCategoryCode, categoryCode) + .lt(OrganizationLocation::getStartTime, new Date()).gt(OrganizationLocation::getEndTime, new Date())); + return organizationLocation; + } + } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationServiceImpl.java index 2c66cfb7..3e4da9b4 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/administration/service/impl/OrganizationServiceImpl.java @@ -1,7 +1,10 @@ package com.openhis.administration.service.impl; +import java.util.List; + import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.openhis.administration.domain.Organization; @@ -27,8 +30,8 @@ public class OrganizationServiceImpl extends ServiceImpl().eq(Organization::getId, orgId) - .set(Organization::getActiveFlag, AccountStatus.ACTIVE.getValue())); + int updateCount = baseMapper.update(new Organization().setActiveFlag(AccountStatus.ACTIVE.getValue()), + new LambdaUpdateWrapper().eq(Organization::getId, orgId)); return updateCount > 0; } @@ -40,9 +43,20 @@ public class OrganizationServiceImpl extends ServiceImpl().eq(Organization::getId, orgId) - .set(Organization::getActiveFlag, AccountStatus.INACTIVE.getValue())); + int updateCount = baseMapper.update(new Organization().setActiveFlag(AccountStatus.INACTIVE.getValue()), + new LambdaUpdateWrapper().eq(Organization::getId, orgId)); return updateCount > 0; } + /** + * 获取机构下拉列表 + * + * @param classEnum 机构分类 + * @return 机构下拉列表 + */ + @Override + public List getList(Integer classEnum) { + return baseMapper.selectList(new LambdaQueryWrapper() + .select(Organization::getId, Organization::getName).eq(Organization::getClassEnum, classEnum)); + } } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/document/domain/Emr.java b/openhis-server/openhis-domain/src/main/java/com/openhis/document/domain/Emr.java index e6bf20dc..bc6ad4b2 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/document/domain/Emr.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/document/domain/Emr.java @@ -1,13 +1,12 @@ package com.openhis.document.domain; -import java.math.BigDecimal; -import java.util.Date; - import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; - import com.core.common.core.domain.HisBaseEntity; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; + import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -26,12 +25,15 @@ public class Emr extends HisBaseEntity { /** ID */ @TableId(type = IdType.ASSIGN_ID) + @JsonSerialize(using = ToStringSerializer.class) private Long id; /** 患者ID */ + @JsonSerialize(using = ToStringSerializer.class) private Long patientId; /** 就诊ID */ + @JsonSerialize(using = ToStringSerializer.class) private Long encounterId; /** 病历信息 */ @@ -43,5 +45,4 @@ public class Emr extends HisBaseEntity { /** 记录人 */ private Long recordId; - } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/document/domain/EmrTemplate.java b/openhis-server/openhis-domain/src/main/java/com/openhis/document/domain/EmrTemplate.java index 7a14c637..72dbc687 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/document/domain/EmrTemplate.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/document/domain/EmrTemplate.java @@ -3,11 +3,14 @@ package com.openhis.document.domain; import java.math.BigDecimal; import java.util.Date; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.core.common.core.domain.HisBaseEntity; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -26,18 +29,20 @@ public class EmrTemplate extends HisBaseEntity { /** ID */ @TableId(type = IdType.ASSIGN_ID) + @JsonSerialize(using = ToStringSerializer.class) private Long id; /** 模板名称 */ private String templateName; /** 模板类型 */ - private String templateCode; + private String templateTypeCode; /** 使用范围 */ private String useScopeCode; /** 个人/科室ID */ + @JsonSerialize(using = ToStringSerializer.class) private Long userId; /** 病历内容 */ diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentRecDetail.java b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentRecDetail.java index 14a4f64c..94e9967f 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentRecDetail.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentRecDetail.java @@ -6,8 +6,8 @@ import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; - import com.core.common.core.domain.HisBaseEntity; + import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -31,6 +31,9 @@ public class PaymentRecDetail extends HisBaseEntity { /** 先前支付明细id */ private Long predecessorId; + /** 付款id */ + private Long reconciliationId; + /** 付款类型 */ private Integer targetEnum; @@ -73,5 +76,4 @@ public class PaymentRecDetail extends HisBaseEntity { /** 单笔交易结果 */ private Integer resultEnum; - } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java index a331f6c5..a9432cab 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/domain/PaymentReconciliation.java @@ -6,8 +6,8 @@ import java.util.Date; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; - import com.core.common.core.domain.HisBaseEntity; + import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; @@ -88,5 +88,6 @@ public class PaymentReconciliation extends HisBaseEntity { /** 就诊ID */ private Long encounterId; - + /** 结算时间 */ + private Date billDate; } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/service/IPaymentReconciliationService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/service/IPaymentReconciliationService.java index 090ff014..25e3eb15 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/service/IPaymentReconciliationService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/service/IPaymentReconciliationService.java @@ -16,8 +16,8 @@ public interface IPaymentReconciliationService extends IService getChargeItemIdListByPayment(Long paymentId); + List getChargeItemIdListByPayment(List paymentIdList); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/service/impl/PaymentReconciliationServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/service/impl/PaymentReconciliationServiceImpl.java index c9e49c4b..639fb487 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/financial/service/impl/PaymentReconciliationServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/financial/service/impl/PaymentReconciliationServiceImpl.java @@ -1,5 +1,6 @@ package com.openhis.financial.service.impl; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -30,21 +31,28 @@ public class PaymentReconciliationServiceImpl extends ServiceImpl getChargeItemIdListByPayment(Long paymentId) { + public List getChargeItemIdListByPayment(List paymentIdList) { // 根据支付id获取支付信息 - PaymentReconciliation paymentReconciliation = - paymentReconciliationMapper.selectOne(new LambdaQueryWrapper() - .select(PaymentReconciliation::getChargeItemIds).eq(PaymentReconciliation::getId, paymentId)); - if (paymentReconciliation == null) { + List paymentReconciliationList = + paymentReconciliationMapper.selectList(new LambdaQueryWrapper() + .select(PaymentReconciliation::getChargeItemIds).in(PaymentReconciliation::getId, paymentIdList)); + if (paymentReconciliationList.isEmpty()) { return null; } + // 拆解所有的chargeItemId,拼装成一个集合 + List chargeItemIdList = paymentReconciliationList.stream().map(PaymentReconciliation::getChargeItemIds) + .collect(Collectors.toList()); + List chargeItemIds = new ArrayList<>(); + for (String chargeItemId : chargeItemIdList) { + chargeItemIds.addAll(Arrays.stream(chargeItemId.split(CommonConstants.Common.COMMA)).map(Long::parseLong) + .collect(Collectors.toList())); + } // 将收费项目集合转换成列表 - return Arrays.stream(paymentReconciliation.getChargeItemIds().split(CommonConstants.Common.COMMA)) - .map(Long::parseLong).collect(Collectors.toList()); + return chargeItemIds; } } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/Medication.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/Medication.java index df26fa0d..7d2bd5af 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/Medication.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/Medication.java @@ -92,4 +92,10 @@ public class Medication extends HisBaseEntity { /** DDD单位 */ private String dddUnitCode; + /** 单次最小用药频次 */ + private String minRateCode; + + /** 单次最大用药频次 */ + private String maxRateCode; + } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDefinition.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDefinition.java index 6db29b4c..c33e0f0c 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDefinition.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDefinition.java @@ -99,6 +99,9 @@ public class MedicationDefinition extends HisBaseEntity { /** 生产厂家 */ private Long manufacturerId; + /** 生产厂商文本 */ + private String manufacturerText; + /** 供应商 */ private Long supplyId; @@ -136,7 +139,7 @@ public class MedicationDefinition extends HisBaseEntity { private String nationalDrugCode; /** 拆分属性 */ - private String partAttribute; + private Integer partAttributeEnum; /** 抗生素分类 */ private String antibioticCode; @@ -153,4 +156,7 @@ public class MedicationDefinition extends HisBaseEntity { /** 基药标识 */ private Integer basicFlag; + /** 住院临时医嘱拆分属性 */ + private Integer thoPartAttributeEnum; + } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDetail.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDetail.java index e9071fd9..980fca10 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDetail.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationDetail.java @@ -99,7 +99,7 @@ public class MedicationDetail extends HisBaseEntity { private String wbStr; /** 药品分类 */ - private Integer categoryCode; + private String categoryCode; /** 商品名称 */ private String merchandiseName; @@ -164,4 +164,40 @@ public class MedicationDetail extends HisBaseEntity { /** 产品特性 */ private Integer characteristic; + /** 所在位置 */ + private Long locationId; + + /** 贯标国家编码 */ + private String nationalDrugCode; + + /** 拆分属性 */ + private Integer partAttributeEnum; + + /** DDD值 */ + private String dddCode; + + /** DDD单位 */ + private String dddUnitCode; + + /** 单次最小用药频次 */ + private String minRateCode; + + /** 单次最大用药频次 */ + private String maxRateCode; + /** 抗生素分类 */ + private String antibioticCode; + /** 权限限制 */ + private Integer restrictedEnum; + /** 是否自制 */ + private Integer selfFlag; + /** 是否抗生素 */ + private Integer antibioticFlag; + /** 基药标识 */ + private Integer basicFlag; + /** 生产厂商文本 */ + private String manufacturerText; + /** 用量限定 */ + private BigDecimal usageLimit; + /** 住院临时医嘱拆分属性 */ + private Integer thoPartAttributeEnum; } diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationRequest.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationRequest.java index a6728700..f41714ef 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationRequest.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/domain/MedicationRequest.java @@ -29,7 +29,7 @@ public class MedicationRequest extends HisBaseEntity { private Long id; /** 药品请求编码 */ - private String bus_no; + private String busNo; /** 处方号 */ private String prescriptionNo; @@ -82,15 +82,25 @@ public class MedicationRequest extends HisBaseEntity { /** 开方医生 */ private Long practitionerId; - /** 发放药房 */ + /** 所在位置 */ private Long locationId; - /** 发放科室 */ + /** + * 发放药房 + */ + private Long performLocation; + + /** 开方人科室 */ private Long orgId; /** 就诊id */ private Long encounterId; + /** + * 诊断ID + */ + private Long conditionId; + /** 支持用药信息 */ private String supportInfo; diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationDefinitionService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationDefinitionService.java index f69bf849..0ecd9358 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationDefinitionService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationDefinitionService.java @@ -20,11 +20,4 @@ public interface IMedicationDefinitionService extends IService { + /** + * 新增草稿状态的药品发放信息 + * + * @param medicationRequestList 药品请求信息 + */ + void addMedicationDispense(List medicationRequestList); + + /** + * 更新未发放药品状态:停止发放 + * + * @param medDisIdList 发放id列表 + * @param refund 停止原因:退费 + */ + void updateStopDispenseStatus(List medDisIdList, Integer refund); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationService.java index 8e5d5ef6..b3ed6cc1 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/IMedicationService.java @@ -32,6 +32,4 @@ public interface IMedicationService extends IService { // 新增药品目录 boolean addMedication(MedicationDetail medicationDetail); - // 新增医保药品目录 - boolean addYbMedicatione(MedicationDetail medicationDetail); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationDefinitionServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationDefinitionServiceImpl.java index dfc6f12f..e1dbe0b7 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationDefinitionServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationDefinitionServiceImpl.java @@ -60,8 +60,5 @@ public class MedicationDefinitionServiceImpl extends ServiceImpl implements IMedicationDispenseService { +public class MedicationDispenseServiceImpl extends ServiceImpl + implements IMedicationDispenseService { + /** + * 新增草稿状态的药品发放信息 + * + * @param medicationRequestList 药品请求信息 + */ + @Override + public void addMedicationDispense(List medicationRequestList) { + for (MedicationRequest medicationRequest : medicationRequestList) { + MedicationDispense medicationDispense = new MedicationDispense(); + // 药品发放id + medicationDispense.setBusNo(medicationRequest.getBusNo()); + // 药品发放状态 + medicationDispense.setStatusEnum(DispenseStatus.DRAFT.getValue()); + // 状态变更时间 + medicationDispense.setStatusChangedTime(DateUtils.getNowDate()); + // 发药类型 + medicationDispense.setDispenseEnum(medicationRequest.getCategoryEnum()); + // 药品编码 + medicationDispense.setMedicationId(medicationRequest.getMedicationId()); + // 请求数量 + medicationDispense.setQuantity(medicationRequest.getQuantity()); + // 请求单位编码 + medicationDispense.setUnitCode(medicationRequest.getUnitCode()); + // 产品批号 + medicationDispense.setLotNumber(medicationRequest.getLotNumber()); + // 患者id + medicationDispense.setPatientId(medicationRequest.getPatientId()); + // 就诊id + medicationDispense.setEncounterId(medicationRequest.getEncounterId()); + // 支持用药信息 + medicationDispense.setSupportInfo(medicationRequest.getSupportInfo()); + // 发药人 + medicationDispense.setPractitionerId(medicationRequest.getPractitionerId()); + // 发放药房 + medicationDispense.setLocationId(medicationRequest.getPerformOrg()); + // 药品请求id + medicationDispense.setMedReqId(medicationRequest.getId()); + // 已发药数量 + medicationDispense.setDispenseQuantity(0); + // 用法 + medicationDispense.setMethodCode(medicationRequest.getMethodCode()); + // 用药频次 + medicationDispense.setFrequencyCode(medicationRequest.getRateCode()); + // 单次剂量 + medicationDispense.setDose(medicationRequest.getDose()); + // 剂量单位 + medicationDispense.setDoseUnitCode(medicationRequest.getDoseUnitCode()); + // 单次最大剂量 + medicationDispense.setMaxUnit(medicationRequest.getMaxDose()); + baseMapper.insert(medicationDispense); + } + } + + /** + * 更新未发放药品状态:停止发放 + * + * @param medDisIdList 发放id列表 + * @param refund 停止原因:退费 + */ + @Override + public void updateStopDispenseStatus(List medDisIdList, Integer refund) { + baseMapper.update( + new MedicationDispense().setStatusEnum(DispenseStatus.STOPPED.getValue()).setNotPerformedReasonEnum(refund), + new LambdaUpdateWrapper().in(MedicationDispense::getId, medDisIdList)); + } } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationServiceImpl.java index 34d33057..0e59a1a0 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/medication/service/impl/MedicationServiceImpl.java @@ -83,14 +83,4 @@ public class MedicationServiceImpl extends ServiceImpl { + /** + * 更新未发放耗材状态:停止发放 + * + * @param devDisIdList 发放id列表 + * @param refund 停止原因:退费 + */ + void updateStopDispenseStatus(List devDisIdList, Integer refund); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IServiceRequestService.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IServiceRequestService.java index 2ed4a05d..f98df483 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IServiceRequestService.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/IServiceRequestService.java @@ -1,6 +1,7 @@ package com.openhis.workflow.service; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import java.util.List; + import com.baomidou.mybatisplus.extension.service.IService; import com.openhis.workflow.domain.ServiceRequest; @@ -12,13 +13,18 @@ import com.openhis.workflow.domain.ServiceRequest; */ public interface IServiceRequestService extends IService { - /** * 查询服务申请管理中basedOnId相同的个数 * * @param basedOnId 请求基于什么的ID * @return basedOnId相同的个数 */ - Long countServiceRequestByBasedOnId(Long basedOnId) ; + Long countServiceRequestByBasedOnId(Long basedOnId); + /** + * 更新执行诊疗状态:停止 + * + * @param serReqIdList 服务请求id列表 + */ + void updateStopRequestStatus(List serReqIdList); } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/DeviceDispenseServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/DeviceDispenseServiceImpl.java index 0dc5c1e6..5e046696 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/DeviceDispenseServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/DeviceDispenseServiceImpl.java @@ -1,8 +1,12 @@ package com.openhis.workflow.service.impl; +import java.util.List; + import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.openhis.common.enums.DispenseStatus; import com.openhis.workflow.domain.DeviceDispense; import com.openhis.workflow.mapper.DeviceDispenseMapper; import com.openhis.workflow.service.IDeviceDispenseService; @@ -14,6 +18,19 @@ import com.openhis.workflow.service.IDeviceDispenseService; * @date 2025-02-20 */ @Service -public class DeviceDispenseServiceImpl extends ServiceImpl implements IDeviceDispenseService { +public class DeviceDispenseServiceImpl extends ServiceImpl + implements IDeviceDispenseService { + /** + * 更新未发放耗材状态:停止发放 + * + * @param devDisIdList 发放id列表 + * @param refund 停止原因:退费 + */ + @Override + public void updateStopDispenseStatus(List devDisIdList, Integer refund) { + baseMapper.update( + new DeviceDispense().setStatusEnum(DispenseStatus.STOPPED.getValue()).setNotPerformedReasonEnum(refund), + new LambdaUpdateWrapper().in(DeviceDispense::getId, devDisIdList)); + } } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/ServiceRequestServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/ServiceRequestServiceImpl.java index c40e3c9c..41deca8c 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/ServiceRequestServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/ServiceRequestServiceImpl.java @@ -1,11 +1,13 @@ package com.openhis.workflow.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import org.springframework.beans.factory.annotation.Autowired; +import java.util.List; + import org.springframework.stereotype.Service; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.openhis.common.enums.RequestStatus; import com.openhis.workflow.domain.ServiceRequest; import com.openhis.workflow.mapper.ServiceRequestMapper; import com.openhis.workflow.service.IServiceRequestService; @@ -20,9 +22,6 @@ import com.openhis.workflow.service.IServiceRequestService; public class ServiceRequestServiceImpl extends ServiceImpl implements IServiceRequestService { - @Autowired - private ServiceRequestMapper serviceRequestMapper; - /** * 查询服务申请管理中basedOnId相同的个数 * @@ -33,6 +32,17 @@ public class ServiceRequestServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(ServiceRequest::getBasedOnId, basedOnId); - return serviceRequestMapper.selectCount(queryWrapper); + return baseMapper.selectCount(queryWrapper); + } + + /** + * 更新执行诊疗状态:停止 + * + * @param serReqIdList 服务请求id列表 + */ + @Override + public void updateStopRequestStatus(List serReqIdList) { + baseMapper.update(new ServiceRequest().setStatusEnum(RequestStatus.STOPPED.getValue()), + new LambdaUpdateWrapper().in(ServiceRequest::getId, serReqIdList)); } } \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/SupplyRequestServiceImpl.java b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/SupplyRequestServiceImpl.java index 4f57c284..08bae25b 100644 --- a/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/SupplyRequestServiceImpl.java +++ b/openhis-server/openhis-domain/src/main/java/com/openhis/workflow/service/impl/SupplyRequestServiceImpl.java @@ -53,10 +53,10 @@ public class SupplyRequestServiceImpl extends ServiceImpl agreeRequest(String busNo, LoginUser loginUser, Date now) { // 更新单据状态 - baseMapper.update(null, - new LambdaUpdateWrapper().eq(SupplyRequest::getBusNo, busNo) - .set(SupplyRequest::getApprovalTime, now).set(SupplyRequest::getApproverId, loginUser.getUserId()) - .set(SupplyRequest::getStatusEnum, SupplyStatus.AGREE.getValue())); + baseMapper.update( + new SupplyRequest().setApprovalTime(now).setApproverId(loginUser.getPractitionerId()) + .setStatusEnum(SupplyStatus.AGREE.getValue()), + new LambdaUpdateWrapper().eq(SupplyRequest::getBusNo, busNo)); // 返回单据详情 return this.getSupplyByBusNo(busNo); } @@ -69,10 +69,9 @@ public class SupplyRequestServiceImpl extends ServiceImpl().eq(SupplyRequest::getBusNo, busNo) - .set(SupplyRequest::getStatusEnum, SupplyStatus.APPROVAL.getValue()) - .set(SupplyRequest::getApplyTime, DateUtils.getNowDate())); + int updateCount = baseMapper.update( + new SupplyRequest().setApplyTime(DateUtils.getNowDate()).setStatusEnum(SupplyStatus.APPROVAL.getValue()), + new LambdaUpdateWrapper().eq(SupplyRequest::getBusNo, busNo)); return updateCount > 0; } @@ -84,8 +83,8 @@ public class SupplyRequestServiceImpl extends ServiceImpl() - .eq(SupplyRequest::getBusNo, busNo).set(SupplyRequest::getStatusEnum, SupplyStatus.WITHDRAW.getValue())); + int updateCount = baseMapper.update(new SupplyRequest().setStatusEnum(SupplyStatus.WITHDRAW.getValue()), + new LambdaUpdateWrapper().eq(SupplyRequest::getBusNo, busNo)); return updateCount > 0; } @@ -99,10 +98,10 @@ public class SupplyRequestServiceImpl extends ServiceImpl().eq(SupplyRequest::getBusNo, busNo) - .set(SupplyRequest::getApprovalTime, now).set(SupplyRequest::getApproverId, loginUser.getUserId()) - .set(SupplyRequest::getStatusEnum, SupplyStatus.REJECT.getValue())); + int updateCount = baseMapper.update( + new SupplyRequest().setApprovalTime(now).setApproverId(loginUser.getPractitionerId()) + .setStatusEnum(SupplyStatus.REJECT.getValue()), + new LambdaUpdateWrapper().eq(SupplyRequest::getBusNo, busNo)); return updateCount > 0; } diff --git a/openhis-server/openhis-domain/src/main/resources/mapper/administration/BizUserMapper.xml b/openhis-server/openhis-domain/src/main/resources/mapper/administration/BizUserMapper.xml new file mode 100644 index 00000000..f7fd379c --- /dev/null +++ b/openhis-server/openhis-domain/src/main/resources/mapper/administration/BizUserMapper.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/openhis-server/openhis-domain/src/main/resources/mapper/administration/BizUserRoleMapper.xml b/openhis-server/openhis-domain/src/main/resources/mapper/administration/BizUserRoleMapper.xml new file mode 100644 index 00000000..73b709a8 --- /dev/null +++ b/openhis-server/openhis-domain/src/main/resources/mapper/administration/BizUserRoleMapper.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/openhis-ui-vue3/package.json b/openhis-ui-vue3/package.json index 68967b75..e6f4014a 100644 --- a/openhis-ui-vue3/package.json +++ b/openhis-ui-vue3/package.json @@ -30,7 +30,9 @@ "moment": "^2.30.1", "nprogress": "0.2.0", "pinia": "2.1.7", + "pinyin": "^4.0.0-alpha.2", "province-city-china": "^8.5.8", + "segmentit": "^2.0.3", "v-region": "^3.3.0", "vue": "3.3.9", "vue-area-linkage": "^5.1.0", diff --git a/openhis-ui-vue3/src/api/system/user copy.js b/openhis-ui-vue3/src/api/system/user copy.js new file mode 100644 index 00000000..49054e3a --- /dev/null +++ b/openhis-ui-vue3/src/api/system/user copy.js @@ -0,0 +1,135 @@ +import request from '@/utils/request' +import { parseStrEmpty } from "@/utils/openhis"; + +// 查询用户列表 +export function listUser(query) { + return request({ + url: '/system/user/list', + method: 'get', + params: query + }) +} + +// 查询用户详细 +export function getUser(userId) { + return request({ + url: '/system/user/' + parseStrEmpty(userId), + method: 'get' + }) +} + +// 新增用户 +export function addUser(data) { + return request({ + url: '/system/user', + method: 'post', + data: data + }) +} + +// 修改用户 +export function updateUser(data) { + return request({ + url: '/system/user', + method: 'put', + data: data + }) +} + +// 删除用户 +export function delUser(userId) { + return request({ + url: '/system/user/' + userId, + method: 'delete' + }) +} + +// 用户密码重置 +export function resetUserPwd(userId, password) { + const data = { + userId, + password + } + return request({ + url: '/system/user/resetPwd', + method: 'put', + data: data + }) +} + +// 用户状态修改 +export function changeUserStatus(userId, status) { + const data = { + userId, + status + } + return request({ + url: '/system/user/changeStatus', + method: 'put', + data: data + }) +} + +// 查询用户个人信息 +export function getUserProfile() { + return request({ + url: '/system/user/profile', + method: 'get' + }) +} + +// 修改用户个人信息 +export function updateUserProfile(data) { + return request({ + url: '/system/user/profile', + method: 'put', + data: data + }) +} + +// 用户密码重置 +export function updateUserPwd(oldPassword, newPassword) { + const data = { + oldPassword, + newPassword + } + return request({ + url: '/system/user/profile/updatePwd', + method: 'put', + params: data + }) +} + +// 用户头像上传 +export function uploadAvatar(data) { + return request({ + url: '/system/user/profile/avatar', + method: 'post', + data: data + }) +} + +// 查询授权角色 +export function getAuthRole(userId) { + return request({ + url: '/system/user/authRole/' + userId, + method: 'get' + }) +} + +// 保存授权角色 +export function updateAuthRole(data) { + return request({ + url: '/system/user/authRole', + method: 'put', + params: data + }) +} + +// 查询部门下拉树结构 +export function deptTreeSelect() { + return request({ + url: '/system/user/deptTree', + method: 'get' + }) +} diff --git a/openhis-ui-vue3/src/api/system/user.js b/openhis-ui-vue3/src/api/system/user.js index 49054e3a..8cc166bd 100644 --- a/openhis-ui-vue3/src/api/system/user.js +++ b/openhis-ui-vue3/src/api/system/user.js @@ -4,7 +4,7 @@ import { parseStrEmpty } from "@/utils/openhis"; // 查询用户列表 export function listUser(query) { return request({ - url: '/system/user/list', + url: '/base-data-manage/practitioner/user-practitioner-page', method: 'get', params: query }) @@ -12,6 +12,14 @@ export function listUser(query) { // 查询用户详细 export function getUser(userId) { + return request({ + url: '/base-data-manage/practitioner/user-practitioner-detail?userId=' + parseStrEmpty(userId), + method: 'get' + }) +} + +// 查询角色 +export function getRole(userId) { return request({ url: '/system/user/' + parseStrEmpty(userId), method: 'get' @@ -21,7 +29,7 @@ export function getUser(userId) { // 新增用户 export function addUser(data) { return request({ - url: '/system/user', + url: '/base-data-manage/practitioner/user-practitioner', method: 'post', data: data }) @@ -30,7 +38,7 @@ export function addUser(data) { // 修改用户 export function updateUser(data) { return request({ - url: '/system/user', + url: '/base-data-manage/practitioner/user-practitioner', method: 'put', data: data }) @@ -39,7 +47,7 @@ export function updateUser(data) { // 删除用户 export function delUser(userId) { return request({ - url: '/system/user/' + userId, + url: '/base-data-manage/practitioner/user-practitioner?userId=' + userId, method: 'delete' }) } @@ -129,7 +137,15 @@ export function updateAuthRole(data) { // 查询部门下拉树结构 export function deptTreeSelect() { return request({ - url: '/system/user/deptTree', + url: '/base-data-manage/organization/organization', + method: 'get' + }) +} + +// 查询位下拉树结构 +export function locationTreeSelect() { + return request({ + url: '/base-data-manage/cabinet-location/cabinet-location', method: 'get' }) } diff --git a/openhis-ui-vue3/src/directive/common/horizontalScroll.js b/openhis-ui-vue3/src/directive/common/horizontalScroll.js new file mode 100644 index 00000000..d4579ab7 --- /dev/null +++ b/openhis-ui-vue3/src/directive/common/horizontalScroll.js @@ -0,0 +1,20 @@ +// 表格上滑滚轮滚动条横向滚动,在只有横向滚动条时使用 +export default { + mounted: (el) => { + const container = el.querySelector('.el-scrollbar__wrap') + if (!container) return + + const handleWheel = (e) => { + // 组织默认事件 + e.preventDefault() + const delta = e.deltaY || e.detail || (-e.wheelDelta) + container.scrollLeft += delta * 0.6 + } + + container.addEventListener('wheel', handleWheel, { passive: false }) + el._horizontalScrollCleanup = () => container.removeEventListener('wheel', handleWheel) + }, + unmounted: (el) => { + el._horizontalScrollCleanup?.() + } + } \ No newline at end of file diff --git a/openhis-ui-vue3/src/directive/index.js b/openhis-ui-vue3/src/directive/index.js index 86b8f88a..1f918b5a 100644 --- a/openhis-ui-vue3/src/directive/index.js +++ b/openhis-ui-vue3/src/directive/index.js @@ -1,9 +1,11 @@ import hasRole from './permission/hasRole' import hasPermi from './permission/hasPermi' import copyText from './common/copyText' +import horizontalScroll from './common/horizontalScroll' export default function directive(app){ app.directive('hasRole', hasRole) app.directive('hasPermi', hasPermi) app.directive('copyText', copyText) + app.directive('horizontal-scroll', horizontalScroll) } \ No newline at end of file diff --git a/openhis-ui-vue3/src/utils/request.js b/openhis-ui-vue3/src/utils/request.js index 3a9be89d..d3118339 100644 --- a/openhis-ui-vue3/src/utils/request.js +++ b/openhis-ui-vue3/src/utils/request.js @@ -12,6 +12,8 @@ let downloadLoadingInstance; export let isRelogin = { show: false }; axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8' +axios.defaults.headers['X-Tenant-ID'] = '1' +axios.defaults.headers['Request-Method-Name'] = 'login' // 创建axios实例 const service = axios.create({ // axios中请求配置有baseURL选项,表示请求URL公共部分 diff --git a/openhis-ui-vue3/src/views/basicmanage/organization/components/api.js b/openhis-ui-vue3/src/views/basicmanage/organization/components/api.js index a6e6a017..5339c67c 100644 --- a/openhis-ui-vue3/src/views/basicmanage/organization/components/api.js +++ b/openhis-ui-vue3/src/views/basicmanage/organization/components/api.js @@ -2,7 +2,7 @@ import request from '@/utils/request' export function getList(queryParams) { return request({ - url: '/basedatamanage/organization/organization', + url: '/base-data-manage/organization/organization', method: 'get', param: queryParams }) @@ -10,7 +10,7 @@ export function getList(queryParams) { export function addOrganization(data) { return request({ - url: '/basedatamanage/organization/organization', + url: '/base-data-manage/organization/organization', method: 'post', data: data }) @@ -18,7 +18,7 @@ export function addOrganization(data) { export function updateOrganization(data) { return request({ - url: '/basedatamanage/organization/organization', + url: '/base-data-manage/organization/organization', method: 'put', data: data }) @@ -26,7 +26,7 @@ export function updateOrganization(data) { export function deleteOrganization(param) { return request({ - url: '/basedatamanage/organization/organization', + url: '/base-data-manage/organization/organization', method: 'delete', params: param }) @@ -34,28 +34,28 @@ export function deleteOrganization(param) { export function getOrgDetail(id) { return request({ - url: '/basedatamanage/organization/organization?orgId=' + id, + url: '/base-data-manage/organization/organization?orgId=' + id, method: 'get', }) } export function initOrgTypeOption() { return request({ - url: '/basedatamanage/organization/init', + url: '/base-data-manage/organization/init', method: 'get', }) } export function disableOrg(id) { return request({ - url: '/basedatamanage/organization/organization-inactive?orgId=' + id, + url: '/base-data-manage/organization/organization-inactive?orgId=' + id, method: 'put', }) } export function enableOrg(id) { return request({ - url: '/basedatamanage/organization/organization-active?orgId=' + id, + url: '/base-data-manage/organization/organization-active?orgId=' + id, method: 'put', }) } diff --git a/openhis-ui-vue3/src/views/basicmanage/supplier/components/supplier.js b/openhis-ui-vue3/src/views/basicmanage/supplier/components/supplier.js index 3282d902..98d535eb 100644 --- a/openhis-ui-vue3/src/views/basicmanage/supplier/components/supplier.js +++ b/openhis-ui-vue3/src/views/basicmanage/supplier/components/supplier.js @@ -70,3 +70,12 @@ export function getSupplierInit() { method: 'get' }) } + +// 查询部门树结构 +export function deptTreeSelect(queryParams) { + return request({ + url: '/base-data-manage/organization/organization', + method: 'get', + param: queryParams + }) +} \ No newline at end of file diff --git a/openhis-ui-vue3/src/views/basicmanage/supplier/index.vue b/openhis-ui-vue3/src/views/basicmanage/supplier/index.vue index b418cda9..cd98ad75 100644 --- a/openhis-ui-vue3/src/views/basicmanage/supplier/index.vue +++ b/openhis-ui-vue3/src/views/basicmanage/supplier/index.vue @@ -7,27 +7,18 @@ v-show="showSearch" label-width="90px" > - - - - + - + + + + @@ -260,12 +264,23 @@ - + - - + + + + + @@ -289,6 +304,7 @@ import { stopSupplier, startSupplier, getSupplierInit, + deptTreeSelect, } from "./components/supplier"; const router = useRouter(); @@ -308,6 +324,7 @@ const multiple = ref(true); const total = ref(0); const title = ref(""); const supplierTypeOptions = ref(undefined); +const deptOptions = ref(undefined); // 部门树选项 // 是否停用 const statusFlagOptions = ref(undefined); // const initPassword = ref(undefined); @@ -320,9 +337,9 @@ const data = reactive({ pageNo: 1, pageSize: 10, searchKey: undefined, // 供应商名称 - busNo: undefined, // 编码 - statusEnum: undefined, // 状态(包括 1:预置,2:启用,3:停用) - sourceEnum: undefined, // 来源(包括 1:厂商/产地目录分类,2:自定义) + // busNo: undefined, // 编码 + typeEnum: undefined, // 状态(包括 1:预置,2:启用,3:停用) + // sourceEnum: undefined, // 来源(包括 1:厂商/产地目录分类,2:自定义) }, rules: { busNo: [{ required: true, message: "编码不能为空", trigger: "blur" }], @@ -349,6 +366,16 @@ function getsupplierTypeList() { }); } +/** 查询部门下拉树结构 */ +function getDeptTree() { + console.log("查询部门下拉树结构"); + deptTreeSelect().then((response) => { + console.log(response, "response查询部门下拉树结构"); + deptOptions.value = response.data.records; + console.log(deptOptions.value, "部门下拉树结构"); + }); +} + /** 查询厂商/产地目录列表 */ function getList() { loading.value = true; @@ -356,7 +383,7 @@ function getList() { console.log(queryParams.value, "queryParams.value"); getSupplierList(queryParams.value).then((res) => { loading.value = false; - console.log(res, "res",res.data.records); + console.log(res, "res", res.data.records); supplierList.value = res.data.records; console.log(supplierList.value, "supplierList.value"); total.value = res.data.total; @@ -423,14 +450,6 @@ function handleSelectionChange(selection) { multiple.value = !selection.length; } -/** 下载模板操作 */ -function importTemplate() { - proxy.download( - "system/user/importTemplate", - {}, - `user_template_${new Date().getTime()}.xlsx` - ); -} /** 重置操作表单 */ function reset() { form.value = { @@ -458,6 +477,8 @@ function handleUpdate(row) { reset(); console.log(row, "row"); form.value = JSON.parse(JSON.stringify(row)); + form.value.activeFlag == 1 ? (form.value.activeFlag = true) : (form.value.activeFlag = false); //是否为活性 + // console.log(form.value.ty, "form.value"); open.value = true; title.value = "厂商/产地编辑"; } @@ -465,6 +486,7 @@ function handleUpdate(row) { function submitForm() { proxy.$refs["supplierRef"].validate((valid) => { if (valid) { + form.activeFlag == true ? (form.activeFlag = 1) : (form.activeFlag = 0); //是否为活性 if (form.value.id != undefined) { console.log(form.value, "editSupplier", form.value.statusEnum); editSupplier(form.value).then((response) => { @@ -495,6 +517,7 @@ function handleView(row) { } getsupplierTypeList(); getList(); +getDeptTree(); +.el-form--inline .el-form-item { + display: inline-flex; + vertical-align: middle; + margin-right: 10px !important; +} + \ No newline at end of file diff --git a/openhis-ui-vue3/src/views/catalog/disease/components/disease.js b/openhis-ui-vue3/src/views/catalog/disease/components/disease.js index 07613c01..6738a23c 100644 --- a/openhis-ui-vue3/src/views/catalog/disease/components/disease.js +++ b/openhis-ui-vue3/src/views/catalog/disease/components/disease.js @@ -1,5 +1,4 @@ import request from '@/utils/request' -import { parseStrEmpty } from "@/utils/openhis"; // 查询病种目录列表 export function getDiseaseList(query) { @@ -13,8 +12,9 @@ export function getDiseaseList(query) { // 查询病种目录详细 export function getDiseaseOne(id) { return request({ - url: '/data-dictionary/disease/information-one/' + parseStrEmpty(id), - method: 'get' + url: '/data-dictionary/disease/information-one', + method: 'get', + params: { id } // 确保参数正确传递 }) } diff --git a/openhis-ui-vue3/src/views/catalog/disease/index.vue b/openhis-ui-vue3/src/views/catalog/disease/index.vue index 56787dbe..c1b102e6 100644 --- a/openhis-ui-vue3/src/views/catalog/disease/index.vue +++ b/openhis-ui-vue3/src/views/catalog/disease/index.vue @@ -3,15 +3,6 @@ -
- 查询 - + 编辑 - 查看 + > --> @@ -270,8 +238,58 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - 编辑保存 - 查看 + > --> @@ -537,34 +593,28 @@ \ No newline at end of file diff --git a/openhis-ui-vue3/src/views/medicationmanagement/purchaseinventory/components/purchaseinventory.js b/openhis-ui-vue3/src/views/medicationmanagement/purchaseinventory/components/purchaseinventory.js index 64c94c83..c4c79651 100644 --- a/openhis-ui-vue3/src/views/medicationmanagement/purchaseinventory/components/purchaseinventory.js +++ b/openhis-ui-vue3/src/views/medicationmanagement/purchaseinventory/components/purchaseinventory.js @@ -1,7 +1,7 @@ import request from '@/utils/request' import { parseStrEmpty } from "@/utils/openhis"; -// 查询服务管理列表 +// 查询采购入库列表 export function getPurchaseinventoryList(query) { return request({ url: '/inventory-manage/purchase/inventory-receipt-page', @@ -10,64 +10,58 @@ export function getPurchaseinventoryList(query) { }) } -// 查询服务管理详细 -export function getPurchaseinventoryOne(id) { +// 入库单据详情 +export function getpurchaseInventoryDetail(busNo) { return request({ - url: '/basic-service/healthcare/healthcare-service-detail/' + parseStrEmpty(id), - method: 'get' + url: '/inventory-manage/purchase/inventory-receipt', + method: 'get', + params: { busNo } // 确保参数正确传递 }) } -// 新增服务管理 +// 添加/编辑入库单据 export function addPurchaseinventory(data) { return request({ - url: '/basic-service/healthcare/healthcare-service', - method: 'post', - data: data - }) -} - -// 修改服务管理 -export function editPurchaseinventory(data) { - return request({ - url: '/basic-service/healthcare/healthcare-service', + url: '/inventory-manage/purchase/inventory-receipt', method: 'put', data: data }) } -// 查询厂商类型 + +// 查询采购入库单据初始化数据 export function getInit() { return request({ - url: '/basic-service/healthcare/init', + url: '/inventory-manage/purchase/init', method: 'get' }) } -// 查询部门树形数据 -export function deptTreeSelect(queryParams) { - return request({ - url: '/base-data-manage/organization/organization', - method: 'get', - param: queryParams - }) -} -// 查询地点树形数据 -export function locationTreeSelect(queryParams) { - return request({ - url: '/base-data-manage/cabinet-location/cabinet-location', - method: 'get', - param: queryParams - }) -} - -// 删除收费挂号项目 +// 删除单据 export function delPurchaseinventory(param) { console.log(param,'aaaa') return request({ - url: '/basic-service/healthcare/healthcare-service', + url: '/inventory-manage/purchase/inventory-receipt', method: 'delete', params: param }) +} + +// 提交审批 +export function submitApproval(busNo) { + return request({ + url: '/inventory-manage/purchase/submit-approval', + method: 'put', + data: { busNo } + }) +} + +// 撤回审批 +export function withdrawApproval(busNo) { + return request({ + url: '/inventory-manage/purchase/withdraw-approval', + method: 'put', + data: { busNo } + }) } \ No newline at end of file diff --git a/openhis-ui-vue3/src/views/medicationmanagement/purchaseinventory/index.vue b/openhis-ui-vue3/src/views/medicationmanagement/purchaseinventory/index.vue index 9fb04066..b067bdd7 100644 --- a/openhis-ui-vue3/src/views/medicationmanagement/purchaseinventory/index.vue +++ b/openhis-ui-vue3/src/views/medicationmanagement/purchaseinventory/index.vue @@ -9,18 +9,14 @@ > - + - - - - + @@ -113,7 +100,7 @@ type="primary" plain icon="Search" - @click="getList" + @click="handleQuery" v-hasPermi="['system:user:import']" >查询 @@ -136,7 +123,12 @@ @selection-change="handleSelectionChange" > - + - + key="occurrenceTime" + prop="occurrenceTime" + width="160" + > + + + width="160" + > + + @@ -223,10 +228,12 @@ />
@@ -234,12 +241,11 @@ \ No newline at end of file diff --git a/openhis-ui-vue3/src/views/system/user copy/authRole.vue b/openhis-ui-vue3/src/views/system/user copy/authRole.vue new file mode 100644 index 00000000..ed27b2f8 --- /dev/null +++ b/openhis-ui-vue3/src/views/system/user copy/authRole.vue @@ -0,0 +1,112 @@ + + + diff --git a/openhis-ui-vue3/src/views/system/user copy/index.vue b/openhis-ui-vue3/src/views/system/user copy/index.vue new file mode 100644 index 00000000..7825494b --- /dev/null +++ b/openhis-ui-vue3/src/views/system/user copy/index.vue @@ -0,0 +1,612 @@ + + + diff --git a/openhis-ui-vue3/src/views/system/user copy/profile/index.vue b/openhis-ui-vue3/src/views/system/user copy/profile/index.vue new file mode 100644 index 00000000..b0f86c86 --- /dev/null +++ b/openhis-ui-vue3/src/views/system/user copy/profile/index.vue @@ -0,0 +1,87 @@ + + + diff --git a/openhis-ui-vue3/src/views/system/user copy/profile/resetPwd.vue b/openhis-ui-vue3/src/views/system/user copy/profile/resetPwd.vue new file mode 100644 index 00000000..f13a3c56 --- /dev/null +++ b/openhis-ui-vue3/src/views/system/user copy/profile/resetPwd.vue @@ -0,0 +1,65 @@ + + + + diff --git a/openhis-ui-vue3/src/views/system/user copy/profile/userAvatar.vue b/openhis-ui-vue3/src/views/system/user copy/profile/userAvatar.vue new file mode 100644 index 00000000..8f132e88 --- /dev/null +++ b/openhis-ui-vue3/src/views/system/user copy/profile/userAvatar.vue @@ -0,0 +1,171 @@ + + + + + \ No newline at end of file diff --git a/openhis-ui-vue3/src/views/system/user copy/profile/userInfo.vue b/openhis-ui-vue3/src/views/system/user copy/profile/userInfo.vue new file mode 100644 index 00000000..00da2708 --- /dev/null +++ b/openhis-ui-vue3/src/views/system/user copy/profile/userInfo.vue @@ -0,0 +1,67 @@ + + + diff --git a/openhis-ui-vue3/src/views/system/user/index.vue b/openhis-ui-vue3/src/views/system/user/index.vue index 5cd9936e..90f94268 100644 --- a/openhis-ui-vue3/src/views/system/user/index.vue +++ b/openhis-ui-vue3/src/views/system/user/index.vue @@ -4,73 +4,35 @@
- +
- +
- + - + - - + + - + 搜索 @@ -80,35 +42,18 @@ - 新增 + 新增 - 修改 + 修改 - 删除 + 删除 - + - - - - + + + + @@ -154,49 +99,46 @@ - +
+
+ 用户信息 +
- - - + + + @@ -220,7 +162,8 @@
- + @@ -228,56 +171,68 @@ - + - {{ dict.label }} + {{ dict.label + }} - - - - + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 备注 +
@@ -295,18 +250,9 @@ - +
将文件拖到此处,或点击上传
@@ -331,7 +278,8 @@ + + diff --git a/openhis-ui-vue3/vite.config.js b/openhis-ui-vue3/vite.config.js index 3fa8a5c1..6731e261 100644 --- a/openhis-ui-vue3/vite.config.js +++ b/openhis-ui-vue3/vite.config.js @@ -32,7 +32,7 @@ export default defineConfig (({mode, command}) => { // https://cn.vitejs.dev/config/#server-proxy '/dev-api': { target: 'http://localhost:18080/openhis', - // target: 'http://192.168.31.221:18080/openhis', + // target: 'http://192.168.31.221:18081/openhis', changeOrigin: true, rewrite: p => p.replace (/^\/dev-api/, ''), },