v0.2
This commit is contained in:
@@ -51,7 +51,7 @@ public class SysLoginController {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||
loginBody.getUuid());
|
||||
loginBody.getUuid(), loginBody.getTenantId());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
@@ -74,6 +74,8 @@ public class SysLoginController {
|
||||
tokenService.refreshToken(loginUser);
|
||||
}
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("optionJson", loginUser.getOptionJson());
|
||||
ajax.put("practitionerId", String.valueOf(loginUser.getPractitionerId()));
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
|
||||
@@ -41,6 +41,11 @@ public class CacheConstants {
|
||||
*/
|
||||
public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
|
||||
|
||||
/**
|
||||
* 登录上次勾选的租户
|
||||
*/
|
||||
public static final String LOGIN_SELECTED_TENANT = "login_selected_tenant:";
|
||||
|
||||
/**
|
||||
* 超出上限,排番失败(时间:{},KEY:{}
|
||||
*/
|
||||
|
||||
@@ -163,7 +163,7 @@ public class Constants {
|
||||
/**
|
||||
* 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
|
||||
*/
|
||||
public static final String[] JOB_WHITELIST_STR = {"com.core.quartz.task"};
|
||||
public static final String[] JOB_WHITELIST_STR = {"com.openhis.quartz.task"};
|
||||
|
||||
/**
|
||||
* 定时任务违规的字符
|
||||
|
||||
@@ -7,20 +7,24 @@ 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;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.core.common.annotation.Excel;
|
||||
import com.core.common.annotation.Excel.ColumnType;
|
||||
import com.core.common.annotation.Excel.Type;
|
||||
import com.core.common.annotation.Excels;
|
||||
import com.core.common.core.domain.BaseEntity;
|
||||
import com.core.common.xss.Xss;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户对象 sys_user
|
||||
*
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Data
|
||||
@@ -79,18 +83,23 @@ public class SysUser extends BaseEntity {
|
||||
/** 部门对象 */
|
||||
@Excels({@Excel(name = "部门名称", targetAttr = "deptName", type = Type.EXPORT),
|
||||
@Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)})
|
||||
@TableField(exist = false)
|
||||
private SysDept dept;
|
||||
|
||||
/** 角色对象 */
|
||||
@TableField(exist = false)
|
||||
private List<SysRole> roles;
|
||||
|
||||
/** 角色组 */
|
||||
@TableField(exist = false)
|
||||
private Long[] roleIds;
|
||||
|
||||
/** 岗位组 */
|
||||
@TableField(exist = false)
|
||||
private Long[] postIds;
|
||||
|
||||
/** 角色ID */
|
||||
@TableField(exist = false)
|
||||
private Long roleId;
|
||||
|
||||
/** 租户ID */
|
||||
@@ -99,6 +108,18 @@ public class SysUser extends BaseEntity {
|
||||
/** 删除标识 */
|
||||
private String deleteFlag;
|
||||
|
||||
/**
|
||||
* 科室id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@TableField(exist = false)
|
||||
private Long orgId;
|
||||
/**
|
||||
* 科室名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String orgName;
|
||||
|
||||
public SysUser() {
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,11 @@ public class LoginBody {
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
private Integer tenantId;
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
@@ -57,4 +62,12 @@ public class LoginBody {
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public Integer getTenantId() {
|
||||
return tenantId;
|
||||
}
|
||||
|
||||
public void setTenantId(Integer tenantId) {
|
||||
this.tenantId = tenantId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Set;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.core.common.core.domain.entity.SysUser;
|
||||
|
||||
@@ -78,11 +79,21 @@ public class LoginUser implements UserDetails {
|
||||
*/
|
||||
private Long orgId;
|
||||
|
||||
/**
|
||||
* 所属医院id
|
||||
*/
|
||||
private Long hospitalId;
|
||||
|
||||
/**
|
||||
* 参与者id
|
||||
*/
|
||||
private Long practitionerId;
|
||||
|
||||
/**
|
||||
* option JSON串
|
||||
*/
|
||||
private JSONObject optionJson;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*/
|
||||
|
||||
@@ -12,6 +12,10 @@ public class LoginUserExtend {
|
||||
* 机构/科室id
|
||||
*/
|
||||
private Long orgId;
|
||||
/**
|
||||
* 科室名称
|
||||
*/
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* 参与者id
|
||||
|
||||
@@ -256,6 +256,19 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断日期是否为未来时间
|
||||
*
|
||||
* @param date Date 类型的日期
|
||||
* @return 是/否
|
||||
*/
|
||||
public static boolean isFuture(Date date) {
|
||||
// 获取当前时间
|
||||
Date currentDate = Calendar.getInstance().getTime();
|
||||
// 检查传入的日期是否在当前时间之后
|
||||
return date.after(currentDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从身份证号码中提取生日
|
||||
*
|
||||
|
||||
@@ -110,7 +110,7 @@ public class HttpUtils {
|
||||
conn.setRequestProperty("connection", "Keep-Alive");
|
||||
conn.setRequestProperty("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64)");
|
||||
conn.setRequestProperty("Accept-Charset", "utf-8");
|
||||
conn.setRequestProperty("contentType", "utf-8");
|
||||
conn.setRequestProperty("contentType", "json");
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
out = new PrintWriter(conn.getOutputStream());
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.core.common.utils.http;
|
||||
|
||||
/**
|
||||
* 老系统http请求工具类
|
||||
*
|
||||
* @author SunJQ
|
||||
* @date 2024-12-30
|
||||
*/
|
||||
public class OldHisHttpUtils {
|
||||
public static String oldHisHttpPost() {
|
||||
|
||||
String s1 = HttpUtils.sendPost("http://localhost:8080/myareahisnyb/gfChargeRatio/gfsum", "");
|
||||
|
||||
System.out.println(s1);
|
||||
return s1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -92,14 +92,14 @@ public class MybatisPlusConfig {
|
||||
"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"));
|
||||
"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",
|
||||
"sys_operation_record"));
|
||||
|
||||
@Override
|
||||
public boolean ignoreTable(String tableName) {
|
||||
@@ -116,7 +116,23 @@ public class MybatisPlusConfig {
|
||||
* 获取当前租户 ID
|
||||
*/
|
||||
private Integer getCurrentTenantId() {
|
||||
// // 尝试从请求头中获取租户ID
|
||||
|
||||
// 首先尝试从线程局部变量中获取租户ID(适用于定时任务等场景)
|
||||
Integer threadLocalTenantId = TenantContext.getCurrentTenant();
|
||||
if (threadLocalTenantId != null) {
|
||||
return threadLocalTenantId;
|
||||
}
|
||||
|
||||
// 获取当前登录用户的租户ID(优先使用SecurityUtils中储存的LoginUser的租户ID)
|
||||
try {
|
||||
if (SecurityUtils.getAuthentication() != null) {
|
||||
return SecurityUtils.getLoginUser().getTenantId();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return 1; // 默认租户ID
|
||||
}
|
||||
|
||||
// 尝试从请求头中获取租户ID
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
|
||||
if (attributes != null) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
@@ -130,10 +146,7 @@ public class MybatisPlusConfig {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 获取当前登录用户的租户 ID
|
||||
if (SecurityUtils.getAuthentication() != null) {
|
||||
return SecurityUtils.getLoginUser().getTenantId();
|
||||
}
|
||||
return 0; // 默认租户ID
|
||||
|
||||
return 1; // 默认租户ID
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package com.core.framework.web.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
@@ -9,16 +12,18 @@ 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.alibaba.fastjson2.JSONObject;
|
||||
import com.core.common.constant.CacheConstants;
|
||||
import com.core.common.constant.Constants;
|
||||
import com.core.common.constant.UserConstants;
|
||||
import com.core.common.core.domain.R;
|
||||
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.enums.DeleteFlag;
|
||||
import com.core.common.enums.TenantStatus;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.exception.user.*;
|
||||
import com.core.common.utils.DateUtils;
|
||||
@@ -28,7 +33,9 @@ import com.core.common.utils.ip.IpUtils;
|
||||
import com.core.framework.manager.AsyncManager;
|
||||
import com.core.framework.manager.factory.AsyncFactory;
|
||||
import com.core.framework.security.context.AuthenticationContextHolder;
|
||||
import com.core.system.domain.SysTenant;
|
||||
import com.core.system.service.ISysConfigService;
|
||||
import com.core.system.service.ISysTenantService;
|
||||
import com.core.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
@@ -53,6 +60,9 @@ public class SysLoginService {
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@Autowired
|
||||
private ISysTenantService sysTenantService;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
@@ -60,11 +70,18 @@ public class SysLoginService {
|
||||
* @param password 密码
|
||||
* @param code 验证码
|
||||
* @param uuid 唯一标识
|
||||
* @param tenantId 租户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public String login(String username, String password, String code, String uuid) {
|
||||
public String login(String username, String password, String code, String uuid, Integer tenantId) {
|
||||
// 验证码校验
|
||||
validateCaptcha(username, code, uuid);
|
||||
// validateCaptcha(username, code, uuid);
|
||||
|
||||
// 租户校验
|
||||
validateTenant(username, tenantId);
|
||||
// 保存本次勾选租户
|
||||
redisCache.setCacheObject(CacheConstants.LOGIN_SELECTED_TENANT + username, tenantId);
|
||||
|
||||
// 登录前置校验
|
||||
loginPreCheck(username, password);
|
||||
// 用户验证
|
||||
@@ -91,29 +108,63 @@ public class SysLoginService {
|
||||
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS,
|
||||
MessageUtils.message("user.login.success")));
|
||||
LoginUser loginUser = (LoginUser)authentication.getPrincipal();
|
||||
|
||||
// -----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());
|
||||
// 设置登录用户信息
|
||||
this.setLoginUserInfo(loginUser, tenantId);
|
||||
// 生成token
|
||||
return tokenService.createToken(loginUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置登录用户信息
|
||||
*
|
||||
* @param loginUser 登录用户
|
||||
* @param tenantId 租户ID
|
||||
*/
|
||||
public void setLoginUserInfo(LoginUser loginUser, Integer tenantId) {
|
||||
// // 登录时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);
|
||||
// }
|
||||
// }
|
||||
// // 设置租户id
|
||||
// loginUser.setTenantId(tenantId);
|
||||
// 记录登录信息
|
||||
recordLoginInfo(loginUser.getUserId());
|
||||
// 设置登录用户的信息
|
||||
LoginUserExtend loginUserExtend = userService.getLoginUserExtend(loginUser.getUserId());
|
||||
if (loginUserExtend != null) {
|
||||
loginUser.setOrgId(loginUserExtend.getOrgId()); // 科室id
|
||||
loginUser.setPractitionerId(loginUserExtend.getPractitionerId()); // 参与者id
|
||||
loginUser.setHospitalId(userService.getHospitalIdByOrgId(loginUserExtend.getOrgId())); // 所属医院id
|
||||
// user
|
||||
loginUser.getUser().setOrgId(loginUserExtend.getOrgId()); // 科室id
|
||||
loginUser.getUser().setOrgName(loginUserExtend.getOrgName()); // 科室名称
|
||||
}
|
||||
|
||||
// 设置租户ID
|
||||
loginUser.getUser().setTenantId(tenantId);
|
||||
loginUser.setTenantId(tenantId);
|
||||
|
||||
// option集合
|
||||
List<Map<String, String>> optionList = userService.getOptionList(tenantId);
|
||||
if (optionList.isEmpty()) {
|
||||
throw new IllegalArgumentException("未匹配到option信息");
|
||||
}
|
||||
JSONObject optionJson = new JSONObject();
|
||||
for (Map<String, String> map : optionList) {
|
||||
String key = map.get("optionkey");
|
||||
String value = map.get("optionvalue");
|
||||
optionJson.put(key, value);
|
||||
}
|
||||
loginUser.setOptionJson(optionJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验验证码
|
||||
*
|
||||
@@ -189,4 +240,35 @@ public class SysLoginService {
|
||||
sysUser.setLoginDate(DateUtils.getNowDate());
|
||||
userService.updateUserProfile(sysUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验租户
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param tenantId 租户ID
|
||||
*/
|
||||
private void validateTenant(String username, Integer tenantId) {
|
||||
// 租户非空校验
|
||||
if (tenantId == null) {
|
||||
throw new ServiceException("请指定所属医院");
|
||||
}
|
||||
// 查询用户绑定的租户列表
|
||||
R<List<SysTenant>> bindTenantList = sysTenantService.getUserBindTenantList(username);
|
||||
// 租户合法性校验
|
||||
Optional<SysTenant> currentTenantOptional =
|
||||
bindTenantList.getData().stream().filter(e -> tenantId.equals(e.getId())).findFirst();
|
||||
if (currentTenantOptional.isEmpty()) {
|
||||
throw new ServiceException("所属医院非法");
|
||||
}
|
||||
// 租户状态校验
|
||||
SysTenant currentTenant = currentTenantOptional.get();
|
||||
if (TenantStatus.DISABLE.getCode().equals(currentTenant.getStatus())) {
|
||||
throw new ServiceException("所属医院停用");
|
||||
}
|
||||
// 租户删除状态校验
|
||||
if (DeleteFlag.DELETED.getCode().equals(currentTenant.getDeleteFlag())) {
|
||||
throw new ServiceException("所属医院不存在");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,9 @@ public class GenUtils {
|
||||
case "doc":
|
||||
genTable.setPackageName(GenConfig.getPackageName() + ".document");
|
||||
break;
|
||||
case "yb":
|
||||
genTable.setPackageName(GenConfig.getPackageName() + ".ybcatalog");
|
||||
break;
|
||||
default:
|
||||
genTable.setPackageName(GenConfig.getPackageName() + ".errortable");
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@ gen:
|
||||
# 自动去除表前缀,默认是false
|
||||
autoRemovePre: true
|
||||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
|
||||
tablePrefix: cod_,adm_,cli_,dia_,med_,wor_,fin_,def_,doc_
|
||||
tablePrefix: cod_,adm_,cli_,dia_,med_,wor_,fin_,def_,doc_,yb_
|
||||
@@ -1,154 +0,0 @@
|
||||
package com.core.quartz.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.annotation.Log;
|
||||
import com.core.common.constant.Constants;
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.page.TableDataInfo;
|
||||
import com.core.common.enums.BusinessType;
|
||||
import com.core.common.exception.job.TaskException;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.poi.ExcelUtil;
|
||||
import com.core.quartz.domain.SysJob;
|
||||
import com.core.quartz.service.ISysJobService;
|
||||
import com.core.quartz.util.CronUtils;
|
||||
import com.core.quartz.util.ScheduleUtils;
|
||||
|
||||
/**
|
||||
* 调度任务信息操作处理
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/job")
|
||||
public class SysJobController extends BaseController {
|
||||
@Autowired
|
||||
private ISysJobService jobService;
|
||||
|
||||
/**
|
||||
* 查询定时任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysJob sysJob) {
|
||||
startPage();
|
||||
List<SysJob> list = jobService.selectJobList(sysJob);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出定时任务列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysJob sysJob) {
|
||||
List<SysJob> list = jobService.selectJobList(sysJob);
|
||||
ExcelUtil<SysJob> util = new ExcelUtil<SysJob>(SysJob.class);
|
||||
util.exportExcel(response, list, "定时任务");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取定时任务详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:query')")
|
||||
@GetMapping(value = "/{jobId}")
|
||||
public AjaxResult getInfo(@PathVariable("jobId") Long jobId) {
|
||||
return success(jobService.selectJobById(jobId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增定时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:add')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SysJob job) throws SchedulerException, TaskException {
|
||||
if (!CronUtils.isValid(job.getCronExpression())) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,Cron表达式不正确");
|
||||
} else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(),
|
||||
new String[] {Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS})) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(),
|
||||
new String[] {Constants.HTTP, Constants.HTTPS})) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规");
|
||||
} else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) {
|
||||
return error("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
|
||||
}
|
||||
job.setCreateBy(getUsername());
|
||||
return toAjax(jobService.insertJob(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改定时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:edit')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException {
|
||||
if (!CronUtils.isValid(job.getCronExpression())) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,Cron表达式不正确");
|
||||
} else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_RMI)) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'rmi'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(),
|
||||
new String[] {Constants.LOOKUP_LDAP, Constants.LOOKUP_LDAPS})) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'ldap(s)'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(),
|
||||
new String[] {Constants.HTTP, Constants.HTTPS})) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不允许'http(s)'调用");
|
||||
} else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), Constants.JOB_ERROR_STR)) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规");
|
||||
} else if (!ScheduleUtils.whiteList(job.getInvokeTarget())) {
|
||||
return error("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
|
||||
}
|
||||
job.setUpdateBy(getUsername());
|
||||
return toAjax(jobService.updateJob(job));
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务状态修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException {
|
||||
SysJob newJob = jobService.selectJobById(job.getJobId());
|
||||
newJob.setStatus(job.getStatus());
|
||||
return toAjax(jobService.changeStatus(newJob));
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务立即执行一次
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:changeStatus')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/run")
|
||||
public AjaxResult run(@RequestBody SysJob job) throws SchedulerException {
|
||||
boolean result = jobService.run(job);
|
||||
return result ? success() : error("任务不存在或已过期!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除定时任务
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
||||
@Log(title = "定时任务", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{jobIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException {
|
||||
jobService.deleteJobByIds(jobIds);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
package com.core.quartz.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.annotation.Log;
|
||||
import com.core.common.core.controller.BaseController;
|
||||
import com.core.common.core.domain.AjaxResult;
|
||||
import com.core.common.core.page.TableDataInfo;
|
||||
import com.core.common.enums.BusinessType;
|
||||
import com.core.common.utils.poi.ExcelUtil;
|
||||
import com.core.quartz.domain.SysJobLog;
|
||||
import com.core.quartz.service.ISysJobLogService;
|
||||
|
||||
/**
|
||||
* 调度日志操作处理
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/jobLog")
|
||||
public class SysJobLogController extends BaseController {
|
||||
@Autowired
|
||||
private ISysJobLogService jobLogService;
|
||||
|
||||
/**
|
||||
* 查询定时任务调度日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysJobLog sysJobLog) {
|
||||
startPage();
|
||||
List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出定时任务调度日志列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:export')")
|
||||
@Log(title = "任务调度日志", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SysJobLog sysJobLog) {
|
||||
List<SysJobLog> list = jobLogService.selectJobLogList(sysJobLog);
|
||||
ExcelUtil<SysJobLog> util = new ExcelUtil<SysJobLog>(SysJobLog.class);
|
||||
util.exportExcel(response, list, "调度日志");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据调度编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:query')")
|
||||
@GetMapping(value = "/{jobLogId}")
|
||||
public AjaxResult getInfo(@PathVariable Long jobLogId) {
|
||||
return success(jobLogService.selectJobLogById(jobLogId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除定时任务调度日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
||||
@Log(title = "定时任务调度日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{jobLogIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] jobLogIds) {
|
||||
return toAjax(jobLogService.deleteJobLogByIds(jobLogIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空定时任务调度日志
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:job:remove')")
|
||||
@Log(title = "调度日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean() {
|
||||
jobLogService.cleanJobLog();
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package com.core.quartz.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.core.quartz.domain.SysJobLog;
|
||||
|
||||
/**
|
||||
* 定时任务调度日志信息信息 服务层
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public interface ISysJobLogService {
|
||||
/**
|
||||
* 获取quartz调度器日志的计划任务
|
||||
*
|
||||
* @param jobLog 调度日志信息
|
||||
* @return 调度任务日志集合
|
||||
*/
|
||||
public List<SysJobLog> selectJobLogList(SysJobLog jobLog);
|
||||
|
||||
/**
|
||||
* 通过调度任务日志ID查询调度信息
|
||||
*
|
||||
* @param jobLogId 调度任务日志ID
|
||||
* @return 调度任务日志对象信息
|
||||
*/
|
||||
public SysJobLog selectJobLogById(Long jobLogId);
|
||||
|
||||
/**
|
||||
* 新增任务日志
|
||||
*
|
||||
* @param jobLog 调度日志信息
|
||||
*/
|
||||
public void addJobLog(SysJobLog jobLog);
|
||||
|
||||
/**
|
||||
* 批量删除调度日志信息
|
||||
*
|
||||
* @param logIds 需要删除的日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobLogByIds(Long[] logIds);
|
||||
|
||||
/**
|
||||
* 删除任务日志
|
||||
*
|
||||
* @param jobId 调度日志ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJobLogById(Long jobId);
|
||||
|
||||
/**
|
||||
* 清空任务日志
|
||||
*/
|
||||
public void cleanJobLog();
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package com.core.quartz.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.quartz.SchedulerException;
|
||||
|
||||
import com.core.common.exception.job.TaskException;
|
||||
import com.core.quartz.domain.SysJob;
|
||||
|
||||
/**
|
||||
* 定时任务调度信息信息 服务层
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public interface ISysJobService {
|
||||
/**
|
||||
* 获取quartz调度器的计划任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 调度任务集合
|
||||
*/
|
||||
public List<SysJob> selectJobList(SysJob job);
|
||||
|
||||
/**
|
||||
* 通过调度任务ID查询调度信息
|
||||
*
|
||||
* @param jobId 调度任务ID
|
||||
* @return 调度任务对象信息
|
||||
*/
|
||||
public SysJob selectJobById(Long jobId);
|
||||
|
||||
/**
|
||||
* 暂停任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int pauseJob(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 恢复任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int resumeJob(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 删除任务后,所对应的trigger也将被删除
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteJob(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 批量删除调度信息
|
||||
*
|
||||
* @param jobIds 需要删除的任务ID
|
||||
* @return 结果
|
||||
*/
|
||||
public void deleteJobByIds(Long[] jobIds) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 任务调度状态修改
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int changeStatus(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 立即运行任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean run(SysJob job) throws SchedulerException;
|
||||
|
||||
/**
|
||||
* 新增任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertJob(SysJob job) throws SchedulerException, TaskException;
|
||||
|
||||
/**
|
||||
* 更新任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateJob(SysJob job) throws SchedulerException, TaskException;
|
||||
|
||||
/**
|
||||
* 校验cron表达式是否有效
|
||||
*
|
||||
* @param cronExpression 表达式
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean checkCronExpressionIsValid(String cronExpression);
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.core.quartz.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.core.quartz.domain.SysJobLog;
|
||||
import com.core.quartz.mapper.SysJobLogMapper;
|
||||
import com.core.quartz.service.ISysJobLogService;
|
||||
|
||||
/**
|
||||
* 定时任务调度日志信息 服务层
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Service
|
||||
public class SysJobLogServiceImpl implements ISysJobLogService {
|
||||
@Autowired
|
||||
private SysJobLogMapper jobLogMapper;
|
||||
|
||||
/**
|
||||
* 获取quartz调度器日志的计划任务
|
||||
*
|
||||
* @param jobLog 调度日志信息
|
||||
* @return 调度任务日志集合
|
||||
*/
|
||||
@Override
|
||||
public List<SysJobLog> selectJobLogList(SysJobLog jobLog) {
|
||||
return jobLogMapper.selectJobLogList(jobLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过调度任务日志ID查询调度信息
|
||||
*
|
||||
* @param jobLogId 调度任务日志ID
|
||||
* @return 调度任务日志对象信息
|
||||
*/
|
||||
@Override
|
||||
public SysJobLog selectJobLogById(Long jobLogId) {
|
||||
return jobLogMapper.selectJobLogById(jobLogId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务日志
|
||||
*
|
||||
* @param jobLog 调度日志信息
|
||||
*/
|
||||
@Override
|
||||
public void addJobLog(SysJobLog jobLog) {
|
||||
jobLogMapper.insertJobLog(jobLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除调度日志信息
|
||||
*
|
||||
* @param logIds 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteJobLogByIds(Long[] logIds) {
|
||||
return jobLogMapper.deleteJobLogByIds(logIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务日志
|
||||
*
|
||||
* @param jobId 调度日志ID
|
||||
*/
|
||||
@Override
|
||||
public int deleteJobLogById(Long jobId) {
|
||||
return jobLogMapper.deleteJobLogById(jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空任务日志
|
||||
*/
|
||||
@Override
|
||||
public void cleanJobLog() {
|
||||
jobLogMapper.cleanJobLog();
|
||||
}
|
||||
}
|
||||
@@ -1,238 +0,0 @@
|
||||
package com.core.quartz.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobKey;
|
||||
import org.quartz.Scheduler;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.core.common.constant.ScheduleConstants;
|
||||
import com.core.common.exception.job.TaskException;
|
||||
import com.core.quartz.domain.SysJob;
|
||||
import com.core.quartz.mapper.SysJobMapper;
|
||||
import com.core.quartz.service.ISysJobService;
|
||||
import com.core.quartz.util.CronUtils;
|
||||
import com.core.quartz.util.ScheduleUtils;
|
||||
|
||||
/**
|
||||
* 定时任务调度信息 服务层
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Service
|
||||
public class SysJobServiceImpl implements ISysJobService {
|
||||
@Autowired
|
||||
private Scheduler scheduler;
|
||||
|
||||
@Autowired
|
||||
private SysJobMapper jobMapper;
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化定时器 主要是防止手动修改数据库导致未同步到定时任务处理(注:不能手动修改数据库ID和任务组名,否则会导致脏数据)
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() throws SchedulerException, TaskException {
|
||||
scheduler.clear();
|
||||
List<SysJob> jobList = jobMapper.selectJobAll();
|
||||
for (SysJob job : jobList) {
|
||||
ScheduleUtils.createScheduleJob(scheduler, job);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取quartz调度器的计划任务列表
|
||||
*
|
||||
* @param job 调度信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysJob> selectJobList(SysJob job) {
|
||||
return jobMapper.selectJobList(job);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过调度任务ID查询调度信息
|
||||
*
|
||||
* @param jobId 调度任务ID
|
||||
* @return 调度任务对象信息
|
||||
*/
|
||||
@Override
|
||||
public SysJob selectJobById(Long jobId) {
|
||||
return jobMapper.selectJobById(jobId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 暂停任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int pauseJob(SysJob job) throws SchedulerException {
|
||||
Long jobId = job.getJobId();
|
||||
String jobGroup = job.getJobGroup();
|
||||
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
||||
int rows = jobMapper.updateJob(job);
|
||||
if (rows > 0) {
|
||||
scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup));
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int resumeJob(SysJob job) throws SchedulerException {
|
||||
Long jobId = job.getJobId();
|
||||
String jobGroup = job.getJobGroup();
|
||||
job.setStatus(ScheduleConstants.Status.NORMAL.getValue());
|
||||
int rows = jobMapper.updateJob(job);
|
||||
if (rows > 0) {
|
||||
scheduler.resumeJob(ScheduleUtils.getJobKey(jobId, jobGroup));
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务后,所对应的trigger也将被删除
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteJob(SysJob job) throws SchedulerException {
|
||||
Long jobId = job.getJobId();
|
||||
String jobGroup = job.getJobGroup();
|
||||
int rows = jobMapper.deleteJobById(jobId);
|
||||
if (rows > 0) {
|
||||
scheduler.deleteJob(ScheduleUtils.getJobKey(jobId, jobGroup));
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除调度信息
|
||||
*
|
||||
* @param jobIds 需要删除的任务ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteJobByIds(Long[] jobIds) throws SchedulerException {
|
||||
for (Long jobId : jobIds) {
|
||||
SysJob job = jobMapper.selectJobById(jobId);
|
||||
deleteJob(job);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务调度状态修改
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int changeStatus(SysJob job) throws SchedulerException {
|
||||
int rows = 0;
|
||||
String status = job.getStatus();
|
||||
if (ScheduleConstants.Status.NORMAL.getValue().equals(status)) {
|
||||
rows = resumeJob(job);
|
||||
} else if (ScheduleConstants.Status.PAUSE.getValue().equals(status)) {
|
||||
rows = pauseJob(job);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 立即运行任务
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean run(SysJob job) throws SchedulerException {
|
||||
boolean result = false;
|
||||
Long jobId = job.getJobId();
|
||||
String jobGroup = job.getJobGroup();
|
||||
SysJob properties = selectJobById(job.getJobId());
|
||||
// 参数
|
||||
JobDataMap dataMap = new JobDataMap();
|
||||
dataMap.put(ScheduleConstants.TASK_PROPERTIES, properties);
|
||||
JobKey jobKey = ScheduleUtils.getJobKey(jobId, jobGroup);
|
||||
if (scheduler.checkExists(jobKey)) {
|
||||
result = true;
|
||||
scheduler.triggerJob(jobKey, dataMap);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务
|
||||
*
|
||||
* @param job 调度信息 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertJob(SysJob job) throws SchedulerException, TaskException {
|
||||
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
||||
int rows = jobMapper.insertJob(job);
|
||||
if (rows > 0) {
|
||||
ScheduleUtils.createScheduleJob(scheduler, job);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新任务的时间表达式
|
||||
*
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateJob(SysJob job) throws SchedulerException, TaskException {
|
||||
SysJob properties = selectJobById(job.getJobId());
|
||||
int rows = jobMapper.updateJob(job);
|
||||
if (rows > 0) {
|
||||
updateSchedulerJob(job, properties.getJobGroup());
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新任务
|
||||
*
|
||||
* @param job 任务对象
|
||||
* @param jobGroup 任务组名
|
||||
*/
|
||||
public void updateSchedulerJob(SysJob job, String jobGroup) throws SchedulerException, TaskException {
|
||||
Long jobId = job.getJobId();
|
||||
// 判断是否存在
|
||||
JobKey jobKey = ScheduleUtils.getJobKey(jobId, jobGroup);
|
||||
if (scheduler.checkExists(jobKey)) {
|
||||
// 防止创建时存在数据问题 先移除,然后在执行创建操作
|
||||
scheduler.deleteJob(jobKey);
|
||||
}
|
||||
ScheduleUtils.createScheduleJob(scheduler, job);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验cron表达式是否有效
|
||||
*
|
||||
* @param cronExpression 表达式
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean checkCronExpressionIsValid(String cronExpression) {
|
||||
return CronUtils.isValid(cronExpression);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.core.quartz.task;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.core.common.utils.StringUtils;
|
||||
|
||||
/**
|
||||
* 定时任务调度测试
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Component("ryTask")
|
||||
public class RyTask {
|
||||
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) {
|
||||
System.out.println(StringUtils.format("执行多参方法: 字符串类型{},布尔类型{},长整型{},浮点型{},整形{}", s, b, l, d, i));
|
||||
}
|
||||
|
||||
public void ryParams(String params) {
|
||||
System.out.println("执行有参方法:" + params);
|
||||
}
|
||||
|
||||
public void ryNoParams() {
|
||||
System.out.println("执行无参方法");
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
package com.core.quartz.util;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.core.common.constant.Constants;
|
||||
import com.core.common.constant.ScheduleConstants;
|
||||
import com.core.common.utils.ExceptionUtil;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.core.common.utils.spring.SpringUtils;
|
||||
import com.core.quartz.domain.SysJob;
|
||||
import com.core.quartz.domain.SysJobLog;
|
||||
import com.core.quartz.service.ISysJobLogService;
|
||||
|
||||
/**
|
||||
* 抽象quartz调用
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public abstract class AbstractQuartzJob implements Job {
|
||||
private static final Logger log = LoggerFactory.getLogger(AbstractQuartzJob.class);
|
||||
|
||||
/**
|
||||
* 线程本地变量
|
||||
*/
|
||||
private static ThreadLocal<Date> threadLocal = new ThreadLocal<>();
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
SysJob sysJob = new SysJob();
|
||||
BeanUtils.copyBeanProp(sysJob, context.getMergedJobDataMap().get(ScheduleConstants.TASK_PROPERTIES));
|
||||
try {
|
||||
before(context, sysJob);
|
||||
if (sysJob != null) {
|
||||
doExecute(context, sysJob);
|
||||
}
|
||||
after(context, sysJob, null);
|
||||
} catch (Exception e) {
|
||||
log.error("任务执行异常 - :", e);
|
||||
after(context, sysJob, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行前
|
||||
*
|
||||
* @param context 工作执行上下文对象
|
||||
* @param sysJob 系统计划任务
|
||||
*/
|
||||
protected void before(JobExecutionContext context, SysJob sysJob) {
|
||||
threadLocal.set(new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行后
|
||||
*
|
||||
* @param context 工作执行上下文对象
|
||||
* @param sysJob 系统计划任务
|
||||
*/
|
||||
protected void after(JobExecutionContext context, SysJob sysJob, Exception e) {
|
||||
Date startTime = threadLocal.get();
|
||||
threadLocal.remove();
|
||||
|
||||
final SysJobLog sysJobLog = new SysJobLog();
|
||||
sysJobLog.setJobName(sysJob.getJobName());
|
||||
sysJobLog.setJobGroup(sysJob.getJobGroup());
|
||||
sysJobLog.setInvokeTarget(sysJob.getInvokeTarget());
|
||||
sysJobLog.setStartTime(startTime);
|
||||
sysJobLog.setStopTime(new Date());
|
||||
long runMs = sysJobLog.getStopTime().getTime() - sysJobLog.getStartTime().getTime();
|
||||
sysJobLog.setJobMessage(sysJobLog.getJobName() + " 总共耗时:" + runMs + "毫秒");
|
||||
if (e != null) {
|
||||
sysJobLog.setStatus(Constants.FAIL);
|
||||
String errorMsg = StringUtils.substring(ExceptionUtil.getExceptionMessage(e), 0, 2000);
|
||||
sysJobLog.setExceptionInfo(errorMsg);
|
||||
} else {
|
||||
sysJobLog.setStatus(Constants.SUCCESS);
|
||||
}
|
||||
|
||||
// 写入数据库当中
|
||||
SpringUtils.getBean(ISysJobLogService.class).addJobLog(sysJobLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行方法,由子类重载
|
||||
*
|
||||
* @param context 工作执行上下文对象
|
||||
* @param sysJob 系统计划任务
|
||||
* @throws Exception 执行过程中的异常
|
||||
*/
|
||||
protected abstract void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.core.quartz.util;
|
||||
|
||||
import org.quartz.DisallowConcurrentExecution;
|
||||
import org.quartz.JobExecutionContext;
|
||||
|
||||
import com.core.quartz.domain.SysJob;
|
||||
|
||||
/**
|
||||
* 定时任务处理(禁止并发执行)
|
||||
*
|
||||
* @author system
|
||||
*
|
||||
*/
|
||||
@DisallowConcurrentExecution
|
||||
public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob {
|
||||
@Override
|
||||
protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception {
|
||||
JobInvokeUtil.invokeMethod(sysJob);
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.core.quartz.util;
|
||||
|
||||
import org.quartz.JobExecutionContext;
|
||||
|
||||
import com.core.quartz.domain.SysJob;
|
||||
|
||||
/**
|
||||
* 定时任务处理(允许并发执行)
|
||||
*
|
||||
* @author system
|
||||
*
|
||||
*/
|
||||
public class QuartzJobExecution extends AbstractQuartzJob {
|
||||
@Override
|
||||
protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception {
|
||||
JobInvokeUtil.invokeMethod(sysJob);
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
package com.core.quartz.util;
|
||||
|
||||
import org.quartz.*;
|
||||
|
||||
import com.core.common.constant.Constants;
|
||||
import com.core.common.constant.ScheduleConstants;
|
||||
import com.core.common.exception.job.TaskException;
|
||||
import com.core.common.exception.job.TaskException.Code;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.spring.SpringUtils;
|
||||
import com.core.quartz.domain.SysJob;
|
||||
|
||||
/**
|
||||
* 定时任务工具类
|
||||
*
|
||||
* @author system
|
||||
*
|
||||
*/
|
||||
public class ScheduleUtils {
|
||||
/**
|
||||
* 得到quartz任务类
|
||||
*
|
||||
* @param sysJob 执行计划
|
||||
* @return 具体执行任务类
|
||||
*/
|
||||
private static Class<? extends Job> getQuartzJobClass(SysJob sysJob) {
|
||||
boolean isConcurrent = "0".equals(sysJob.getConcurrent());
|
||||
return isConcurrent ? QuartzJobExecution.class : QuartzDisallowConcurrentExecution.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建任务触发对象
|
||||
*/
|
||||
public static TriggerKey getTriggerKey(Long jobId, String jobGroup) {
|
||||
return TriggerKey.triggerKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建任务键对象
|
||||
*/
|
||||
public static JobKey getJobKey(Long jobId, String jobGroup) {
|
||||
return JobKey.jobKey(ScheduleConstants.TASK_CLASS_NAME + jobId, jobGroup);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建定时任务
|
||||
*/
|
||||
public static void createScheduleJob(Scheduler scheduler, SysJob job) throws SchedulerException, TaskException {
|
||||
Class<? extends Job> jobClass = getQuartzJobClass(job);
|
||||
// 构建job信息
|
||||
Long jobId = job.getJobId();
|
||||
String jobGroup = job.getJobGroup();
|
||||
JobDetail jobDetail = JobBuilder.newJob(jobClass).withIdentity(getJobKey(jobId, jobGroup)).build();
|
||||
|
||||
// 表达式调度构建器
|
||||
CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule(job.getCronExpression());
|
||||
cronScheduleBuilder = handleCronScheduleMisfirePolicy(job, cronScheduleBuilder);
|
||||
|
||||
// 按新的cronExpression表达式构建一个新的trigger
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(jobId, jobGroup))
|
||||
.withSchedule(cronScheduleBuilder).build();
|
||||
|
||||
// 放入参数,运行时的方法可以获取
|
||||
jobDetail.getJobDataMap().put(ScheduleConstants.TASK_PROPERTIES, job);
|
||||
|
||||
// 判断是否存在
|
||||
if (scheduler.checkExists(getJobKey(jobId, jobGroup))) {
|
||||
// 防止创建时存在数据问题 先移除,然后在执行创建操作
|
||||
scheduler.deleteJob(getJobKey(jobId, jobGroup));
|
||||
}
|
||||
|
||||
// 判断任务是否过期
|
||||
if (StringUtils.isNotNull(CronUtils.getNextExecution(job.getCronExpression()))) {
|
||||
// 执行调度任务
|
||||
scheduler.scheduleJob(jobDetail, trigger);
|
||||
}
|
||||
|
||||
// 暂停任务
|
||||
if (job.getStatus().equals(ScheduleConstants.Status.PAUSE.getValue())) {
|
||||
scheduler.pauseJob(ScheduleUtils.getJobKey(jobId, jobGroup));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置定时任务策略
|
||||
*/
|
||||
public static CronScheduleBuilder handleCronScheduleMisfirePolicy(SysJob job, CronScheduleBuilder cb)
|
||||
throws TaskException {
|
||||
switch (job.getMisfirePolicy()) {
|
||||
case ScheduleConstants.MISFIRE_DEFAULT:
|
||||
return cb;
|
||||
case ScheduleConstants.MISFIRE_IGNORE_MISFIRES:
|
||||
return cb.withMisfireHandlingInstructionIgnoreMisfires();
|
||||
case ScheduleConstants.MISFIRE_FIRE_AND_PROCEED:
|
||||
return cb.withMisfireHandlingInstructionFireAndProceed();
|
||||
case ScheduleConstants.MISFIRE_DO_NOTHING:
|
||||
return cb.withMisfireHandlingInstructionDoNothing();
|
||||
default:
|
||||
throw new TaskException(
|
||||
"The task misfire policy '" + job.getMisfirePolicy() + "' cannot be used in cron schedule tasks",
|
||||
Code.CONFIG_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查包名是否为白名单配置
|
||||
*
|
||||
* @param invokeTarget 目标字符串
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean whiteList(String invokeTarget) {
|
||||
String packageName = StringUtils.substringBefore(invokeTarget, "(");
|
||||
int count = StringUtils.countMatches(packageName, ".");
|
||||
if (count > 1) {
|
||||
return StringUtils.containsAnyIgnoreCase(invokeTarget, Constants.JOB_WHITELIST_STR);
|
||||
}
|
||||
Object obj = SpringUtils.getBean(StringUtils.split(invokeTarget, ".")[0]);
|
||||
String beanPackageName = obj.getClass().getPackage().getName();
|
||||
return StringUtils.containsAnyIgnoreCase(beanPackageName, Constants.JOB_WHITELIST_STR)
|
||||
&& !StringUtils.containsAnyIgnoreCase(beanPackageName, Constants.JOB_ERROR_STR);
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,6 @@
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>42.3.1</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -37,6 +37,16 @@ public interface SysDictDataMapper {
|
||||
*/
|
||||
public String selectDictLabel(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
|
||||
public SysDictData selectDictInfo(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
|
||||
|
||||
/**
|
||||
* 根据字典数据ID查询信息
|
||||
*
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
package com.core.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.core.common.core.domain.model.LoginUserExtend;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.core.common.core.domain.entity.SysUser;
|
||||
import com.core.common.core.domain.model.LoginUserExtend;
|
||||
|
||||
/**
|
||||
* 用户表 数据层
|
||||
*
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
public interface SysUserMapper {
|
||||
@Mapper
|
||||
public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
*
|
||||
* @param sysUser 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@@ -23,7 +27,7 @@ public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@@ -31,7 +35,7 @@ public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
@@ -39,7 +43,7 @@ public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@@ -47,7 +51,7 @@ public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
@@ -55,7 +59,7 @@ public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -63,7 +67,7 @@ public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -71,7 +75,7 @@ public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
* @return 结果
|
||||
@@ -80,7 +84,7 @@ public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
@@ -89,7 +93,7 @@ public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -97,7 +101,7 @@ public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -105,7 +109,7 @@ public interface SysUserMapper {
|
||||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param userName 用户名称
|
||||
* @return 结果
|
||||
*/
|
||||
@@ -134,4 +138,21 @@ public interface SysUserMapper {
|
||||
* @return 扩展属性
|
||||
*/
|
||||
LoginUserExtend getLoginUserExtend(@Param("userId") Long userId);
|
||||
|
||||
/**
|
||||
* 通过科室id获取医院id
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 医院id
|
||||
*/
|
||||
Long getHospitalIdByOrgId(@Param("orgId") Long orgId);
|
||||
|
||||
/**
|
||||
* 查询 option集合
|
||||
*
|
||||
* @param tenantId 租户id
|
||||
* @return option集合
|
||||
*/
|
||||
List<Map<String, String>> getOptionList(@Param("tenantId") Integer tenantId);
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,15 @@ public interface ISysDictDataService {
|
||||
*/
|
||||
public String selectDictLabel(String dictType, String dictValue);
|
||||
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
public SysDictData selectDictInfo(String dictType, String dictValue);
|
||||
|
||||
/**
|
||||
* 根据字典数据ID查询信息
|
||||
*
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.core.system.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.core.common.core.domain.entity.SysUser;
|
||||
import com.core.common.core.domain.model.LoginUserExtend;
|
||||
@@ -212,4 +214,20 @@ public interface ISysUserService {
|
||||
* @return 扩展属性
|
||||
*/
|
||||
LoginUserExtend getLoginUserExtend(Long userId);
|
||||
|
||||
/**
|
||||
* 通过科室id获取医院id
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 医院id
|
||||
*/
|
||||
Long getHospitalIdByOrgId(Long orgId);
|
||||
|
||||
/**
|
||||
* 查询 option集合
|
||||
*
|
||||
* @param tenantId 租户id
|
||||
* @return option集合
|
||||
*/
|
||||
List<Map<String,String>> getOptionList(Integer tenantId);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,17 @@ public class SysDictDataServiceImpl implements ISysDictDataService {
|
||||
public String selectDictLabel(String dictType, String dictValue) {
|
||||
return dictDataMapper.selectDictLabel(dictType, dictValue);
|
||||
}
|
||||
/**
|
||||
* 根据字典类型和字典键值查询字典数据信息
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @param dictValue 字典键值
|
||||
* @return 字典标签
|
||||
*/
|
||||
@Override
|
||||
public SysDictData selectDictInfo(String dictType, String dictValue) {
|
||||
return dictDataMapper.selectDictInfo(dictType, dictValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典数据ID查询信息
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.core.system.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.validation.Validator;
|
||||
@@ -497,4 +499,26 @@ public class SysUserServiceImpl implements ISysUserService {
|
||||
return userMapper.getLoginUserExtend(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过科室id获取医院id
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 医院id
|
||||
*/
|
||||
@Override
|
||||
public Long getHospitalIdByOrgId(Long orgId){
|
||||
return userMapper.getHospitalIdByOrgId(orgId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 option集合
|
||||
*
|
||||
* @param tenantId 租户id
|
||||
* @return option集合
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String,String>> getOptionList(Integer tenantId){
|
||||
return userMapper.getOptionList(tenantId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,6 +64,12 @@
|
||||
and dict_value = #{dictValue}
|
||||
</select>
|
||||
|
||||
<select id="selectDictInfo" parameterType="String" resultMap="SysDictDataResult">
|
||||
<include refid="selectDictDataVo"/>
|
||||
where dict_type = #{dictType}
|
||||
and dict_value = #{dictValue}
|
||||
</select>
|
||||
|
||||
<select id="selectDictDataById" parameterType="Long" resultMap="SysDictDataResult">
|
||||
<include refid="selectDictDataVo"/>
|
||||
where dict_code = #{dictCode}
|
||||
|
||||
@@ -267,10 +267,40 @@
|
||||
|
||||
<select id="getLoginUserExtend" resultType="com.core.common.core.domain.model.LoginUserExtend">
|
||||
SELECT T1.ID AS practitioner_id,
|
||||
T1.org_id AS org_id
|
||||
T1.org_id AS org_id,
|
||||
T2.NAME AS org_name
|
||||
FROM adm_practitioner AS T1
|
||||
LEFT JOIN adm_organization AS T2 ON T2.ID = T1.org_id
|
||||
WHERE T1.delete_flag = '0'
|
||||
AND T1.user_id = #{userId} LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getHospitalIdByOrgId" resultType="long">
|
||||
SELECT CASE
|
||||
WHEN
|
||||
ao.type_enum = 1 THEN
|
||||
ao.ID
|
||||
ELSE (SELECT parent.ID
|
||||
FROM adm_organization AS parent
|
||||
WHERE parent.bus_no = SUBSTRING(ao.bus_no FROM '^[^.]+') LIMIT 1 )
|
||||
END
|
||||
AS result_id
|
||||
FROM
|
||||
adm_organization AS ao
|
||||
WHERE
|
||||
ao.ID =
|
||||
#{orgId}
|
||||
</select>
|
||||
|
||||
<select id="getOptionList" resultType="map">
|
||||
SELECT
|
||||
option_key AS optionkey,
|
||||
option_value AS optionvalue
|
||||
FROM
|
||||
sys_option
|
||||
WHERE
|
||||
delete_flag = '0'
|
||||
AND tenant_id = #{tenantId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -16,6 +16,12 @@
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring 配置 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- 领域-->
|
||||
<dependency>
|
||||
@@ -30,11 +36,23 @@
|
||||
<artifactId>liteflow-spring-boot-starter</artifactId>
|
||||
<version>2.12.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- junit-->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>2.0.43</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -68,8 +86,8 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
<source>17</source>
|
||||
<target>17</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
@@ -3,9 +3,12 @@ package com.openhis;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import com.openhis.web.ybmanage.config.YbServiceConfig;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
@@ -15,6 +18,7 @@ import org.springframework.core.env.Environment;
|
||||
* @author system
|
||||
*/
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}, scanBasePackages = {"com.core", "com.openhis"})
|
||||
@EnableConfigurationProperties(YbServiceConfig.class)
|
||||
public class OpenHisApplication {
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.openhis.web.basedatamanage.appservice;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.LocationQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.LocationAddOrEditDto;
|
||||
import com.openhis.web.basedatamanage.dto.LocationPageParam;
|
||||
|
||||
/**
|
||||
* Location 应该服务类
|
||||
@@ -26,20 +28,47 @@ public interface ILocationAppService {
|
||||
*/
|
||||
R<?> getLocationById(Long locationId);
|
||||
|
||||
/**
|
||||
* 添加/编辑位置信息
|
||||
*
|
||||
* @param locationQueryDto 位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditInventoryReceipt(LocationQueryDto locationQueryDto);
|
||||
|
||||
/**
|
||||
* 删除位置信息
|
||||
*
|
||||
* @param locationId 位置信息id
|
||||
* @param busNo 位置信息编码
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> deleteLocation(Long locationId);
|
||||
R<?> deleteLocation(String busNo);
|
||||
|
||||
/**
|
||||
* 位置分页列表
|
||||
*
|
||||
* @param locationPageParam 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param searchKey 模糊查询条件
|
||||
* @param request 请求
|
||||
* @return 位置分页列表
|
||||
*/
|
||||
R<?> getLocationPage(LocationPageParam locationPageParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 新增位置信息
|
||||
*
|
||||
* @param locationAddOrEditDto 库房位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addLocation(LocationAddOrEditDto locationAddOrEditDto);
|
||||
|
||||
/**
|
||||
* 编辑位置信息
|
||||
*
|
||||
* @param locationAddOrEditDto 库房位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> editLocation(LocationAddOrEditDto locationAddOrEditDto);
|
||||
|
||||
/**
|
||||
* 位置初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> locationInit();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationDto;
|
||||
|
||||
/**
|
||||
* Organization 应该服务类
|
||||
@@ -18,7 +18,7 @@ public interface IOrganizationAppService {
|
||||
* @param request 请求数据
|
||||
* @return 机构树分页列表
|
||||
*/
|
||||
Page<OrganizationQueryDto> getOrganizationTree(Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 机构信息详情
|
||||
@@ -31,10 +31,10 @@ public interface IOrganizationAppService {
|
||||
/**
|
||||
* 添加/编辑机构信息
|
||||
*
|
||||
* @param organizationQueryDto 机构信息
|
||||
* @param organizationDto 机构信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> addOrEditOrganization(OrganizationQueryDto organizationQueryDto);
|
||||
R<?> addOrEditOrganization(OrganizationDto organizationDto);
|
||||
|
||||
/**
|
||||
* 机构信息
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.openhis.web.basedatamanage.dto.OrgLocQueryParam;
|
||||
* Organization 应该服务类
|
||||
*/
|
||||
public interface IOrganizationLocationAppService {
|
||||
|
||||
/**
|
||||
* 查询机构位置
|
||||
*
|
||||
@@ -18,16 +19,7 @@ public interface IOrganizationLocationAppService {
|
||||
* @param request 请求数据
|
||||
* @return 机构位置分页列表
|
||||
*/
|
||||
R<?> getOrgLocPage(OrgLocQueryParam orgLocQueryParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 机构位置信息详情
|
||||
*
|
||||
* @param orgLocId 机构位置信息id
|
||||
* @return 机构位置信息详情
|
||||
*/
|
||||
R<?> getOrgLocById(Long orgLocId);
|
||||
R<?> getOrgLocPage(OrgLocQueryParam orgLocQueryParam, Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 添加/编辑机构位置信息
|
||||
@@ -45,4 +37,18 @@ public interface IOrganizationLocationAppService {
|
||||
*/
|
||||
R<?> deleteOrgLoc(Long orgLocId);
|
||||
|
||||
/**
|
||||
* 机构位置关系初始化
|
||||
*
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> organizationLocationInit();
|
||||
|
||||
/**
|
||||
* 根据类型查询药房/药库
|
||||
*
|
||||
* @param locationForm 查询字段
|
||||
* @return 机构位置关系分页列表
|
||||
*/
|
||||
R<?> getLocationListByForm(Integer locationForm);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,11 @@ package com.openhis.web.basedatamanage.appservice;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.dto.SelectableOrgDto;
|
||||
import com.openhis.web.basedatamanage.dto.UserAndPractitionerDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 参与者 应该服务类
|
||||
*/
|
||||
@@ -45,4 +48,19 @@ public interface IPractitionerAppService {
|
||||
*/
|
||||
R<?> delUserPractitioner(Long userId);
|
||||
|
||||
/**
|
||||
* 查询可选择切换科室集合
|
||||
*
|
||||
* @return 可选择切换科室集合
|
||||
*/
|
||||
List<SelectableOrgDto> getSelectableOrgList();
|
||||
|
||||
/**
|
||||
* 切换科室
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> switchOrg(Long orgId);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,32 +4,206 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
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.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
import com.core.common.utils.ChineseConvertUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.mapper.LocationMapper;
|
||||
import com.openhis.administration.service.ILocationService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.LocationBedStatus;
|
||||
import com.openhis.common.enums.LocationForm;
|
||||
import com.openhis.common.enums.LocationMode;
|
||||
import com.openhis.common.enums.LocationStatus;
|
||||
import com.openhis.common.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.ILocationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.LocationQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.*;
|
||||
|
||||
@Service
|
||||
public class LocationAppServiceImpl implements ILocationAppService {
|
||||
|
||||
@Resource
|
||||
ILocationService locationService;
|
||||
private ILocationService locationService;
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Resource
|
||||
private LocationMapper locationMapper;
|
||||
|
||||
/**
|
||||
* 位置初始化
|
||||
*
|
||||
* @return 初始化信息
|
||||
*/
|
||||
@Override
|
||||
public R<?> locationInit() {
|
||||
LocationInitDto initDto = new LocationInitDto();
|
||||
// 位置状态
|
||||
List<LocationInitDto.locationStatusOption> locationStatusOptions = new ArrayList<>();
|
||||
locationStatusOptions.add(new LocationInitDto.locationStatusOption(LocationStatus.ACTIVE.getValue(),
|
||||
LocationStatus.ACTIVE.getInfo()));
|
||||
locationStatusOptions.add(new LocationInitDto.locationStatusOption(LocationStatus.INACTIVE.getValue(),
|
||||
LocationStatus.INACTIVE.getInfo()));
|
||||
initDto.setLocationStatusOptions(locationStatusOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置信息详情
|
||||
*
|
||||
* @param locationId 位置信息id
|
||||
* @return 位置信息详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getLocationById(Long locationId) {
|
||||
LocationInfoDto locationInfoDto = new LocationInfoDto();
|
||||
BeanUtils.copyProperties(locationService.getById(locationId), locationInfoDto);
|
||||
// 位置类型
|
||||
locationInfoDto
|
||||
.setFormEnum_enumText(EnumUtils.getInfoByValue(LocationForm.class, locationInfoDto.getFormEnum()));
|
||||
// 使用状态
|
||||
locationInfoDto.setOperationalEnum_enumText(
|
||||
EnumUtils.getInfoByValue(LocationOperational.class, locationInfoDto.getOperationalEnum()));
|
||||
// 启用停用
|
||||
locationInfoDto
|
||||
.setStatusEnum_enumText(EnumUtils.getInfoByValue(LocationStatus.class, locationInfoDto.getStatusEnum()));
|
||||
return R.ok(locationInfoDto,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"位置信息查询"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除位置信息
|
||||
*
|
||||
* @param busNo 位置信息编码
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteLocation(String busNo) {
|
||||
// 删除位置信息(连同子集)
|
||||
boolean result =
|
||||
locationService.remove(new LambdaQueryWrapper<Location>().likeRight(Location::getBusNo, busNo));
|
||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"位置信息删除"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, new Object[] {"位置信息删除"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置分页列表
|
||||
*
|
||||
* @param locationPageParam 查询条件
|
||||
* @param searchKey 模糊查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求
|
||||
* @return 位置分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getLocationPage(LocationPageParam locationPageParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
//数据初始化,不使用eq条件拼接
|
||||
List<Integer> formList = locationPageParam.getLocationFormList();
|
||||
locationPageParam.setLocationFormList(null);
|
||||
String busNo = locationPageParam.getBusNo();
|
||||
locationPageParam.setBusNo(null);
|
||||
// 构建查询条件
|
||||
QueryWrapper<Location> queryWrapper = HisQueryUtils.buildQueryWrapper(locationPageParam, searchKey,
|
||||
new HashSet<>(Arrays.asList(CommonConstants.FieldName.Name, CommonConstants.FieldName.PyStr,
|
||||
CommonConstants.FieldName.WbStr)),
|
||||
request);
|
||||
// 根据不同的位置类型查询不同的位置分页信息(前端必传默认值)
|
||||
if (formList != null && !formList.isEmpty()) {
|
||||
queryWrapper.lambda().in(Location::getFormEnum, formList);
|
||||
}
|
||||
// 根据父节点编码查询子项
|
||||
queryWrapper.lambda().likeRight(StringUtils.isNotNull(busNo), Location::getBusNo, busNo);
|
||||
if (locationPageParam.getFormEnum() != null) {
|
||||
queryWrapper.lambda().eq(Location::getFormEnum, locationPageParam.getFormEnum());
|
||||
}
|
||||
|
||||
// 查询位置分页列表
|
||||
Page<LocationInfoDto> locationPage =
|
||||
HisPageUtils.selectPage(locationMapper, queryWrapper, pageNo, pageSize, LocationInfoDto.class);
|
||||
locationPage.getRecords().forEach(e -> {
|
||||
// 位置类型
|
||||
e.setFormEnum_enumText(EnumUtils.getInfoByValue(LocationForm.class, e.getFormEnum()));
|
||||
// 使用状态
|
||||
e.setOperationalEnum_enumText(EnumUtils.getInfoByValue(LocationOperational.class, e.getOperationalEnum()));
|
||||
// 启用停用
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(LocationStatus.class, e.getStatusEnum()));
|
||||
});
|
||||
return R.ok(locationPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增位置信息
|
||||
*
|
||||
* @param locationAddOrEditDto 库房位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> addLocation(LocationAddOrEditDto locationAddOrEditDto) {
|
||||
|
||||
Location location = new Location();
|
||||
BeanUtils.copyProperties(locationAddOrEditDto, location);
|
||||
location.setFormEnum(Integer.valueOf(locationAddOrEditDto.getFormEnum()));
|
||||
// 拼音码
|
||||
location.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(locationAddOrEditDto.getName()));
|
||||
// 五笔码
|
||||
location.setWbStr(ChineseConvertUtils.toWBFirstLetter(locationAddOrEditDto.getName()));
|
||||
// 采番bus_no三位
|
||||
String code = assignSeqUtil.getSeq(AssignSeqEnum.LOCATION_BUS_NO.getPrefix(), 3);
|
||||
// 如果传了上级 把当前的code拼到后边
|
||||
if (StringUtils.isNotEmpty(location.getBusNo())) {
|
||||
location.setBusNo(String.format(CommonConstants.Common.MONTAGE_FORMAT, location.getBusNo(),
|
||||
CommonConstants.Common.POINT, code));
|
||||
} else {
|
||||
location.setBusNo(code);
|
||||
}
|
||||
boolean result = locationService.addLocation(location);
|
||||
if (result) {
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"库房"}));
|
||||
}
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑位置信息
|
||||
*
|
||||
* @param locationAddOrEditDto 库房位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> editLocation(LocationAddOrEditDto locationAddOrEditDto) {
|
||||
Location location = new Location();
|
||||
BeanUtils.copyProperties(locationAddOrEditDto, location);
|
||||
// 拼音码
|
||||
location.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(locationAddOrEditDto.getName()));
|
||||
// 五笔码
|
||||
location.setWbStr(ChineseConvertUtils.toWBFirstLetter(locationAddOrEditDto.getName()));
|
||||
boolean result = locationService.updateLocation(location);
|
||||
if (result) {
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"库房"}));
|
||||
}
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置分页列表-树型
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 位置分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getLocationTree(Integer formKey, Integer pageNo, Integer pageSize) {
|
||||
|
||||
@@ -42,8 +216,8 @@ public class LocationAppServiceImpl implements ILocationAppService {
|
||||
Page<Location> page = locationService.page(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
List<Location> locationList = page.getRecords();
|
||||
// 将位置列表转为树结构
|
||||
List<LocationQueryDto> locationTree = buildTree(locationList);
|
||||
Page<LocationQueryDto> locationQueryDtoPage = new Page<>(pageNo, pageSize, page.getTotal());
|
||||
List<LocationDto> locationTree = buildTree(locationList);
|
||||
Page<LocationDto> locationQueryDtoPage = new Page<>(pageNo, pageSize, page.getTotal());
|
||||
locationQueryDtoPage.setRecords(locationTree);
|
||||
|
||||
locationQueryDtoPage.getRecords().forEach(e -> {
|
||||
@@ -67,18 +241,18 @@ public class LocationAppServiceImpl implements ILocationAppService {
|
||||
* @param records 位置列表
|
||||
* @return tree
|
||||
*/
|
||||
private List<LocationQueryDto> buildTree(List<Location> records) {
|
||||
private List<LocationDto> buildTree(List<Location> records) {
|
||||
// 按b_no的层级排序,确保父节点先处理
|
||||
List<Location> sortedRecords = records.stream()
|
||||
.sorted(Comparator.comparingInt(r -> r.getBusNo().split("\\.").length)).collect(Collectors.toList());
|
||||
|
||||
Map<String, LocationQueryDto> nodeMap = new HashMap<>();
|
||||
List<LocationQueryDto> tree = new ArrayList<>();
|
||||
Map<String, LocationDto> nodeMap = new HashMap<>();
|
||||
List<LocationDto> tree = new ArrayList<>();
|
||||
|
||||
for (Location record : sortedRecords) {
|
||||
String bNo = record.getBusNo();
|
||||
String[] parts = bNo.split("\\.");
|
||||
LocationQueryDto node = new LocationQueryDto();
|
||||
LocationDto node = new LocationDto();
|
||||
BeanUtils.copyProperties(record, node);
|
||||
// 将当前节点加入映射
|
||||
nodeMap.put(bNo, node);
|
||||
@@ -89,7 +263,7 @@ public class LocationAppServiceImpl implements ILocationAppService {
|
||||
} else {
|
||||
// 获取父节点的b_no(去掉最后一部分)
|
||||
String parentBNo = String.join(".", Arrays.copyOf(parts, parts.length - 1));
|
||||
LocationQueryDto parent = nodeMap.get(parentBNo);
|
||||
LocationDto parent = nodeMap.get(parentBNo);
|
||||
|
||||
if (parent != null) {
|
||||
parent.getChildren().add(node);
|
||||
@@ -102,65 +276,4 @@ public class LocationAppServiceImpl implements ILocationAppService {
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 位置信息详情
|
||||
*
|
||||
* @param locationId 位置信息id
|
||||
* @return 位置信息详情
|
||||
*/
|
||||
@Override
|
||||
public R<?> getLocationById(Long locationId) {
|
||||
Location location = locationService.getById(locationId);
|
||||
return R.ok(location, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"位置信息查询"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑位置信息
|
||||
*
|
||||
* @param locationQueryDto 位置信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> addOrEditInventoryReceipt(LocationQueryDto locationQueryDto) {
|
||||
|
||||
// 初始化位置信息
|
||||
Location location = new Location();
|
||||
BeanUtils.copyProperties(locationQueryDto, location);
|
||||
|
||||
if (locationQueryDto.getId() != null) {
|
||||
// 更新位置信息
|
||||
locationService.updateById(location);
|
||||
} else {
|
||||
// 插入位置信息
|
||||
location
|
||||
// 状态编码:有效
|
||||
.setStatusEnum(LocationStatus.ACTIVE.getValue())
|
||||
// 操作状态:空闲
|
||||
.setOperationalEnum(LocationBedStatus.U.getValue())
|
||||
// 模式编码:具体
|
||||
.setModeEnum(LocationMode.INSTANCE.getValue())
|
||||
// 模式编码:库房
|
||||
.setFormEnum(LocationForm.CABINET.getValue());
|
||||
locationService.save(location);
|
||||
}
|
||||
// 返回位置信息id
|
||||
return R.ok(location.getId(),
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"位置信息添加编辑"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除位置信息
|
||||
*
|
||||
* @param locationId 位置信息id
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> deleteLocation(Long locationId) {
|
||||
// 删除位置信息
|
||||
boolean result = locationService.removeById(locationId);
|
||||
return result ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"位置信息删除"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00006, new Object[] {"位置信息删除"}));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,34 +6,43 @@ import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.common.enums.AccountStatus;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
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.core.common.utils.StringUtils;
|
||||
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.AccountStatus;
|
||||
import com.openhis.common.enums.AssignSeqEnum;
|
||||
import com.openhis.common.enums.OrganizationClass;
|
||||
import com.openhis.common.enums.OrganizationType;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationDto;
|
||||
|
||||
@Service
|
||||
public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
|
||||
@Resource
|
||||
IOrganizationService organizationService;
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Resource
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Override
|
||||
public Page<OrganizationQueryDto> getOrganizationTree(Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
public Page<OrganizationDto> getOrganizationTree(Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
// 查询机构列表
|
||||
Page<Organization> page = organizationService.page(new Page<>(pageNo, pageSize));
|
||||
List<Organization> organizationList = page.getRecords();
|
||||
// 将机构列表转为树结构
|
||||
List<OrganizationQueryDto> orgTree = buildTree(organizationList);
|
||||
Page<OrganizationQueryDto> orgQueryDtoPage = new Page<>(pageNo, pageSize, page.getTotal());
|
||||
List<OrganizationDto> orgTree = buildTree(organizationList);
|
||||
Page<OrganizationDto> orgQueryDtoPage = new Page<>(pageNo, pageSize, page.getTotal());
|
||||
orgQueryDtoPage.setRecords(orgTree);
|
||||
return orgQueryDtoPage;
|
||||
}
|
||||
@@ -44,19 +53,22 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
* @param records 机构列表
|
||||
* @return tree
|
||||
*/
|
||||
private List<OrganizationQueryDto> buildTree(List<Organization> records) {
|
||||
private List<OrganizationDto> buildTree(List<Organization> records) {
|
||||
// 按b_no的层级排序,确保父节点先处理
|
||||
List<Organization> sortedRecords = records.stream()
|
||||
.sorted(Comparator.comparingInt(r -> r.getBusNo().split("\\.").length)).collect(Collectors.toList());
|
||||
|
||||
Map<String, OrganizationQueryDto> nodeMap = new HashMap<>();
|
||||
List<OrganizationQueryDto> tree = new ArrayList<>();
|
||||
Map<String, OrganizationDto> nodeMap = new HashMap<>();
|
||||
List<OrganizationDto> tree = new ArrayList<>();
|
||||
|
||||
for (Organization record : sortedRecords) {
|
||||
String bNo = record.getBusNo();
|
||||
String[] parts = bNo.split("\\.");
|
||||
OrganizationQueryDto node = new OrganizationQueryDto();
|
||||
OrganizationDto node = new OrganizationDto();
|
||||
BeanUtils.copyProperties(record, node);
|
||||
node.setTypeEnum_dictText(EnumUtils.getInfoByValue(OrganizationType.class, node.getTypeEnum()));
|
||||
node.setClassEnum_dictText(EnumUtils.getInfoByValue(OrganizationClass.class, node.getClassEnum()));
|
||||
node.setActiveFlag_dictText(EnumUtils.getInfoByValue(AccountStatus.class, node.getActiveFlag()));
|
||||
// 将当前节点加入映射
|
||||
nodeMap.put(bNo, node);
|
||||
|
||||
@@ -66,7 +78,7 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
} else {
|
||||
// 获取父节点的b_no(去掉最后一部分)
|
||||
String parentBNo = String.join(".", Arrays.copyOf(parts, parts.length - 1));
|
||||
OrganizationQueryDto parent = nodeMap.get(parentBNo);
|
||||
OrganizationDto parent = nodeMap.get(parentBNo);
|
||||
|
||||
if (parent != null) {
|
||||
parent.getChildren().add(node);
|
||||
@@ -94,27 +106,37 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
/**
|
||||
* 添加/编辑机构
|
||||
*
|
||||
* @param organizationQueryDto 机构信息
|
||||
* @param organizationDto 机构信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> addOrEditOrganization(OrganizationQueryDto organizationQueryDto) {
|
||||
public R<?> addOrEditOrganization(OrganizationDto organizationDto) {
|
||||
|
||||
// 新增organization信息
|
||||
Organization organization = new Organization();
|
||||
BeanUtils.copyProperties(organizationQueryDto, organization);
|
||||
BeanUtils.copyProperties(organizationDto, organization);
|
||||
|
||||
if (organizationQueryDto.getId() != null) {
|
||||
if (organizationDto.getId() != null) {
|
||||
// 更新机构信息
|
||||
organizationService.updateById(organization);
|
||||
} else {
|
||||
// 活动标识:有效
|
||||
organization.setActiveFlag(AccountStatus.ACTIVE.getValue());
|
||||
// 采番bus_no三位
|
||||
String code = assignSeqUtil.getSeq(AssignSeqEnum.ORGANIZATION_BUS_NO.getPrefix(), 3);
|
||||
// 如果传了上级科室 把当前的code拼到后边
|
||||
if (StringUtils.isNotEmpty(organization.getBusNo())) {
|
||||
organization.setBusNo(String.format(CommonConstants.Common.MONTAGE_FORMAT, organization.getBusNo(),
|
||||
CommonConstants.Common.POINT, code));
|
||||
} else {
|
||||
organization.setBusNo(code);
|
||||
}
|
||||
// 生成待发送的机构信息
|
||||
organizationService.save(organization);
|
||||
}
|
||||
// 返回机构id
|
||||
return R.ok(organization.getId(), MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息更新添加"}));
|
||||
return R.ok(organization.getId(),
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构信息更新添加"}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +155,8 @@ public class OrganizationAppServiceImpl implements IOrganizationAppService {
|
||||
|
||||
// 删除机构信息
|
||||
boolean deleteOrgSuccess = organizationService.removeByIds(orgIdList);
|
||||
return deleteOrgSuccess ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"机构信息"}))
|
||||
return deleteOrgSuccess
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"机构信息"}))
|
||||
: R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, new Object[] {"机构信息"}));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
package com.openhis.web.basedatamanage.appservice.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -13,50 +14,104 @@ 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.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.openhis.administration.domain.OrganizationLocation;
|
||||
import com.openhis.administration.mapper.OrganizationLocationMapper;
|
||||
import com.openhis.administration.service.ILocationService;
|
||||
import com.openhis.administration.service.IOrganizationLocationService;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.LocationForm;
|
||||
import com.openhis.common.enums.OrganizationType;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationLocationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocInitDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryParam;
|
||||
|
||||
@Service
|
||||
public class OrganizationLocationAppServiceImpl implements IOrganizationLocationAppService {
|
||||
|
||||
@Autowired
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Autowired
|
||||
private ILocationService locationService;
|
||||
|
||||
@Autowired
|
||||
private OrganizationLocationMapper organizationLocationMapper;
|
||||
|
||||
@Autowired
|
||||
private IOrganizationLocationService organizationLocationService;
|
||||
|
||||
/**
|
||||
* 机构位置关系初始化
|
||||
*
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOrgLocPage(OrgLocQueryParam orgLocQueryParam, String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
public R<?> organizationLocationInit() {
|
||||
OrgLocInitDto initDto = new OrgLocInitDto();
|
||||
// 位置类型
|
||||
List<OrgLocInitDto.locationFormOption> chargeItemStatusOptions = new ArrayList<>();
|
||||
chargeItemStatusOptions
|
||||
.add(new OrgLocInitDto.locationFormOption(LocationForm.CABINET.getValue(), LocationForm.CABINET.getInfo()));
|
||||
chargeItemStatusOptions.add(
|
||||
new OrgLocInitDto.locationFormOption(LocationForm.PHARMACY.getValue(), LocationForm.PHARMACY.getInfo()));
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<OrganizationLocation> queryWrapper = HisQueryUtils.buildQueryWrapper(orgLocQueryParam, searchKey,
|
||||
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), request);
|
||||
|
||||
// 查询机构位置分页列表
|
||||
Page<OrgLocQueryDto> orgLocQueryDtoPage =
|
||||
HisPageUtils.selectPage(organizationLocationMapper, queryWrapper, pageNo, pageSize, OrgLocQueryDto.class);
|
||||
|
||||
return R.ok(orgLocQueryDtoPage);
|
||||
// 获取科室下拉选列表
|
||||
List<Organization> organizationList = organizationService.getList(OrganizationType.DEPARTMENT.getValue(), null);
|
||||
List<OrgLocInitDto.departmentOption> organizationOptions = organizationList.stream()
|
||||
.map(organization -> new OrgLocInitDto.departmentOption(organization.getId(), organization.getName()))
|
||||
.collect(Collectors.toList());
|
||||
initDto.setLocationFormOptions(chargeItemStatusOptions).setDepartmentOptions(organizationOptions);
|
||||
return R.ok(initDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构位置信息详情
|
||||
* 根据类型查询药房/药库
|
||||
*
|
||||
* @param orgLocId 机构位置信息id
|
||||
* @return 机构位置信息详情
|
||||
* @param locationForm 查询字段
|
||||
* @return 机构位置关系分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOrgLocById(Long orgLocId) {
|
||||
OrganizationLocation orgLoc = organizationLocationService.getById(orgLocId);
|
||||
return R.ok(orgLoc, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"机构位置信息查询"}));
|
||||
public R<?> getLocationListByForm(Integer locationForm) {
|
||||
|
||||
OrgLocInitDto orgLocInitDto = new OrgLocInitDto();
|
||||
List<Location> locationList = new ArrayList<>();
|
||||
if (LocationForm.CABINET.getValue().equals(locationForm)) {
|
||||
locationList = locationService.getCabinetList();
|
||||
} else if (LocationForm.PHARMACY.getValue().equals(locationForm)) {
|
||||
locationList = locationService.getPharmacyList();
|
||||
}
|
||||
List<OrgLocInitDto.locationOption> locationOptions = locationList.stream()
|
||||
.map(location -> new OrgLocInitDto.locationOption(location.getId(), location.getName()))
|
||||
.collect(Collectors.toList());
|
||||
orgLocInitDto.setLocationOptions(locationOptions);
|
||||
return R.ok(orgLocInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构位置关系分页列表
|
||||
*
|
||||
* @param orgLocQueryParam 查询字段
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 机构位置关系分页列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getOrgLocPage(OrgLocQueryParam orgLocQueryParam, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<OrganizationLocation> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(orgLocQueryParam, null, null, request);
|
||||
// 查询机构位置分页列表
|
||||
Page<OrgLocQueryDto> orgLocQueryDtoPage =
|
||||
HisPageUtils.selectPage(organizationLocationMapper, queryWrapper, pageNo, pageSize, OrgLocQueryDto.class);
|
||||
return R.ok(orgLocQueryDtoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@ 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.core.system.service.ISysTenantService;
|
||||
import com.openhis.administration.domain.BizUser;
|
||||
import com.openhis.administration.domain.BizUserRole;
|
||||
import com.openhis.administration.domain.Practitioner;
|
||||
@@ -32,6 +33,7 @@ import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.web.basedatamanage.appservice.IPractitionerAppService;
|
||||
import com.openhis.web.basedatamanage.dto.PractitionerOrgAndLocationDto;
|
||||
import com.openhis.web.basedatamanage.dto.PractitionerRolesDto;
|
||||
import com.openhis.web.basedatamanage.dto.SelectableOrgDto;
|
||||
import com.openhis.web.basedatamanage.dto.UserAndPractitionerDto;
|
||||
import com.openhis.web.basedatamanage.mapper.PractitionerAppAppMapper;
|
||||
|
||||
@@ -53,6 +55,9 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
@Resource
|
||||
IPractitionerRoleService iPractitionerRoleService;
|
||||
|
||||
@Resource
|
||||
ISysTenantService sysTenantService;
|
||||
|
||||
/**
|
||||
* 新增用户及参与者
|
||||
*
|
||||
@@ -64,6 +69,7 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
String userName = userAndPractitionerDto.getUserName();
|
||||
String nickName = userAndPractitionerDto.getNickName();
|
||||
String phonenumber = userAndPractitionerDto.getPhonenumber();
|
||||
String pharPracCertNo = userAndPractitionerDto.getPharPracCertNo(); // 职业证件编号
|
||||
String sex = userAndPractitionerDto.getSex();
|
||||
// 账号唯一性
|
||||
long count = iBizUserService.count(new LambdaQueryWrapper<BizUser>().eq(BizUser::getUserName, userName));
|
||||
@@ -83,6 +89,10 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
iBizUserService.save(bizUser);
|
||||
Long userId =
|
||||
iBizUserService.getOne(new LambdaQueryWrapper<BizUser>().eq(BizUser::getUserName, userName)).getUserId(); // 用户id
|
||||
|
||||
// 初始化租户绑定
|
||||
sysTenantService.initTenantBind(userId);
|
||||
|
||||
// 新增 sys_user_role
|
||||
List<PractitionerRolesDto> practitionerRoleDtoList = userAndPractitionerDto.getPractitionerRolesDtoList();
|
||||
BizUserRole bizUserRole;
|
||||
@@ -108,6 +118,7 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
practitioner.setOrgId(responsibilityOrgDtoList.get(0).getOrgId()); // 机构id
|
||||
practitioner.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(nickName)); // 拼音码
|
||||
practitioner.setWbStr(ChineseConvertUtils.toWBFirstLetter(nickName)); // 五笔码
|
||||
practitioner.setPharPracCertNo(pharPracCertNo); // 职业证件编号
|
||||
iPractitionerService.save(practitioner);
|
||||
Long practitionerId = practitioner.getId();// 参与者id
|
||||
// 新增 adm_practitioner_role
|
||||
@@ -138,7 +149,38 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.LOCATION_ADMIN.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(manageLocationDto.getLocationId()); // 位置id
|
||||
practitionerRole.setOrgId(manageLocationDto.getOrgId()); // 机构id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 4.管理药房
|
||||
List<PractitionerOrgAndLocationDto> manageMedicationLocationDtoList =
|
||||
userAndPractitionerDto.getManageMedicationLocationDtoList();
|
||||
for (PractitionerOrgAndLocationDto practitionerOrgAndLocationDto : manageMedicationLocationDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.PHARMACIST.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(practitionerOrgAndLocationDto.getLocationId()); // 位置id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 5.护士-管理科室集合
|
||||
List<PractitionerOrgAndLocationDto> manageOrgDtoList = userAndPractitionerDto.getManageOrgDtoList();
|
||||
for (PractitionerOrgAndLocationDto manageOrgDto : manageOrgDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.NURSE.getCode());// 角色code
|
||||
practitionerRole.setOrgId(manageOrgDto.getOrgId()); // 机构id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 5.护士-管理病区集合
|
||||
List<PractitionerOrgAndLocationDto> manageWardLocationDtoList =
|
||||
userAndPractitionerDto.getManageWardLocationDtoList();
|
||||
for (PractitionerOrgAndLocationDto manageWardLocationDto : manageWardLocationDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.NURSE.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(manageWardLocationDto.getLocationId()); // 位置id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
|
||||
@@ -195,6 +237,26 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
&& PractitionerRoles.LOCATION_ADMIN.getCode().equals(e.getRoleCode()))
|
||||
.collect(Collectors.toList());
|
||||
record.setManageLocationDtoList(list4);
|
||||
// 匹配管理药房
|
||||
List<
|
||||
PractitionerOrgAndLocationDto> list5 =
|
||||
orgAndLocationDtoList.stream()
|
||||
.filter(e -> e.getPractitionerId().equals(record.getPractitionerId())
|
||||
&& PractitionerRoles.PHARMACIST.getCode().equals(e.getRoleCode()))
|
||||
.collect(Collectors.toList());
|
||||
record.setManageMedicationLocationDtoList(list5);
|
||||
// 匹配护士-管理科室
|
||||
List<PractitionerOrgAndLocationDto> list6 = orgAndLocationDtoList.stream()
|
||||
.filter(e -> e.getPractitionerId().equals(record.getPractitionerId())
|
||||
&& PractitionerRoles.NURSE.getCode().equals(e.getRoleCode()) && e.getOrgId() != null)
|
||||
.collect(Collectors.toList());
|
||||
record.setManageOrgDtoList(list6);
|
||||
// 匹配护士-管理病区
|
||||
List<PractitionerOrgAndLocationDto> list7 = orgAndLocationDtoList.stream()
|
||||
.filter(e -> e.getPractitionerId().equals(record.getPractitionerId())
|
||||
&& PractitionerRoles.NURSE.getCode().equals(e.getRoleCode()) && e.getLocationId() != null)
|
||||
.collect(Collectors.toList());
|
||||
record.setManageWardLocationDtoList(list7);
|
||||
}
|
||||
return userPractitionerPage;
|
||||
}
|
||||
@@ -213,6 +275,7 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
String nickName = userAndPractitionerDto.getNickName();
|
||||
String phonenumber = userAndPractitionerDto.getPhonenumber();
|
||||
String sex = userAndPractitionerDto.getSex();
|
||||
String pharPracCertNo = userAndPractitionerDto.getPharPracCertNo(); // 职业证件编号
|
||||
// 编辑 sys_user
|
||||
BizUser bizUser = new BizUser();
|
||||
bizUser.setNickName(nickName); // 昵称
|
||||
@@ -248,6 +311,7 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
practitioner.setOrgId(responsibilityOrgDtoList.get(0).getOrgId()); // 机构id
|
||||
practitioner.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(nickName)); // 拼音码
|
||||
practitioner.setWbStr(ChineseConvertUtils.toWBFirstLetter(nickName)); // 五笔码
|
||||
practitioner.setPharPracCertNo(pharPracCertNo);// 职业证件编号
|
||||
iPractitionerService.updateById(practitioner);
|
||||
// 先删除,再新增 adm_practitioner_role
|
||||
practitionerAppAppMapper.delPractitionerRole(practitionerId);
|
||||
@@ -278,7 +342,38 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.LOCATION_ADMIN.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(manageLocationDto.getLocationId()); // 位置id
|
||||
practitionerRole.setOrgId(manageLocationDto.getOrgId()); // 机构id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 4.管理药房
|
||||
List<PractitionerOrgAndLocationDto> manageMedicationLocationDtoList =
|
||||
userAndPractitionerDto.getManageMedicationLocationDtoList();
|
||||
for (PractitionerOrgAndLocationDto practitionerOrgAndLocationDto : manageMedicationLocationDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.PHARMACIST.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(practitionerOrgAndLocationDto.getLocationId()); // 位置id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 5.护士-管理科室集合
|
||||
List<PractitionerOrgAndLocationDto> manageOrgDtoList = userAndPractitionerDto.getManageOrgDtoList();
|
||||
for (PractitionerOrgAndLocationDto manageOrgDto : manageOrgDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.NURSE.getCode());// 角色code
|
||||
practitionerRole.setOrgId(manageOrgDto.getOrgId()); // 机构id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
// 5.护士-管理病区集合
|
||||
List<PractitionerOrgAndLocationDto> manageWardLocationDtoList =
|
||||
userAndPractitionerDto.getManageWardLocationDtoList();
|
||||
for (PractitionerOrgAndLocationDto manageWardLocationDto : manageWardLocationDtoList) {
|
||||
practitionerRole = new PractitionerRole();
|
||||
practitionerRole.setName(nickName); // 姓名
|
||||
practitionerRole.setPractitionerId(practitionerId); // 参与者id
|
||||
practitionerRole.setRoleCode(PractitionerRoles.NURSE.getCode()); // 角色code
|
||||
practitionerRole.setLocationId(manageWardLocationDto.getLocationId()); // 位置id
|
||||
iPractitionerRoleService.save(practitionerRole);
|
||||
}
|
||||
|
||||
@@ -308,4 +403,33 @@ public class PractitionerAppServiceImpl implements IPractitionerAppService {
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00005, new Object[] {"人员信息"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询可选择切换科室集合
|
||||
*
|
||||
* @return 可选择切换科室集合
|
||||
*/
|
||||
@Override
|
||||
public List<SelectableOrgDto> getSelectableOrgList() {
|
||||
// 参与者id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
return practitionerAppAppMapper.getSelectableOrgList(practitionerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换科室
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> switchOrg(Long orgId) {
|
||||
// 参与者id
|
||||
Long practitionerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
Practitioner practitioner = new Practitioner();
|
||||
practitioner.setId(practitionerId);
|
||||
practitioner.setOrgId(orgId);
|
||||
iPractitionerService.updateById(practitioner);
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"切换科室"}));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basedatamanage.appservice.ILocationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.LocationQueryDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 位置管理Controller业务层处理
|
||||
*
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base-data-manage/cabinet-location")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class CabinetLocationController {
|
||||
|
||||
private final ILocationAppService iLocationAppService;
|
||||
|
||||
/**
|
||||
* 位置分页列表
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 位置分页列表
|
||||
*/
|
||||
@GetMapping(value = "/cabinet-location")
|
||||
public R<?> getLocationPage(@RequestParam(required = false, value = "formKey", defaultValue = "") Integer formKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return iLocationAppService.getLocationTree(formKey, pageNo, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取库房位置需要编辑的信息
|
||||
*
|
||||
* @param locationId 库房位置信息Id
|
||||
*/
|
||||
@GetMapping("/cabinet-location-getById")
|
||||
public R<?> getLocationById(@Validated @RequestParam Long locationId) {
|
||||
return iLocationAppService.getLocationById(locationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑库房位置信息
|
||||
*
|
||||
* @param locationQueryDto 库房位置信息
|
||||
*/
|
||||
@PutMapping("/cabinet-location")
|
||||
public R<?> addOrEditLocation(@Validated @RequestBody LocationQueryDto locationQueryDto) {
|
||||
return iLocationAppService.addOrEditInventoryReceipt(locationQueryDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库房位置信息
|
||||
*
|
||||
* @param locationId 库房位置信息Id
|
||||
*/
|
||||
@DeleteMapping("/cabinet-location")
|
||||
public R<?> deleteLocation(@RequestParam Long locationId) {
|
||||
return iLocationAppService.deleteLocation(locationId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,9 +3,6 @@
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -15,10 +12,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.OrganizationType;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationInitDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrganizationQueryDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -39,13 +35,7 @@ public class OrganizationController {
|
||||
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
|
||||
List<OrganizationInitDto> initDto = new ArrayList<>();
|
||||
|
||||
for (OrganizationType type : OrganizationType.values()) {
|
||||
initDto.add(new OrganizationInitDto(type.getValue(), type.getCode()));
|
||||
}
|
||||
return R.ok(initDto);
|
||||
return R.ok(new OrganizationInitDto());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,9 +47,8 @@ public class OrganizationController {
|
||||
*/
|
||||
@GetMapping(value = "/organization")
|
||||
public R<?> getOrganizationPage(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
Page<OrganizationQueryDto> organizationTree =
|
||||
iOrganizationAppService.getOrganizationTree(pageNo, pageSize, request);
|
||||
@RequestParam(value = "pageSize", defaultValue = "100") Integer pageSize, HttpServletRequest request) {
|
||||
Page<OrganizationDto> organizationTree = iOrganizationAppService.getOrganizationTree(pageNo, pageSize, request);
|
||||
return R.ok(organizationTree,
|
||||
MessageUtils.createMessage(PromptMsgConstant.Common.M00009, new Object[] {"机构信息"}));
|
||||
}
|
||||
@@ -78,12 +67,12 @@ public class OrganizationController {
|
||||
/**
|
||||
* 添加/编辑机构信息
|
||||
*
|
||||
* @param organizationQueryDto 机构信息
|
||||
* @param organizationDto 机构信息
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PutMapping("/organization")
|
||||
public R<?> addOrEditInventoryReceipt(@Validated @RequestBody OrganizationQueryDto organizationQueryDto) {
|
||||
return iOrganizationAppService.addOrEditOrganization(organizationQueryDto);
|
||||
@PostMapping("/organization")
|
||||
public R<?> addOrEditInventoryReceipt(@Validated @RequestBody OrganizationDto organizationDto) {
|
||||
return iOrganizationAppService.addOrEditOrganization(organizationDto);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,13 +9,8 @@ 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.core.common.core.domain.R;
|
||||
import com.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.service.ILocationService;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.web.basedatamanage.appservice.IOrganizationLocationAppService;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocInitDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryDto;
|
||||
import com.openhis.web.basedatamanage.dto.OrgLocQueryParam;
|
||||
|
||||
@@ -35,34 +30,22 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class OrganizationLocationController {
|
||||
|
||||
@Autowired
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Autowired
|
||||
private ILocationService locationService;
|
||||
|
||||
@Autowired
|
||||
private IOrganizationLocationAppService iOrganizationLocationAppService;
|
||||
private IOrganizationLocationAppService organizationLocationAppService;
|
||||
|
||||
/**
|
||||
* 机构位置关系初始化
|
||||
*
|
||||
* @return 操作结果
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> init() {
|
||||
|
||||
OrgLocInitDto initDto = new OrgLocInitDto();
|
||||
// 设置科室列表
|
||||
initDto.setOrganization(organizationService.list())
|
||||
// 设置药库列表
|
||||
.setLocation(locationService.list(new LambdaQueryWrapper<Location>().in(Location::getFormEnum, 11)));
|
||||
return R.ok(initDto);
|
||||
return organizationLocationAppService.organizationLocationInit();
|
||||
}
|
||||
|
||||
/**
|
||||
* 机构位置关系分页列表
|
||||
*
|
||||
* @param orgLocQueryParam 查询字段
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
@@ -70,31 +53,30 @@ public class OrganizationLocationController {
|
||||
*/
|
||||
@GetMapping(value = "/org-loc")
|
||||
public R<?> getOrgLocPage(OrgLocQueryParam orgLocQueryParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return iOrganizationLocationAppService.getOrgLocPage(orgLocQueryParam, searchKey, pageNo, pageSize, request);
|
||||
|
||||
return organizationLocationAppService.getOrgLocPage(orgLocQueryParam, pageNo, pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机构位置关系需要编辑的信息
|
||||
* 根据类型查询药房/药库
|
||||
*
|
||||
* @param orgLocId 机构位置关系信息
|
||||
* @param locationForm 查询字段
|
||||
* @return 机构位置关系分页列表
|
||||
*/
|
||||
@GetMapping("/org-loc-getById")
|
||||
public R<?> getOrgLocById(@Validated @RequestParam Long orgLocId) {
|
||||
return iOrganizationLocationAppService.getOrgLocById(orgLocId);
|
||||
@GetMapping(value = "/loc-list")
|
||||
public R<?> getLocationListByForm(@RequestParam Integer locationForm) {
|
||||
return organizationLocationAppService.getLocationListByForm(locationForm);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑机构位置关系信息
|
||||
* 新增/编辑机构位置关系信息
|
||||
*
|
||||
* @param orgLocQueryDto 机构位置关系信息
|
||||
*/
|
||||
@PutMapping("/org-loc")
|
||||
@PostMapping("/org-loc")
|
||||
public R<?> addOrEditOrgLoc(@Validated @RequestBody OrgLocQueryDto orgLocQueryDto) {
|
||||
return iOrganizationLocationAppService.addOrEditOrgLoc(orgLocQueryDto);
|
||||
return organizationLocationAppService.addOrEditOrgLoc(orgLocQueryDto);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +86,7 @@ public class OrganizationLocationController {
|
||||
*/
|
||||
@DeleteMapping("/org-loc")
|
||||
public R<?> delOrgLoc(@RequestParam Long orgLocId) {
|
||||
return iOrganizationLocationAppService.deleteOrgLoc(orgLocId);
|
||||
return organizationLocationAppService.deleteOrgLoc(orgLocId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,4 +90,24 @@ public class PractitionerController {
|
||||
return practitionerAppService.delUserPractitioner(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询可选择切换科室集合
|
||||
*
|
||||
* @return 可选择切换科室集合
|
||||
*/
|
||||
@GetMapping(value = "/get-selectable-org-list")
|
||||
public R<?> getSelectableOrgList() {
|
||||
return R.ok(practitionerAppService.getSelectableOrgList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换科室
|
||||
*
|
||||
* @param orgId 科室id
|
||||
* @return 结果
|
||||
*/
|
||||
@PutMapping(value = "/switch-org")
|
||||
public R<?> switchOrg(@RequestParam Long orgId) {
|
||||
return practitionerAppService.switchOrg(orgId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class LocationQueryDto {
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 编码 */
|
||||
@NotBlank(message = "位置编码不能为空")
|
||||
private String busNo;
|
||||
|
||||
/** 名称 */
|
||||
@NotBlank(message = "位置名称不能为空")
|
||||
private String name;
|
||||
|
||||
/** 状态编码 */
|
||||
@NotNull(message = "状态编码不能为空")
|
||||
// private LocationStatus statusEnum;
|
||||
private Integer statusEnum;
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 操作状态 */
|
||||
@NotNull(message = "操作状态不能为空")
|
||||
// private LocationBedStatus operationalEnum;
|
||||
private Integer operationalEnum;
|
||||
private String operationalEnum_enumText;
|
||||
|
||||
/** 模式编码 */
|
||||
@NotNull(message = "模式编码不能为空")
|
||||
// private LocationMode modeEnum;
|
||||
private Integer modeEnum;
|
||||
private String modeEnum_enumText;
|
||||
|
||||
/** 模式编码 */
|
||||
private String typeCode;
|
||||
|
||||
/** 功能编码 */
|
||||
@NotBlank(message = "功能编码不能为空")
|
||||
private String typeJson;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔码 */
|
||||
private String wbStr;
|
||||
|
||||
/** 物理形式枚举 */
|
||||
@NotNull(message = "物理形式枚举不能为空")
|
||||
// private LocationForm formEnum;
|
||||
private Integer formEnum;
|
||||
private String formEnum_enumText;
|
||||
|
||||
/** 机构编码 */
|
||||
@NotNull(message = "机构编码不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long organizationId;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer displayOrder;
|
||||
|
||||
/** 子集合 */
|
||||
private List<LocationQueryDto> children = new ArrayList<>();
|
||||
|
||||
}
|
||||
@@ -3,11 +3,10 @@
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.openhis.administration.domain.Location;
|
||||
import com.openhis.administration.domain.Organization;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -20,11 +19,58 @@ import lombok.experimental.Accessors;
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OrgLocInitDto implements Serializable {
|
||||
public class OrgLocInitDto {
|
||||
|
||||
/** 机构科室信息 */
|
||||
private List<Organization> organization;
|
||||
/**
|
||||
* 收费状态
|
||||
*/
|
||||
private List<OrgLocInitDto.locationFormOption> locationFormOptions;
|
||||
|
||||
/** 位置药房信息 */
|
||||
private List<Location> location;
|
||||
/** 科室列表 */
|
||||
private List<OrgLocInitDto.departmentOption> departmentOptions;
|
||||
|
||||
/** 科室列表 */
|
||||
private List<OrgLocInitDto.locationOption> locationOptions;
|
||||
|
||||
/** 位置列表 */
|
||||
@Data
|
||||
public static class locationOption {
|
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long value;
|
||||
private String label;
|
||||
|
||||
public locationOption(Long value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
|
||||
/** 科室列表 */
|
||||
@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 locationFormOption {
|
||||
private Integer value;
|
||||
private String label;
|
||||
|
||||
public locationFormOption(Integer value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
import java.util.Timer;
|
||||
|
||||
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;
|
||||
@@ -25,11 +29,9 @@ public class OrgLocQueryDto {
|
||||
|
||||
/** 机构编码 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name")
|
||||
private Long organizationId;
|
||||
|
||||
/** 位置编码 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
private String organizationId_dictText;
|
||||
|
||||
/** 默认药房 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@@ -38,11 +40,26 @@ public class OrgLocQueryDto {
|
||||
/** 发放类别 */
|
||||
private String distributionCategoryCode;
|
||||
|
||||
/**
|
||||
* 诊疗定义id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long activityDefinitionId;
|
||||
|
||||
/**
|
||||
* 诊疗类型
|
||||
*/
|
||||
@Dict(dictCode = "activity_category_code")
|
||||
private String activityCategoryCode;
|
||||
private String activityCategoryCode_dictText;
|
||||
|
||||
/** 开始时间 */
|
||||
private Date startTime;
|
||||
//@JsonFormat(pattern = "HH:mm:ss")
|
||||
private Time startTime;
|
||||
|
||||
/** 结束时间 */
|
||||
private Date endTime;
|
||||
//@JsonFormat(pattern = "HH:mm:ss")
|
||||
private Time endTime;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer displayOrder;
|
||||
|
||||
@@ -18,7 +18,17 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = true)
|
||||
public class OrgLocQueryParam implements Serializable {
|
||||
|
||||
/** 活动标识 */
|
||||
private Integer activeFlag;
|
||||
/**
|
||||
* 科室id
|
||||
*/
|
||||
private Long organizationId;
|
||||
|
||||
/**
|
||||
* 药房id
|
||||
*/
|
||||
private Long defLocationId;
|
||||
|
||||
/** 发放类别 */
|
||||
private String distributionCategoryCode;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.openhis.common.enums.OrganizationClass;
|
||||
import com.openhis.common.enums.OrganizationType;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -16,11 +21,49 @@ import lombok.experimental.Accessors;
|
||||
@Accessors(chain = true)
|
||||
public class OrganizationInitDto {
|
||||
|
||||
private Integer value;
|
||||
private String code;
|
||||
private List<OrganizationTypeOption> organizationTypeOptions;
|
||||
|
||||
public OrganizationInitDto(Integer value, String code) {
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
private List<OrganizationClassOption> organizationClassOptions;
|
||||
|
||||
@Data
|
||||
public static class OrganizationTypeOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
|
||||
public OrganizationTypeOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class OrganizationClassOption {
|
||||
private Integer value;
|
||||
private String info;
|
||||
|
||||
public OrganizationClassOption(Integer value, String info) {
|
||||
this.value = value;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
||||
public OrganizationInitDto() {
|
||||
List<OrganizationTypeOption> organizationTypeOptionList = List.of(
|
||||
new OrganizationTypeOption(OrganizationType.HOSPITAL.getValue(), OrganizationType.HOSPITAL.getInfo()),
|
||||
new OrganizationTypeOption(OrganizationType.DEPARTMENT.getValue(), OrganizationType.DEPARTMENT.getInfo()));
|
||||
|
||||
List<OrganizationClassOption> organizationClassOptionList = List.of(
|
||||
new OrganizationClassOption(OrganizationClass.CLINIC.getValue(), OrganizationClass.CLINIC.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.INPATIENT.getValue(), OrganizationClass.INPATIENT.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.PHARMACY.getValue(), OrganizationClass.PHARMACY.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.STORAGE.getValue(), OrganizationClass.STORAGE.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.FIN.getValue(), OrganizationClass.FIN.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.NS.getValue(), OrganizationClass.NS.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.MANAGER.getValue(), OrganizationClass.MANAGER.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.SUPPORT.getValue(), OrganizationClass.SUPPORT.getInfo()),
|
||||
new OrganizationClassOption(OrganizationClass.OTHER.getValue(), OrganizationClass.OTHER.getInfo()));
|
||||
|
||||
this.organizationTypeOptions = organizationTypeOptionList;
|
||||
this.organizationClassOptions = organizationClassOptionList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright ©2023 CJB-CNIT Team. All rights reserved
|
||||
*/
|
||||
package com.openhis.web.basedatamanage.dto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.enums.OrganizationClass;
|
||||
import com.openhis.common.enums.OrganizationType;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class OrganizationQueryDto {
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 活动标识 */
|
||||
private Integer activeFlag;
|
||||
|
||||
/** 机构类型枚举 */
|
||||
private OrganizationType typeEnum;
|
||||
|
||||
/** 机构分类枚举 */
|
||||
private OrganizationClass classEnum;
|
||||
|
||||
/** 拼音码 */
|
||||
private String pyStr;
|
||||
|
||||
/** 五笔码 */
|
||||
private String wbStr;
|
||||
|
||||
/** 医保码 */
|
||||
private String ybNo;
|
||||
|
||||
/** 医保名称 */
|
||||
private String ybName;
|
||||
|
||||
/** 显示顺序 */
|
||||
private Integer displayOrder;
|
||||
|
||||
/** 子集合 */
|
||||
private List<OrganizationQueryDto> children = new ArrayList<>();
|
||||
}
|
||||
@@ -94,6 +94,11 @@ public class UserAndPractitionerDto {
|
||||
*/
|
||||
private String ybNo;
|
||||
|
||||
/**
|
||||
* 职业证件编号
|
||||
*/
|
||||
private String pharPracCertNo;
|
||||
|
||||
/**
|
||||
* 机构id
|
||||
*/
|
||||
@@ -122,4 +127,18 @@ public class UserAndPractitionerDto {
|
||||
*/
|
||||
private List<PractitionerOrgAndLocationDto> manageLocationDtoList;
|
||||
|
||||
/**
|
||||
* 管理药房集合
|
||||
*/
|
||||
private List<PractitionerOrgAndLocationDto> manageMedicationLocationDtoList;
|
||||
|
||||
/**
|
||||
* 护士-管理科室集合
|
||||
*/
|
||||
private List<PractitionerOrgAndLocationDto> manageOrgDtoList;
|
||||
|
||||
/**
|
||||
* 护士-管理病区集合
|
||||
*/
|
||||
private List<PractitionerOrgAndLocationDto> manageWardLocationDtoList;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.openhis.web.basedatamanage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.openhis.web.basedatamanage.dto.SelectableOrgDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -60,4 +61,12 @@ public interface PractitionerAppAppMapper {
|
||||
*/
|
||||
void delPractitionerRole(@Param("practitionerId") Long practitionerId);
|
||||
|
||||
/**
|
||||
* 查询可选择切换科室集合
|
||||
*
|
||||
* @param practitionerId 参与者id
|
||||
* @return 可选择切换科室集合
|
||||
*/
|
||||
List<SelectableOrgDto> getSelectableOrgList(@Param("practitionerId") Long practitionerId);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.stream.Stream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.yb.service.YbManager;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -21,6 +22,8 @@ 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.utils.StringUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.ChargeItemDefinition;
|
||||
import com.openhis.administration.domain.HealthcareService;
|
||||
@@ -29,6 +32,7 @@ import com.openhis.administration.service.IHealthcareServiceService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.AccountStatus;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.common.enums.Whether;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
@@ -52,6 +56,8 @@ public class HealthcareServiceController {
|
||||
|
||||
private final HealthcareServiceBizMapper healthcareServiceBizMapper;
|
||||
|
||||
private final YbManager ybService;
|
||||
|
||||
/**
|
||||
* 服务管理基础数据初始化
|
||||
*/
|
||||
@@ -89,9 +95,21 @@ public class HealthcareServiceController {
|
||||
HealthcareService healthcareServiceAfterAdd = iHealthcareServiceService.addHealthcareService(healthcareService);
|
||||
// 同时保存费用定价
|
||||
ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition();
|
||||
chargeItemDefinitionFormData.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
BeanUtils.copyProperties(chargeItemDefinitionFormData, chargeItemDefinition);
|
||||
boolean res = iChargeItemDefinitionService.addChargeItemDefinitionByHealthcareService(healthcareServiceAfterAdd,
|
||||
chargeItemDefinition);
|
||||
// 调用医保目录对照接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
// 医保开关打开并且,页面传了医保编码
|
||||
String ybNo = healthcareServiceFormData.getYbNo();
|
||||
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(ybNo)) {
|
||||
R<?> r = ybService.directoryCheck(CommonConstants.TableName.ADM_HEALTHCARE_SERVICE,
|
||||
healthcareServiceAfterAdd.getId());
|
||||
if (200 != r.getCode()) {
|
||||
throw new RuntimeException("医保目录对照接口异常");
|
||||
}
|
||||
}
|
||||
return res ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00001, new Object[] {"服务管理"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00010, null));
|
||||
}
|
||||
@@ -115,7 +133,8 @@ public class HealthcareServiceController {
|
||||
QueryWrapper<HealthcareServiceDto> queryWrapper = HisQueryUtils.buildQueryWrapper(healthcareServiceDto,
|
||||
searchKey, new HashSet<>(Arrays.asList("name", "charge_name")), request);
|
||||
IPage<HealthcareServiceDto> healthcareServicePage = healthcareServiceBizMapper.getHealthcareServicePage(
|
||||
new Page<>(pageNo, pageSize), CommonConstants.TableName.ADM_HEALTHCARE_SERVICE, queryWrapper);
|
||||
new Page<>(pageNo, pageSize), CommonConstants.TableName.ADM_HEALTHCARE_SERVICE,
|
||||
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, queryWrapper);
|
||||
healthcareServicePage.getRecords().forEach(e -> {
|
||||
// 活动标记-枚举类回显赋值
|
||||
e.setActiveFlag_enumText(EnumUtils.getInfoByValue(AccountStatus.class, e.getActiveFlag()));
|
||||
@@ -139,8 +158,9 @@ public class HealthcareServiceController {
|
||||
// 构建查询条件
|
||||
QueryWrapper<HealthcareServiceDto> queryWrapper =
|
||||
HisQueryUtils.buildQueryWrapper(healthcareServiceDto, null, null, null);
|
||||
IPage<HealthcareServiceDto> healthcareServicePage = healthcareServiceBizMapper
|
||||
.getHealthcareServicePage(new Page<>(1, 1), CommonConstants.TableName.ADM_HEALTHCARE_SERVICE, queryWrapper);
|
||||
IPage<HealthcareServiceDto> healthcareServicePage = healthcareServiceBizMapper.getHealthcareServicePage(
|
||||
new Page<>(1, 1), CommonConstants.TableName.ADM_HEALTHCARE_SERVICE,
|
||||
CommonConstants.TableName.WOR_ACTIVITY_DEFINITION, queryWrapper);
|
||||
HealthcareServiceDto healthcareServiceDtoDetail = healthcareServicePage.getRecords().get(0);
|
||||
// 枚举赋值
|
||||
healthcareServiceDtoDetail
|
||||
@@ -164,6 +184,17 @@ public class HealthcareServiceController {
|
||||
healthcareServiceAddOrUpdateParam.getHealthcareServiceFormData();
|
||||
HealthcareService healthcareService = new HealthcareService();
|
||||
BeanUtils.copyProperties(healthcareServiceFormData, healthcareService);
|
||||
// 调用医保目录对照接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
// 医保开关打开并且,页面传了医保编码
|
||||
String ybNo = healthcareServiceFormData.getYbNo();
|
||||
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(ybNo)) {
|
||||
R<?> r =
|
||||
ybService.directoryCheck(CommonConstants.TableName.ADM_HEALTHCARE_SERVICE, healthcareService.getId());
|
||||
if (200 != r.getCode()) {
|
||||
throw new RuntimeException("医保目录对照接口异常");
|
||||
}
|
||||
}
|
||||
boolean res = iHealthcareServiceService.updateHealthcareService(healthcareService);
|
||||
return res ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"服务管理"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ChargeItemDefinitionFormData {
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private PublicationStatus statusEnum;
|
||||
private Integer statusEnum;
|
||||
|
||||
/**
|
||||
* 机构ID
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.openhis.web.basicservice.dto;
|
||||
|
||||
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 lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 服务管理 Dto
|
||||
*/
|
||||
@@ -29,7 +30,7 @@ public class HealthcareServiceDto {
|
||||
/**
|
||||
* 提供部门ID
|
||||
*/
|
||||
@Dict(dictTable = "adm_organization",dictCode = "id",dictText = "name")
|
||||
@Dict(dictTable = "adm_organization", dictCode = "id", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long offeredOrgId;
|
||||
private String offeredOrgId_dictText;
|
||||
@@ -58,7 +59,7 @@ public class HealthcareServiceDto {
|
||||
/**
|
||||
* 地点
|
||||
*/
|
||||
@Dict(dictTable = "adm_location",dictCode = "id",dictText = "name")
|
||||
@Dict(dictTable = "adm_location", dictCode = "id", dictText = "name")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
private String locationId_dictText;
|
||||
@@ -105,4 +106,9 @@ public class HealthcareServiceDto {
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 诊疗费
|
||||
*/
|
||||
private BigDecimal activityPrice;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.openhis.web.basicservice.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 服务项目管理表单数据
|
||||
*
|
||||
@@ -51,7 +51,7 @@ public class HealthcareServiceFormData {
|
||||
/**
|
||||
* 地点
|
||||
*/
|
||||
@NotBlank(message = "地点不能为空")
|
||||
// @NotBlank(message = "地点不能为空")
|
||||
private Long locationId;
|
||||
|
||||
/**
|
||||
@@ -82,5 +82,7 @@ public class HealthcareServiceFormData {
|
||||
@NotBlank(message = "预约要求不能为空")
|
||||
private Integer appointmentRequiredFlag;
|
||||
|
||||
/** 医保编码 */
|
||||
private String ybNo;
|
||||
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public interface HealthcareServiceBizMapper {
|
||||
* @return 列表信息
|
||||
*/
|
||||
IPage<HealthcareServiceDto> getHealthcareServicePage(@Param("page") Page<HealthcareServiceDto> page,
|
||||
@Param("tableName") String tableName,
|
||||
@Param("tableName") String tableName, @Param("activityTableName") String activityTableName,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<HealthcareServiceDto> queryWrapper);
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageParam;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPrescriptionDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门诊收费 service
|
||||
@@ -35,7 +38,7 @@ public interface IOutpatientChargeAppService {
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
R<?> getEncounterPatientPrescription(Long encounterId);
|
||||
List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId);
|
||||
|
||||
/**
|
||||
* 医保转自费
|
||||
|
||||
@@ -9,6 +9,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.chargemanage.dto.EncounterPatientPageParam;
|
||||
import com.openhis.web.chargemanage.dto.RefundItemParam;
|
||||
|
||||
/**
|
||||
* 门诊退费 service
|
||||
@@ -29,10 +30,10 @@ public interface IOutpatientRefundAppService {
|
||||
/**
|
||||
* 根据账单退费
|
||||
*
|
||||
* @param paymentIdList 付费id列表
|
||||
* @param refundItemList 退费项目id列表
|
||||
* @return 操作结果
|
||||
*/
|
||||
R<?> refundPayment(List<Long> paymentIdList);
|
||||
R<?> refundPayment(List<RefundItemParam> refundItemList);
|
||||
|
||||
/**
|
||||
* 查询结算过的就诊患者分页列表
|
||||
@@ -53,4 +54,28 @@ public interface IOutpatientRefundAppService {
|
||||
* @return 初始化信息
|
||||
*/
|
||||
R<?> outpatientRefundInit();
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者的退费账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 退费账单列表
|
||||
*/
|
||||
R<?> getEncounterPatientRefund(Long encounterId);
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者因退费重新生成的账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 重新生成的账单列表
|
||||
*/
|
||||
R<?> getRegenerateCharge(Long encounterId);
|
||||
|
||||
/**
|
||||
* 校验是否可以退费(耗材/药品是否已退,诊疗是否取消执行)
|
||||
*
|
||||
* @param chargeItemIdList 收费项目id列表
|
||||
* @return 是否可退
|
||||
*/
|
||||
R<?> verifyRefundable(List<Long> chargeItemIdList);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.basicservice.dto.HealthcareServiceDto;
|
||||
import com.openhis.web.chargemanage.dto.*;
|
||||
import com.openhis.web.paymentmanage.dto.CancelRegPaymentDto;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 门诊挂号 应用Service
|
||||
@@ -25,26 +28,33 @@ public interface IOutpatientRegistrationAppService {
|
||||
|
||||
/**
|
||||
* 查询费用性质
|
||||
*
|
||||
*
|
||||
* @return 费用性质
|
||||
*/
|
||||
List<ContractMetadata> getContractMetadata();
|
||||
|
||||
/**
|
||||
* 根据位置id筛选医生
|
||||
*
|
||||
* @param locationId 位置ID
|
||||
* 查询门诊科室数据
|
||||
*
|
||||
* @return 门诊科室
|
||||
*/
|
||||
List<OrgMetadata> getOrgMetadata();
|
||||
|
||||
/**
|
||||
* 根据科室id筛选医生
|
||||
*
|
||||
* @param orgId 科室ID
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 筛选医生
|
||||
*/
|
||||
IPage<PractitionerMetadata> getPractitionerMetadataByLocationId(Long locationId, String searchKey, Integer pageNo,
|
||||
IPage<PractitionerMetadata> getPractitionerMetadataByLocationId(Long orgId, String searchKey, Integer pageNo,
|
||||
Integer pageSize);
|
||||
|
||||
/**
|
||||
* 根据机构id筛选服务项目
|
||||
*
|
||||
*
|
||||
* @param organizationId 机构id
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
@@ -55,12 +65,12 @@ public interface IOutpatientRegistrationAppService {
|
||||
Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 保存挂号
|
||||
*
|
||||
* @param outpatientRegistrationAddParam 就诊表单信息
|
||||
* 退号
|
||||
*
|
||||
* @param cancelRegPaymentDto 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> saveRegister(OutpatientRegistrationAddParam outpatientRegistrationAddParam);
|
||||
R<?> returnRegister(CancelRegPaymentDto cancelRegPaymentDto);
|
||||
|
||||
/**
|
||||
* 查询当日就诊数据
|
||||
@@ -70,6 +80,14 @@ public interface IOutpatientRegistrationAppService {
|
||||
* @param pageSize 每页多少条
|
||||
* @return 当日就诊数据
|
||||
*/
|
||||
IPage<CurrentDayEncounterDto> getCurrentDayEncounter(String searchKey, Integer pageNo, Integer pageSize);
|
||||
IPage<CurrentDayEncounterDto> getCurrentDayEncounter(String searchKey, Integer pageNo, Integer pageSize, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 取消挂号
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
R<?> cancelRegister(Long encounterId);
|
||||
|
||||
}
|
||||
|
||||
@@ -30,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.EncounterPatientPrescriptionDto;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientInitDto;
|
||||
import com.openhis.web.chargemanage.mapper.OutpatientChargeAppMapper;
|
||||
|
||||
@@ -98,7 +99,7 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
|
||||
// 收费状态枚举
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));
|
||||
// 计算年龄
|
||||
e.setAge(AgeCalculatorUtil.getAge(e.getBirthDate()));
|
||||
e.setAge(e.getBirthDate() != null ? AgeCalculatorUtil.getAge(e.getBirthDate()) : "");
|
||||
});
|
||||
return R.ok(encounterPatientPage);
|
||||
}
|
||||
@@ -110,11 +111,19 @@ public class OutpatientChargeAppServiceImpl implements IOutpatientChargeAppServi
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterPatientPrescription(Long encounterId) {
|
||||
return R.ok(outpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId,
|
||||
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(),
|
||||
ChargeItemContext.DEVICE.getValue(), ChargeItemStatus.PLANNED.getValue(),
|
||||
ChargeItemStatus.BILLABLE.getValue(), ChargeItemStatus.BILLED.getValue()));
|
||||
public List<EncounterPatientPrescriptionDto> getEncounterPatientPrescription(Long encounterId) {
|
||||
List<EncounterPatientPrescriptionDto> prescriptionDtoList =
|
||||
outpatientChargeAppMapper.selectEncounterPatientPrescription(encounterId,
|
||||
ChargeItemContext.ACTIVITY.getValue(), ChargeItemContext.MEDICATION.getValue(),
|
||||
ChargeItemContext.DEVICE.getValue(), ChargeItemContext.REGISTER.getValue(),
|
||||
ChargeItemStatus.PLANNED.getValue(), ChargeItemStatus.BILLABLE.getValue(),
|
||||
ChargeItemStatus.BILLED.getValue(), ChargeItemStatus.REFUNDING.getValue(),
|
||||
ChargeItemStatus.REFUNDED.getValue(), ChargeItemStatus.PART_REFUND.getValue());
|
||||
prescriptionDtoList.forEach(e -> {
|
||||
// 收费状态枚举
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getStatusEnum()));
|
||||
});
|
||||
return prescriptionDtoList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,17 +7,22 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
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.extension.plugins.pagination.Page;
|
||||
import com.core.common.core.domain.R;
|
||||
import com.core.common.exception.ServiceException;
|
||||
import com.core.common.utils.AgeCalculatorUtil;
|
||||
import com.core.common.utils.AssignSeqUtil;
|
||||
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;
|
||||
@@ -25,11 +30,18 @@ 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.domain.MedicationDispense;
|
||||
import com.openhis.medication.domain.MedicationRequest;
|
||||
import com.openhis.medication.service.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationRequestService;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientRefundAppService;
|
||||
import com.openhis.web.chargemanage.dto.*;
|
||||
import com.openhis.web.chargemanage.mapper.OutpatientRefundAppMapper;
|
||||
import com.openhis.workflow.domain.DeviceDispense;
|
||||
import com.openhis.workflow.domain.DeviceRequest;
|
||||
import com.openhis.workflow.domain.ServiceRequest;
|
||||
import com.openhis.workflow.service.IDeviceDispenseService;
|
||||
import com.openhis.workflow.service.IDeviceRequestService;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
|
||||
/**
|
||||
@@ -53,6 +65,12 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
|
||||
private IDeviceDispenseService deviceDispenseService;
|
||||
@Autowired
|
||||
private IServiceRequestService serviceRequestService;
|
||||
@Autowired
|
||||
private IMedicationRequestService medicationRequestService;
|
||||
@Autowired
|
||||
private IDeviceRequestService deviceRequestService;
|
||||
@Autowired
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
/**
|
||||
* 门诊退费页面初始化
|
||||
@@ -83,26 +101,154 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterPatientPayment(Long encounterId) {
|
||||
List<EncounterPatientPaymentDto> patientPaymentList =
|
||||
|
||||
// 患者账单信息列表
|
||||
List<EncounterPatientPaymentDto> encounterPatientPaymentList =
|
||||
outpatientRefundAppMapper.selectEncounterPatientPayment(encounterId, PaymentStatus.SUCCESS.getValue(),
|
||||
PaymentStatus.REFUND_ALL.getValue(), PaymentStatus.REFUND_PART.getValue());
|
||||
return R.ok(patientPaymentList);
|
||||
PaymentStatus.REFUND_PART.getValue(), PaymentStatus.REFUND_ALL.getValue());
|
||||
|
||||
// 获取付款id集合
|
||||
List<Long> paymentIdList =
|
||||
encounterPatientPaymentList.stream().map(EncounterPatientPaymentDto::getId).collect(Collectors.toList());
|
||||
if (paymentIdList.isEmpty()) {
|
||||
return R.ok(null);
|
||||
}
|
||||
// 根据付款id获取对应收费项目的id列表(费用项id)
|
||||
List<Long> chargeItemIdList = paymentReconciliationService.getChargeItemIdListByPayment(paymentIdList);
|
||||
|
||||
// 根据收费项目id列表查询费用项
|
||||
List<RefundItemDto> refundItemList = outpatientRefundAppMapper.selectRefundItem(chargeItemIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE);
|
||||
refundItemList.forEach(e -> {
|
||||
// 退费状态
|
||||
e.setRefundStatus_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getRefundStatus()));
|
||||
// 发放状态
|
||||
e.setDispenseStatus_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, e.getDispenseStatus()));
|
||||
// 执行状态
|
||||
e.setServiceStatus_enumText(EnumUtils.getInfoByValue(RequestStatus.class, e.getServiceStatus()));
|
||||
|
||||
});
|
||||
|
||||
return R.ok(refundItemList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据账单退费
|
||||
*
|
||||
* @param paymentIdList 付费id列表
|
||||
* @param refundItemList 退费项目id列表
|
||||
* @return 操作结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> refundPayment(List<Long> paymentIdList) {
|
||||
// todo:医生同意退费(审批流)
|
||||
// 根据支付id获取对应收费项目的id列表
|
||||
List<Long> chargeItemIdList = paymentReconciliationService.getChargeItemIdListByPayment(paymentIdList);
|
||||
public R<?> refundPayment(List<RefundItemParam> refundItemList) {
|
||||
|
||||
// 根据收费项目id列表查询退费项
|
||||
List<RefundItemDto> refundItemList = outpatientRefundAppMapper.selectRefundItem(chargeItemIdList,
|
||||
// 未退费用项,生成新的请求发放费用项
|
||||
List<RefundItemParam> creatList = new ArrayList<>();
|
||||
for (RefundItemParam param : refundItemList) {
|
||||
if (!param.getRefundFlg()) {
|
||||
// 未退费费用项list
|
||||
creatList.add(param);
|
||||
}
|
||||
}
|
||||
|
||||
if (!creatList.isEmpty()) {
|
||||
// 未退费费用项id集合
|
||||
List<Long> creatChargeItemIdList =
|
||||
creatList.stream().map(RefundItemParam::getChargeItemId).collect(Collectors.toList());
|
||||
// 根据费用项id查询费用项请求发放信息
|
||||
List<RefundItemDto> creatChargeItemList = outpatientRefundAppMapper.selectRefundItem(creatChargeItemIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE);
|
||||
|
||||
for (RefundItemDto creatdDto : creatChargeItemList) {
|
||||
|
||||
// 未退费用项,生成新的请求,发放,费用项
|
||||
if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(creatdDto.getServiceTable())) {
|
||||
// 药品请求查询
|
||||
MedicationRequest medicationRequest = medicationRequestService.getById(creatdDto.getRequestId());
|
||||
// 生成新的药品请求
|
||||
medicationRequest.setId(null); // 药品请求id
|
||||
medicationRequest.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 10)); // 药品请求编码
|
||||
medicationRequest.setPrescriptionNo(
|
||||
String.valueOf(new StringBuilder("C").append(creatdDto.getPrescriptionNo()))); // 处方号
|
||||
medicationRequestService.save(medicationRequest);
|
||||
|
||||
// 药品发放查询
|
||||
MedicationDispense medicationDispense =
|
||||
medicationDispenseService.getById(creatdDto.getDispenseId());
|
||||
// 生成新的药品发放
|
||||
medicationDispense.setId(null); // 药品发放id
|
||||
medicationDispense.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.MEDICATION_DIS_NO.getPrefix(), 10)); // 药品发放编码
|
||||
medicationDispense.setMedReqId(medicationRequest.getId()); // 药品请求id
|
||||
medicationDispenseService.save(medicationDispense);
|
||||
|
||||
// 费用项查询
|
||||
ChargeItem chargeItem = chargeItemService.getById(creatdDto.getChargeItemId());
|
||||
// 生成新的费用项
|
||||
chargeItem.setRefundId(chargeItem.getId());// 退费id
|
||||
chargeItem.setId(null); // 费用项id
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(medicationRequest.getBusNo())); // 编码
|
||||
chargeItem.setPrescriptionNo(
|
||||
String.valueOf(new StringBuilder("C").append(creatdDto.getPrescriptionNo()))); // 处方号
|
||||
chargeItem.setServiceId(medicationRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.PLANNED.getValue());// 收费单状态:待收费
|
||||
chargeItemService.save(chargeItem);
|
||||
|
||||
} else if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(creatdDto.getServiceTable())) {
|
||||
// 服务请求查询
|
||||
ServiceRequest serviceRequest = serviceRequestService.getById(creatdDto.getRequestId());
|
||||
// 生成新的服务请求
|
||||
serviceRequest.setId(null); // 服务请求id
|
||||
serviceRequest.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 10)); // 服务请求编码
|
||||
serviceRequestService.save(serviceRequest);
|
||||
|
||||
// 费用项查询
|
||||
ChargeItem chargeItem = chargeItemService.getById(creatdDto.getChargeItemId());
|
||||
// 生成新的费用项
|
||||
chargeItem.setRefundId(chargeItem.getId());// 退费id
|
||||
chargeItem.setId(null); // 费用项id
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(serviceRequest.getBusNo())); // 编码
|
||||
chargeItem.setServiceId(serviceRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.PLANNED.getValue());// 收费单状态:待收费
|
||||
chargeItemService.save(chargeItem);
|
||||
|
||||
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(creatdDto.getServiceTable())) {
|
||||
// 耗材请求查询
|
||||
DeviceRequest deviceRequest = deviceRequestService.getById(creatdDto.getRequestId());
|
||||
// 生成新的耗材请求
|
||||
deviceRequest.setId(null); // 耗材请求id
|
||||
deviceRequest.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 10)); // 耗材请求编码
|
||||
deviceRequestService.save(deviceRequest);
|
||||
|
||||
// 耗材发放查询
|
||||
DeviceDispense deviceDispense = deviceDispenseService.getById(creatdDto.getDispenseId());
|
||||
// 生成新的耗材发放
|
||||
deviceDispense.setId(null); // 耗材id
|
||||
deviceDispense.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.DEVICE_DIS_NO.getPrefix(), 10)); // 器材发放id
|
||||
deviceDispense.setDeviceReqId(deviceRequest.getId()); // 器材请求id
|
||||
deviceDispenseService.save(deviceDispense);
|
||||
|
||||
// 费用项查询
|
||||
ChargeItem chargeItem = chargeItemService.getById(creatdDto.getChargeItemId());
|
||||
// 生成新的费用项
|
||||
chargeItem.setRefundId(chargeItem.getId());// 退费id
|
||||
chargeItem.setId(null); // 费用项id
|
||||
chargeItem.setBusNo(AssignSeqEnum.CHARGE_ITEM_NO.getPrefix().concat(deviceRequest.getBusNo())); // 编码
|
||||
chargeItem.setServiceId(deviceRequest.getId()); // 医疗服务ID
|
||||
chargeItem.setStatusEnum(ChargeItemStatus.PLANNED.getValue());// 收费单状态:待收费
|
||||
chargeItemService.save(chargeItem);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 全部退费
|
||||
// 退费费用项id集合
|
||||
List<Long> chargeItemIdList =
|
||||
refundItemList.stream().map(RefundItemParam::getChargeItemId).collect(Collectors.toList());
|
||||
|
||||
// 根据费用项id查询费用项请求发放信息
|
||||
List<RefundItemDto> chargeItemList = outpatientRefundAppMapper.selectRefundItem(chargeItemIdList,
|
||||
CommonConstants.TableName.MED_MEDICATION_REQUEST, CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.Common.THREE);
|
||||
|
||||
@@ -110,47 +256,114 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
|
||||
List<Long> devDisIdList = new ArrayList<>();
|
||||
List<Long> serReqIdList = new ArrayList<>();
|
||||
|
||||
for (RefundItemDto refundItem : refundItemList) {
|
||||
if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(refundItem.getServiceTable())) {
|
||||
for (RefundItemDto dto : chargeItemList) {
|
||||
|
||||
if (CommonConstants.TableName.MED_MEDICATION_REQUEST.equals(dto.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[] {"药品"}));
|
||||
if (DispenseStatus.COMPLETED.getValue().equals(dto.getDispenseStatus())
|
||||
|| DispenseStatus.PART_COMPLETED.getValue().equals(dto.getDispenseStatus())) {
|
||||
// 药品请求查询
|
||||
MedicationRequest medicationRequest = medicationRequestService.getById(dto.getRequestId());
|
||||
if (medicationRequest.getRefundMedicineId() != null) {
|
||||
throw new ServiceException("已申请退药,请勿重复申请");
|
||||
}
|
||||
// 生成药品请求(退药)
|
||||
medicationRequest.setId(null); // 药品请求id
|
||||
medicationRequest.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.MEDICATION_RES_NO.getPrefix(), 10)); // 药品请求编码
|
||||
medicationRequest.setQuantity(dto.getQuantity() * (-1)); // 请求数量
|
||||
medicationRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
|
||||
medicationRequest.setStatusEnum(RequestStatus.IN_REFUND.getValue()); // 请求状态
|
||||
medicationRequest.setRefundMedicineId(dto.getRequestId()); // 退药id
|
||||
medicationRequest
|
||||
.setPrescriptionNo(String.valueOf(new StringBuilder("T").append(dto.getPrescriptionNo())));
|
||||
medicationRequestService.save(medicationRequest);
|
||||
|
||||
} else {
|
||||
// todo:审批流药师同意退费
|
||||
medDisIdList.add(refundItem.getDispenseId());
|
||||
if (DispenseStatus.STOPPED.getValue().equals(dto.getDispenseStatus())
|
||||
&& NotPerformedReason.REFUND.getValue().equals(dto.getNotPerformedReason())) {
|
||||
throw new ServiceException("已申请退药,请勿重复申请");
|
||||
}
|
||||
medDisIdList.add(dto.getDispenseId());
|
||||
}
|
||||
} else if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(refundItem.getServiceTable())) {
|
||||
|
||||
} else if (CommonConstants.TableName.WOR_SERVICE_REQUEST.equals(dto.getServiceTable())) {
|
||||
// 诊疗项目需医技科室同意退费
|
||||
if (RequestStatus.COMPLETED.getValue().equals(refundItem.getRefundStatus())) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.ChargeRefund.M00002, null));
|
||||
if (RequestStatus.COMPLETED.getValue().equals(dto.getServiceStatus())) {
|
||||
// 服务请求查询
|
||||
ServiceRequest serviceRequest = serviceRequestService.getById(dto.getRequestId());
|
||||
if (serviceRequest.getRefundServiceId() != null) {
|
||||
throw new ServiceException("已申请退药,请勿重复申请");
|
||||
}
|
||||
// 生成服务请求(取消服务)
|
||||
serviceRequest.setId(null); // 服务请求id
|
||||
serviceRequest.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.SERVICE_RES_NO.getPrefix(), 10)); // 服务请求编码
|
||||
serviceRequest.setQuantity(dto.getQuantity() * (-1)); // 请求数量
|
||||
serviceRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
|
||||
serviceRequest.setStatusEnum(RequestStatus.ENDED.getValue()); // 请求状态
|
||||
serviceRequest.setRefundServiceId(dto.getRequestId()); // 退药id
|
||||
serviceRequestService.save(serviceRequest);
|
||||
|
||||
} else {
|
||||
// todo:审批流医技师同意退费
|
||||
serReqIdList.add(refundItem.getServiceId());
|
||||
if (RequestStatus.STOPPED.getValue().equals(dto.getServiceStatus())) {
|
||||
throw new ServiceException("已申请退费,请勿重复申请");
|
||||
}
|
||||
serReqIdList.add(dto.getServiceId());
|
||||
}
|
||||
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(refundItem.getServiceTable())) {
|
||||
|
||||
} else if (CommonConstants.TableName.WOR_DEVICE_REQUEST.equals(dto.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[] {"耗材"}));
|
||||
if (DispenseStatus.COMPLETED.getValue().equals(dto.getDispenseStatus())
|
||||
|| DispenseStatus.PART_COMPLETED.getValue().equals(dto.getDispenseStatus())) {
|
||||
// 耗材请求查询
|
||||
DeviceRequest deviceRequest = deviceRequestService.getById(dto.getRequestId());
|
||||
if (deviceRequest.getRefundDeviceId() != null) {
|
||||
throw new ServiceException("已申请退药,请勿重复申请");
|
||||
}
|
||||
// 生成耗材请求(退耗材)
|
||||
deviceRequest.setId(null); // 耗材请求id
|
||||
deviceRequest.setBusNo(assignSeqUtil.getSeq(AssignSeqEnum.DEVICE_RES_NO.getPrefix(), 10)); // 耗材请求编码
|
||||
deviceRequest.setQuantity(dto.getQuantity() * (-1)); // 请求数量
|
||||
deviceRequest.setUnitCode(dto.getUnitCode()); // 请求单位编码
|
||||
deviceRequest.setStatusEnum(RequestStatus.IN_REFUND.getValue()); // 请求状态
|
||||
deviceRequest.setRefundDeviceId(dto.getRequestId()); // 退药id
|
||||
deviceRequestService.save(deviceRequest);
|
||||
|
||||
} else {
|
||||
devDisIdList.add(refundItem.getDispenseId());
|
||||
if (DispenseStatus.STOPPED.getValue().equals(dto.getDispenseStatus())
|
||||
&& NotPerformedReason.REFUND.getValue().equals(dto.getNotPerformedReason())) {
|
||||
throw new ServiceException("已申请退药,请勿重复申请");
|
||||
}
|
||||
devDisIdList.add(dto.getDispenseId());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 更新收费状态:已退费
|
||||
|
||||
// // 付款id集合
|
||||
// List<Long> paymentIdList =
|
||||
// refundItemList.stream().map(RefundItemParam::getPaymentId).collect(Collectors.toList());
|
||||
// // 付款id去重
|
||||
// paymentIdList = paymentIdList.stream().distinct().collect(Collectors.toList());
|
||||
// // 更新支付状态:退款中
|
||||
// paymentReconciliationService.updateRefundingStatus(paymentIdList);
|
||||
|
||||
// 更新收费状态:退费中
|
||||
chargeItemService.updateRefundChargeStatus(chargeItemIdList);
|
||||
// 更新未发放药品状态:停止发放,停止原因:退费
|
||||
medicationDispenseService.updateStopDispenseStatus(medDisIdList, NotPerformedReason.REFUND.getValue());
|
||||
// 更新未发放耗材状态:停止发放,停止原因:退费
|
||||
deviceDispenseService.updateStopDispenseStatus(devDisIdList, NotPerformedReason.REFUND.getValue());
|
||||
// 更新执行诊疗状态:停止
|
||||
serviceRequestService.updateStopRequestStatus(serReqIdList);
|
||||
|
||||
if (!medDisIdList.isEmpty()) {
|
||||
// 更新未发放药品状态:停止发放,停止原因:退费
|
||||
medicationDispenseService.updateStopDispenseStatus(medDisIdList, NotPerformedReason.REFUND.getValue());
|
||||
}
|
||||
if (!devDisIdList.isEmpty()) {
|
||||
// 更新未发放耗材状态:停止发放,停止原因:退费
|
||||
deviceDispenseService.updateStopDispenseStatus(devDisIdList, NotPerformedReason.REFUND.getValue());
|
||||
}
|
||||
if (!serReqIdList.isEmpty()) {
|
||||
// 更新未执行诊疗状态:停止
|
||||
serviceRequestService.updateStopRequestStatus(serReqIdList);
|
||||
}
|
||||
|
||||
// 返回退费成功信息
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"处方退费"}));
|
||||
return R.ok(MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"门诊退费"}));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,7 +390,7 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
|
||||
Page<EncounterPatientPageDto> 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());
|
||||
ChargeItemStatus.PART_REFUND.getValue(), AccountType.MEDICAL_ELECTRONIC_CERTIFICATE.getCode());
|
||||
|
||||
encounterPatientPage.getRecords().forEach(e -> {
|
||||
// 性别枚举
|
||||
@@ -191,4 +404,84 @@ public class OutpatientRefundAppServiceImpl implements IOutpatientRefundAppServi
|
||||
});
|
||||
return R.ok(encounterPatientPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者的退费账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 退费账单列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getEncounterPatientRefund(Long encounterId) {
|
||||
List<EncounterPatientRefundDto> refundDtoList = outpatientRefundAppMapper.selectEncounterPatientRefund(
|
||||
encounterId, ChargeItemStatus.REFUNDING.getValue(), ChargeItemStatus.REFUNDED.getValue(),
|
||||
ChargeItemStatus.PART_REFUND.getValue(), CommonConstants.TableName.WOR_SERVICE_REQUEST,
|
||||
CommonConstants.TableName.WOR_DEVICE_REQUEST, CommonConstants.TableName.MED_MEDICATION_REQUEST);
|
||||
refundDtoList.forEach(e -> {
|
||||
// 收费状态枚举
|
||||
e.setChargeStatus_enumText(EnumUtils.getInfoByValue(ChargeItemStatus.class, e.getChargeStatus()));
|
||||
// 支付状态枚举
|
||||
e.setPaymentStatus_enumText(EnumUtils.getInfoByValue(PaymentStatus.class, e.getPaymentStatus()));
|
||||
// 发药状态
|
||||
e.setDispenseStatus_enumText(EnumUtils.getInfoByValue(DispenseStatus.class, e.getDispenseStatus()));
|
||||
// 诊疗执行枚举
|
||||
e.setServiceStatus_enumText(EnumUtils.getInfoByValue(RequestStatus.class, e.getServiceStatus()));
|
||||
});
|
||||
return R.ok(refundDtoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者因退费重新生成的账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 重新生成的账单列表
|
||||
*/
|
||||
@Override
|
||||
public R<?> getRegenerateCharge(Long encounterId) {
|
||||
return R.ok(chargeItemService.getRegenerateCharge(encounterId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否可以退费(耗材/药品是否已退,诊疗是否取消执行)
|
||||
*
|
||||
* @param chargeItemIdList 收费项目id列表
|
||||
* @return 是否可退
|
||||
*/
|
||||
@Override
|
||||
public R<?> verifyRefundable(List<Long> chargeItemIdList) {
|
||||
// 查询收费项目信息
|
||||
List<ChargeItem> chargeItemList = chargeItemService.listByIds(chargeItemIdList);
|
||||
|
||||
// 分别获取各个请求id列表
|
||||
List<Long> medReqIdList = new ArrayList<>();
|
||||
List<Long> devReqIdList = new ArrayList<>();
|
||||
chargeItemList.forEach(item -> {
|
||||
switch (item.getServiceTable()) {
|
||||
case CommonConstants.TableName.MED_MEDICATION_REQUEST -> medReqIdList.add(item.getServiceId());
|
||||
case CommonConstants.TableName.WOR_DEVICE_REQUEST -> devReqIdList.add(item.getServiceId());
|
||||
}
|
||||
});
|
||||
|
||||
if (!medReqIdList.isEmpty()) {
|
||||
List<MedicationRequest> medicationRequestList = medicationRequestService.list(
|
||||
new LambdaQueryWrapper<MedicationRequest>().in(MedicationRequest::getRefundMedicineId, medReqIdList));
|
||||
if (!medicationRequestList.isEmpty()) {
|
||||
if (medicationRequestList.stream().map(MedicationRequest::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(RequestStatus.IN_REFUND.getValue()))) {
|
||||
throw new ServiceException("请先退药后再退费");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!devReqIdList.isEmpty()) {
|
||||
List<DeviceRequest> deviceRequestList = deviceRequestService
|
||||
.list(new LambdaQueryWrapper<DeviceRequest>().in(DeviceRequest::getRefundDeviceId, devReqIdList));
|
||||
if (!deviceRequestList.isEmpty()) {
|
||||
if (deviceRequestList.stream().map(DeviceRequest::getStatusEnum)
|
||||
.anyMatch(x -> x.equals(RequestStatus.IN_REFUND.getValue()))) {
|
||||
throw new ServiceException("请先退耗材后再退费");
|
||||
}
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
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 javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import liquibase.pro.packaged.A;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@@ -15,25 +20,33 @@ 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.MessageUtils;
|
||||
import com.core.common.utils.SecurityUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.*;
|
||||
import com.openhis.administration.mapper.PatientMapper;
|
||||
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.PractitionerRoles;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisPageUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.financial.domain.Contract;
|
||||
import com.openhis.financial.mapper.ContractMapper;
|
||||
import com.openhis.financial.service.IContractService;
|
||||
import com.openhis.web.basicservice.dto.HealthcareServiceDto;
|
||||
import com.openhis.web.basicservice.mapper.HealthcareServiceBizMapper;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientRegistrationAppService;
|
||||
import com.openhis.web.chargemanage.dto.*;
|
||||
import com.openhis.web.chargemanage.mapper.OutpatientRegistrationAppMapper;
|
||||
import com.openhis.web.doctorstation.appservice.IDoctorStationAdviceAppService;
|
||||
import com.openhis.web.paymentmanage.appservice.IPaymentRecService;
|
||||
import com.openhis.web.paymentmanage.dto.CancelPaymentDto;
|
||||
import com.openhis.web.paymentmanage.dto.CancelRegPaymentDto;
|
||||
import com.openhis.workflow.service.IServiceRequestService;
|
||||
import com.openhis.yb.model.CancelRegPaymentModel;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
|
||||
/**
|
||||
* 门诊挂号 应用实现类
|
||||
@@ -68,36 +81,57 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
||||
@Resource
|
||||
IChargeItemService iChargeItemService;
|
||||
|
||||
@Resource
|
||||
IOrganizationService iOrganizationService;
|
||||
|
||||
@Resource
|
||||
YbManager ybManager;
|
||||
|
||||
@Resource
|
||||
IDoctorStationAdviceAppService iDoctorStationAdviceAppService;
|
||||
|
||||
@Resource
|
||||
AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Resource
|
||||
IServiceRequestService iServiceRequestService;
|
||||
|
||||
@Resource
|
||||
IContractService iContractService;
|
||||
|
||||
@Resource
|
||||
IPaymentRecService iPaymentRecService;
|
||||
|
||||
/**
|
||||
* 门诊挂号 - 查询患者信息
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 患者信息
|
||||
*/
|
||||
@Override
|
||||
public Page<PatientMetadata> getPatientMetadataBySearchKey(String searchKey, Integer pageNo, Integer pageSize) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<Patient> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
|
||||
new HashSet<>(Arrays.asList("id_card", "name", "py_str", "wb_str")), null);
|
||||
new HashSet<>(Arrays.asList("id_card", "name", "py_str", "wb_str")), null);
|
||||
// 设置排序
|
||||
queryWrapper.orderByDesc("update_time");
|
||||
// 患者信息
|
||||
Page<PatientMetadata> patientMetadataPage =
|
||||
HisPageUtils.selectPage(patientMapper, queryWrapper, pageNo, pageSize, PatientMetadata.class);
|
||||
HisPageUtils.selectPage(patientMapper, queryWrapper, pageNo, pageSize, PatientMetadata.class);
|
||||
// 现有就诊过的患者id集合
|
||||
List<Long> patientIdList =
|
||||
iEncounterService.list().stream().map(e -> e.getPatientId()).collect(Collectors.toList());
|
||||
iEncounterService.list().stream().map(e -> e.getPatientId()).collect(Collectors.toList());
|
||||
|
||||
patientMetadataPage.getRecords().forEach(e -> {
|
||||
// 性别枚举
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
// 计算年龄
|
||||
e.setAge(AgeCalculatorUtil.getAge(e.getBirthDate()));
|
||||
e.setAge(e.getBirthDate() != null ? AgeCalculatorUtil.getAge(e.getBirthDate()) : "");
|
||||
// 初复诊
|
||||
e.setFirstEnum_enumText(patientIdList.contains(e.getId()) ? EncounterType.FOLLOW_UP.getInfo()
|
||||
: EncounterType.INITIAL.getInfo());
|
||||
: EncounterType.INITIAL.getInfo());
|
||||
|
||||
});
|
||||
return patientMetadataPage;
|
||||
@@ -112,7 +146,7 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
||||
public List<ContractMetadata> getContractMetadata() {
|
||||
// TODO: Contract表的基础数据维护还没做,具体不知道状态字段的取值是什么,先查询默认值为0的数据
|
||||
List<Contract> ContractList =
|
||||
contractMapper.selectList(new LambdaQueryWrapper<Contract>().eq(Contract::getStatusEnum, 0));
|
||||
contractMapper.selectList(new LambdaQueryWrapper<Contract>().eq(Contract::getStatusEnum, 0));
|
||||
// 复制同名字段并 return
|
||||
return ContractList.stream().map(contract -> {
|
||||
ContractMetadata metadata = new ContractMetadata();
|
||||
@@ -126,23 +160,42 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据位置id筛选医生
|
||||
* 查询门诊科室数据
|
||||
*
|
||||
* @param locationId 位置ID
|
||||
* @return 门诊科室
|
||||
*/
|
||||
@Override
|
||||
public List<OrgMetadata> getOrgMetadata() {
|
||||
List<Organization> list =
|
||||
iOrganizationService.getList(OrganizationType.DEPARTMENT.getValue(), OrganizationClass.CLINIC.getValue());
|
||||
List<OrgMetadata> orgMetadataList = new ArrayList<>();
|
||||
OrgMetadata orgMetadata;
|
||||
for (Organization organization : list) {
|
||||
orgMetadata = new OrgMetadata();
|
||||
BeanUtils.copyProperties(organization, orgMetadata);
|
||||
orgMetadataList.add(orgMetadata);
|
||||
}
|
||||
return orgMetadataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据科室id筛选医生
|
||||
*
|
||||
* @param orgId 科室ID
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 筛选医生
|
||||
*/
|
||||
@Override
|
||||
public IPage<PractitionerMetadata> getPractitionerMetadataByLocationId(Long locationId, String searchKey,
|
||||
Integer pageNo, Integer pageSize) {
|
||||
public IPage<PractitionerMetadata> getPractitionerMetadataByLocationId(Long orgId, String searchKey, Integer pageNo,
|
||||
Integer pageSize) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<PractitionerMetadata> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
|
||||
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), null);
|
||||
new HashSet<>(Arrays.asList("name", "py_str", "wb_str")), null);
|
||||
IPage<PractitionerMetadata> practitionerMetadataPage =
|
||||
outpatientRegistrationAppMapper.getPractitionerMetadataPage(new Page<>(pageNo, pageSize), locationId,
|
||||
PractitionerRoles.DOCTOR.getCode(), queryWrapper);
|
||||
outpatientRegistrationAppMapper.getPractitionerMetadataPage(new Page<>(pageNo, pageSize), orgId,
|
||||
PractitionerRoles.DOCTOR.getCode(), queryWrapper);
|
||||
practitionerMetadataPage.getRecords().forEach(e -> {
|
||||
// 性别
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
@@ -154,110 +207,118 @@ public class OutpatientRegistrationAppServiceImpl implements IOutpatientRegistra
|
||||
* 根据机构id筛选服务项目
|
||||
*
|
||||
* @param organizationId 机构id
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 服务项目
|
||||
*/
|
||||
@Override
|
||||
public IPage<HealthcareServiceDto> getHealthcareMetadataByOrganizationId(Long organizationId, String searchKey,
|
||||
Integer pageNo, Integer pageSize) {
|
||||
Integer pageNo, Integer pageSize) {
|
||||
// 构建查询条件
|
||||
HealthcareServiceDto healthcareServiceDto = new HealthcareServiceDto();
|
||||
healthcareServiceDto.setOfferedOrgId(organizationId);
|
||||
QueryWrapper<HealthcareServiceDto> queryWrapper = HisQueryUtils.buildQueryWrapper(healthcareServiceDto,
|
||||
searchKey, new HashSet<>(Arrays.asList("name", "charge_name")), null);
|
||||
searchKey, new HashSet<>(Arrays.asList("name", "charge_name")), null);
|
||||
return healthcareServiceBizMapper.getHealthcareServicePage(new Page<>(pageNo, pageSize),
|
||||
CommonConstants.TableName.ADM_HEALTHCARE_SERVICE, queryWrapper);
|
||||
CommonConstants.TableName.ADM_HEALTHCARE_SERVICE, CommonConstants.TableName.WOR_ACTIVITY_DEFINITION,
|
||||
queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存挂号
|
||||
* 退号
|
||||
*
|
||||
* @param outpatientRegistrationAddParam 就诊表单信息
|
||||
* @param cancelRegPaymentDto 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> saveRegister(OutpatientRegistrationAddParam outpatientRegistrationAddParam) {
|
||||
// 就诊管理-表单数据
|
||||
EncounterFormData encounterFormData = outpatientRegistrationAddParam.getEncounterFormData();
|
||||
// 就诊位置管理-表单数据
|
||||
EncounterLocationFormData encounterLocationFormData =
|
||||
outpatientRegistrationAddParam.getEncounterLocationFormData();
|
||||
// 就诊参数者管理-表单数据
|
||||
EncounterParticipantFormData encounterParticipantFormData =
|
||||
outpatientRegistrationAddParam.getEncounterParticipantFormData();
|
||||
// 就诊账户管理-表单数据
|
||||
AccountFormData accountFormData = outpatientRegistrationAddParam.getAccountFormData();
|
||||
// 费用项管理-表单数据
|
||||
ChargeItemFormData chargeItemFormData = outpatientRegistrationAddParam.getChargeItemFormData();
|
||||
|
||||
// 患者ID
|
||||
Long patientId = encounterFormData.getPatientId();
|
||||
// 服务项目ID
|
||||
Long serviceTypeId = encounterFormData.getServiceTypeId();
|
||||
// 校验是否重复挂号
|
||||
Integer num = outpatientRegistrationAppMapper.getNumByPatientIdAndOrganizationId(patientId, serviceTypeId);
|
||||
if (num > 0) {
|
||||
return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null));
|
||||
public R<?> returnRegister(CancelRegPaymentDto cancelRegPaymentDto) {
|
||||
Encounter byId = iEncounterService.getById(cancelRegPaymentDto.getEncounterId());
|
||||
if (EncounterStatus.CANCELLED.getValue().equals(byId.getStatusEnum())) {
|
||||
return R.fail(null, "该患者已经退号,请勿重复退号");
|
||||
}
|
||||
// 保存就诊信息
|
||||
Encounter encounter = new Encounter();
|
||||
BeanUtils.copyProperties(encounterFormData, encounter);
|
||||
// 就诊ID
|
||||
Long encounterId = iEncounterService.saveEncounterByRegister(encounter);
|
||||
// 保存就诊位置信息
|
||||
encounterLocationFormData.setEncounterId(encounterId);
|
||||
EncounterLocation encounterLocation = new EncounterLocation();
|
||||
BeanUtils.copyProperties(encounterLocationFormData, encounterLocation);
|
||||
iEncounterLocationService.saveEncounterLocationByRegister(encounterLocation);
|
||||
// 保存就诊参数者信息 , 选了参与这才保存
|
||||
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();
|
||||
BeanUtils.copyProperties(accountFormData, account);
|
||||
// 账户ID
|
||||
Long accountId = iAccountService.saveAccountByRegister(account);
|
||||
// 保存就诊费用项
|
||||
chargeItemFormData.setEncounterId(encounterId);
|
||||
chargeItemFormData.setAccountId(accountId);
|
||||
ChargeItem chargeItem = new ChargeItem();
|
||||
BeanUtils.copyProperties(chargeItemFormData, chargeItem);
|
||||
iChargeItemService.saveChargeItemByRegister(chargeItem);
|
||||
iEncounterService.returnRegister(cancelRegPaymentDto.getEncounterId());
|
||||
// 查询账户信息
|
||||
Account account = iAccountService
|
||||
.getOne(new LambdaQueryWrapper<Account>().eq(Account::getEncounterId, cancelRegPaymentDto.getEncounterId())
|
||||
.ne(Account::getTypeCode, AccountType.PERSONAL_CASH_ACCOUNT.getCode())
|
||||
.eq(Account::getEncounterFlag, Whether.YES.getValue()));
|
||||
|
||||
return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"挂号"}));
|
||||
CancelPaymentDto cancelPaymentDto = new CancelPaymentDto();
|
||||
BeanUtils.copyProperties(cancelRegPaymentDto, cancelPaymentDto);
|
||||
|
||||
// 开通医保的处理
|
||||
if ("1".equals(SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH))
|
||||
&& account != null && !"0000".equals(account.getContractNo())) {
|
||||
CancelRegPaymentModel model = new CancelRegPaymentModel();
|
||||
BeanUtils.copyProperties(cancelRegPaymentDto, model);
|
||||
ybManager.cancelReg(model);
|
||||
cancelPaymentDto.setSetlId(model.getSetlId());
|
||||
//return R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[] {"医保退号"}));
|
||||
}
|
||||
|
||||
R<?> result = iPaymentRecService.cancelRegPayment(cancelPaymentDto);
|
||||
|
||||
PaymentReconciliation paymentRecon = null;
|
||||
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
|
||||
paymentRecon = (PaymentReconciliation) result.getData();
|
||||
}
|
||||
if(paymentRecon!=null) {
|
||||
List<String> strings = Arrays.asList(paymentRecon.getChargeItemIds().split(","));
|
||||
List<Long> chargeItemIds = new ArrayList<>();
|
||||
for (String string : strings) {
|
||||
chargeItemIds.add(Long.parseLong(string));
|
||||
}
|
||||
// 更新收费状态:已退费
|
||||
if (!chargeItemIds.isEmpty()) {
|
||||
iChargeItemService.updatePaymentStatus(chargeItemIds, ChargeItemStatus.REFUNDED.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// 2025/05/05 该处保存费用项后,会通过统一收费处理进行收费
|
||||
return R.ok(paymentRecon, MessageUtils.createMessage(PromptMsgConstant.Common.M00004, new Object[]{"退号"}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当日就诊数据
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 当日就诊数据
|
||||
*/
|
||||
@Override
|
||||
public IPage<CurrentDayEncounterDto> getCurrentDayEncounter(String searchKey, Integer pageNo, Integer pageSize) {
|
||||
public IPage<CurrentDayEncounterDto> getCurrentDayEncounter(String searchKey, Integer pageNo, Integer pageSize,
|
||||
HttpServletRequest request) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<CurrentDayEncounterDto> queryWrapper = HisQueryUtils.buildQueryWrapper(null, searchKey,
|
||||
new HashSet<>(Arrays.asList("patient_name", "organization_name", "practitioner_name", "healthcare_name")),
|
||||
null);
|
||||
new HashSet<>(Arrays.asList("patient_name", "organization_name", "practitioner_name", "healthcare_name")),
|
||||
request);
|
||||
|
||||
IPage<CurrentDayEncounterDto> currentDayEncounter = outpatientRegistrationAppMapper
|
||||
.getCurrentDayEncounter(new Page<>(pageNo, pageSize), ParticipantType.ADMITTER.getCode(), queryWrapper);
|
||||
IPage<CurrentDayEncounterDto> currentDayEncounter = outpatientRegistrationAppMapper.getCurrentDayEncounter(
|
||||
new Page<>(pageNo, pageSize), EncounterClass.AMB.getValue(), ParticipantType.ADMITTER.getCode(),
|
||||
queryWrapper, ChargeItemContext.REGISTER.getValue(), PaymentStatus.SUCCESS.getValue());
|
||||
currentDayEncounter.getRecords().forEach(e -> {
|
||||
// 性别
|
||||
e.setGenderEnum_enumText(EnumUtils.getInfoByValue(AdministrativeGender.class, e.getGenderEnum()));
|
||||
// 就诊状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(EncounterStatus.class, e.getStatusEnum()));
|
||||
// 计算年龄
|
||||
e.setAge(e.getBirthDate() != null ? AgeCalculatorUtil.getAge(e.getBirthDate()) : "");
|
||||
});
|
||||
return currentDayEncounter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消挂号
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> cancelRegister(Long encounterId) {
|
||||
iEncounterService.removeById(encounterId);
|
||||
return R.ok("已取消挂号");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ 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 com.openhis.web.chargemanage.dto.RefundItemParam;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -57,30 +58,62 @@ public class OutpatientRefundController {
|
||||
@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));
|
||||
return outpatientRefundAppService.getBilledEncounterPatientPage(encounterPatientPageParam, searchKey, pageNo,
|
||||
pageSize, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者的账单
|
||||
* 根据就诊id查询患者的账单(申请退费列表)
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 患者账单列表
|
||||
*/
|
||||
@GetMapping(value = "/patient-payment")
|
||||
public R<?> getEncounterPatientPayment(@RequestParam Long encounterId) {
|
||||
return R.ok(outpatientRefundAppService.getEncounterPatientPayment(encounterId));
|
||||
return outpatientRefundAppService.getEncounterPatientPayment(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据账单退费
|
||||
* 根据账单申请退费
|
||||
*
|
||||
* @param paymentIdList 付费id列表
|
||||
* @param refundItemList 退费项目id列表
|
||||
* @return 操作结果
|
||||
*/
|
||||
@PostMapping(value = "/refund-payment")
|
||||
public R<?> refundPayment(@RequestBody List<Long> paymentIdList) {
|
||||
return R.ok(outpatientRefundAppService.refundPayment(paymentIdList));
|
||||
public R<?> refundPayment(@RequestBody List<RefundItemParam> refundItemList) {
|
||||
return outpatientRefundAppService.refundPayment(refundItemList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者的退费账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 退费账单列表
|
||||
*/
|
||||
@GetMapping(value = "/patient-refund")
|
||||
public R<?> getEncounterPatientRefund(@RequestParam Long encounterId) {
|
||||
return outpatientRefundAppService.getEncounterPatientRefund(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据就诊id查询患者因退费重新生成的账单
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 重新生成的账单列表
|
||||
*/
|
||||
@GetMapping(value = "/regenerate_charge")
|
||||
public R<?> getRegenerateCharge(@RequestParam Long encounterId) {
|
||||
return outpatientRefundAppService.getRegenerateCharge(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验是否可以退费(耗材/药品是否已退,诊疗是否取消执行)
|
||||
*
|
||||
* @param chargeItemIdList 收费项目id列表
|
||||
* @return 是否可退
|
||||
*/
|
||||
@GetMapping(value = "/verify_refund")
|
||||
public R<?> verifyRefundable(@RequestParam List<Long> chargeItemIdList) {
|
||||
return outpatientRefundAppService.verifyRefundable(chargeItemIdList);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,20 +4,22 @@
|
||||
package com.openhis.web.chargemanage.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.openhis.financial.domain.PaymentReconciliation;
|
||||
import com.openhis.web.paymentmanage.appservice.IEleInvoiceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.common.enums.LocationForm;
|
||||
import com.openhis.common.enums.PriorityLevel;
|
||||
import com.openhis.web.basedatamanage.appservice.ILocationAppService;
|
||||
import com.openhis.web.chargemanage.appservice.IOutpatientRegistrationAppService;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientRegistrationAddParam;
|
||||
import com.openhis.web.chargemanage.dto.OutpatientRegistrationInitDto;
|
||||
import com.openhis.web.paymentmanage.dto.CancelRegPaymentDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -32,8 +34,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class OutpatientRegistrationController {
|
||||
|
||||
private final IOutpatientRegistrationAppService iOutpatientRegistrationAppService;
|
||||
private final ILocationAppService iLocationAppService;
|
||||
|
||||
@Autowired
|
||||
private IEleInvoiceService eleInvoiceService;
|
||||
/**
|
||||
* 基础数据初始化
|
||||
*/
|
||||
@@ -66,7 +69,7 @@ public class OutpatientRegistrationController {
|
||||
|
||||
/**
|
||||
* 查询费用性质
|
||||
*
|
||||
*
|
||||
* @return 费用性质
|
||||
*/
|
||||
@GetMapping(value = "/contract-list")
|
||||
@@ -75,29 +78,25 @@ public class OutpatientRegistrationController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询就诊位置
|
||||
* 查询就诊科室
|
||||
*
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @return 位置分页列表
|
||||
* @return 就诊科室集合
|
||||
*/
|
||||
@GetMapping(value = "/location-tree")
|
||||
public R<?> getLocationTree(@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return iLocationAppService.getLocationTree(LocationForm.ROOM.getValue(), pageNo, pageSize);
|
||||
|
||||
@GetMapping(value = "/org-list")
|
||||
public R<?> getLocationTree() {
|
||||
return R.ok(iOutpatientRegistrationAppService.getOrgMetadata());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据位置id筛选医生
|
||||
* 根据科室id筛选医生
|
||||
*/
|
||||
@GetMapping(value = "/practitioner-metadata")
|
||||
public R<?> getPractitionerMetadata(@RequestParam(value = "locationId") Long locationId,
|
||||
public R<?> getPractitionerMetadata(@RequestParam(value = "orgId") Long orgId,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return R.ok(iOutpatientRegistrationAppService.getPractitionerMetadataByLocationId(locationId, searchKey, pageNo,
|
||||
pageSize));
|
||||
return R.ok(
|
||||
iOutpatientRegistrationAppService.getPractitionerMetadataByLocationId(orgId, searchKey, pageNo, pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,19 +112,45 @@ public class OutpatientRegistrationController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存挂号
|
||||
*
|
||||
* @param outpatientRegistrationAddParam 就诊表单信息
|
||||
* 退号
|
||||
*
|
||||
* @param cancelRegPaymentDto 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping(value = "/save")
|
||||
public R<?> saveRegister(@Valid @RequestBody OutpatientRegistrationAddParam outpatientRegistrationAddParam) {
|
||||
return iOutpatientRegistrationAppService.saveRegister(outpatientRegistrationAddParam);
|
||||
@PutMapping(value = "return")
|
||||
public R<?> returnRegister(@RequestBody CancelRegPaymentDto cancelRegPaymentDto) {
|
||||
|
||||
R<?> result = iOutpatientRegistrationAppService.returnRegister(cancelRegPaymentDto);
|
||||
// 取消付款成功后,开具发票
|
||||
if (result.getCode() == 200) {
|
||||
PaymentReconciliation paymentRecon = null;
|
||||
if (PaymentReconciliation.class.isAssignableFrom(result.getData().getClass())) {
|
||||
paymentRecon = (PaymentReconciliation)result.getData();
|
||||
}
|
||||
R<?> eleResult = eleInvoiceService.invoiceWriteoff(paymentRecon.getRelationId(), cancelRegPaymentDto.getReason());
|
||||
if (eleResult.getCode() != 200) {
|
||||
// 因取消付款成功前端需要关闭弹窗,此处信息仅用于提示所以返回ok
|
||||
return R.ok(null, " 取消付款成功,电子发票开具失败 :" + eleResult.getMsg());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消挂号
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @return 结果
|
||||
*/
|
||||
@PutMapping(value = "cancel")
|
||||
public R<?> cancelRegister(@RequestParam(value = "encounterId") Long encounterId) {
|
||||
return iOutpatientRegistrationAppService.cancelRegister(encounterId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当日就诊数据
|
||||
*
|
||||
*
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
@@ -134,8 +159,8 @@ public class OutpatientRegistrationController {
|
||||
@GetMapping(value = "/current-day-encounter")
|
||||
public R<?> getCurrentDayEncounter(@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return R.ok(iOutpatientRegistrationAppService.getCurrentDayEncounter(searchKey, pageNo, pageSize));
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
return R.ok(iOutpatientRegistrationAppService.getCurrentDayEncounter(searchKey, pageNo, pageSize, request));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,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.constant.CommonConstants;
|
||||
import com.openhis.common.enums.AccountBillingStatus;
|
||||
import com.openhis.common.enums.AccountStatus;
|
||||
|
||||
@@ -37,8 +38,7 @@ public class AccountFormData {
|
||||
private Integer billingStatusEnum;
|
||||
|
||||
/** 账户类型编码 */
|
||||
@NotNull(message = "账户类型不能为空")
|
||||
private String typeCode; // 1:个人现金账户, 2:医保账户
|
||||
private String typeCode; // 【01医保电子凭证 | 02 居民身份证 | 03 社会保障卡 | 04 个人现金账户】
|
||||
|
||||
/** 名称 */
|
||||
private String name; // 刷医保卡时应该会带出该信息
|
||||
@@ -59,6 +59,7 @@ public class AccountFormData {
|
||||
* 设置默认值
|
||||
*/
|
||||
public AccountFormData() {
|
||||
this.contractNo = CommonConstants.BusinessName.DEFAULT_CONTRACT_NO;
|
||||
this.statusEnum = AccountStatus.ACTIVE.getValue();
|
||||
this.billingStatusEnum = AccountBillingStatus.OPEN.getValue();
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ 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.constant.CommonConstants;
|
||||
import com.openhis.common.enums.ChargeItemContext;
|
||||
import com.openhis.common.enums.ChargeItemStatus;
|
||||
import com.openhis.common.enums.EncounterClass;
|
||||
|
||||
@@ -81,8 +82,8 @@ public class ChargeItemFormData {
|
||||
* 设置默认值
|
||||
*/
|
||||
public ChargeItemFormData() {
|
||||
this.statusEnum = ChargeItemStatus.BILLED.getValue();
|
||||
this.contextEnum = EncounterClass.AMB.getValue();
|
||||
this.statusEnum = ChargeItemStatus.PLANNED.getValue();
|
||||
this.contextEnum = ChargeItemContext.REGISTER.getValue();
|
||||
this.occurrenceTime = new Date();
|
||||
this.performerId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
this.entererId = SecurityUtils.getLoginUser().getPractitionerId();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
@@ -89,4 +90,45 @@ public class CurrentDayEncounterDto {
|
||||
*/
|
||||
private Date registerTime;
|
||||
|
||||
/**
|
||||
* 价格
|
||||
*/
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/**
|
||||
* 账户名称
|
||||
*/
|
||||
private String accountName;
|
||||
|
||||
/**
|
||||
* 挂号人
|
||||
*/
|
||||
private String entererName;
|
||||
|
||||
/**
|
||||
* 收费项目ids
|
||||
*/
|
||||
private String chargeItemIds;
|
||||
|
||||
/**
|
||||
* 付款id
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long paymentId;
|
||||
|
||||
/**
|
||||
* 发票url地址
|
||||
*/
|
||||
private String pictureUrl;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
*/
|
||||
private String age;
|
||||
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
private Date birthDate;
|
||||
|
||||
}
|
||||
|
||||
@@ -38,6 +38,11 @@ public class EncounterFormData {
|
||||
*/
|
||||
private Integer ybClassEnum;
|
||||
|
||||
/**
|
||||
* 类别医保文本
|
||||
*/
|
||||
private String ybClassText; // 医保接口获取
|
||||
|
||||
/**
|
||||
* 优先级编码
|
||||
*/
|
||||
|
||||
@@ -27,8 +27,6 @@ public class EncounterLocationFormData {
|
||||
/**
|
||||
* 位置ID
|
||||
*/
|
||||
@NotNull(message = "位置ID不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long locationId;
|
||||
|
||||
/** 状态枚举 */
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
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.ParticipantType;
|
||||
@@ -33,7 +31,7 @@ public class EncounterParticipantFormData {
|
||||
* 设置默认值
|
||||
*/
|
||||
public EncounterParticipantFormData() {
|
||||
this.typeCode = ParticipantType.ADMITTER.getCode();
|
||||
this.typeCode = ParticipantType.REGISTRATION_DOCTOR.getCode();// 挂号医生
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,12 @@ public class EncounterPatientPageDto {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/**
|
||||
* 患者
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/**
|
||||
* 患者姓名
|
||||
*/
|
||||
@@ -83,9 +89,9 @@ public class EncounterPatientPageDto {
|
||||
private BigDecimal balanceAmount;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
* 接诊时间
|
||||
*/
|
||||
private Date startTime;
|
||||
private Date receptionTime;
|
||||
|
||||
/**
|
||||
* 年龄
|
||||
@@ -99,12 +105,12 @@ public class EncounterPatientPageDto {
|
||||
/**
|
||||
* 医保总额
|
||||
*/
|
||||
private BigDecimal insurancePrice;
|
||||
private BigDecimal insuranceAmount;
|
||||
|
||||
/**
|
||||
* 自费总额
|
||||
*/
|
||||
private BigDecimal selfPrice;
|
||||
private BigDecimal selfAmount;
|
||||
|
||||
/**
|
||||
* 付款总额
|
||||
|
||||
@@ -49,9 +49,9 @@ public class EncounterPatientPageParam {
|
||||
private String encounterBusNo;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
* 接诊时间
|
||||
*/
|
||||
private Date startTime;
|
||||
private Date receptionTime;
|
||||
|
||||
/**
|
||||
* 收费时间
|
||||
|
||||
@@ -5,6 +5,7 @@ package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -39,7 +40,7 @@ public class EncounterPatientPaymentDto {
|
||||
/** 关联账户ID */
|
||||
private Long accountId;
|
||||
|
||||
/** 状态 */
|
||||
/** 支付状态 */
|
||||
private Integer statusEnum;
|
||||
|
||||
/** 关联ID */
|
||||
|
||||
@@ -6,6 +6,9 @@ package com.openhis.web.chargemanage.dto;
|
||||
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;
|
||||
|
||||
@@ -28,9 +31,19 @@ public class EncounterPatientPrescriptionDto {
|
||||
private String statusEnum_enumText;
|
||||
|
||||
/** 就诊ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long encounterId;
|
||||
|
||||
/** 患者id */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long patientId;
|
||||
|
||||
/** ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/** 开立科室 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long requestingOrgId;
|
||||
|
||||
/** 数量 */
|
||||
@@ -51,18 +64,40 @@ public class EncounterPatientPrescriptionDto {
|
||||
/** 业务编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 开立人ID */
|
||||
/** 收款人ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@Dict(dictCode = "id", dictTable = "adm_practitioner", dictText = "name")
|
||||
private Long entererId;
|
||||
private String entererId_dictText;
|
||||
|
||||
/** 开立时间 */
|
||||
private Date enteredDate;
|
||||
|
||||
/** 收费时间 */
|
||||
private Date billDate;
|
||||
|
||||
/** 关联账户ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long accountId;
|
||||
|
||||
/** 物品编码 */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long itemId;
|
||||
|
||||
/** 物品名称 */
|
||||
private String itemName;
|
||||
|
||||
/** 特病标识 */
|
||||
@Dict(dictCode = "med_type")
|
||||
private String medTypeCode;
|
||||
private String medTypeCode_dictText;
|
||||
|
||||
/** 合同编码 */
|
||||
private String contractNo;
|
||||
|
||||
/** 医保编码 */
|
||||
private String ybNo;
|
||||
|
||||
/** 合同名称 */
|
||||
private String contractName;
|
||||
}
|
||||
|
||||
@@ -2,9 +2,13 @@ package com.openhis.web.chargemanage.dto;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
import com.openhis.web.paymentmanage.dto.PaymentDetailDto;
|
||||
import com.openhis.yb.dto.Info5301SpecialConditionResult;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 门诊挂号 新增参数
|
||||
*/
|
||||
@@ -41,9 +45,32 @@ public class OutpatientRegistrationAddParam {
|
||||
@Valid
|
||||
private AccountFormData accountFormData;
|
||||
/**
|
||||
* 费用项管理-表单数据
|
||||
* 费用项管理-表单数据 //todo:挂号费会绑定诊查费,该字段会变成List,挂号前先把这个收费项开个前台,后台没有保存
|
||||
*/
|
||||
@Valid
|
||||
private ChargeItemFormData chargeItemFormData;
|
||||
|
||||
/**
|
||||
* 密钥 医保挂号时使用
|
||||
*/
|
||||
private String busiCardInfo;//2025/05/16 前后端一致,前端大写,后端保持大写
|
||||
|
||||
/**
|
||||
* 类型 医保挂号时使用
|
||||
*/
|
||||
private String ybMdtrtCertType;
|
||||
/**
|
||||
* 医保个人结算方式 参照枚举 按项目结算 01 按定额结算 02
|
||||
*/
|
||||
private String YbPsnSetlWay;
|
||||
|
||||
public OutpatientRegistrationAddParam(){
|
||||
this.YbPsnSetlWay = "01";
|
||||
}
|
||||
|
||||
/**
|
||||
* 特慢病列表
|
||||
*/
|
||||
private List<Info5301SpecialConditionResult> feedetail;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,9 +3,14 @@
|
||||
*/
|
||||
package com.openhis.web.chargemanage.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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 退款项目 dto
|
||||
*
|
||||
@@ -17,7 +22,12 @@ import lombok.experimental.Accessors;
|
||||
public class RefundItemDto {
|
||||
|
||||
/** 收费ID */
|
||||
private Long chargeId;
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long chargeItemId;
|
||||
|
||||
/** 收费ID */
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long paymentId;
|
||||
|
||||
/** 医疗服务所在表 */
|
||||
private String serviceTable;
|
||||
@@ -28,14 +38,37 @@ public class RefundItemDto {
|
||||
/** 请求编码 */
|
||||
private String busNo;
|
||||
|
||||
/** 处方号 */
|
||||
private String prescriptionNo;
|
||||
|
||||
/** 请求数量 */
|
||||
private Integer quantity;
|
||||
|
||||
/** 请求单位编码 */
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String unitCode;
|
||||
private String unitCode_dictText;
|
||||
|
||||
/** 单价 */
|
||||
private BigDecimal unitPrice;
|
||||
|
||||
/** 总价 */
|
||||
private BigDecimal totalPrice;
|
||||
|
||||
/** 退款状态 */
|
||||
private Integer refundStatus;
|
||||
private String refundStatus_enumText;
|
||||
|
||||
/** 发放状态 */
|
||||
private Integer dispenseStatus;
|
||||
private String dispenseStatus_enumText;
|
||||
|
||||
/** 执行状态 */
|
||||
private Integer serviceStatus;
|
||||
private String serviceStatus_enumText;
|
||||
|
||||
/** 未发药原因 */
|
||||
private Integer notPerformedReason;
|
||||
|
||||
/** 项目id */
|
||||
private Long itemId;
|
||||
@@ -43,6 +76,10 @@ public class RefundItemDto {
|
||||
/** 发放id */
|
||||
private Long dispenseId;
|
||||
|
||||
/** 请求id */
|
||||
private Long requestId;
|
||||
|
||||
/** 项目名 */
|
||||
private Long itemName;
|
||||
private String itemName;
|
||||
|
||||
}
|
||||
|
||||
@@ -41,12 +41,18 @@ public interface OutpatientChargeAppMapper {
|
||||
* @param activity 项目
|
||||
* @param medication 药品
|
||||
* @param device 耗材
|
||||
* @param register 挂号费
|
||||
* @param planned 收费状态:待收费
|
||||
* @param billable 收费状态:待结算
|
||||
* @param billed 收费状态:已结算
|
||||
* @param refunding 收费状态:退费中
|
||||
* @param refunded 收费状态:全部退费
|
||||
* @param partRefund 收费状态:部分退费
|
||||
* @return 患者处方列表
|
||||
*/
|
||||
List<EncounterPatientPrescriptionDto> selectEncounterPatientPrescription(@Param("encounterId") Long encounterId,
|
||||
@Param("activity") Integer activity, @Param("medication") Integer medication, @Param("device") Integer device,
|
||||
@Param("planned") Integer planned, @Param("billable") Integer billable, @Param("billed") Integer billed);
|
||||
@Param("register") Integer register, @Param("planned") Integer planned, @Param("billable") Integer billable,
|
||||
@Param("billed") Integer billed, @Param("refunding") Integer refunding, @Param("refunded") Integer refunded,
|
||||
@Param("partRefund") Integer partRefund);
|
||||
}
|
||||
|
||||
@@ -11,10 +11,7 @@ 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;
|
||||
import com.openhis.web.chargemanage.dto.*;
|
||||
|
||||
/**
|
||||
* 门诊退费 appMapper
|
||||
@@ -30,17 +27,17 @@ public interface OutpatientRefundAppMapper {
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param success 支付状态:成功
|
||||
* @param refundAll 支付状态:全部退款
|
||||
* @param refundPart 支付状态:部分退款
|
||||
* @param refundAll 支付状态:全部退款
|
||||
* @return 就诊患者账单列表
|
||||
*/
|
||||
List<EncounterPatientPaymentDto> selectEncounterPatientPayment(@Param("encounterId") Long encounterId,
|
||||
@Param("success") Integer success, @Param("refundAll") Integer refundAll,
|
||||
@Param("refundPart") Integer refundPart);
|
||||
@Param("success") Integer success, @Param("refundPart") Integer refundPart,
|
||||
@Param("refundAll") Integer refundAll);
|
||||
|
||||
/**
|
||||
* 查询退费项目
|
||||
*
|
||||
*
|
||||
* @param chargeItemIdList 收费项列表
|
||||
* @param medMedicationRequest 药品请求表
|
||||
* @param worServiceRequest 服务请求表
|
||||
@@ -68,5 +65,22 @@ public interface OutpatientRefundAppMapper {
|
||||
Page<EncounterPatientPageDto> selectBilledEncounterPatientPage(@Param("page") Page<EncounterPatientPageDto> page,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<EncounterPatientPageParam> queryWrapper, @Param("billed") Integer billed,
|
||||
@Param("refunding") Integer refunding, @Param("refunded") Integer refunded,
|
||||
@Param("partRefund") Integer partRefund, @Param("insurance") Integer insurance);
|
||||
@Param("partRefund") Integer partRefund, @Param("insurance") String insurance);
|
||||
|
||||
/**
|
||||
* 查询患者退费项目
|
||||
*
|
||||
* @param encounterId 就诊id
|
||||
* @param refunding 收费状态:退费中
|
||||
* @param refunded 收费状态:已退款
|
||||
* @param partRefund 收费状态:部分退款
|
||||
* @param worServiceRequest 服务请求表
|
||||
* @param worDeviceRequest 设备请求表
|
||||
* @param medMedicationRequest 药品请求表
|
||||
* @return 查询患者退费项目
|
||||
*/
|
||||
List<EncounterPatientRefundDto> selectEncounterPatientRefund(@Param("encounterId") Long encounterId,
|
||||
@Param("refunding") Integer refunding, @Param("refunded") Integer refunded,
|
||||
@Param("partRefund") Integer partRefund, @Param("worServiceRequest") String worServiceRequest,
|
||||
@Param("worDeviceRequest") String worDeviceRequest, @Param("medMedicationRequest") String medMedicationRequest);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.openhis.web.chargemanage.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@@ -9,6 +11,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.openhis.web.chargemanage.dto.CurrentDayEncounterDto;
|
||||
import com.openhis.web.chargemanage.dto.PractitionerMetadata;
|
||||
import com.openhis.web.personalization.dto.ActivityDeviceDto;
|
||||
|
||||
/**
|
||||
* 门诊挂号 应用Mapper
|
||||
@@ -19,25 +22,38 @@ public interface OutpatientRegistrationAppMapper {
|
||||
* 查询医生
|
||||
*/
|
||||
IPage<PractitionerMetadata> getPractitionerMetadataPage(@Param("page") Page<PractitionerMetadata> page,
|
||||
@Param("locationId") Long locationId, @Param("RoleCode") String RoleCode,
|
||||
@Param("orgId") Long orgId, @Param("RoleCode") String RoleCode,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<PractitionerMetadata> queryWrapper);
|
||||
|
||||
/**
|
||||
* 根据病人id和科室id查询当日挂号次数
|
||||
*/
|
||||
Integer getNumByPatientIdAndOrganizationId(@Param("patientId") Long patientId,
|
||||
@Param("serviceTypeId") Long serviceTypeId);
|
||||
@Param("serviceTypeId") Long serviceTypeId, @Param("cancelled") Integer cancelled);
|
||||
|
||||
/**
|
||||
* 查询当日就诊数据
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param classEnum 就诊类型
|
||||
* @param participantType 参与者类型
|
||||
* @param queryWrapper 查询条件
|
||||
* @param register 收费项目类型:挂号
|
||||
* @param paymentStatus 支付状态:成功
|
||||
* @return 当日就诊数据
|
||||
*/
|
||||
IPage<CurrentDayEncounterDto> getCurrentDayEncounter(@Param("page") Page<CurrentDayEncounterDto> page,
|
||||
@Param("participantType") String participantType,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<CurrentDayEncounterDto> queryWrapper);
|
||||
@Param("classEnum") Integer classEnum, @Param("participantType") String participantType,
|
||||
@Param(Constants.WRAPPER) QueryWrapper<CurrentDayEncounterDto> queryWrapper,
|
||||
@Param("register") Integer register, @Param("paymentStatus") Integer paymentStatus);
|
||||
|
||||
/**
|
||||
* 查询item绑定的信息(耗材或诊疗)
|
||||
*
|
||||
* @param itemId itemId
|
||||
* @param devActable 绑定的表名(耗材或诊疗)
|
||||
* @return item绑定的信息
|
||||
*/
|
||||
List<ActivityDeviceDto> getTmpActivityList(@Param("itemId") String itemId, @Param("devActable") String devActable);
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ public interface IDeviceManageAppService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/information-init")
|
||||
R<?> getDeviceManageInit();
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
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<Long> ids);
|
||||
|
||||
/**
|
||||
* 诊疗目录启用
|
||||
*
|
||||
* @param ids 诊疗目录ID列表
|
||||
* @return
|
||||
*/
|
||||
R<?> editDiseaseTreatmentStart(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 新增外来诊疗目录
|
||||
*
|
||||
* @param diagnosisTreatmentUpDto 诊疗目录
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/information")
|
||||
R<?> addDiseaseTreatment(DiagnosisTreatmentUpDto diagnosisTreatmentUpDto);
|
||||
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.openhis.web.datadictionary.appservice;
|
||||
|
||||
import com.openhis.administration.domain.ChargeItemDefDetail;
|
||||
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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目定价
|
||||
@@ -29,4 +29,12 @@ public interface IItemDefinitionService {
|
||||
*/
|
||||
boolean updateItem(ChargeItemDefinition chargeItemDefinition);
|
||||
|
||||
/**
|
||||
* 修改项目定价表子信息
|
||||
*
|
||||
* @param chargeItemDefinition 项目定价表信息
|
||||
* @param price 价格
|
||||
* @param conditionCode 条件
|
||||
*/
|
||||
boolean updateItemDetail(ChargeItemDefinition chargeItemDefinition, BigDecimal price,String conditionCode);
|
||||
}
|
||||
|
||||
@@ -13,15 +13,12 @@ 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.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;
|
||||
@@ -32,22 +29,21 @@ 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.domain.Supplier;
|
||||
import com.openhis.administration.service.IDeviceDefinitionService;
|
||||
import com.openhis.administration.service.IOrganizationService;
|
||||
import com.openhis.administration.service.ISupplierService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
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.enums.*;
|
||||
import com.openhis.common.utils.EnumUtils;
|
||||
import com.openhis.common.utils.HisQueryUtils;
|
||||
import com.openhis.sys.service.IOperationRecordService;
|
||||
import com.openhis.web.datadictionary.appservice.IDeviceManageAppService;
|
||||
import com.openhis.web.datadictionary.appservice.IItemDefinitionService;
|
||||
import com.openhis.web.datadictionary.dto.*;
|
||||
import com.openhis.web.datadictionary.mapper.DeviceManageMapper;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
|
||||
/**
|
||||
* 器材目录 impl
|
||||
@@ -59,16 +55,13 @@ import com.openhis.web.datadictionary.mapper.DeviceManageMapper;
|
||||
public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
|
||||
|
||||
@Autowired
|
||||
private DeviceDefinitionMapper deviceDefinitionMapper;
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceDefinitionService deviceDefinitionService;
|
||||
|
||||
@Autowired
|
||||
private IOrganizationService organizationService;
|
||||
|
||||
@Resource
|
||||
DeviceManageMapper deviceManageMapper;
|
||||
private DeviceManageMapper deviceManageMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService sysDictTypeService;
|
||||
@@ -80,7 +73,13 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
|
||||
private ISupplierService supplierService;
|
||||
|
||||
@Autowired(required = false)
|
||||
AssignSeqUtil assignSeqUtil;
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Autowired
|
||||
private YbManager ybService;
|
||||
|
||||
@Autowired
|
||||
private IOperationRecordService iOperationRecordService;
|
||||
|
||||
/**
|
||||
* 器材目录初始化
|
||||
@@ -98,14 +97,14 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
|
||||
.collect(Collectors.toList());
|
||||
deviceManageInitDto.setStatusFlagOptions(statusEnumOptions);
|
||||
|
||||
// // 获取执行科室
|
||||
// LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(Organization::getTypeEnum, OrganizationType.HOSPITAL_DEPARTMENT);
|
||||
// List<Organization> organizations = organizationService.list(queryWrapper);
|
||||
// List<DeviceManageInitDto.exeOrganization> exeOrganizations = organizations.stream()
|
||||
// .map(exeOrg -> new DeviceManageInitDto.exeOrganization(exeOrg.getId(), exeOrg.getName()))
|
||||
// .collect(Collectors.toList());
|
||||
// deviceManageInitDto.setExeOrganizations(exeOrganizations);
|
||||
// // 获取执行科室
|
||||
// LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(Organization::getTypeEnum, OrganizationType.HOSPITAL_DEPARTMENT);
|
||||
// List<Organization> organizations = organizationService.list(queryWrapper);
|
||||
// List<DeviceManageInitDto.exeOrganization> exeOrganizations = organizations.stream()
|
||||
// .map(exeOrg -> new DeviceManageInitDto.exeOrganization(exeOrg.getId(), exeOrg.getName()))
|
||||
// .collect(Collectors.toList());
|
||||
// deviceManageInitDto.setExeOrganizations(exeOrganizations);
|
||||
// // 从枚举中获取器材分类
|
||||
// List<DeviceManageInitDto.deviceCategory> deviceCategories = Stream.of(DeviceCategory.values())
|
||||
// .map(category -> new DeviceManageInitDto.deviceCategory(category.getValue(), category.getInfo()))
|
||||
@@ -148,10 +147,8 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
|
||||
* @return 器材目录查询结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> getDevicePage(DeviceManageSelParam deviceManageSelParam,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
public R<?> getDevicePage(DeviceManageSelParam deviceManageSelParam, String searchKey, Integer pageNo,
|
||||
Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<DeviceManageDto> queryWrapper = HisQueryUtils.buildQueryWrapper(deviceManageSelParam, searchKey,
|
||||
@@ -188,7 +185,11 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
|
||||
*/
|
||||
@Override
|
||||
public R<?> editDevice(DeviceManageUpDto deviceManageDto) {
|
||||
|
||||
// // 校验是否可以编辑
|
||||
// boolean result = supplyRequestService.verifyAbleEdit(deviceManageDto.getId());
|
||||
// if (result) {
|
||||
// return R.fail("该耗材已经发生过业务,不可编辑");
|
||||
// }
|
||||
DeviceDefinition deviceDefinition = new DeviceDefinition();
|
||||
BeanUtils.copyProperties(deviceManageDto, deviceDefinition);
|
||||
// 拼音码
|
||||
@@ -198,13 +199,40 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
|
||||
|
||||
// 更新器材信息
|
||||
if (deviceDefinitionService.updateById(deviceDefinition)) {
|
||||
|
||||
// 调用医保目录对照接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(deviceDefinition.getYbNo())) {
|
||||
R<?> r =
|
||||
ybService.directoryCheck(CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition.getId());
|
||||
if (200 != r.getCode()) {
|
||||
throw new RuntimeException("医保目录对照接口异常");
|
||||
}
|
||||
}
|
||||
|
||||
ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition();
|
||||
chargeItemDefinition.setYbType(deviceManageDto.getYbType()).setTypeCode(deviceManageDto.getItemTypeCode())
|
||||
.setInstanceTable(CommonConstants.TableName.ADM_DEVICE_DEFINITION)
|
||||
.setInstanceId(deviceDefinition.getId());
|
||||
.setInstanceId(deviceDefinition.getId()).setPrice(deviceManageDto.getRetailPrice())
|
||||
.setChargeName(deviceManageDto.getName());;
|
||||
// 插入操作记录
|
||||
iOperationRecordService.addEntityOperationRecord(DbOpType.UPDATE.getCode(),
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition);
|
||||
// 更新价格表
|
||||
boolean upItemDef = itemDefinitionServic.updateItem(chargeItemDefinition);
|
||||
|
||||
// 更新子表,修改购入价,条件:采购
|
||||
boolean upItemDetail1 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
|
||||
deviceManageDto.getPurchasePrice(), ConditionCode.PURCHASE.getCode());
|
||||
// 更新子表,修改零售价,条件:单位
|
||||
boolean upItemDetail2 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
|
||||
deviceManageDto.getRetailPrice(), ConditionCode.UNIT.getCode());
|
||||
// 更新子表,修改最高零售价,条件:限制
|
||||
boolean upItemDetail3 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
|
||||
deviceManageDto.getMaximumRetailPrice(), ConditionCode.LIMIT.getCode());
|
||||
|
||||
// 更新价格表
|
||||
return itemDefinitionServic.updateItem(chargeItemDefinition)
|
||||
return upItemDef && upItemDetail1 && upItemDetail2 && upItemDetail3
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
@@ -246,6 +274,9 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
|
||||
deviceDefinition.setStatusEnum(PublicationStatus.RETIRED.getValue());
|
||||
DeviceDefinitionList.add(deviceDefinition);
|
||||
}
|
||||
// 插入操作记录
|
||||
iOperationRecordService.addIdsOperationRecord(DbOpType.STOP.getCode(),
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION, ids);
|
||||
|
||||
// 更新器材信息
|
||||
return deviceDefinitionService.updateBatchById(DeviceDefinitionList)
|
||||
@@ -271,6 +302,9 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
|
||||
DeviceDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
DeviceDefinitionList.add(DeviceDefinition);
|
||||
}
|
||||
// 插入操作记录
|
||||
iOperationRecordService.addIdsOperationRecord(DbOpType.START.getCode(),
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION, ids);
|
||||
|
||||
// 更新器材信息
|
||||
return deviceDefinitionService.updateBatchById(DeviceDefinitionList)
|
||||
@@ -298,17 +332,29 @@ public class DeviceManageAppServiceImpl implements IDeviceManageAppService {
|
||||
deviceDefinition.setWbStr(ChineseConvertUtils.toWBFirstLetter(deviceDefinition.getName()));
|
||||
|
||||
// 新增外来器材目录
|
||||
deviceDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue());
|
||||
deviceDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
|
||||
if (deviceDefinitionService.addDevice(deviceDefinition)) {
|
||||
// 调用医保目录对照接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(deviceDefinition.getYbNo())) {
|
||||
R<?> r =
|
||||
ybService.directoryCheck(CommonConstants.TableName.ADM_DEVICE_DEFINITION, deviceDefinition.getId());
|
||||
if (200 != r.getCode()) {
|
||||
throw new RuntimeException("医保目录对照接口异常");
|
||||
}
|
||||
}
|
||||
// 插入操作记录
|
||||
iOperationRecordService.addEntityOperationRecord(DbOpType.INSERT.getCode(),
|
||||
CommonConstants.TableName.ADM_DEVICE_DEFINITION, 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());
|
||||
.setInstanceId(deviceDefinition.getId()).setPrice(deviceManageUpDto.getRetailPrice());
|
||||
|
||||
return itemDefinitionServic.addItem(itemUpFromDirectoryDto)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"}))
|
||||
|
||||
@@ -1,331 +0,0 @@
|
||||
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<DiagnosisTreatmentInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
|
||||
.map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
diagnosisTreatmentInitDto.setStatusFlagOptions(statusEnumOptions);
|
||||
// 获取执行科室
|
||||
LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Organization::getTypeEnum, OrganizationType.HOSPITAL_DEPARTMENT);
|
||||
List<Organization> organizations = iOrganizationService.list(queryWrapper);
|
||||
List<DiagnosisTreatmentInitDto.exeOrganization> exeOrganizations = organizations.stream()
|
||||
.map(exeOrg -> new DiagnosisTreatmentInitDto.exeOrganization(exeOrg.getId(), exeOrg.getName()))
|
||||
.collect(Collectors.toList());
|
||||
diagnosisTreatmentInitDto.setExeOrganizations(exeOrganizations);
|
||||
|
||||
// 获取诊目录疗分类
|
||||
List<SysDictData> diagnosisList =
|
||||
sysDictTypeService.selectDictDataByType(CommonConstants.DictName.DIAGNOSIS_CATEGORY_CODE);
|
||||
// 获取诊疗录疗分类
|
||||
List<DiagnosisTreatmentInitDto.dictCategoryCode> diagnosisCategories = diagnosisList.stream().map(
|
||||
category -> new DiagnosisTreatmentInitDto.dictCategoryCode(category.getDictValue(), category.getDictLabel()))
|
||||
.collect(Collectors.toList());
|
||||
diagnosisTreatmentInitDto.setDiagnosisCategoryOptions(diagnosisCategories);
|
||||
|
||||
// 查询医疗服务项类型
|
||||
List<SysDictData> medical_service_items =
|
||||
iSysDictTypeService.selectDictDataByType(ActivityDefCategory.MEDICAL_SERVICE_ITEM.getCode());
|
||||
// 获取医疗服务项List
|
||||
List<DiagnosisTreatmentInitDto.diseaseTreatmentType> diseaseTreatmentCategoryList = medical_service_items
|
||||
.stream().map(status -> new DiagnosisTreatmentInitDto.diseaseTreatmentType(status.getDictValue(),
|
||||
status.getDictLabel()))
|
||||
.collect(Collectors.toList());
|
||||
List<DiagnosisTreatmentInitDto.diseaseTreatmentCategory> 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<SysDictData> medical_service_items2 =
|
||||
// iSysDictTypeService.selectDictDataByType(ActivityDefCategory.TREATMENT_SURGERY.getCode());
|
||||
// // 获取手术与治疗List
|
||||
// List<DiagnosisTreatmentInitDto.diseaseTreatmentType> 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<DiagnosisTreatmentInitDto.statusEnumOption> typeEnumOptions = Stream.of(ActivityType.values())
|
||||
.map(status -> new DiagnosisTreatmentInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
diagnosisTreatmentInitDto.setTypeEnumOptions(typeEnumOptions);
|
||||
|
||||
// 获取是/否 列表
|
||||
// 获取状态
|
||||
List<DiagnosisTreatmentInitDto.statusEnumOption> 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<DiagnosisTreatmentDto> queryWrapper = HisQueryUtils.buildQueryWrapper(DiagnosisTreatmentSelParam,
|
||||
searchKey, new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request);
|
||||
|
||||
// 分页查询
|
||||
IPage<DiagnosisTreatmentDto> 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<Long> ids) {
|
||||
|
||||
List<ActivityDefinition> 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<Long> ids) {
|
||||
|
||||
List<ActivityDefinition> 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));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,21 +9,21 @@ 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.AssignSeqUtil;
|
||||
import com.core.common.utils.ChineseConvertUtils;
|
||||
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.AssignSeqEnum;
|
||||
import com.openhis.common.enums.ConditionDefinitionSource;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.common.enums.Whether;
|
||||
@@ -101,6 +101,10 @@ public class DiseaseManageAppServiceImpl implements IDiseaseManageAppService {
|
||||
e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbMatchFlag()));
|
||||
// 状态
|
||||
e.setStatusEnum_enumText(EnumUtils.getInfoByValue(PublicationStatus.class, e.getStatusEnum()));
|
||||
// 所属分类
|
||||
e.setSourceEnum_enumText(EnumUtils.getInfoByValue(ConditionDefinitionSource.class, e.getSourceEnum()));
|
||||
// 医保标记
|
||||
e.setYbFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getYbFlag()));
|
||||
});
|
||||
|
||||
// 返回【病种目录列表DTO】分页
|
||||
@@ -155,7 +159,7 @@ public class DiseaseManageAppServiceImpl implements IDiseaseManageAppService {
|
||||
for (Long detail : ids) {
|
||||
ConditionDefinition conditionDefinition = new ConditionDefinition();
|
||||
conditionDefinition.setId(detail);
|
||||
conditionDefinition.setStatusEnum(PublicationStatus.RETIRED.getValue());
|
||||
conditionDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
conditionDefinitionList.add(conditionDefinition);
|
||||
}
|
||||
// 更新病种信息
|
||||
@@ -200,7 +204,7 @@ public class DiseaseManageAppServiceImpl implements IDiseaseManageAppService {
|
||||
conditionDefinition.setConditionCode(code);
|
||||
|
||||
// 新增外来病种目录
|
||||
conditionDefinition.setStatusEnum(PublicationStatus.DRAFT.getValue());
|
||||
conditionDefinition.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
// 拼音码
|
||||
conditionDefinition.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(conditionDefinition.getName()));
|
||||
// 五笔码
|
||||
|
||||
@@ -1,30 +1,25 @@
|
||||
package com.openhis.web.datadictionary.appservice.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
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.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.ChargeItemDefDetail;
|
||||
import com.openhis.administration.domain.ChargeItemDefinition;
|
||||
import com.openhis.administration.mapper.ChargeItemDefAppMapper;
|
||||
import com.openhis.administration.mapper.ChargeItemDefinitionMapper;
|
||||
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.common.enums.ConditionCode;
|
||||
import com.openhis.web.datadictionary.appservice.IItemDefinitionService;
|
||||
import com.openhis.web.datadictionary.dto.MedicationManageUpDto;
|
||||
import com.openhis.web.datadictionary.dto.ItemUpFromDirectoryDto;
|
||||
|
||||
/**
|
||||
* 项目定价 实现
|
||||
@@ -40,7 +35,10 @@ public class ItemDefinitionServiceImpl implements IItemDefinitionService {
|
||||
|
||||
@Autowired
|
||||
IChargeItemDefDetailService chargeItemDefDetailService;
|
||||
|
||||
@Autowired
|
||||
ChargeItemDefinitionMapper chargeItemDefinitionMapper;
|
||||
@Autowired
|
||||
ChargeItemDefAppMapper chargeItemDefAppMapper;
|
||||
|
||||
/**
|
||||
* 添加药品/器材/诊疗的项目定价
|
||||
@@ -50,7 +48,6 @@ public class ItemDefinitionServiceImpl implements IItemDefinitionService {
|
||||
@Override
|
||||
public boolean addItem(ItemUpFromDirectoryDto itemUpFromDirectoryDto) {
|
||||
|
||||
|
||||
ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition();
|
||||
BeanUtils.copyProperties(itemUpFromDirectoryDto, chargeItemDefinition);
|
||||
|
||||
@@ -58,27 +55,31 @@ public class ItemDefinitionServiceImpl implements IItemDefinitionService {
|
||||
|
||||
if (insertCIDSuccess) {
|
||||
List<ChargeItemDefDetail> shargeItemDefDetails = new ArrayList<>();
|
||||
//插入购入价
|
||||
ChargeItemDefDetail chargeItemDefDetail1 = new ChargeItemDefDetail();
|
||||
chargeItemDefDetail1.setDefinitionId(chargeItemDefinition.getId())
|
||||
// 条件:采购
|
||||
.setConditionCode(ConditionCode.PROCUREMENT.getCode())
|
||||
// 购入价
|
||||
.setAmount(itemUpFromDirectoryDto.getPurchasePrice());
|
||||
shargeItemDefDetails.add(chargeItemDefDetail1);
|
||||
//插入零售价
|
||||
// 诊疗没有购入价
|
||||
if (!CommonConstants.TableName.WOR_ACTIVITY_DEFINITION.equals(itemUpFromDirectoryDto.getInstanceTable())) {
|
||||
// 插入购入价
|
||||
ChargeItemDefDetail chargeItemDefDetail1 = new ChargeItemDefDetail();
|
||||
chargeItemDefDetail1.setDefinitionId(chargeItemDefinition.getId())
|
||||
// 条件:采购
|
||||
.setConditionCode(ConditionCode.PURCHASE.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())
|
||||
// 条件:限制
|
||||
@@ -94,7 +95,6 @@ public class ItemDefinitionServiceImpl implements IItemDefinitionService {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改项目定价表
|
||||
*
|
||||
@@ -108,9 +108,37 @@ public class ItemDefinitionServiceImpl implements IItemDefinitionService {
|
||||
updateWrapper.eq(ChargeItemDefinition::getInstanceId, chargeItemDefinition.getInstanceId());
|
||||
updateWrapper.eq(ChargeItemDefinition::getInstanceTable, chargeItemDefinition.getInstanceTable())
|
||||
.set(ChargeItemDefinition::getYbType, chargeItemDefinition.getYbType())
|
||||
.set(ChargeItemDefinition::getTypeCode, chargeItemDefinition.getTypeCode());
|
||||
.set(ChargeItemDefinition::getTypeCode, chargeItemDefinition.getTypeCode())
|
||||
.set(ChargeItemDefinition::getPrice, chargeItemDefinition.getPrice())
|
||||
.set(ChargeItemDefinition::getChargeName, chargeItemDefinition.getChargeName());
|
||||
|
||||
return chargeItemDefinitionService.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目定价表子信息
|
||||
*
|
||||
* @param chargeItemDefinition 项目定价表子信息
|
||||
* @param price 价格
|
||||
* @param conditionCode 条件
|
||||
*/
|
||||
@Override
|
||||
public boolean updateItemDetail(ChargeItemDefinition chargeItemDefinition, BigDecimal price, String conditionCode) {
|
||||
|
||||
LambdaQueryWrapper<ChargeItemDefinition> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ChargeItemDefinition::getInstanceId, chargeItemDefinition.getInstanceId())
|
||||
.eq(ChargeItemDefinition::getInstanceTable, chargeItemDefinition.getInstanceTable());
|
||||
|
||||
ChargeItemDefinition cItemDefObj = chargeItemDefinitionMapper.selectOne(queryWrapper);
|
||||
|
||||
// 关联项目和代码位为key,更新表
|
||||
LambdaUpdateWrapper<ChargeItemDefDetail> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.eq(ChargeItemDefDetail::getDefinitionId, cItemDefObj.getId());
|
||||
updateWrapper.eq(ChargeItemDefDetail::getConditionCode, conditionCode).set(ChargeItemDefDetail::getAmount,
|
||||
price);
|
||||
|
||||
return chargeItemDefDetailService.update(null, updateWrapper);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,8 +13,6 @@ 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;
|
||||
@@ -26,6 +24,7 @@ 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.common.utils.poi.ExcelUtil;
|
||||
import com.core.system.service.ISysDictTypeService;
|
||||
@@ -41,10 +40,15 @@ 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.IMedicationDispenseService;
|
||||
import com.openhis.medication.service.IMedicationService;
|
||||
import com.openhis.sys.service.IOperationRecordService;
|
||||
import com.openhis.web.datadictionary.appservice.IItemDefinitionService;
|
||||
import com.openhis.web.datadictionary.appservice.IMedicationManageAppService;
|
||||
import com.openhis.web.datadictionary.dto.*;
|
||||
import com.openhis.web.datadictionary.mapper.MedicationManageSearchMapper;
|
||||
import com.openhis.workflow.service.ISupplyRequestService;
|
||||
import com.openhis.yb.service.YbManager;
|
||||
|
||||
/**
|
||||
* 药品目录 impl
|
||||
@@ -73,7 +77,19 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
|
||||
private IItemDefinitionService itemDefinitionServic;
|
||||
|
||||
@Autowired(required = false)
|
||||
AssignSeqUtil assignSeqUtil;
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
|
||||
@Autowired
|
||||
private YbManager ybService;
|
||||
|
||||
@Autowired
|
||||
private IOperationRecordService iOperationRecordService;
|
||||
|
||||
@Autowired
|
||||
private ISupplyRequestService supplyRequestService;
|
||||
|
||||
@Autowired
|
||||
private IMedicationDispenseService medicationDispenseService;
|
||||
|
||||
/**
|
||||
* 药品目录初始化
|
||||
@@ -129,6 +145,11 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
|
||||
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 医保等级List
|
||||
List<MedicationManageInitDto.statusEnumOption> chrgitmLvOptions = Stream.of(InsuranceLevel.values())
|
||||
.map(status -> new MedicationManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
medicationManageInitDto.setStatusFlagOptions(statusEnumOptions);
|
||||
medicationManageInitDto.setDomainFlagOptions(domainEnumOptions);
|
||||
medicationManageInitDto.setSupplierListOptions(supplierListOptions);
|
||||
@@ -137,6 +158,7 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
|
||||
medicationManageInitDto.setStatusRestrictedOptions(statusRestrictedOptions);
|
||||
medicationManageInitDto.setPartAttributeEnumOptions(partAttributeEnumOptions);
|
||||
medicationManageInitDto.setTempOrderSplitPropertyEnumOptions(tempOrderSplitPropertyOptions);
|
||||
medicationManageInitDto.setChrgitmLvOptions(chrgitmLvOptions);
|
||||
|
||||
return R.ok(medicationManageInitDto);
|
||||
}
|
||||
@@ -214,7 +236,15 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
|
||||
*/
|
||||
@Override
|
||||
public R<?> editMedication(@Validated @RequestBody MedicationManageUpDto medicationManageUpDto) {
|
||||
|
||||
// 校验是否可以编辑
|
||||
boolean result = supplyRequestService.verifyAbleEdit(medicationManageUpDto.getMedicationDefId());
|
||||
if (result) {
|
||||
return R.fail("该药品已经发生过业务,不可编辑");
|
||||
}
|
||||
// boolean result = medicationDispenseService.verifyAbleEdit(medicationManageUpDto.getMedicationDefId());
|
||||
// if (result) {
|
||||
// return R.fail("该药品已经发生过业务,不可编辑");
|
||||
// }
|
||||
MedicationDefinition medicationDefinition = new MedicationDefinition();
|
||||
Medication medication = new Medication();
|
||||
BeanUtils.copyProperties(medicationManageUpDto, medication); // 子表信息
|
||||
@@ -233,19 +263,46 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
|
||||
chargeItemDefinition.setYbType(medicationManageUpDto.getYbType())
|
||||
.setTypeCode(medicationManageUpDto.getTypeCode())
|
||||
.setInstanceTable(CommonConstants.TableName.MED_MEDICATION_DEFINITION)
|
||||
.setInstanceId(medicationManageUpDto.getMedicationDefId());
|
||||
.setInstanceId(medicationManageUpDto.getMedicationDefId()).setPrice(medicationManageUpDto.getRetailPrice())
|
||||
.setChargeName(medicationManageUpDto.getName());
|
||||
|
||||
// 更新子表药品信息
|
||||
if (medicationService.updateById(medication)) {
|
||||
|
||||
// 更新主表药品信息
|
||||
boolean updateMedicationDefinition = medicationDefinitionService.updateById(medicationDefinition);
|
||||
if (updateMedicationDefinition) {
|
||||
// 调用医保目录对照接口
|
||||
String ybSwitch =
|
||||
SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(medicationDefinition.getYbNo())) {
|
||||
R<?> r = ybService.directoryCheck(CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
medicationDefinition.getId());
|
||||
if (200 != r.getCode()) {
|
||||
throw new RuntimeException("医保目录对照接口异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 插入操作记录
|
||||
iOperationRecordService.addEntityOperationRecord(DbOpType.UPDATE.getCode(),
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, medication);
|
||||
|
||||
// 更新价格表
|
||||
boolean updateChargeItemDefinition = itemDefinitionServic.updateItem(chargeItemDefinition);
|
||||
// 更新子表,修改购入价,条件:采购
|
||||
boolean upItemDetail1 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
|
||||
medicationManageUpDto.getPurchasePrice(), ConditionCode.PURCHASE.getCode());
|
||||
// 更新子表,修改零售价,条件:单位
|
||||
boolean upItemDetail2 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
|
||||
medicationManageUpDto.getRetailPrice(), ConditionCode.UNIT.getCode());
|
||||
// 更新子表,修改最高零售价,条件:限制
|
||||
boolean upItemDetail3 = itemDefinitionServic.updateItemDetail(chargeItemDefinition,
|
||||
medicationManageUpDto.getMaximumRetailPrice(), ConditionCode.LIMIT.getCode());
|
||||
|
||||
return (updateMedicationDefinition && updateChargeItemDefinition)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"药品目录"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
return (updateMedicationDefinition && updateChargeItemDefinition && upItemDetail1 && upItemDetail2
|
||||
&& upItemDetail3)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"药品目录"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
} else {
|
||||
return R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
@@ -282,9 +339,12 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
|
||||
for (Long detail : ids) {
|
||||
Medication medication = new Medication();
|
||||
medication.setId(detail);
|
||||
medication.setStatusEnum(PublicationStatus.RETIRED);
|
||||
medication.setStatusEnum(PublicationStatus.RETIRED.getValue());
|
||||
medicationList.add(medication);
|
||||
}
|
||||
// 插入操作记录
|
||||
iOperationRecordService.addIdsOperationRecord(DbOpType.STOP.getCode(),
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, ids);
|
||||
// 更新药品信息
|
||||
return medicationService.updateBatchById(medicationList)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"药品目录"}))
|
||||
@@ -305,9 +365,12 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
|
||||
for (Long detail : ids) {
|
||||
Medication medication = new Medication();
|
||||
medication.setId(detail);
|
||||
medication.setStatusEnum(PublicationStatus.ACTIVE);
|
||||
medication.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
medicationList.add(medication);
|
||||
}
|
||||
// 插入操作记录
|
||||
iOperationRecordService.addIdsOperationRecord(DbOpType.START.getCode(),
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, ids);
|
||||
// 更新药品信息
|
||||
return medicationService.updateBatchById(medicationList)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"药品目录"}))
|
||||
@@ -324,8 +387,9 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
|
||||
|
||||
MedicationDetail medicationDetail = new MedicationDetail();
|
||||
BeanUtils.copyProperties(medicationManageUpDto, medicationDetail);
|
||||
medicationDetail.setStatusEnum(PublicationStatus.ACTIVE.getValue());
|
||||
// 使用10位数基础采番
|
||||
String code = assignSeqUtil.getSeq(AssignSeqEnum.MEDICATION_NUM.getPrefix(),10);
|
||||
String code = assignSeqUtil.getSeq(AssignSeqEnum.MEDICATION_NUM.getPrefix(), 10);
|
||||
medicationDetail.setBusNo(code);
|
||||
// 拼音码
|
||||
medicationDetail.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(medicationDetail.getName()));
|
||||
@@ -338,7 +402,18 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
|
||||
|
||||
// 新增主表外来药品目录
|
||||
if (medicationDefinitionService.addMedication(medicationDetail)) {
|
||||
|
||||
// 调用医保目录对照接口
|
||||
String ybSwitch = SecurityUtils.getLoginUser().getOptionJson().getString(CommonConstants.Option.YB_SWITCH); // 医保开关
|
||||
if (Whether.YES.getCode().equals(ybSwitch) && StringUtils.isNotEmpty(medicationDetail.getYbNo())) {
|
||||
R<?> r = ybService.directoryCheck(CommonConstants.TableName.MED_MEDICATION_DEFINITION,
|
||||
medicationDetail.getId());
|
||||
if (200 != r.getCode()) {
|
||||
throw new RuntimeException("医保目录对照接口异常");
|
||||
}
|
||||
}
|
||||
// 插入操作记录
|
||||
iOperationRecordService.addEntityOperationRecord(DbOpType.INSERT.getCode(),
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION, medicationDetail);
|
||||
// 新增子表外来药品目录
|
||||
boolean insertMedicationSuccess = medicationService.addMedication(medicationDetail);
|
||||
ItemUpFromDirectoryDto itemUpFromDirectoryDto = new ItemUpFromDirectoryDto();
|
||||
@@ -346,10 +421,8 @@ public class MedicationManageAppServiceImpl implements IMedicationManageAppServi
|
||||
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())
|
||||
.setEffectiveStart(DateUtils.getNowDate()).setOrgId(SecurityUtils.getLoginUser().getOrgId())
|
||||
.setConditionFlag(Whether.YES.getValue()).setChargeName(medicationDetail.getName())
|
||||
.setPrice(medicationManageUpDto.getRetailPrice());
|
||||
|
||||
// 添加药品成功后,添加相应的条件价格表信息
|
||||
|
||||
@@ -12,35 +12,35 @@ 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;
|
||||
import com.openhis.web.datadictionary.dto.SupplierInitDto;
|
||||
import com.openhis.web.datadictionary.dto.SupplierSearchParam;
|
||||
import com.openhis.web.datadictionary.dto.SupplierUpDto;
|
||||
import com.core.common.exception.ServiceException;
|
||||
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.AssignSeqUtil;
|
||||
import com.core.common.utils.ChineseConvertUtils;
|
||||
import com.core.common.utils.MessageUtils;
|
||||
import com.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
import com.openhis.administration.domain.Supplier;
|
||||
import com.openhis.administration.mapper.SupplierMapper;
|
||||
import com.openhis.administration.service.ISupplierService;
|
||||
import com.openhis.common.constant.CommonConstants;
|
||||
import com.openhis.common.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.AssignSeqEnum;
|
||||
import com.openhis.common.enums.DelFlag;
|
||||
import com.openhis.common.enums.SupplierType;
|
||||
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 org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.openhis.web.datadictionary.appservice.ISupplierManagementAppService;
|
||||
import com.openhis.web.datadictionary.dto.SupplierDto;
|
||||
import com.openhis.web.datadictionary.dto.SupplierInitDto;
|
||||
import com.openhis.web.datadictionary.dto.SupplierSearchParam;
|
||||
import com.openhis.web.datadictionary.dto.SupplierUpDto;
|
||||
|
||||
/**
|
||||
* 厂商/产地 impl
|
||||
@@ -56,6 +56,9 @@ public class SupplierManagementAppServiceImpl implements ISupplierManagementAppS
|
||||
@Autowired
|
||||
private SupplierMapper supplierMapper;
|
||||
|
||||
@Autowired(required = false)
|
||||
AssignSeqUtil assignSeqUtil;
|
||||
|
||||
/**
|
||||
* 厂商/产地初始化
|
||||
*
|
||||
@@ -83,24 +86,26 @@ public class SupplierManagementAppServiceImpl implements ISupplierManagementAppS
|
||||
* @return 厂商/产地查询结果
|
||||
*/
|
||||
@Override
|
||||
public R<?> getSupplierList(SupplierSearchParam supplierSearchParam, String searchKey,
|
||||
Integer typeEnum, Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
public R<?> getSupplierList(SupplierSearchParam supplierSearchParam, String searchKey, Integer typeEnum,
|
||||
Integer pageNo, Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
// 构建查询条件
|
||||
QueryWrapper<Supplier> 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<Supplier> queryWrapper = HisQueryUtils.buildQueryWrapper(
|
||||
supplierSearchParam, searchKey, new HashSet<>(Arrays.asList(CommonConstants.FieldName.BusNo,
|
||||
CommonConstants.FieldName.Name, CommonConstants.FieldName.PyStr, CommonConstants.FieldName.WbStr)),
|
||||
request);
|
||||
if (StringUtils.isNotNull(typeEnum)) {
|
||||
queryWrapper.eq(CommonConstants.FieldName.TypeEnum, typeEnum);
|
||||
}
|
||||
|
||||
// 设置排序
|
||||
queryWrapper.orderByAsc("bus_no");
|
||||
queryWrapper.eq(CommonConstants.FieldName.DeleteFlag, DelFlag.NO.getCode())
|
||||
.orderByDesc(CommonConstants.FieldName.BusNo);
|
||||
// 分页查询
|
||||
Page<SupplierDto> supplierPage =
|
||||
HisPageUtils.selectPage(supplierMapper, queryWrapper, pageNo, pageSize, SupplierDto.class);
|
||||
// 枚举类回显赋值
|
||||
supplierPage.getRecords().forEach(e -> {
|
||||
e.setActiveFlag_enumText(EnumUtils.getInfoByValue(AccountStatus.class, e.getActiveFlag()));
|
||||
e.setActiveFlag_enumText(EnumUtils.getInfoByValue(Whether.class, e.getActiveFlag()));
|
||||
// 厂商类型
|
||||
e.setTypeEnum_enumText(EnumUtils.getInfoByValue(SupplierType.class, e.getTypeEnum()));
|
||||
});
|
||||
@@ -116,12 +121,25 @@ public class SupplierManagementAppServiceImpl implements ISupplierManagementAppS
|
||||
@Override
|
||||
public R<?> addSupplyRequest(SupplierUpDto supplierUpDto) {
|
||||
|
||||
// 重复添加校验
|
||||
// 根据名字,地址,类型查询供应商信息
|
||||
List<Supplier> supplierList = supplierService.getsupplierList(supplierUpDto.getName(),
|
||||
supplierUpDto.getAddress(), supplierUpDto.getTypeEnum());
|
||||
if(!supplierList.isEmpty()){
|
||||
throw new ServiceException("数据已添加,请勿重复添加");
|
||||
}
|
||||
|
||||
Supplier supplierInfo = new Supplier();
|
||||
BeanUtils.copyProperties(supplierUpDto, supplierInfo);
|
||||
// 设置拼音首拼
|
||||
supplierInfo.setPyStr(ChineseConvertUtils.toPinyinFirstLetter(supplierInfo.getName()));
|
||||
// 设置五笔首拼
|
||||
supplierInfo.setWbStr(ChineseConvertUtils.toWBFirstLetter(supplierInfo.getName()));
|
||||
|
||||
// 使用基础采番,设置供应商编码,10位数
|
||||
String code = assignSeqUtil.getSeq(AssignSeqEnum.SUPPLIER_BUS_NO.getPrefix(), 10);
|
||||
supplierInfo.setBusNo(code);
|
||||
|
||||
return supplierService.addSupplier(supplierInfo)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"厂商/供应商信息"}))
|
||||
: R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null));
|
||||
|
||||
@@ -9,7 +9,6 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.administration.service.IDeviceDefinitionService;
|
||||
import com.openhis.web.datadictionary.appservice.IDeviceManageAppService;
|
||||
import com.openhis.web.datadictionary.dto.DeviceManageDto;
|
||||
import com.openhis.web.datadictionary.dto.DeviceManageSelParam;
|
||||
@@ -29,43 +28,18 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class DeviceManageController {
|
||||
private final IDeviceDefinitionService iDeviceDefinitionService;
|
||||
// private final DeviceDefinitionMapper DeviceDefinitionMapper;
|
||||
// private final IOrganizationService iOrganizationService;
|
||||
|
||||
@Autowired
|
||||
private IDeviceManageAppService deviceManageAppService;
|
||||
|
||||
/**
|
||||
* TODO: 器材目录初期查询
|
||||
* 器材目录初期查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/init")
|
||||
public R<?> getDeviceManageInit() {
|
||||
|
||||
return deviceManageAppService.getDeviceManageInit();
|
||||
|
||||
// DeviceManageInitDto deviceManageInitDto = new DeviceManageInitDto();
|
||||
// // 获取状态
|
||||
// List<DeviceManageInitDto.statusEnumOption> statusEnumOptions = Stream.of(PublicationStatus.values())
|
||||
// .map(status -> new DeviceManageInitDto.statusEnumOption(status.getValue(), status.getInfo()))
|
||||
// .collect(Collectors.toList());
|
||||
// deviceManageInitDto.setStatusFlagOptions(statusEnumOptions);
|
||||
// // 获取执行科室
|
||||
// LambdaQueryWrapper<Organization> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(Organization::getTypeEnum, OrganizationType.HOSPITAL_DEPARTMENT);
|
||||
// List<Organization> organizations = iOrganizationService.list(queryWrapper);
|
||||
// List<DeviceManageInitDto.exeOrganization> exeOrganizations = organizations.stream()
|
||||
// .map(exeOrg -> new DeviceManageInitDto.exeOrganization(exeOrg.getId(), exeOrg.getName()))
|
||||
// .collect(Collectors.toList());
|
||||
// deviceManageInitDto.setExeOrganizations(exeOrganizations);
|
||||
// // 获取分类
|
||||
// List<DeviceManageInitDto.deviceCategory> deviceCategories = Stream.of(DeviceCategory.values())
|
||||
// .map(category -> new DeviceManageInitDto.deviceCategory(category.getValue(), category.getInfo()))
|
||||
// .collect(Collectors.toList());
|
||||
// deviceManageInitDto.setDeviceCategories(deviceCategories);
|
||||
// return R.ok(deviceManageInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,33 +56,7 @@ public class DeviceManageController {
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
return deviceManageAppService.getDevicePage(deviceManageSelParam, searchKey, pageNo, pageSize, request);
|
||||
|
||||
// // 构建查询条件
|
||||
// QueryWrapper<DeviceDefinition> queryWrapper = HisQueryUtils.buildQueryWrapper(deviceManageSelParam,
|
||||
// searchKey,
|
||||
// new HashSet<>(Arrays.asList("bus_no", "name", "py_str", "wb_str")), request);
|
||||
// // 设置排序
|
||||
// queryWrapper.orderByAsc("bus_no");
|
||||
//
|
||||
// // 分页查询
|
||||
// Page<DeviceManageDto> deviceManagePage =
|
||||
// HisPageUtils.selectPage(DeviceDefinitionMapper, queryWrapper, pageNo, pageSize, DeviceManageDto.class);
|
||||
//
|
||||
// deviceManagePage.getRecords().forEach(e -> {
|
||||
// // 高值器材标志枚举类回显赋值
|
||||
// e.setHvcmFlag_enumText(EnumUtils.getInfoByValue(WhetherContainUnknown.class, e.getHvcmFlag()));
|
||||
// // 医保标记枚举类回显赋值
|
||||
// e.setYbFlag_enumText(EnumUtils.getInfoByValue(WhetherContainUnknown.class, e.getYbFlag()));
|
||||
// // 医保对码标记枚举类回显赋值
|
||||
// e.setYbMatchFlag_enumText(EnumUtils.getInfoByValue(WhetherContainUnknown.class, e.getYbMatchFlag()));
|
||||
// // 过敏标记枚举类回显赋值
|
||||
// e.setAllergenFlag_enumText(EnumUtils.getInfoByValue(WhetherContainUnknown.class, e.getAllergenFlag()));
|
||||
// });
|
||||
//
|
||||
// // 返回【器材目录列表DTO】分页
|
||||
// return R.ok(deviceManagePage);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,22 +92,7 @@ public class DeviceManageController {
|
||||
*/
|
||||
@PutMapping("/information-stop")
|
||||
public R<?> editDeviceStop(@RequestBody List<Long> ids) {
|
||||
|
||||
return deviceManageAppService.editDeviceStop(ids);
|
||||
|
||||
// List<DeviceDefinition> DeviceDefinitionList = new CopyOnWriteArrayList<>();
|
||||
//
|
||||
// // 取得更新值
|
||||
// for (Long detail : ids) {
|
||||
// DeviceDefinition DeviceDefinition = new DeviceDefinition();
|
||||
// DeviceDefinition.setId(detail);
|
||||
// DeviceDefinition.setStatusEnum(PublicationStatus.RETIRED);
|
||||
// DeviceDefinitionList.add(DeviceDefinition);
|
||||
// }
|
||||
// // 更新器材信息
|
||||
// return iDeviceDefinitionService.updateBatchById(DeviceDefinitionList)
|
||||
// ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"}))
|
||||
// : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,42 +103,18 @@ public class DeviceManageController {
|
||||
*/
|
||||
@PutMapping("/information-start")
|
||||
public R<?> editDeviceStart(@RequestBody List<Long> ids) {
|
||||
|
||||
return deviceManageAppService.editDeviceStart(ids);
|
||||
|
||||
// List<DeviceDefinition> DeviceDefinitionList = new CopyOnWriteArrayList<>();
|
||||
//
|
||||
// // 取得更新值
|
||||
// for (Long detail : ids) {
|
||||
// DeviceDefinition DeviceDefinition = new DeviceDefinition();
|
||||
// DeviceDefinition.setId(detail);
|
||||
// DeviceDefinition.setStatusEnum(PublicationStatus.ACTIVE);
|
||||
// DeviceDefinitionList.add(DeviceDefinition);
|
||||
// }
|
||||
// // 更新器材信息
|
||||
// return iDeviceDefinitionService.updateBatchById(DeviceDefinitionList)
|
||||
// ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"}))
|
||||
// : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增外来器材目录
|
||||
* 新增器材目录
|
||||
*
|
||||
* @param deviceManageUpDto 器材目录
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/information")
|
||||
public R<?> addDevice(@Validated @RequestBody DeviceManageUpDto deviceManageUpDto) {
|
||||
|
||||
return deviceManageAppService.addDevice(deviceManageUpDto);
|
||||
|
||||
// DeviceDefinition DeviceDefinition = new DeviceDefinition();
|
||||
// BeanUtils.copyProperties(deviceManageUpDto, DeviceDefinition);
|
||||
// // 新增外来器材目录
|
||||
// DeviceDefinition.setStatusEnum(PublicationStatus.DRAFT);
|
||||
// return iDeviceDefinitionService.addDevice(DeviceDefinition)
|
||||
// ? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"器材目录"}))
|
||||
// : R.fail(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00008, null));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.core.common.core.domain.R;
|
||||
import com.openhis.web.datadictionary.appservice.IDiagnosisTreatmentManageAppService;
|
||||
import com.openhis.web.datadictionary.appservice.IDiagTreatMAppService;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentDto;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentSelParam;
|
||||
import com.openhis.web.datadictionary.dto.DiagnosisTreatmentUpDto;
|
||||
@@ -30,7 +30,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class DiagnosisTreatmentController {
|
||||
|
||||
@Autowired
|
||||
private IDiagnosisTreatmentManageAppService diagnosisTreatmentManageAppService;
|
||||
private IDiagTreatMAppService diagTreatMAppService;
|
||||
|
||||
/**
|
||||
* 诊疗目录初期查询
|
||||
@@ -39,8 +39,7 @@ public class DiagnosisTreatmentController {
|
||||
*/
|
||||
@GetMapping("/init")
|
||||
public R<?> getDiseaseTreatmentInit() {
|
||||
|
||||
return diagnosisTreatmentManageAppService.getDiseaseTreatmentInit();
|
||||
return diagTreatMAppService.getDiseaseTreatmentInit();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,9 +56,7 @@ public class DiagnosisTreatmentController {
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest request) {
|
||||
|
||||
// 返回【诊疗目录列表DTO】分页
|
||||
return diagnosisTreatmentManageAppService.getDiseaseTreatmentPage(DiagnosisTreatmentSelParam, searchKey, pageNo,
|
||||
return diagTreatMAppService.getDiseaseTreatmentPage(DiagnosisTreatmentSelParam, searchKey, pageNo,
|
||||
pageSize, request);
|
||||
}
|
||||
|
||||
@@ -71,8 +68,7 @@ public class DiagnosisTreatmentController {
|
||||
*/
|
||||
@GetMapping("/information-one")
|
||||
public R<?> getDiseaseTreatmentOne(@RequestParam Long id) {
|
||||
|
||||
return diagnosisTreatmentManageAppService.getDiseaseTreatmentOne(id);
|
||||
return diagTreatMAppService.getDiseaseTreatmentOne(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,8 +79,7 @@ public class DiagnosisTreatmentController {
|
||||
*/
|
||||
@PutMapping("/information")
|
||||
public R<?> editDiseaseTreatment(@RequestBody DiagnosisTreatmentUpDto diagnosisTreatmentUpDto) {
|
||||
|
||||
return diagnosisTreatmentManageAppService.editDiseaseTreatment(diagnosisTreatmentUpDto);
|
||||
return diagTreatMAppService.editDiseaseTreatment(diagnosisTreatmentUpDto);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,8 +90,7 @@ public class DiagnosisTreatmentController {
|
||||
*/
|
||||
@PutMapping("/information-stop")
|
||||
public R<?> editDiseaseTreatmentStop(@RequestBody List<Long> ids) {
|
||||
|
||||
return diagnosisTreatmentManageAppService.editDiseaseTreatmentStop(ids);
|
||||
return diagTreatMAppService.editDiseaseTreatmentStop(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +101,7 @@ public class DiagnosisTreatmentController {
|
||||
*/
|
||||
@PutMapping("/information-start")
|
||||
public R<?> editDiseaseTreatmentStart(@RequestBody List<Long> ids) {
|
||||
return diagnosisTreatmentManageAppService.editDiseaseTreatmentStart(ids);
|
||||
return diagTreatMAppService.editDiseaseTreatmentStart(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,7 +112,7 @@ public class DiagnosisTreatmentController {
|
||||
*/
|
||||
@PostMapping("/information")
|
||||
public R<?> addDiseaseTreatment(@Validated @RequestBody DiagnosisTreatmentUpDto diagnosisTreatmentUpDto) {
|
||||
return diagnosisTreatmentManageAppService.addDiseaseTreatment(diagnosisTreatmentUpDto);
|
||||
return diagTreatMAppService.addDiseaseTreatment(diagnosisTreatmentUpDto);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,206 +3,98 @@
|
||||
*/
|
||||
package com.openhis.web.datadictionary.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.ibatis.builder.MapperBuilderAssistant;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.MybatisConfiguration;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
||||
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.core.common.utils.StringUtils;
|
||||
import com.core.common.utils.bean.BeanUtils;
|
||||
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.constant.PromptMsgConstant;
|
||||
import com.openhis.common.enums.ChargeItemEnum;
|
||||
import com.openhis.common.enums.ItemType;
|
||||
import com.openhis.common.enums.ChargeItemContext;
|
||||
import com.openhis.common.enums.PublicationStatus;
|
||||
import com.openhis.web.datadictionary.dto.ChargeItemDefPageDto;
|
||||
import com.openhis.web.datadictionary.dto.ChargeItemOptionDto;
|
||||
import com.openhis.web.datadictionary.dto.ItemDefSearchParam;
|
||||
import com.openhis.web.datadictionary.appservice.ItemDefinitionAppService;
|
||||
import com.openhis.web.datadictionary.dto.ItemDefinitionDto;
|
||||
import com.openhis.web.datadictionary.mapper.ChargeItemDefSearchMapper;
|
||||
import com.openhis.web.datadictionary.dto.ItemDefinitionInitDto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 项目定价
|
||||
*
|
||||
* @author zxy
|
||||
* @date 2025-02-21
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/dict-dictionary/definition")
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
public class ItemDefinitionController {
|
||||
|
||||
@Autowired(required = false)
|
||||
private IChargeItemDefinitionService chargeItemDefinitionService;
|
||||
@Autowired(required = false)
|
||||
private IChargeItemDefDetailService chargeItemDefAppService;
|
||||
@Autowired(required = false)
|
||||
private ChargeItemDefSearchMapper chargeItemDefSearchMapper;
|
||||
@Autowired(required = false)
|
||||
private AssignSeqUtil assignSeqUtil;
|
||||
private final ItemDefinitionAppService itemDefinitionAppService;
|
||||
|
||||
/**
|
||||
* 项目定价列表
|
||||
*
|
||||
* @param itemDefSearchParam 查询条件
|
||||
* @return 项目定价列表
|
||||
* 项目定价基础数据初始化
|
||||
*
|
||||
* @return 项目定价基础数据
|
||||
*/
|
||||
@GetMapping(value = "/init")
|
||||
public R<?> getInitDefinitionOptions(ItemDefSearchParam itemDefSearchParam) {
|
||||
/// TODO: 2025/2/26 收费项目下拉框 暂未做成用枚举代替,后续替换
|
||||
List<ChargeItemOptionDto> chargeItemOptions = new ArrayList<>();
|
||||
if (ItemType.MEDICINE.getCode().equals(itemDefSearchParam.getDefinitionType())) {
|
||||
// 西药
|
||||
chargeItemOptions.add(new ChargeItemOptionDto(ChargeItemEnum.WEST_MEDICINE.getCode(),
|
||||
ChargeItemEnum.WEST_MEDICINE.getInfo()));
|
||||
// 中药饮片
|
||||
chargeItemOptions.add(new ChargeItemOptionDto(ChargeItemEnum.CHINESE_MEDICINE_SLICES_FEE.getCode(),
|
||||
ChargeItemEnum.CHINESE_MEDICINE_SLICES_FEE.getInfo()));
|
||||
// 中成药
|
||||
chargeItemOptions.add(new ChargeItemOptionDto(ChargeItemEnum.CHINESE_MEDICINE_FEE.getCode(),
|
||||
ChargeItemEnum.CHINESE_MEDICINE_FEE.getInfo()));
|
||||
// 其他
|
||||
chargeItemOptions
|
||||
.add(new ChargeItemOptionDto(ChargeItemEnum.OTHER_FEE.getCode(), ChargeItemEnum.OTHER_FEE.getInfo()));
|
||||
} else if (ItemType.DEVICE.getCode().equals(itemDefSearchParam.getDefinitionType())) {
|
||||
// 卫生材料
|
||||
chargeItemOptions.add(new ChargeItemOptionDto(ChargeItemEnum.SANITARY_MATERIALS_FEE.getCode(),
|
||||
ChargeItemEnum.SANITARY_MATERIALS_FEE.getInfo()));
|
||||
// 其他
|
||||
chargeItemOptions
|
||||
.add(new ChargeItemOptionDto(ChargeItemEnum.OTHER_FEE.getCode(), ChargeItemEnum.OTHER_FEE.getInfo()));
|
||||
} else if (ItemType.ACTIVITY.getCode().equals(itemDefSearchParam.getDefinitionType())) {
|
||||
// 床位
|
||||
chargeItemOptions
|
||||
.add(new ChargeItemOptionDto(ChargeItemEnum.BED_FEE.getCode(), ChargeItemEnum.BED_FEE.getInfo()));
|
||||
// 诊察
|
||||
chargeItemOptions.add(new ChargeItemOptionDto(ChargeItemEnum.DIAGNOSTIC_FEE.getCode(),
|
||||
ChargeItemEnum.DIAGNOSTIC_FEE.getInfo()));
|
||||
// 检查
|
||||
chargeItemOptions
|
||||
.add(new ChargeItemOptionDto(ChargeItemEnum.CHECK_FEE.getCode(), ChargeItemEnum.CHECK_FEE.getInfo()));
|
||||
// 化验
|
||||
chargeItemOptions.add(new ChargeItemOptionDto(ChargeItemEnum.DIAGNOSTIC_TEST_FEE.getCode(),
|
||||
ChargeItemEnum.DIAGNOSTIC_TEST_FEE.getInfo()));
|
||||
// 治疗
|
||||
chargeItemOptions.add(new ChargeItemOptionDto(ChargeItemEnum.MEDICAL_EXPENSE_FEE.getCode(),
|
||||
ChargeItemEnum.MEDICAL_EXPENSE_FEE.getInfo()));
|
||||
// 手术
|
||||
chargeItemOptions.add(new ChargeItemOptionDto(ChargeItemEnum.OPERATION_FEE.getCode(),
|
||||
ChargeItemEnum.OPERATION_FEE.getInfo()));
|
||||
// 护理费
|
||||
chargeItemOptions.add(
|
||||
new ChargeItemOptionDto(ChargeItemEnum.NURSING_FEE.getCode(), ChargeItemEnum.NURSING_FEE.getInfo()));
|
||||
// 其他
|
||||
chargeItemOptions.add(new ChargeItemOptionDto(ChargeItemEnum.GENERAL_CONSULTATION_FEE.getCode(),
|
||||
ChargeItemEnum.GENERAL_CONSULTATION_FEE.getInfo()));
|
||||
// 挂号
|
||||
chargeItemOptions.add(new ChargeItemOptionDto(ChargeItemEnum.REGISTRATION_FEE.getCode(),
|
||||
ChargeItemEnum.REGISTRATION_FEE.getInfo()));
|
||||
// 其他
|
||||
chargeItemOptions
|
||||
.add(new ChargeItemOptionDto(ChargeItemEnum.OTHER_FEE.getCode(), ChargeItemEnum.OTHER_FEE.getInfo()));
|
||||
}
|
||||
return R.ok(chargeItemOptions);
|
||||
public R<?> init() {
|
||||
ItemDefinitionInitDto itemDefinitionInitDto = new ItemDefinitionInitDto();
|
||||
// 状态
|
||||
List<ItemDefinitionInitDto.PublicationStatusOption> publicationStatusOptions =
|
||||
Stream.of(PublicationStatus.values())
|
||||
.map(status -> new ItemDefinitionInitDto.PublicationStatusOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
itemDefinitionInitDto.setPublicationStatusOptions(publicationStatusOptions);
|
||||
// 收费项目类型
|
||||
List<ItemDefinitionInitDto.ChargeItemContextOption> chargeItemContextOptions =
|
||||
Stream.of(ChargeItemContext.values())
|
||||
.map(status -> new ItemDefinitionInitDto.ChargeItemContextOption(status.getValue(), status.getInfo()))
|
||||
.collect(Collectors.toList());
|
||||
itemDefinitionInitDto.setChargeItemContextOptions(chargeItemContextOptions);
|
||||
return R.ok(itemDefinitionInitDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目定价列表
|
||||
*
|
||||
* @param chargeItemDefPageDto 查询条件
|
||||
* @param pageNo 当前页码
|
||||
* @param pageSize 查询条数
|
||||
* @param request 请求数据
|
||||
* @return 项目定价列表
|
||||
* 项目定价 分页
|
||||
*
|
||||
* @param itemDefinitionDto dto
|
||||
* @param searchKey 模糊查询关键字
|
||||
* @param chargeItemContext 收费项目类型
|
||||
* @param pageNo 当前页
|
||||
* @param pageSize 每页多少条
|
||||
* @return 项目定价
|
||||
*/
|
||||
@GetMapping(value = "/item-definition-page")
|
||||
public R<?> getDefinitionPage(ChargeItemDefPageDto chargeItemDefPageDto,
|
||||
@GetMapping(value = "/charge-item-info")
|
||||
public R<?> getChargeItemInfo(ItemDefinitionDto itemDefinitionDto,
|
||||
@RequestParam(value = "searchKey", defaultValue = "") String searchKey,
|
||||
@RequestParam(value = "chargeItemContext") Integer chargeItemContext,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(value = "searchKey", required = false) String searchKey, HttpServletRequest request) {
|
||||
|
||||
IPage<ChargeItemDefPageDto> chargeItemDefinitionPage = new Page<>();
|
||||
// 初始化表格配置并构建查询条件
|
||||
TableInfoHelper.initTableInfo(new MapperBuilderAssistant(new MybatisConfiguration(), ""),
|
||||
ChargeItemDefPageDto.class);
|
||||
LambdaQueryWrapper<ChargeItemDefPageDto> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// 构造查询条件
|
||||
if (StringUtils.isNotEmpty(searchKey)) {
|
||||
queryWrapper.and(q -> q.like(ChargeItemDefPageDto::getChargeName, searchKey).or()
|
||||
.like(ChargeItemDefPageDto::getItemNo, searchKey).or().like(ChargeItemDefPageDto::getPyStr, searchKey));
|
||||
}
|
||||
if (chargeItemDefPageDto.getChargeItem() != null) {
|
||||
queryWrapper.eq(ChargeItemDefPageDto::getCategoryCode, chargeItemDefPageDto.getChargeItem());
|
||||
}
|
||||
// 通过 DefinitionType 区分药品定价/器具定价/活动定价
|
||||
if (ItemType.MEDICINE.getCode().equals(chargeItemDefPageDto.getDefinitionType())) {
|
||||
queryWrapper.eq(ChargeItemDefPageDto::getInstanceTable,
|
||||
CommonConstants.TableName.MED_MEDICATION_DEFINITION);
|
||||
chargeItemDefinitionPage = chargeItemDefSearchMapper.getMedList(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
} else if (ItemType.DEVICE.getCode().equals(chargeItemDefPageDto.getDefinitionType())) {
|
||||
queryWrapper.eq(ChargeItemDefPageDto::getInstanceTable, CommonConstants.TableName.ADM_DEVICE_DEFINITION);
|
||||
chargeItemDefinitionPage = chargeItemDefSearchMapper.getDevList(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
} else if (ItemType.ACTIVITY.getCode().equals(chargeItemDefPageDto.getDefinitionType())) {
|
||||
queryWrapper.eq(ChargeItemDefPageDto::getInstanceTable, CommonConstants.TableName.WOR_ACTIVITY_DEFINITION);
|
||||
chargeItemDefinitionPage = chargeItemDefSearchMapper.getActList(new Page<>(pageNo, pageSize), queryWrapper);
|
||||
}
|
||||
return R.ok(chargeItemDefinitionPage, MessageUtils.createMessage(PromptMsgConstant.Common.M00009, null));
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
return R.ok(itemDefinitionAppService.getChargeItemInfo(itemDefinitionDto, chargeItemContext, searchKey, pageNo,
|
||||
pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目定价
|
||||
* 项目定价详细
|
||||
*
|
||||
* @param itemDefinitionDto 修改内容
|
||||
* @return 修改结果
|
||||
* @param id id
|
||||
* @return 项目定价详细
|
||||
*/
|
||||
@PutMapping(value = "/item-definition")
|
||||
public R<?> edit(@Validated @RequestBody ItemDefinitionDto itemDefinitionDto) {
|
||||
// 更新adm_charge_item_definition信息
|
||||
ChargeItemDefinition chargeItemDefinition = new ChargeItemDefinition();
|
||||
BeanUtils.copyProperties(itemDefinitionDto, chargeItemDefinition);
|
||||
if (!chargeItemDefinitionService.updateById(chargeItemDefinition)) {
|
||||
return R.fail(MessageUtils.createMessage(PromptMsgConstant.Common.M00007, null));
|
||||
}
|
||||
|
||||
// 更新收费项目adm_charge_item_def_app
|
||||
ChargeItemDefDetail chargeItemDefDetail = new ChargeItemDefDetail();
|
||||
BeanUtils.copyProperties(itemDefinitionDto, chargeItemDefDetail);
|
||||
chargeItemDefDetail.setDefinitionId(itemDefinitionDto.getId());
|
||||
chargeItemDefDetail.setId(itemDefinitionDto.getItemId());
|
||||
return chargeItemDefAppService.updateChargeItemDefApp(chargeItemDefDetail)
|
||||
? R.ok(null, MessageUtils.createMessage(PromptMsgConstant.Common.M00002, new Object[] {"费用定价"}))
|
||||
: R.fail(PromptMsgConstant.Common.M00007, null);
|
||||
@GetMapping(value = "/charge-item-info-detail")
|
||||
public R<?> getChargeItemInfoDetail(@RequestParam Long id) {
|
||||
return R.ok(itemDefinitionAppService.getChargeItemInfoDetail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改项目定价
|
||||
*
|
||||
* @return 修改结果
|
||||
* 改价
|
||||
*
|
||||
* @param id id
|
||||
* @param price 价格
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping(value = "/status-enum-option")
|
||||
public R<?> getDropdownOption() {
|
||||
return R.ok(Arrays.stream(PublicationStatus.values())
|
||||
.map(status -> new ChargeItemOptionDto(status.getValue(), status.getInfo())).collect(Collectors.toList()));
|
||||
@PutMapping(value = "/update-charge-item")
|
||||
public R<?> updateChargeItemInfo(@RequestParam("id") Long id, @RequestParam("price") BigDecimal price) {
|
||||
return itemDefinitionAppService.updateChargeItemInfo(id, price);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class SupplierManagementController {
|
||||
public R<?> editSupplyRequest(@Validated @RequestBody SupplierUpDto supplierUpDto) {
|
||||
|
||||
// 更新供应商信息信息
|
||||
return supplierManagementAppService.addSupplyRequest(supplierUpDto);
|
||||
return supplierManagementAppService.editSupplyRequest(supplierUpDto);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.openhis.common.enums.PublicationStatus;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 器材目录分页检索
|
||||
*
|
||||
@@ -152,4 +154,7 @@ public class DeviceManageDto {
|
||||
/** 最高零售价 */
|
||||
private BigDecimal maximumRetailPrice;
|
||||
|
||||
/** 医保等级 */
|
||||
private Integer chrgitmLv;
|
||||
|
||||
}
|
||||
|
||||
@@ -40,11 +40,9 @@ public class DeviceManageUpDto {
|
||||
private String wbStr;
|
||||
|
||||
/** 器材分类 */
|
||||
@NotNull(message = "器材分类不能为空")
|
||||
private String categoryCode;
|
||||
|
||||
/** 器材种类 */
|
||||
@NotBlank(message = "器材种类不能为空")
|
||||
private String typeCode;
|
||||
|
||||
/** 包装单位 */
|
||||
@@ -52,11 +50,9 @@ public class DeviceManageUpDto {
|
||||
private String unitCode;
|
||||
|
||||
/** 包装规格 */
|
||||
@NotBlank(message = "包装规格不能为空")
|
||||
private String size;
|
||||
|
||||
/** 拆零比 */
|
||||
@NotNull(message = "拆零比不能为空")
|
||||
private BigDecimal partPercent;
|
||||
|
||||
/** 最小使用单位 */
|
||||
@@ -64,32 +60,27 @@ public class DeviceManageUpDto {
|
||||
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;
|
||||
|
||||
/** 高值器材标志 */
|
||||
private Integer hvcmFlag;
|
||||
|
||||
/** 销售单位 */
|
||||
@NotBlank(message = "销售单位不能为空")
|
||||
private String salesUnitCode;
|
||||
|
||||
/** 批准文号 */
|
||||
@NotBlank(message = "批准文号不能为空")
|
||||
private String approvalNumber;
|
||||
|
||||
/** 医保标记 */
|
||||
@@ -110,7 +101,6 @@ public class DeviceManageUpDto {
|
||||
private String manufacturerText;
|
||||
|
||||
/** 供应商 */
|
||||
@NotNull(message = "供应商不能为空")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long supplyId;
|
||||
|
||||
@@ -118,7 +108,6 @@ public class DeviceManageUpDto {
|
||||
private String description;
|
||||
|
||||
/** 适用范围 */
|
||||
@NotBlank(message = "适用范围不能为空")
|
||||
private String jurisdiction;
|
||||
|
||||
/** 器材版本 */
|
||||
@@ -131,23 +120,20 @@ public class DeviceManageUpDto {
|
||||
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;
|
||||
|
||||
|
||||
/** 医保等级 */
|
||||
private Integer chrgitmLv;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class DiagnosisTreatmentDto {
|
||||
private String typeEnum_enumText;
|
||||
|
||||
/** 使用单位 */
|
||||
@Dict(dictCode = "rate_code")
|
||||
@Dict(dictCode = "unit_code")
|
||||
private String permittedUnitCode;
|
||||
private String permittedUnitCode_dictText;
|
||||
|
||||
@@ -100,12 +100,12 @@ public class DiagnosisTreatmentDto {
|
||||
private String itemTypeCode_dictText;
|
||||
|
||||
/** 医保类别 */
|
||||
@Dict(dictCode = "yb_type")
|
||||
@Dict(dictCode = "med_chrgitm_type")
|
||||
private String ybType;
|
||||
private String ybType_dictText;
|
||||
|
||||
/** 购入价 */
|
||||
private BigDecimal purchasePrice;
|
||||
// /** 购入价 */
|
||||
// private BigDecimal purchasePrice;
|
||||
|
||||
/** 零售价 */
|
||||
private BigDecimal retailPrice;
|
||||
@@ -113,5 +113,14 @@ public class DiagnosisTreatmentDto {
|
||||
/** 最高零售价 */
|
||||
private BigDecimal maximumRetailPrice;
|
||||
|
||||
/** 医保等级 */
|
||||
private Integer chrgitmLv;
|
||||
|
||||
/** 子项json */
|
||||
private String childrenJson;
|
||||
|
||||
/** 划价标记 */
|
||||
private Integer pricingFlag;
|
||||
private String pricingFlag_enumText;
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user