32 changed files with 2961 additions and 16 deletions
@ -0,0 +1,66 @@ |
|||||
|
package com.acupuncture.web.controller.web; |
||||
|
|
||||
|
import com.acupuncture.common.core.domain.BaseDto; |
||||
|
import com.acupuncture.common.core.domain.JsonResponse; |
||||
|
import com.acupuncture.system.domain.dto.PmsPatientDto; |
||||
|
import com.acupuncture.system.domain.vo.PmsPatientVo; |
||||
|
import com.acupuncture.system.service.PmsPatientService; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import io.swagger.annotations.Api; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
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.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zzc |
||||
|
* @Package com.acupuncture.web.controller.web |
||||
|
* @Date 2025/2/11 9:13 |
||||
|
* @description: |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Api(tags = "随访相关") |
||||
|
@RestController |
||||
|
@RequestMapping("/patient") |
||||
|
public class PmsPatientController { |
||||
|
|
||||
|
@Resource |
||||
|
private PmsPatientService pmsPatientService; |
||||
|
|
||||
|
@ApiOperation("添加患者信息") |
||||
|
@PostMapping("/add") |
||||
|
public JsonResponse<Integer> add(@RequestBody @Validated PmsPatientDto.PatientAdd dto){ |
||||
|
pmsPatientService.add(dto); |
||||
|
return JsonResponse.ok(); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation("修改患者信息") |
||||
|
@PostMapping("/upd") |
||||
|
public JsonResponse<Integer> upd(@RequestBody @Validated PmsPatientDto.PatientUpd dto){ |
||||
|
pmsPatientService.upd(dto); |
||||
|
return JsonResponse.ok(); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation("删除患者信息") |
||||
|
@PostMapping("/del") |
||||
|
public JsonResponse<Integer> del(@RequestBody @Validated PmsPatientDto.Delete dto){ |
||||
|
pmsPatientService.del(dto.getIdList()); |
||||
|
return JsonResponse.ok(); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation("查询患者信息") |
||||
|
@PostMapping("/query") |
||||
|
public JsonResponse<PageInfo<PmsPatientVo.PatientResult>> query(@RequestBody @Validated BaseDto<PmsPatientDto.PatientQuery> dto){ |
||||
|
if (dto.getPageNum() > 0) { |
||||
|
PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); |
||||
|
} |
||||
|
return JsonResponse.ok(new PageInfo<>(pmsPatientService.query(dto.getParam()))); |
||||
|
} |
||||
|
} |
@ -0,0 +1,100 @@ |
|||||
|
package com.acupuncture.framework.aspectj; |
||||
|
|
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.acupuncture.common.constant.UserConstants; |
||||
|
import com.acupuncture.common.exception.base.BaseException; |
||||
|
import com.acupuncture.common.utils.SecurityUtils; |
||||
|
import com.acupuncture.common.utils.StringUtils; |
||||
|
import com.acupuncture.framework.datasource.DataSourceManager; |
||||
|
import com.acupuncture.framework.datasource.DynamicDataSourceContextHolder; |
||||
|
import com.acupuncture.system.domain.po.UmsDataSource; |
||||
|
import com.acupuncture.system.mapper.SysUserMapper; |
||||
|
import com.acupuncture.system.service.DmsLoginService; |
||||
|
import org.aspectj.lang.ProceedingJoinPoint; |
||||
|
import org.aspectj.lang.annotation.Around; |
||||
|
import org.aspectj.lang.annotation.Aspect; |
||||
|
import org.aspectj.lang.annotation.Pointcut; |
||||
|
import org.slf4j.Logger; |
||||
|
import org.slf4j.LoggerFactory; |
||||
|
import org.springframework.core.annotation.Order; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.web.context.request.RequestContextHolder; |
||||
|
import org.springframework.web.context.request.ServletRequestAttributes; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.http.HttpServletRequest; |
||||
|
|
||||
|
/** |
||||
|
* 多数据源处理 |
||||
|
* |
||||
|
* @author cc |
||||
|
*/ |
||||
|
@Aspect |
||||
|
@Order(1) |
||||
|
@Component |
||||
|
public class AdminGlobalDataSourceAspect { |
||||
|
protected Logger logger = LoggerFactory.getLogger(getClass()); |
||||
|
|
||||
|
// @Autowired
|
||||
|
// private UmsDataSourceMapper umsDataSourceMapper;
|
||||
|
@Resource |
||||
|
private DmsLoginService dmsLoginService; |
||||
|
|
||||
|
private static final String DATASOURCE_NOT_FOUND = "未找到数据源"; |
||||
|
|
||||
|
@Pointcut("(execution(* com.acupuncture.web.controller..*.*(..))) && !@annotation(com.acupuncture.common.annotation.DataSource)") |
||||
|
public void dsPointCut() { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Around("dsPointCut()") |
||||
|
public Object around(ProceedingJoinPoint point) throws Throwable { |
||||
|
String dataSourceKey = getDataSource(point); |
||||
|
|
||||
|
if (StringUtils.isNotNull(dataSourceKey)) { |
||||
|
DataSourceManager.setDataSourceKey(dataSourceKey); |
||||
|
} |
||||
|
|
||||
|
try { |
||||
|
return point.proceed(); |
||||
|
} finally { |
||||
|
// 销毁数据源 在执行方法之后
|
||||
|
DynamicDataSourceContextHolder.clearDataSourceType(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取需要切换的数据源 |
||||
|
*/ |
||||
|
public String getDataSource(ProceedingJoinPoint point) { |
||||
|
// 获取请求携带的令牌
|
||||
|
HttpServletRequest request = ((ServletRequestAttributes) |
||||
|
RequestContextHolder.getRequestAttributes()).getRequest(); |
||||
|
|
||||
|
String authHeader = request.getHeader(UserConstants.HEADER_KEY_TOKEN); |
||||
|
//token为空
|
||||
|
if(StrUtil.isEmpty(authHeader)){ |
||||
|
return null; |
||||
|
} |
||||
|
// String deptId = request.getHeader(WebConstant.HEADER_KEY_DEPT_ID);
|
||||
|
Long tenantId = SecurityUtils.getTenantId(); |
||||
|
if (tenantId == null) { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
//设置所属医院和数据源
|
||||
|
// SecurityUtils.setCurrentHospitalId(Long.parseLong(deptId));
|
||||
|
|
||||
|
// // 获取当前的用户
|
||||
|
// LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
|
// if(ObjectUtil.isNull(loginUser) || loginUser.getUser().isAdmin()){
|
||||
|
// return null;
|
||||
|
// }
|
||||
|
//根据部门ID查询数据源
|
||||
|
UmsDataSource dataSource = dmsLoginService.getDataSourceByTenantId(tenantId); |
||||
|
if (dataSource == null) { |
||||
|
throw new BaseException(DATASOURCE_NOT_FOUND); |
||||
|
} |
||||
|
return dataSource.getDataSourceKey(); |
||||
|
} |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.acupuncture.framework.config; |
||||
|
|
||||
|
import com.acupuncture.common.utils.ExceptionUtil; |
||||
|
import com.acupuncture.framework.datasource.DataSourceManager; |
||||
|
import com.acupuncture.system.domain.po.UmsDataSource; |
||||
|
import com.acupuncture.system.domain.po.UmsDataSourceExample; |
||||
|
import com.acupuncture.system.persist.mapper.UmsDataSourceMapper; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.InitializingBean; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 启动初始化数据 |
||||
|
* |
||||
|
* @author zy |
||||
|
* @date 2024/4/27 15:07 |
||||
|
*/ |
||||
|
@Component |
||||
|
@Slf4j |
||||
|
public class LoadingDataSource implements InitializingBean { |
||||
|
|
||||
|
@Resource |
||||
|
private UmsDataSourceMapper umsDataSourceMapper; |
||||
|
@Resource |
||||
|
private DataSourceManager dataSourceManager; |
||||
|
|
||||
|
@Override |
||||
|
public void afterPropertiesSet() { |
||||
|
// 加载数据源
|
||||
|
UmsDataSourceExample example = new UmsDataSourceExample(); |
||||
|
example.createCriteria().andDelFlagEqualTo((byte) 0); |
||||
|
List<UmsDataSource> baseDataSources = umsDataSourceMapper.selectByExample(example); |
||||
|
log.info("初次启动加载数据源...{}", baseDataSources); |
||||
|
for (UmsDataSource dataSource : baseDataSources) { |
||||
|
try { |
||||
|
dataSourceManager.createDataSource(dataSource); |
||||
|
} catch (Exception e) { |
||||
|
e.printStackTrace(); |
||||
|
log.error("加载数据源失败:", ExceptionUtil.getExceptionMessage(e)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
package com.acupuncture.framework.datasource; |
||||
|
|
||||
|
import com.acupuncture.system.domain.po.UmsDataSource; |
||||
|
import com.zaxxer.hikari.HikariDataSource; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import javax.sql.DataSource; |
||||
|
import java.util.Map; |
||||
|
import java.util.concurrent.ConcurrentHashMap; |
||||
|
|
||||
|
/** |
||||
|
* @author zy |
||||
|
* @date 2024/4/27 15:11 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class DataSourceManager { |
||||
|
|
||||
|
/** |
||||
|
* JDBC数据源连接池 |
||||
|
*/ |
||||
|
public static final Map<String, DataSource> DATA_SOURCE_POOL_JDBC = new ConcurrentHashMap<>(); |
||||
|
|
||||
|
public void createDataSource(UmsDataSource ds) { |
||||
|
|
||||
|
String datasourceId = ds.getDataSourceKey(); |
||||
|
String username = ds.getUsername(); |
||||
|
String password = ds.getPassword(); |
||||
|
String jdbcUrl = ds.getUrl(); |
||||
|
|
||||
|
HikariDataSource dataSource = new HikariDataSource(); |
||||
|
dataSource.setUsername(username); |
||||
|
dataSource.setPassword(password); |
||||
|
dataSource.setJdbcUrl(jdbcUrl); |
||||
|
dataSource.setMinimumIdle(2); |
||||
|
dataSource.setMaxLifetime(1800000); |
||||
|
dataSource.setIdleTimeout(600000); |
||||
|
dataSource.setConnectionTimeout(10000); |
||||
|
|
||||
|
DataSourceManager.DATA_SOURCE_POOL_JDBC.put(datasourceId, dataSource); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 设置数据源key |
||||
|
* |
||||
|
* @param key |
||||
|
*/ |
||||
|
public static void setDataSourceKey(String key) { |
||||
|
DynamicDataSourceContextHolder.setDataSourceType(key); |
||||
|
} |
||||
|
} |
@ -1,4 +1,4 @@ |
|||||
package com.acupuncture.system.domain.vo; |
package com.acupuncture.system.domain.dto; |
||||
|
|
||||
import io.swagger.annotations.ApiModelProperty; |
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
import lombok.Data; |
@ -0,0 +1,90 @@ |
|||||
|
package com.acupuncture.system.domain.dto; |
||||
|
|
||||
|
import com.acupuncture.system.domain.po.PmsPatient; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zzc |
||||
|
* @Package com.acupuncture.system.domain.dto |
||||
|
* @Date 2025/2/10 17:26 |
||||
|
* @description: |
||||
|
*/ |
||||
|
public class PmsPatientDto { |
||||
|
|
||||
|
@Data |
||||
|
public static class PatientQuery { |
||||
|
@ApiModelProperty("关键字 支持模糊名字,拼音首拼,拼音全拼") |
||||
|
private String keywords; |
||||
|
@ApiModelProperty("开始年龄") |
||||
|
private Integer startAge; |
||||
|
@ApiModelProperty("结束年龄") |
||||
|
private Integer endAge; |
||||
|
@ApiModelProperty("性别") |
||||
|
private Integer gender; |
||||
|
@ApiModelProperty("建档组织") |
||||
|
private Long tenantId; |
||||
|
@ApiModelProperty("身份证") |
||||
|
private String idCard; |
||||
|
@ApiModelProperty("来源") |
||||
|
private Integer sourceId; |
||||
|
@ApiModelProperty("建档人") |
||||
|
private String createBy; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
public static class PatientAdd { |
||||
|
private String name; |
||||
|
|
||||
|
private Byte gender; |
||||
|
|
||||
|
private Date birthDate; |
||||
|
|
||||
|
private String ethnicity; |
||||
|
|
||||
|
private Integer educationYears; |
||||
|
|
||||
|
private String phone; |
||||
|
|
||||
|
private Byte idCardType; |
||||
|
|
||||
|
private String idCard; |
||||
|
|
||||
|
private Byte source; |
||||
|
|
||||
|
private String currentIllnessHistory; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
@Data |
||||
|
public static class PatientUpd { |
||||
|
private Long id; |
||||
|
private String name; |
||||
|
|
||||
|
private Byte gender; |
||||
|
|
||||
|
private Date birthDate; |
||||
|
|
||||
|
private String ethnicity; |
||||
|
|
||||
|
private Integer educationYears; |
||||
|
|
||||
|
private String phone; |
||||
|
|
||||
|
private Byte idCardType; |
||||
|
|
||||
|
private String idCard; |
||||
|
|
||||
|
private Byte source; |
||||
|
|
||||
|
private String currentIllnessHistory; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
public static class Delete { |
||||
|
private List<Long> idList; |
||||
|
} |
||||
|
} |
@ -0,0 +1,238 @@ |
|||||
|
package com.acupuncture.system.domain.po; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
public class PmsPatient implements Serializable { |
||||
|
private Long id; |
||||
|
|
||||
|
private String name; |
||||
|
|
||||
|
private String pinyinFull; |
||||
|
|
||||
|
private String pinyinSimple; |
||||
|
|
||||
|
private Byte gender; |
||||
|
|
||||
|
private Date birthDate; |
||||
|
|
||||
|
private String ethnicity; |
||||
|
|
||||
|
private Integer educationYears; |
||||
|
|
||||
|
private String phone; |
||||
|
|
||||
|
private Byte idCardType; |
||||
|
|
||||
|
private String idCard; |
||||
|
|
||||
|
private Byte source; |
||||
|
|
||||
|
private String currentIllnessHistory; |
||||
|
|
||||
|
private Byte delFlag; |
||||
|
|
||||
|
private Long tenantId; |
||||
|
|
||||
|
private String createBy; |
||||
|
|
||||
|
private Date createTime; |
||||
|
|
||||
|
private String updateBy; |
||||
|
|
||||
|
private Date updateTime; |
||||
|
|
||||
|
private String remark; |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
public Long getId() { |
||||
|
return id; |
||||
|
} |
||||
|
|
||||
|
public void setId(Long id) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return name; |
||||
|
} |
||||
|
|
||||
|
public void setName(String name) { |
||||
|
this.name = name == null ? null : name.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getPinyinFull() { |
||||
|
return pinyinFull; |
||||
|
} |
||||
|
|
||||
|
public void setPinyinFull(String pinyinFull) { |
||||
|
this.pinyinFull = pinyinFull == null ? null : pinyinFull.trim(); |
||||
|
} |
||||
|
|
||||
|
public String getPinyinSimple() { |
||||
|
return pinyinSimple; |
||||
|
} |
||||
|
|
||||
|
public void setPinyinSimple(String pinyinSimple) { |
||||
|
this.pinyinSimple = pinyinSimple == null ? null : pinyinSimple.trim(); |
||||
|
} |
||||
|
|
||||
|
public Byte getGender() { |
||||
|
return gender; |
||||
|
} |
||||
|
|
||||
|
public void setGender(Byte gender) { |
||||
|
this.gender = gender; |
||||
|
} |
||||
|
|
||||
|
public Date getBirthDate() { |
||||
|
return birthDate; |
||||
|
} |
||||
|
|
||||
|
public void setBirthDate(Date birthDate) { |
||||
|
this.birthDate = birthDate; |
||||
|
} |
||||
|
|
||||
|
public String getEthnicity() { |
||||
|
return ethnicity; |
||||
|
} |
||||
|
|
||||
|
public void setEthnicity(String ethnicity) { |
||||
|
this.ethnicity = ethnicity == null ? null : ethnicity.trim(); |
||||
|
} |
||||
|
|
||||
|
public Integer getEducationYears() { |
||||
|
return educationYears; |
||||
|
} |
||||
|
|
||||
|
public void setEducationYears(Integer educationYears) { |
||||
|
this.educationYears = educationYears; |
||||
|
} |
||||
|
|
||||
|
public String getPhone() { |
||||
|
return phone; |
||||
|
} |
||||
|
|
||||
|
public void setPhone(String phone) { |
||||
|
this.phone = phone == null ? null : phone.trim(); |
||||
|
} |
||||
|
|
||||
|
public Byte getIdCardType() { |
||||
|
return idCardType; |
||||
|
} |
||||
|
|
||||
|
public void setIdCardType(Byte idCardType) { |
||||
|
this.idCardType = idCardType; |
||||
|
} |
||||
|
|
||||
|
public String getIdCard() { |
||||
|
return idCard; |
||||
|
} |
||||
|
|
||||
|
public void setIdCard(String idCard) { |
||||
|
this.idCard = idCard == null ? null : idCard.trim(); |
||||
|
} |
||||
|
|
||||
|
public Byte getSource() { |
||||
|
return source; |
||||
|
} |
||||
|
|
||||
|
public void setSource(Byte source) { |
||||
|
this.source = source; |
||||
|
} |
||||
|
|
||||
|
public String getCurrentIllnessHistory() { |
||||
|
return currentIllnessHistory; |
||||
|
} |
||||
|
|
||||
|
public void setCurrentIllnessHistory(String currentIllnessHistory) { |
||||
|
this.currentIllnessHistory = currentIllnessHistory == null ? null : currentIllnessHistory.trim(); |
||||
|
} |
||||
|
|
||||
|
public Byte getDelFlag() { |
||||
|
return delFlag; |
||||
|
} |
||||
|
|
||||
|
public void setDelFlag(Byte delFlag) { |
||||
|
this.delFlag = delFlag; |
||||
|
} |
||||
|
|
||||
|
public Long getTenantId() { |
||||
|
return tenantId; |
||||
|
} |
||||
|
|
||||
|
public void setTenantId(Long tenantId) { |
||||
|
this.tenantId = tenantId; |
||||
|
} |
||||
|
|
||||
|
public String getCreateBy() { |
||||
|
return createBy; |
||||
|
} |
||||
|
|
||||
|
public void setCreateBy(String createBy) { |
||||
|
this.createBy = createBy == null ? null : createBy.trim(); |
||||
|
} |
||||
|
|
||||
|
public Date getCreateTime() { |
||||
|
return createTime; |
||||
|
} |
||||
|
|
||||
|
public void setCreateTime(Date createTime) { |
||||
|
this.createTime = createTime; |
||||
|
} |
||||
|
|
||||
|
public String getUpdateBy() { |
||||
|
return updateBy; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateBy(String updateBy) { |
||||
|
this.updateBy = updateBy == null ? null : updateBy.trim(); |
||||
|
} |
||||
|
|
||||
|
public Date getUpdateTime() { |
||||
|
return updateTime; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateTime(Date updateTime) { |
||||
|
this.updateTime = updateTime; |
||||
|
} |
||||
|
|
||||
|
public String getRemark() { |
||||
|
return remark; |
||||
|
} |
||||
|
|
||||
|
public void setRemark(String remark) { |
||||
|
this.remark = remark == null ? null : remark.trim(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
StringBuilder sb = new StringBuilder(); |
||||
|
sb.append(getClass().getSimpleName()); |
||||
|
sb.append(" ["); |
||||
|
sb.append("Hash = ").append(hashCode()); |
||||
|
sb.append(", id=").append(id); |
||||
|
sb.append(", name=").append(name); |
||||
|
sb.append(", pinyinFull=").append(pinyinFull); |
||||
|
sb.append(", pinyinSimple=").append(pinyinSimple); |
||||
|
sb.append(", gender=").append(gender); |
||||
|
sb.append(", birthDate=").append(birthDate); |
||||
|
sb.append(", ethnicity=").append(ethnicity); |
||||
|
sb.append(", educationYears=").append(educationYears); |
||||
|
sb.append(", phone=").append(phone); |
||||
|
sb.append(", idCardType=").append(idCardType); |
||||
|
sb.append(", idCard=").append(idCard); |
||||
|
sb.append(", source=").append(source); |
||||
|
sb.append(", currentIllnessHistory=").append(currentIllnessHistory); |
||||
|
sb.append(", delFlag=").append(delFlag); |
||||
|
sb.append(", tenantId=").append(tenantId); |
||||
|
sb.append(", createBy=").append(createBy); |
||||
|
sb.append(", createTime=").append(createTime); |
||||
|
sb.append(", updateBy=").append(updateBy); |
||||
|
sb.append(", updateTime=").append(updateTime); |
||||
|
sb.append(", remark=").append(remark); |
||||
|
sb.append("]"); |
||||
|
return sb.toString(); |
||||
|
} |
||||
|
} |
File diff suppressed because it is too large
@ -0,0 +1,54 @@ |
|||||
|
package com.acupuncture.system.domain.vo; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zzc |
||||
|
* @Package com.acupuncture.system.domain.vo |
||||
|
* @Date 2025/2/10 17:22 |
||||
|
* @description: |
||||
|
*/ |
||||
|
public class PmsPatientVo { |
||||
|
|
||||
|
@Data |
||||
|
public static class PatientResult { |
||||
|
@ApiModelProperty("") |
||||
|
private Long id; |
||||
|
@ApiModelProperty("患者姓名") |
||||
|
private String name; |
||||
|
@ApiModelProperty("性别(0男, 1女)") |
||||
|
private Integer gender; |
||||
|
|
||||
|
@ApiModelProperty("出生日期") |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date birthDate; |
||||
|
@ApiModelProperty("民族") |
||||
|
private String ethnicity; |
||||
|
@ApiModelProperty("受教育年限") |
||||
|
private Integer educationYears; |
||||
|
@ApiModelProperty("手机号码") |
||||
|
private String phone; |
||||
|
@ApiModelProperty("证件类型(0身份证;1护照或外国人永居证; 2港澳居民来往内地通行; 3台湾居民来往大陆通行证; 4其他;)") |
||||
|
private Integer idCardType; |
||||
|
@ApiModelProperty("证件号码") |
||||
|
private String idCard; |
||||
|
@ApiModelProperty("数据来源(0筛查, 1录入, 2HIS)") |
||||
|
private Integer source; |
||||
|
@ApiModelProperty("现病史,存储格式:[\"高血压\",\"脑血管病\"]") |
||||
|
private String currentIllnessHistory; |
||||
|
@ApiModelProperty("建档组织(当前登录账号医院ID)") |
||||
|
private Long organizationId; |
||||
|
@ApiModelProperty("创建者") |
||||
|
private String createBy; |
||||
|
@ApiModelProperty("创建时间") |
||||
|
private Date createTime; |
||||
|
@ApiModelProperty("备注") |
||||
|
private String remark; |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package com.acupuncture.system.persist.dao; |
||||
|
|
||||
|
import com.acupuncture.system.domain.dto.PmsPatientDto; |
||||
|
import com.acupuncture.system.domain.vo.PmsPatientVo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zzc |
||||
|
* @Package com.acupuncture.system.persist.dao |
||||
|
* @Date 2025/2/10 17:55 |
||||
|
* @description: |
||||
|
*/ |
||||
|
public interface PmsPatientDao { |
||||
|
|
||||
|
List<PmsPatientVo.PatientResult> query(PmsPatientDto.PatientQuery dto); |
||||
|
|
||||
|
} |
@ -0,0 +1,28 @@ |
|||||
|
package com.acupuncture.system.persist.mapper; |
||||
|
|
||||
|
import com.acupuncture.system.domain.po.PmsPatient; |
||||
|
import com.acupuncture.system.domain.po.PmsPatientExample; |
||||
|
import java.util.List; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
|
||||
|
public interface PmsPatientMapper { |
||||
|
long countByExample(PmsPatientExample example); |
||||
|
|
||||
|
int deleteByPrimaryKey(Long id); |
||||
|
|
||||
|
int insert(PmsPatient record); |
||||
|
|
||||
|
int insertSelective(PmsPatient record); |
||||
|
|
||||
|
List<PmsPatient> selectByExample(PmsPatientExample example); |
||||
|
|
||||
|
PmsPatient selectByPrimaryKey(Long id); |
||||
|
|
||||
|
int updateByExampleSelective(@Param("record") PmsPatient record, @Param("example") PmsPatientExample example); |
||||
|
|
||||
|
int updateByExample(@Param("record") PmsPatient record, @Param("example") PmsPatientExample example); |
||||
|
|
||||
|
int updateByPrimaryKeySelective(PmsPatient record); |
||||
|
|
||||
|
int updateByPrimaryKey(PmsPatient record); |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.acupuncture.system.service; |
||||
|
|
||||
|
import com.acupuncture.common.annotation.DataSource; |
||||
|
import com.acupuncture.common.enums.DataSourceType; |
||||
|
import com.acupuncture.system.domain.dto.PmsPatientDto; |
||||
|
import com.acupuncture.system.domain.vo.PmsPatientVo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zzc |
||||
|
* @Package com.acupuncture.system.service |
||||
|
* @Date 2025/2/10 17:29 |
||||
|
* @description: |
||||
|
*/ |
||||
|
public interface PmsPatientService { |
||||
|
|
||||
|
/** |
||||
|
* 添加患者信息 |
||||
|
* @param dto |
||||
|
* @return |
||||
|
*/ |
||||
|
int add(PmsPatientDto.PatientAdd dto); |
||||
|
|
||||
|
/** |
||||
|
* 修改患者信息 |
||||
|
* @param dto |
||||
|
* @return |
||||
|
*/ |
||||
|
int upd(PmsPatientDto.PatientUpd dto); |
||||
|
|
||||
|
/** |
||||
|
* 删除患者信息 |
||||
|
* @param idList |
||||
|
* @return |
||||
|
*/ |
||||
|
int del(List<Long> idList); |
||||
|
|
||||
|
/** |
||||
|
* 查询患者信息 |
||||
|
* @param dto |
||||
|
* @return |
||||
|
*/ |
||||
|
List<PmsPatientVo.PatientResult> query(PmsPatientDto.PatientQuery dto); |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,68 @@ |
|||||
|
package com.acupuncture.system.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.bean.BeanUtil; |
||||
|
import cn.hutool.core.util.IdUtil; |
||||
|
import com.acupuncture.common.utils.SecurityUtils; |
||||
|
import com.acupuncture.system.domain.dto.PmsPatientDto; |
||||
|
import com.acupuncture.system.domain.po.PmsPatient; |
||||
|
import com.acupuncture.system.domain.po.PmsPatientExample; |
||||
|
import com.acupuncture.system.domain.vo.PmsPatientVo; |
||||
|
import com.acupuncture.system.persist.dao.PmsPatientDao; |
||||
|
import com.acupuncture.system.persist.mapper.PmsPatientMapper; |
||||
|
import com.acupuncture.system.service.PmsPatientService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Propagation; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Author zzc |
||||
|
* @Package com.acupuncture.system.service |
||||
|
* @Date 2025/2/10 17:29 |
||||
|
* @description: |
||||
|
*/ |
||||
|
@Service |
||||
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
||||
|
public class PmsPatientServiceImpl implements PmsPatientService { |
||||
|
|
||||
|
@Resource |
||||
|
private PmsPatientMapper pmsPatientMapper; |
||||
|
@Resource |
||||
|
private PmsPatientDao pmsPatientDao; |
||||
|
|
||||
|
@Override |
||||
|
public int add(PmsPatientDto.PatientAdd dto) { |
||||
|
PmsPatient pmsPatient = BeanUtil.copyProperties(dto, PmsPatient.class); |
||||
|
pmsPatient.setId(IdUtil.getSnowflakeNextId()); |
||||
|
pmsPatient.setCreateBy(SecurityUtils.getUsername()); |
||||
|
pmsPatient.setDelFlag((byte) 0); |
||||
|
pmsPatient.setCreateTime(new Date()); |
||||
|
pmsPatient.setTenantId(SecurityUtils.getTenantId()); |
||||
|
return pmsPatientMapper.insertSelective(pmsPatient); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int upd(PmsPatientDto.PatientUpd dto) { |
||||
|
PmsPatient pmsPatient = BeanUtil.copyProperties(dto, PmsPatient.class); |
||||
|
pmsPatient.setUpdateBy(SecurityUtils.getUsername()); |
||||
|
pmsPatient.setUpdateTime(new Date()); |
||||
|
return pmsPatientMapper.updateByPrimaryKeySelective(pmsPatient); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int del(List<Long> idList) { |
||||
|
PmsPatientExample pmsPatientExample = new PmsPatientExample(); |
||||
|
pmsPatientExample.createCriteria().andIdIn(idList).andDelFlagEqualTo((byte) 0); |
||||
|
PmsPatient pmsPatient = new PmsPatient(); |
||||
|
pmsPatient.setDelFlag((byte) 1); |
||||
|
return pmsPatientMapper.updateByExampleSelective(pmsPatient, pmsPatientExample); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<PmsPatientVo.PatientResult> query(PmsPatientDto.PatientQuery dto) { |
||||
|
return pmsPatientDao.query(dto); |
||||
|
} |
||||
|
} |
@ -0,0 +1,55 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.acupuncture.system.persist.dao.PmsPatientDao"> |
||||
|
|
||||
|
<select id="query" resultType="com.acupuncture.system.domain.vo.PmsPatientVo$PatientResult" |
||||
|
parameterType="com.acupuncture.system.domain.dto.PmsPatientDto$PatientQuery"> |
||||
|
SELECT |
||||
|
id, |
||||
|
name, |
||||
|
gender, |
||||
|
birth_date as birthDate, |
||||
|
ethnicity, |
||||
|
education_years as educationYears, |
||||
|
phone, |
||||
|
id_card_type as idCardType, |
||||
|
id_card as idCard, |
||||
|
source, |
||||
|
current_illness_history as currentIllnessHistory, |
||||
|
create_by as createBy, |
||||
|
create_time as createTime |
||||
|
FROM |
||||
|
pms_patient |
||||
|
<where> |
||||
|
del_flag = 0 |
||||
|
<if test="query.tenantId != null"> |
||||
|
AND tenant_id = #{query.tenantId} |
||||
|
</if> |
||||
|
<if test="query.gender != null"> |
||||
|
AND gender = #{query.gender} |
||||
|
</if> |
||||
|
<if test="query.phone != null and query.phone != ''"> |
||||
|
AND phone = #{query.phone} |
||||
|
</if> |
||||
|
<if test="query.idCard != null and query.idCard != ''"> |
||||
|
AND id_card = #{query.idCard} |
||||
|
</if> |
||||
|
<if test="query.source != null"> |
||||
|
AND source = #{query.source} |
||||
|
</if> |
||||
|
<if test="query.startAge != null"> |
||||
|
AND DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), birth_date)), '%Y') + 0 >= #{query.startAge} |
||||
|
</if> |
||||
|
<if test="query.endAge != null"> |
||||
|
AND DATE_FORMAT(FROM_DAYS(DATEDIFF(NOW(), birth_date)), '%Y') + 0 <= #{query.endAge} |
||||
|
</if> |
||||
|
<if test="query.keywords != null and query.keywords != ''"> |
||||
|
AND ( |
||||
|
name LIKE CONCAT('%', #{query.keywords}, '%') |
||||
|
OR pinyin_full LIKE CONCAT('%', #{query.keywords}, '%') |
||||
|
OR pinyin_simple LIKE CONCAT('%', #{query.keywords}, '%') |
||||
|
) |
||||
|
</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
</mapper> |
@ -0,0 +1,442 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.acupuncture.system.persist.mapper.PmsPatientMapper"> |
||||
|
<resultMap id="BaseResultMap" type="com.acupuncture.system.domain.po.PmsPatient"> |
||||
|
<id column="id" jdbcType="BIGINT" property="id" /> |
||||
|
<result column="name" jdbcType="VARCHAR" property="name" /> |
||||
|
<result column="pinyin_full" jdbcType="VARCHAR" property="pinyinFull" /> |
||||
|
<result column="pinyin_simple" jdbcType="VARCHAR" property="pinyinSimple" /> |
||||
|
<result column="gender" jdbcType="TINYINT" property="gender" /> |
||||
|
<result column="birth_date" jdbcType="DATE" property="birthDate" /> |
||||
|
<result column="ethnicity" jdbcType="VARCHAR" property="ethnicity" /> |
||||
|
<result column="education_years" jdbcType="INTEGER" property="educationYears" /> |
||||
|
<result column="phone" jdbcType="VARCHAR" property="phone" /> |
||||
|
<result column="id_card_type" jdbcType="TINYINT" property="idCardType" /> |
||||
|
<result column="id_card" jdbcType="VARCHAR" property="idCard" /> |
||||
|
<result column="source" jdbcType="TINYINT" property="source" /> |
||||
|
<result column="current_illness_history" jdbcType="VARCHAR" property="currentIllnessHistory" /> |
||||
|
<result column="del_flag" jdbcType="TINYINT" property="delFlag" /> |
||||
|
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" /> |
||||
|
<result column="create_by" jdbcType="VARCHAR" property="createBy" /> |
||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
||||
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy" /> |
||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> |
||||
|
<result column="remark" jdbcType="VARCHAR" property="remark" /> |
||||
|
</resultMap> |
||||
|
<sql id="Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
<sql id="Update_By_Example_Where_Clause"> |
||||
|
<where> |
||||
|
<foreach collection="example.oredCriteria" item="criteria" separator="or"> |
||||
|
<if test="criteria.valid"> |
||||
|
<trim prefix="(" prefixOverrides="and" suffix=")"> |
||||
|
<foreach collection="criteria.criteria" item="criterion"> |
||||
|
<choose> |
||||
|
<when test="criterion.noValue"> |
||||
|
and ${criterion.condition} |
||||
|
</when> |
||||
|
<when test="criterion.singleValue"> |
||||
|
and ${criterion.condition} #{criterion.value} |
||||
|
</when> |
||||
|
<when test="criterion.betweenValue"> |
||||
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
||||
|
</when> |
||||
|
<when test="criterion.listValue"> |
||||
|
and ${criterion.condition} |
||||
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
||||
|
#{listItem} |
||||
|
</foreach> |
||||
|
</when> |
||||
|
</choose> |
||||
|
</foreach> |
||||
|
</trim> |
||||
|
</if> |
||||
|
</foreach> |
||||
|
</where> |
||||
|
</sql> |
||||
|
<sql id="Base_Column_List"> |
||||
|
id, name, pinyin_full, pinyin_simple, gender, birth_date, ethnicity, education_years, |
||||
|
phone, id_card_type, id_card, source, current_illness_history, del_flag, tenant_id, |
||||
|
create_by, create_time, update_by, update_time, remark |
||||
|
</sql> |
||||
|
<select id="selectByExample" parameterType="com.acupuncture.system.domain.po.PmsPatientExample" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<if test="distinct"> |
||||
|
distinct |
||||
|
</if> |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from pms_patient |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
<if test="orderByClause != null"> |
||||
|
order by ${orderByClause} |
||||
|
</if> |
||||
|
</select> |
||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
||||
|
select |
||||
|
<include refid="Base_Column_List" /> |
||||
|
from pms_patient |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</select> |
||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
||||
|
delete from pms_patient |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</delete> |
||||
|
<insert id="insert" parameterType="com.acupuncture.system.domain.po.PmsPatient"> |
||||
|
insert into pms_patient (id, name, pinyin_full, |
||||
|
pinyin_simple, gender, birth_date, |
||||
|
ethnicity, education_years, phone, |
||||
|
id_card_type, id_card, source, |
||||
|
current_illness_history, del_flag, tenant_id, |
||||
|
create_by, create_time, update_by, |
||||
|
update_time, remark) |
||||
|
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{pinyinFull,jdbcType=VARCHAR}, |
||||
|
#{pinyinSimple,jdbcType=VARCHAR}, #{gender,jdbcType=TINYINT}, #{birthDate,jdbcType=DATE}, |
||||
|
#{ethnicity,jdbcType=VARCHAR}, #{educationYears,jdbcType=INTEGER}, #{phone,jdbcType=VARCHAR}, |
||||
|
#{idCardType,jdbcType=TINYINT}, #{idCard,jdbcType=VARCHAR}, #{source,jdbcType=TINYINT}, |
||||
|
#{currentIllnessHistory,jdbcType=VARCHAR}, #{delFlag,jdbcType=TINYINT}, #{tenantId,jdbcType=BIGINT}, |
||||
|
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR}, |
||||
|
#{updateTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}) |
||||
|
</insert> |
||||
|
<insert id="insertSelective" parameterType="com.acupuncture.system.domain.po.PmsPatient"> |
||||
|
insert into pms_patient |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null"> |
||||
|
id, |
||||
|
</if> |
||||
|
<if test="name != null"> |
||||
|
name, |
||||
|
</if> |
||||
|
<if test="pinyinFull != null"> |
||||
|
pinyin_full, |
||||
|
</if> |
||||
|
<if test="pinyinSimple != null"> |
||||
|
pinyin_simple, |
||||
|
</if> |
||||
|
<if test="gender != null"> |
||||
|
gender, |
||||
|
</if> |
||||
|
<if test="birthDate != null"> |
||||
|
birth_date, |
||||
|
</if> |
||||
|
<if test="ethnicity != null"> |
||||
|
ethnicity, |
||||
|
</if> |
||||
|
<if test="educationYears != null"> |
||||
|
education_years, |
||||
|
</if> |
||||
|
<if test="phone != null"> |
||||
|
phone, |
||||
|
</if> |
||||
|
<if test="idCardType != null"> |
||||
|
id_card_type, |
||||
|
</if> |
||||
|
<if test="idCard != null"> |
||||
|
id_card, |
||||
|
</if> |
||||
|
<if test="source != null"> |
||||
|
source, |
||||
|
</if> |
||||
|
<if test="currentIllnessHistory != null"> |
||||
|
current_illness_history, |
||||
|
</if> |
||||
|
<if test="delFlag != null"> |
||||
|
del_flag, |
||||
|
</if> |
||||
|
<if test="tenantId != null"> |
||||
|
tenant_id, |
||||
|
</if> |
||||
|
<if test="createBy != null"> |
||||
|
create_by, |
||||
|
</if> |
||||
|
<if test="createTime != null"> |
||||
|
create_time, |
||||
|
</if> |
||||
|
<if test="updateBy != null"> |
||||
|
update_by, |
||||
|
</if> |
||||
|
<if test="updateTime != null"> |
||||
|
update_time, |
||||
|
</if> |
||||
|
<if test="remark != null"> |
||||
|
remark, |
||||
|
</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null"> |
||||
|
#{id,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="name != null"> |
||||
|
#{name,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="pinyinFull != null"> |
||||
|
#{pinyinFull,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="pinyinSimple != null"> |
||||
|
#{pinyinSimple,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="gender != null"> |
||||
|
#{gender,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="birthDate != null"> |
||||
|
#{birthDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="ethnicity != null"> |
||||
|
#{ethnicity,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="educationYears != null"> |
||||
|
#{educationYears,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="phone != null"> |
||||
|
#{phone,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="idCardType != null"> |
||||
|
#{idCardType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="idCard != null"> |
||||
|
#{idCard,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="source != null"> |
||||
|
#{source,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="currentIllnessHistory != null"> |
||||
|
#{currentIllnessHistory,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="delFlag != null"> |
||||
|
#{delFlag,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="tenantId != null"> |
||||
|
#{tenantId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="createBy != null"> |
||||
|
#{createBy,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="createTime != null"> |
||||
|
#{createTime,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="updateBy != null"> |
||||
|
#{updateBy,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="updateTime != null"> |
||||
|
#{updateTime,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="remark != null"> |
||||
|
#{remark,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
<select id="countByExample" parameterType="com.acupuncture.system.domain.po.PmsPatientExample" resultType="java.lang.Long"> |
||||
|
select count(*) from pms_patient |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</select> |
||||
|
<update id="updateByExampleSelective" parameterType="map"> |
||||
|
update pms_patient |
||||
|
<set> |
||||
|
<if test="record.id != null"> |
||||
|
id = #{record.id,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.name != null"> |
||||
|
name = #{record.name,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.pinyinFull != null"> |
||||
|
pinyin_full = #{record.pinyinFull,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.pinyinSimple != null"> |
||||
|
pinyin_simple = #{record.pinyinSimple,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.gender != null"> |
||||
|
gender = #{record.gender,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="record.birthDate != null"> |
||||
|
birth_date = #{record.birthDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="record.ethnicity != null"> |
||||
|
ethnicity = #{record.ethnicity,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.educationYears != null"> |
||||
|
education_years = #{record.educationYears,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="record.phone != null"> |
||||
|
phone = #{record.phone,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.idCardType != null"> |
||||
|
id_card_type = #{record.idCardType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="record.idCard != null"> |
||||
|
id_card = #{record.idCard,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.source != null"> |
||||
|
source = #{record.source,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="record.currentIllnessHistory != null"> |
||||
|
current_illness_history = #{record.currentIllnessHistory,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.delFlag != null"> |
||||
|
del_flag = #{record.delFlag,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="record.tenantId != null"> |
||||
|
tenant_id = #{record.tenantId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="record.createBy != null"> |
||||
|
create_by = #{record.createBy,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.createTime != null"> |
||||
|
create_time = #{record.createTime,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="record.updateBy != null"> |
||||
|
update_by = #{record.updateBy,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="record.updateTime != null"> |
||||
|
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="record.remark != null"> |
||||
|
remark = #{record.remark,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
</set> |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
<update id="updateByExample" parameterType="map"> |
||||
|
update pms_patient |
||||
|
set id = #{record.id,jdbcType=BIGINT}, |
||||
|
name = #{record.name,jdbcType=VARCHAR}, |
||||
|
pinyin_full = #{record.pinyinFull,jdbcType=VARCHAR}, |
||||
|
pinyin_simple = #{record.pinyinSimple,jdbcType=VARCHAR}, |
||||
|
gender = #{record.gender,jdbcType=TINYINT}, |
||||
|
birth_date = #{record.birthDate,jdbcType=DATE}, |
||||
|
ethnicity = #{record.ethnicity,jdbcType=VARCHAR}, |
||||
|
education_years = #{record.educationYears,jdbcType=INTEGER}, |
||||
|
phone = #{record.phone,jdbcType=VARCHAR}, |
||||
|
id_card_type = #{record.idCardType,jdbcType=TINYINT}, |
||||
|
id_card = #{record.idCard,jdbcType=VARCHAR}, |
||||
|
source = #{record.source,jdbcType=TINYINT}, |
||||
|
current_illness_history = #{record.currentIllnessHistory,jdbcType=VARCHAR}, |
||||
|
del_flag = #{record.delFlag,jdbcType=TINYINT}, |
||||
|
tenant_id = #{record.tenantId,jdbcType=BIGINT}, |
||||
|
create_by = #{record.createBy,jdbcType=VARCHAR}, |
||||
|
create_time = #{record.createTime,jdbcType=TIMESTAMP}, |
||||
|
update_by = #{record.updateBy,jdbcType=VARCHAR}, |
||||
|
update_time = #{record.updateTime,jdbcType=TIMESTAMP}, |
||||
|
remark = #{record.remark,jdbcType=VARCHAR} |
||||
|
<if test="_parameter != null"> |
||||
|
<include refid="Update_By_Example_Where_Clause" /> |
||||
|
</if> |
||||
|
</update> |
||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.acupuncture.system.domain.po.PmsPatient"> |
||||
|
update pms_patient |
||||
|
<set> |
||||
|
<if test="name != null"> |
||||
|
name = #{name,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="pinyinFull != null"> |
||||
|
pinyin_full = #{pinyinFull,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="pinyinSimple != null"> |
||||
|
pinyin_simple = #{pinyinSimple,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="gender != null"> |
||||
|
gender = #{gender,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="birthDate != null"> |
||||
|
birth_date = #{birthDate,jdbcType=DATE}, |
||||
|
</if> |
||||
|
<if test="ethnicity != null"> |
||||
|
ethnicity = #{ethnicity,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="educationYears != null"> |
||||
|
education_years = #{educationYears,jdbcType=INTEGER}, |
||||
|
</if> |
||||
|
<if test="phone != null"> |
||||
|
phone = #{phone,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="idCardType != null"> |
||||
|
id_card_type = #{idCardType,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="idCard != null"> |
||||
|
id_card = #{idCard,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="source != null"> |
||||
|
source = #{source,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="currentIllnessHistory != null"> |
||||
|
current_illness_history = #{currentIllnessHistory,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="delFlag != null"> |
||||
|
del_flag = #{delFlag,jdbcType=TINYINT}, |
||||
|
</if> |
||||
|
<if test="tenantId != null"> |
||||
|
tenant_id = #{tenantId,jdbcType=BIGINT}, |
||||
|
</if> |
||||
|
<if test="createBy != null"> |
||||
|
create_by = #{createBy,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="createTime != null"> |
||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="updateBy != null"> |
||||
|
update_by = #{updateBy,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
<if test="updateTime != null"> |
||||
|
update_time = #{updateTime,jdbcType=TIMESTAMP}, |
||||
|
</if> |
||||
|
<if test="remark != null"> |
||||
|
remark = #{remark,jdbcType=VARCHAR}, |
||||
|
</if> |
||||
|
</set> |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
<update id="updateByPrimaryKey" parameterType="com.acupuncture.system.domain.po.PmsPatient"> |
||||
|
update pms_patient |
||||
|
set name = #{name,jdbcType=VARCHAR}, |
||||
|
pinyin_full = #{pinyinFull,jdbcType=VARCHAR}, |
||||
|
pinyin_simple = #{pinyinSimple,jdbcType=VARCHAR}, |
||||
|
gender = #{gender,jdbcType=TINYINT}, |
||||
|
birth_date = #{birthDate,jdbcType=DATE}, |
||||
|
ethnicity = #{ethnicity,jdbcType=VARCHAR}, |
||||
|
education_years = #{educationYears,jdbcType=INTEGER}, |
||||
|
phone = #{phone,jdbcType=VARCHAR}, |
||||
|
id_card_type = #{idCardType,jdbcType=TINYINT}, |
||||
|
id_card = #{idCard,jdbcType=VARCHAR}, |
||||
|
source = #{source,jdbcType=TINYINT}, |
||||
|
current_illness_history = #{currentIllnessHistory,jdbcType=VARCHAR}, |
||||
|
del_flag = #{delFlag,jdbcType=TINYINT}, |
||||
|
tenant_id = #{tenantId,jdbcType=BIGINT}, |
||||
|
create_by = #{createBy,jdbcType=VARCHAR}, |
||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}, |
||||
|
update_by = #{updateBy,jdbcType=VARCHAR}, |
||||
|
update_time = #{updateTime,jdbcType=TIMESTAMP}, |
||||
|
remark = #{remark,jdbcType=VARCHAR} |
||||
|
where id = #{id,jdbcType=BIGINT} |
||||
|
</update> |
||||
|
</mapper> |
Loading…
Reference in new issue