loaddefault
This commit is contained in:
parent
10141a88d5
commit
696a0d8403
@ -1,17 +1,22 @@
|
|||||||
package com.czlis.common.core.domain.entity;
|
package com.czlis.common.core.domain.entity;
|
||||||
|
|
||||||
|
import com.czlis.common.core.domain.entity.lis.LabInputcol;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录配置类
|
* 登录系统产生的临床性全局参数
|
||||||
|
* 除登录用户属性本身基本参数外的都放到此处存放
|
||||||
|
* 支持动态变更,该登录用户的所有会话都共享此处变量
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class SysLoginParam {
|
public class SysLoginParam {
|
||||||
|
//1.全局参数
|
||||||
/**
|
/**
|
||||||
* 登录的医疗机构
|
* 登录的医疗机构
|
||||||
*/
|
*/
|
||||||
@ -20,10 +25,16 @@ public class SysLoginParam {
|
|||||||
* 客户端唯一标识
|
* 客户端唯一标识
|
||||||
*/
|
*/
|
||||||
private String localid;
|
private String localid;
|
||||||
|
//2.标本录入场景
|
||||||
/**
|
/**
|
||||||
* 默认仪器
|
* 记忆当前仪器,自动记忆参数在当前仪器与记忆仪器不同时,清除自动记忆临床参数
|
||||||
*/
|
*/
|
||||||
private String default_instr;
|
private String current_instrid;
|
||||||
|
/**保存自动记忆的字段实时值**/
|
||||||
|
private List<LabInputcol> current_labInputcol;
|
||||||
|
//单独处理临时自动记忆字段
|
||||||
|
private String current_hdys_sybh;
|
||||||
|
private String current_hdys_eybh;
|
||||||
|
private String current_yhdh_sybh;
|
||||||
|
private String current_yhdh_eybh;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,204 @@
|
|||||||
|
package com.czlis.interfaceCommon.utils;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实体类操作工具类
|
||||||
|
* 提供动态设置和获取字段值的公共方法
|
||||||
|
*/
|
||||||
|
public class EntityUtils {
|
||||||
|
/**
|
||||||
|
* 动态设置对象的字段值
|
||||||
|
* @param entity 实体对象
|
||||||
|
* @param fieldName 字段名
|
||||||
|
* @param value 要设置的值
|
||||||
|
*/
|
||||||
|
public static void setItem(Object entity, String fieldName, Object value) {
|
||||||
|
if (entity == null) {
|
||||||
|
System.out.println("错误:实体对象为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (fieldName == null || fieldName.trim().isEmpty()) {
|
||||||
|
System.out.println("错误:字段名为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 构建setter方法名
|
||||||
|
String methodName = "set" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
|
||||||
|
|
||||||
|
// 处理值类型
|
||||||
|
Class<?> valueClass = value != null ? value.getClass() : null;
|
||||||
|
|
||||||
|
// 处理基本类型包装类
|
||||||
|
if (valueClass == Integer.class) {
|
||||||
|
valueClass = int.class;
|
||||||
|
} else if (valueClass == Boolean.class) {
|
||||||
|
valueClass = boolean.class;
|
||||||
|
} else if (valueClass == Long.class) {
|
||||||
|
valueClass = long.class;
|
||||||
|
} else if (valueClass == Double.class) {
|
||||||
|
valueClass = double.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取并调用方法
|
||||||
|
Method method = entity.getClass().getMethod(methodName, valueClass);
|
||||||
|
method.invoke(entity, value);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
System.out.println("未找到set方法:" + fieldName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("设置字段值出错,字段名:" + fieldName + ",错误信息:" + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 动态获取对象的字段值
|
||||||
|
* @param entity 实体对象
|
||||||
|
* @param fieldName 字段名
|
||||||
|
* @return 字段值(需要根据实际类型强转)
|
||||||
|
*/
|
||||||
|
public static Object getItem(Object entity, String fieldName) {
|
||||||
|
if (entity == null) {
|
||||||
|
System.out.println("错误:实体对象为空");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (fieldName == null || fieldName.trim().isEmpty()) {
|
||||||
|
System.out.println("错误:字段名为空");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 构建getter方法名
|
||||||
|
String methodName = "get" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
|
||||||
|
|
||||||
|
// 对于boolean类型,getter方法可能以is开头
|
||||||
|
if (!hasMethod(entity.getClass(), methodName)) {
|
||||||
|
methodName = "is" + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用getter方法并返回结果
|
||||||
|
Method method = entity.getClass().getMethod(methodName);
|
||||||
|
return method.invoke(entity);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
System.out.println("未找到get方法:" + fieldName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("获取字段值出错,字段名:" + fieldName + ",错误信息:" + e.getMessage());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取字符串类型字段值
|
||||||
|
*/
|
||||||
|
public static String getItemString(Object entity, String fieldName) {
|
||||||
|
Object value = getItem(entity, fieldName);
|
||||||
|
return value != null ? value.toString() : null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取整数类型字段值
|
||||||
|
*/
|
||||||
|
public static Integer getItemInteger(Object entity, String fieldName) {
|
||||||
|
Object value = getItem(entity, fieldName);
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).intValue();
|
||||||
|
} else if (value instanceof String) {
|
||||||
|
return Integer.parseInt((String) value);
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.out.println("字段" + fieldName + "转换为Integer失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取长整数类型字段值
|
||||||
|
*/
|
||||||
|
public static Long getItemLong(Object entity, String fieldName) {
|
||||||
|
Object value = getItem(entity, fieldName);
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).longValue();
|
||||||
|
} else if (value instanceof String) {
|
||||||
|
return Long.parseLong((String) value);
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.out.println("字段" + fieldName + "转换为Long失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取双精度浮点类型字段值
|
||||||
|
*/
|
||||||
|
public static Double getItemDouble(Object entity, String fieldName) {
|
||||||
|
Object value = getItem(entity, fieldName);
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (value instanceof Number) {
|
||||||
|
return ((Number) value).doubleValue();
|
||||||
|
} else if (value instanceof String) {
|
||||||
|
return Double.parseDouble((String) value);
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
System.out.println("字段" + fieldName + "转换为Double失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取日期类型字段值
|
||||||
|
*/
|
||||||
|
public static Date getItemDate(Object entity, String fieldName) {
|
||||||
|
Object value = getItem(entity, fieldName);
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value instanceof Date) {
|
||||||
|
return (Date) value;
|
||||||
|
} else {
|
||||||
|
System.out.println("字段" + fieldName + "不是有效的Date类型");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取布尔类型字段值
|
||||||
|
*/
|
||||||
|
public static Boolean getItemBoolean(Object entity, String fieldName) {
|
||||||
|
Object value = getItem(entity, fieldName);
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value instanceof Boolean) {
|
||||||
|
return (Boolean) value;
|
||||||
|
} else if (value instanceof String) {
|
||||||
|
return Boolean.parseBoolean((String) value);
|
||||||
|
} else if (value instanceof Number) {
|
||||||
|
// 数字0为false,其他为true
|
||||||
|
return ((Number) value).intValue() != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("字段" + fieldName + "转换为Boolean失败");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 检查类是否有指定方法
|
||||||
|
*/
|
||||||
|
private static boolean hasMethod(Class<?> clazz, String methodName) {
|
||||||
|
try {
|
||||||
|
clazz.getMethod(methodName);
|
||||||
|
return true;
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -502,4 +502,15 @@ public class LisUtil {
|
|||||||
}
|
}
|
||||||
System.out.println("PDF合并完成,输出路径:" + outputFilePath);
|
System.out.println("PDF合并完成,输出路径:" + outputFilePath);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 判断目标字符串是否在两个字符串之间(按字典顺序)
|
||||||
|
* @param target 目标字符串
|
||||||
|
* @param start 起始字符串
|
||||||
|
* @param end 结束字符串
|
||||||
|
* @return 如果target在start和end之间(包含边界),返回true,否则返回false
|
||||||
|
*/
|
||||||
|
public static boolean isStringBetween(String target, String start, String end) {
|
||||||
|
// 检查目标字符串是否大于等于start且小于等于end
|
||||||
|
return target.compareTo(start) >= 0 && target.compareTo(end) <= 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -124,6 +124,7 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
return new Result("0", "保存成功");
|
return new Result("0", "保存成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改病人信息
|
* 修改病人信息
|
||||||
* @param jyrq
|
* @param jyrq
|
||||||
@ -140,6 +141,17 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
if("5".equals(jgbz)) return new Result("-1", "结果已锁定禁止修改!");
|
if("5".equals(jgbz)) return new Result("-1", "结果已锁定禁止修改!");
|
||||||
if("1".equals(jgbz)) return new Result("-1", "结果已初审禁止修改!");
|
if("1".equals(jgbz)) return new Result("-1", "结果已初审禁止修改!");
|
||||||
commonUtil.updateLabPatByColumn(jyrq,yq,ybh,column,value);
|
commonUtil.updateLabPatByColumn(jyrq,yq,ybh,column,value);
|
||||||
|
//对于开启自动记忆的字段,保存修改值
|
||||||
|
SysLoginParam loginConfigParam = loginConfigParamUtil.getLoginConfigParam();
|
||||||
|
List<LabInputcol> labInputcolList=getLabInputcol(loginConfigParam,yq);
|
||||||
|
Optional<LabInputcol> collect0 = labInputcolList.stream().filter(labInputcol0 -> column.equals(labInputcol0.getZdmc())).findFirst();
|
||||||
|
if (collect0.isPresent()) {
|
||||||
|
String zdjy=collect0.get().getZdjy();
|
||||||
|
if("1".equals(zdjy)){
|
||||||
|
collect0.ifPresent(labR -> labR.setMrz(value));
|
||||||
|
loginConfigParam.setCurrent_labInputcol(labInputcolList);
|
||||||
|
}
|
||||||
|
}
|
||||||
Boolean setcalc=false;
|
Boolean setcalc=false;
|
||||||
List<XmCalc> xmCalcList=null;
|
List<XmCalc> xmCalcList=null;
|
||||||
switch(column){
|
switch(column){
|
||||||
@ -336,24 +348,69 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Result loaddefault(Date jyrq, String yq, String ybh) {
|
public Result loaddefault(Date jyrq, String yq, String ybh) {
|
||||||
LabPat labPat=new LabPat();
|
LabPat labPat=commonUtil.getLabPatOne(jyrq, yq, ybh);
|
||||||
labPat.setSqsj(commonUtil.getCurrentTime());
|
Date ldt_now=commonUtil.getCurrentTime();
|
||||||
String yljg=commonUtil.getLabInstr(yq).getYljg();
|
if(labPat.getSqsj()==null) labPat.setSqsj(ldt_now);
|
||||||
SysLoginParam loginConfigParam = loginConfigParamUtil.getLoginConfigParam();
|
if(labPat.getYljg()==null) labPat.setYljg(commonUtil.getLabInstr(yq).getYljg());
|
||||||
// loginConfigParam.getLoginYLJG();
|
SysLoginParam loginConfigParam = loginConfigParamUtil.getLoginConfigParam();
|
||||||
labPat.setYljg(yljg);
|
String Current_instrid=loginConfigParam.getCurrent_instrid();
|
||||||
List<LabInputcol> labInputcolList= commonUtil.getLabInputcol(yq);
|
List<LabInputcol> labInputcolList=loginConfigParam.getCurrent_labInputcol();
|
||||||
for (LabInputcol labInputcol : labInputcolList) {
|
if(Current_instrid==null||!yq.equals(Current_instrid)){
|
||||||
// if(!"!".equals(labInputcol)){
|
loginConfigParam.setCurrent_yhdh_sybh("");
|
||||||
// String zdmc=labInputcol.getZdmc();
|
loginConfigParam.setCurrent_yhdh_eybh("");
|
||||||
// switch(zdmc){
|
loginConfigParam.setCurrent_hdys_sybh("");
|
||||||
// case "":
|
loginConfigParam.setCurrent_hdys_eybh("");
|
||||||
// break;
|
labInputcolList= commonUtil.getLabInputcol(yq);
|
||||||
// default:
|
loginConfigParam.setCurrent_labInputcol(labInputcolList);
|
||||||
// }
|
}
|
||||||
// }
|
List<LabInputcol> labInputcolList0=labInputcolList.stream().filter(labInputcol0->labInputcol0.getMrz()!=null&&"".equals(labInputcol0.getMrz())).collect(Collectors.toList());
|
||||||
|
String mrz=null;
|
||||||
|
for (LabInputcol labInputcol : labInputcolList0) {
|
||||||
|
if(!"!".equals(labInputcol)){
|
||||||
|
String zdmc=labInputcol.getZdmc();
|
||||||
|
switch(zdmc){
|
||||||
|
case "dysj":
|
||||||
|
case "cyrq":
|
||||||
|
case "sqsj":
|
||||||
|
case "nl":
|
||||||
|
case "yhdh":
|
||||||
|
mrz=labInputcol.getMrz();
|
||||||
|
if(mrz!=null&&"".equals(mrz)) {
|
||||||
|
String sybh= loginConfigParam.getCurrent_yhdh_sybh();
|
||||||
|
String eybh= loginConfigParam.getCurrent_yhdh_eybh();
|
||||||
|
if("".equals(sybh)&&"".equals(eybh)&&sybh!=null&&eybh!=null) {
|
||||||
|
if (LisUtil.isStringBetween(ybh, sybh, eybh)) {
|
||||||
|
labPat.setYhdh(mrz);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
labPat.setYhdh(mrz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "hdys":
|
||||||
|
String sybh= loginConfigParam.getCurrent_hdys_sybh();
|
||||||
|
String eybh= loginConfigParam.getCurrent_hdys_eybh();
|
||||||
|
if("".equals(sybh)&&"".equals(eybh)&&sybh!=null&&eybh!=null) {
|
||||||
|
if (LisUtil.isStringBetween(ybh, sybh, eybh)) {
|
||||||
|
labPat.setHdys(mrz);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
labPat.setHdys(mrz);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
mrz=labInputcol.getMrz();
|
||||||
|
if(mrz!=null&&"".equals(mrz)) {
|
||||||
|
EntityUtils.setItem(labPat, zdmc, mrz);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return new Result("0", "审核成功!",labPat);
|
String yhdh=SecurityUtils.getLoginUser().getUsername();
|
||||||
|
if(labPat.getYhdh()==null||"".equals(labPat.getYhdh())) labPat.setYhdh(SecurityUtils.getLoginUser().getUsername());
|
||||||
|
labPat.setLastuser(yhdh);
|
||||||
|
labPat.setLastdt(ldt_now);
|
||||||
|
if(labPat.getJgbz()==null)labPat.setJgbz(ReportStatusConstants.DEFAULT);
|
||||||
|
return new Result("0", "样本初始化成功!",labPat);
|
||||||
}
|
}
|
||||||
public void updateLabReqmainZT(String userId, String sqh) {
|
public void updateLabReqmainZT(String userId, String sqh) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
@ -1873,4 +1930,24 @@ public class LisWorkOperServiceImpl implements LisWorkOperService {
|
|||||||
}
|
}
|
||||||
return new Result("0", "登记成功");
|
return new Result("0", "登记成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取自动记忆字段修改值
|
||||||
|
* @param loginConfigParam
|
||||||
|
* @param yq
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<LabInputcol> getLabInputcol(SysLoginParam loginConfigParam,String yq){
|
||||||
|
String Current_instrid=loginConfigParam.getCurrent_instrid();
|
||||||
|
List<LabInputcol> labInputcolList=loginConfigParam.getCurrent_labInputcol();
|
||||||
|
if(Current_instrid==null||!yq.equals(Current_instrid)) {
|
||||||
|
loginConfigParam.setCurrent_yhdh_sybh("");
|
||||||
|
loginConfigParam.setCurrent_yhdh_eybh("");
|
||||||
|
loginConfigParam.setCurrent_hdys_sybh("");
|
||||||
|
loginConfigParam.setCurrent_hdys_eybh("");
|
||||||
|
labInputcolList = commonUtil.getLabInputcol(yq);
|
||||||
|
loginConfigParam.setCurrent_labInputcol(labInputcolList);
|
||||||
|
}
|
||||||
|
return labInputcolList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user