add===>:移植专病筛查模块

This commit is contained in:
haown 2023-09-21 17:11:12 +08:00
parent 444d1f8400
commit 0997c0a5d1
28 changed files with 2662 additions and 7 deletions

View File

@ -0,0 +1,17 @@
package com.xinelu.common.constant;
/**
* @description: 筛查项目通用常量
* @author: haown
* @create: 2023-09-08 17:08
**/
public class ScreeningProjectConstants {
public static final String PLATELET = "血小板筛查";
public static final String EYE = "眼底病变筛查";
public static final String ALZHEIMER = "阿尔兹海默症筛查";
public static final String DOPPLER = "多普勒筛查";
}

View File

@ -0,0 +1,36 @@
package com.xinelu.common.core.domain;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 下拉框VO
* @author: haown
* @create: 2022-11-22 09:14
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SelectVo {
private static final long serialVersionUID = 8507280915433781280L;
/**
*
*/
private String value;
/**
* 标签
*/
private String label;
/**
* 子类
*/
private List<SelectVo> children;
}

View File

@ -0,0 +1,19 @@
package com.xinelu.common.core.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import lombok.Data;
/**
* @description: 时间轴
* @author: haown
* @create: 2022-12-13 11:13
**/
@Data
public class TimelineVo {
private String id;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
}

View File

@ -0,0 +1,86 @@
package com.xinelu.common.enums;
import java.util.Arrays;
/**
* @author gaoyu
* @description: 文件上传类型
* @date 2022-11-30 10:46
*/
public enum UploadType {
AVATAR("1001", "用户头像", "JPG,PNG,JPEG,BMP", "file/user/avatar/"),
USER_CERT("1002", "用户证书", "JPG,PNG,JPEG,BMP", "file/user/cert/"),
INSTITUTION_SIGNATURE("1003", "机构签章", "JPG,PNG,JPEG,BMP", "file/institution/signature/"),
F_RESIDENT_SIGNATURE("1007", "医生随访签字","JPG,PNG,JPEG,BMP", "file/resident/followup/signature/"),
F_RESIDENT_HEADIMG("1004", "居民随访头像(佐证)","JPG,PNG,JPEG,BMP", "file/resident/followup/signature/"),
F_RESIDENT_FINGER("1008", "居民指纹","JPG,PNG,JPEG,BMP", "file/resident/followup/finger/"),
A_RESIDENT_SIGNATURE("1005", "档案居民签名","JPG,PNG,JPEG,BMP", "file/resident/archive/signature/"),
A_RESIDENT_HEADIMG("1006", "档案居民头像","JPG,PNG,JPEG,BMP", "file/resident/archive/headimg/"),
A_RESIDENT_FAMILY_SIGNATURE("1007", "档案居民家属签名","JPG,PNG,JPEG,BMP", "file/resident/archive/family/signature/"),
LEFT_EYE_RESULT("2001", "眼底镜筛查结果-左眼", "JPG,PNG,JPEG", "file/screening/lefteye/"),
RIGHT_EYE_RESULT("2002", "眼底镜筛查结果-右眼", "JPG,PNG,JPEG", "file/screening/righteye/"),
PLATELET_RESULT("2003", "血小板筛查结果", "JPG,PNG,JPEG,PDF", "file/screening/platelet/"),
DOPPLER_RESULT("2004", "多普勒筛查结果", "JPG,PNG,JPEG", "file/screening/doppler/"),
SCREENING_BARCODE("2005", "筛查预约条形码", "JPG,PNG,JPEG", "file/screening/barcode/"),
REGISTRATION_BARCODE("2006", "登记条形码", "JPG,PNG,JPEG", "file/registration/barcode/"),
ALZHEIMER_DISEASE_BARCODE("2007", "阿尔兹海默症结果", "DOC,DOCX", "file/alzheimer/disease/"),
/**
* APP安装包保存路径
*/
APP_UPLOAD_PATH("5001", "APP安装包", "APK", "file/apk/"),
/**
* APP安装包二维码保存路径
*/
APP_QRCODE_PATH("5002", "APP安装包二维码", "JPG,PNG", "file/img/qrcode/app/"),
EMPTY("", "", "", "");
private final String code;
private final String label;
private final String suffix;
private final String path;
UploadType(String code, String label, String suffix, String path) {
this.code = code;
this.label = label;
this.suffix = suffix;
this.path = path;
}
public String getCode() {
return code;
}
public String getLabel() {
return label;
}
public String getSuffix() {
return suffix;
}
public String getPath() {
return path;
}
public static UploadType getUploadType(final String code) {
return Arrays.stream(UploadType.values()).filter(ut -> ut.code.equals(code)).findFirst().orElse(EMPTY);
}
}

View File

@ -163,6 +163,19 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
return Date.from(zdt.toInstant());
}
/**
* 得到日期字符串 默认格式yyyy-MM-dd pattern可以为"yyyy-MM-dd" "HH:mm:ss" "E"
*/
public static String formatDate(Date date, Object... pattern) {
String formatDate = null;
if (pattern != null && pattern.length > 0) {
formatDate = DateFormatUtils.format(date, pattern[0].toString());
} else {
formatDate = DateFormatUtils.format(date, "yyyy-MM-dd");
}
return formatDate;
}
/**
* 转换日期到字符串
*

View File

@ -34,5 +34,9 @@
<artifactId>swagger-models</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>com.xinelu</groupId>
<artifactId>xinelu-system</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,131 @@
package com.xinelu.manage.controller.screeningproject;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.R;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.utils.uuid.IdUtils;
import com.xinelu.manage.domain.screeningproject.ScreeningProject;
import com.xinelu.manage.service.screeningproject.IScreeningProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import javax.annotation.Resource;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
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;
/**
* @description: 项目控制器
* @author: haown
* @create: 2023-01-19 10:49
**/
@RestController
@RequestMapping("/business/project")
@Api(tags = "项目控制器")
public class ScreeningProjectController extends BaseController {
@Resource
private IScreeningProjectService projectService;
@ApiOperation("服务项目分页列表")
@GetMapping("list")
public TableDataInfo list(ScreeningProject project) {
startPage();
List<ScreeningProject> list = projectService.findList(project);
return getDataTable(list);
}
@ApiOperation("服务项目列表")
@GetMapping("getList")
public R<List<ScreeningProject>> getList(ScreeningProject project) {
List<ScreeningProject> list = projectService.findList(project);
return R.ok(list);
}
@ApiOperation("新增服务项目")
@PostMapping("add")
public R<String> add(@RequestBody ScreeningProject project) {
if (projectService.checkSameProjectName(project.getProjectName(), project.getDeptId(), null)) {
return R.fail("" + project.getDeptName() + "】已存在服务项目【" + project.getProjectName() + "】,不能重复添加");
}
//价格校验
if (Objects.isNull(project.getDiscount())) {
project.setDiscount(10);
if (Objects.isNull(project.getPrice())) {
project.setPrice(new BigDecimal(0));
}
project.setDiscountPrice(project.getPrice());
}
boolean greaterThan = Objects.nonNull(project.getDiscount()) && project.getDiscount() > 10;
boolean lessThan = Objects.nonNull(project.getDiscount()) && project.getDiscount() < 1;
if (BooleanUtils.isTrue(greaterThan) || BooleanUtils.isTrue(lessThan)) {
return R.fail("折扣不能大于10,或小于1");
}
if (StringUtils.isBlank(project.getStatus())) {
project.setStatus("1");
}
project.setDiscountPrice(project.getPrice().multiply(new BigDecimal(project.getDiscount())).multiply(new BigDecimal("0.1")));
project.setProjectId(IdUtils.fastSimpleUUID());
project.setCreateBy(getUsername());
project.setCreateTime(new Date());
project.setDelFlag("0");
return projectService.insert(project) > 0 ? R.ok() : R.fail("保存失败");
}
@ApiOperation("修改服务项目")
@PostMapping("update")
public R<?> update(@RequestBody ScreeningProject project) {
if (projectService.checkSameProjectName(project.getProjectName(), project.getDeptId(), project.getProjectId())) {
return R.fail("" + project.getDeptName() + "】已存在服务项目【" + project.getProjectName() + "】,不能重复添加");
}
//价格校验
if (Objects.isNull(project.getDiscount())) {
project.setDiscount(10);
if (Objects.isNull(project.getPrice())) {
project.setPrice(new BigDecimal(0));
}
project.setDiscountPrice(project.getPrice());
}
boolean greaterThan = Objects.nonNull(project.getDiscount()) && project.getDiscount() > 10;
boolean lessThan = Objects.nonNull(project.getDiscount()) && project.getDiscount() < 1;
if (BooleanUtils.isTrue(greaterThan) || BooleanUtils.isTrue(lessThan)) {
return R.fail("折扣不能大于10,或小于1");
}
if (StringUtils.isBlank(project.getStatus())) {
project.setStatus("1");
}
project.setDiscountPrice(project.getPrice().multiply(new BigDecimal(project.getDiscount())).multiply(new BigDecimal("0.1")));
project.setUpdateBy(getUsername());
project.setUpdateTime(new Date());
projectService.update(project);
return R.ok();
}
@ApiOperation("修改服务项目状态")
@PostMapping("changeStatus")
public R<?> changeStatus(@RequestBody ScreeningProject project) {
project.setUpdateBy(getUsername());
projectService.update(project);
return R.ok();
}
@ApiOperation("逻辑删除服务项目")
@PostMapping("delete/{projectId}")
@ApiImplicitParam(name = "projectId", value = "服务项目编号", required = true, dataTypeClass = String.class)
public R<?> delete(@PathVariable String projectId) {
ScreeningProject project = new ScreeningProject();
project.setProjectId(projectId);
project.setDelFlag("1");
project.setUpdateBy(getUsername());
projectService.delete(project);
return R.ok();
}
}

View File

@ -0,0 +1,126 @@
package com.xinelu.manage.controller.screeningrecord;
import com.xinelu.common.annotation.RepeatSubmit;
import com.xinelu.common.core.controller.BaseController;
import com.xinelu.common.core.domain.R;
import com.xinelu.common.core.domain.SelectVo;
import com.xinelu.common.core.domain.TimelineVo;
import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.utils.StringUtils;
import com.xinelu.manage.domain.screeningrecord.ScreeningRecord;
import com.xinelu.manage.dto.screeningrecord.ScreeningRecordDTO;
import com.xinelu.manage.dto.screeningrecord.ScreeningRecordSaveDTO;
import com.xinelu.manage.service.screeningrecord.IScreeningRecordService;
import com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
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;
/**
* @Author mengkuiliang
* @Description 筛查预约控制器
* @Date 2023-01-29 13:57
* @Param
* @return
**/
@RestController
@RequestMapping("/business/screening")
@Api(tags = "筛查预约控制器")
public class ScreeningRecordController extends BaseController {
@Resource
private IScreeningRecordService screeningRecordService;
@GetMapping("/screeningList")
@ApiOperation(value = "居民预约筛查列表")
public TableDataInfo screeningList(ScreeningRecordDTO query) {
startPage();
return getDataTable(screeningRecordService.screeningList(query));
}
@GetMapping("/list")
@ApiOperation(value = "获取列表")
public List<ScreeningRecordVo> list(ScreeningRecordDTO query) {
return screeningRecordService.list(query);
}
@GetMapping("/detail/{screeningId}")
@ApiOperation(value = "获取预约详情")
public R<ScreeningRecordVo> detail(@PathVariable String screeningId) {
return R.ok(screeningRecordService.detail(screeningId));
}
@GetMapping("/getScreening/{registerId}")
@ApiOperation(value = "获取当前预约信息")
public R<ScreeningRecordVo> getScreeningByRegisterId(@PathVariable String registerId) {
return R.ok(screeningRecordService.getScreeningByRegisterId(registerId));
}
@GetMapping("/last/{registerId}")
@ApiOperation(value = "获取最新一次筛查结果")
public R<ScreeningRecordVo> last(@PathVariable String registerId) {
return R.ok(screeningRecordService.last(registerId,null));
}
@GetMapping("/timelineList/{registerId}")
@ApiOperation(value = "根据居民业务主键查询筛查记录时间轴", response = TimelineVo.class, notes = "根据居民业务主键查询筛查记录时间轴", httpMethod = "GET")
@ApiImplicitParam(name = "registerId", value = "居民业务主键", required = true, dataTypeClass = String.class)
public R<List<SelectVo>> TimelineList(@PathVariable("registerId") String registerId) {
return R.ok(screeningRecordService.getTimelineList(registerId));
}
@GetMapping("/receive/{screeningId}")
@ApiOperation(value = "登记")
public R<String> receive(@PathVariable("screeningId") String screeningId) {
if(StringUtils.isBlank(screeningId)) {
return R.fail("请选择预约信息");
}
try {
String registrationCode = screeningRecordService.receive(screeningId);
return R.ok("预约已登记成功,条码:" + registrationCode + " 请及时进行筛查。");
} catch (Exception e) {
return R.fail(e.getMessage());
}
}
@PostMapping("/update")
@ApiOperation(value = "修改")
public R<String> update(@RequestBody ScreeningRecord body) {
// 判断是否已登记
ScreeningRecordVo screeningRecordVo = screeningRecordService.detail(body.getScreeningId());
if (StringUtils.equals("1", screeningRecordVo.getScreeningStatus())) {
return R.fail("该预约未登记,请先登记!");
}
int flag = screeningRecordService.update(body);
return flag < 0 ? R.fail() : R.ok();
}
@PostMapping("/pushScreening")
@ApiOperation(value = "推送筛查项目")
@RepeatSubmit(interval = 2000, message = "请求过于频繁")
public R<String> pushScreening(@RequestBody ScreeningRecordSaveDTO body) {
try {
if (StringUtils.isBlank(body.getRegisterId())) {
return R.fail("请选择居民!");
}
if (CollectionUtils.isEmpty(body.getProjectList())) {
return R.fail("请选择筛查项目!");
}
int flag = screeningRecordService.pushScreening(body);
return R.ok(flag > 0 ? "保存成功": "保存失败");
} catch (Exception e) {
return R.fail(e.getMessage());
}
}
}

View File

@ -0,0 +1,83 @@
package com.xinelu.manage.domain.screeningproject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
import lombok.Data;
/**
* 项目表
* @TableName screening_project
*/
@Data
public class ScreeningProject extends BaseEntity {
/**
* 自增主键
*/
private Long id;
/**
* 项目业务主键
*/
@ApiModelProperty("项目业务主键")
private String projectId;
/**
* 项目名称
*/
@ApiModelProperty("项目名称")
private String projectName;
/**
* 项目类型1检查项目 2套餐项目
*/
@ApiModelProperty("项目类型1检查项目 2套餐项目")
private String projectType;
/**
* 价格
*/
private BigDecimal price;
/**
* 折扣
*/
private Integer discount;
/**
* 优惠后价格
*/
private BigDecimal discountPrice;
/**
* 启用状态0启用 1未启用
*/
private String status;
/**
* 医院编号
*/
@ApiModelProperty("医院编号")
private String deptId;
/**
* 医院名称
*/
@ApiModelProperty("医院名称")
private String deptName;
/**
* 删除标识0存在1已删除
*/
private String delFlag;
/**
* 创建时间
* */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,147 @@
package com.xinelu.manage.domain.screeningrecord;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 居民预约记录表
* @TableName sd_screening_record
*/
@Data
public class ScreeningRecord implements Serializable {
/**
* 自增主键
*/
private Long id;
/**
* 业务主键
*/
@ApiModelProperty("业务主键")
private String screeningId;
/**
* 居民业务主键
*/
@ApiModelProperty("居民业务主键")
private String registerId;
/**
* 居民姓名
*/
@ApiModelProperty("居民姓名")
private String residentName;
/**
* 状态1已预约 2取消预约 3已登记 4已完成
*/
@ApiModelProperty("状态1已预约 2取消预约 3已登记 4已完成")
private String screeningStatus;
/**
* 基础疾病
*/
@ApiModelProperty("基础疾病")
private String disease;
/**
* 医院编号
*/
private String deptId;
/**
* 医院名称
*/
private String deptName;
/**
* 预约项目业务主键
*/
private String projectId;
/**
* 预约项目名称
* */
private String projectName;
/**
* 检查日期
*/
private Date screeningDate;
/**
* 预约开始时间
*/
private Date applyStartTime;
/**
* 预约结束时间
*/
private Date applyEndTime;
/**
* 内容
*/
private String content;
/**
* 诊断结果
* */
@ApiModelProperty("诊断结果")
private String diagnosticResult;
/**
* 附件
* */
@ApiModelProperty("附件一")
private String attachment;
/**
* 附件2
* */
@ApiModelProperty("附件二")
private String attachmentTwo;
/**
* 医生编号
*/
@ApiModelProperty("医生编号")
private String doctorId;
/**
* 医生名称
*/
@ApiModelProperty("医生名称")
private String doctorName;
@ApiModelProperty("预约码")
private String applyCode;
@ApiModelProperty(value = "预约条码")
private String applyBarcode;
@ApiModelProperty("登记日期")
private Date registrationDate;
@ApiModelProperty("登记码")
private String registrationCode;
@ApiModelProperty(value = "登记条码")
private String registrationBarcode;
@ApiModelProperty(value = "筛查种类1居民预约2医生推送")
private String screeningType;
@ApiModelProperty(value = "医生推送日期")
private Date pushDate;
private String assessRecordId;
/**
* 备注
*/
private String remark;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,75 @@
package com.xinelu.manage.dto.screeningrecord;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* @Author mengkuiliang
* @Description 居民预约请求对象
* @Date 2023-01-29 14:03
* @Param
* @return
**/
@Data
@ApiModel("居民预约请求对象")
public class ScreeningApplyDTO implements Serializable {
/**
* 居民业务主键
*/
@ApiModelProperty(value = "居民业务主键")
private String registerId;
@ApiModelProperty(value = "居民身份证号")
private String identity;
private String screeningId;
/**
* 预约开始时间
*/
@ApiModelProperty(value = "预约开始时间", required = true)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date applyStartTime;
/**
* 预约结束时间
*/
@ApiModelProperty(value = "预约结束时间", required = true)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date applyEndTime;
@ApiModelProperty(value = "预约机构业务主键", required = true)
private String deptId;
@ApiModelProperty(value = "预约机构名称", required = true)
private String deptName;
@ApiModelProperty(value = "预约项目业务主键", required = true)
private String projectId;
@ApiModelProperty(value = "预约项目名称", required = true)
private String projectName;
@ApiModelProperty(value = "附件一")
private String attachment;
@ApiModelProperty(value = "附件二")
private String attachmentTwo;
/**
* 删除标识0正常1已删除
*/
@ApiModelProperty(value = "删除标识0正常1已删除", hidden = true)
private String delFlag;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
}

View File

@ -0,0 +1,144 @@
package com.xinelu.manage.dto.screeningrecord;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* @Author mengkuiliang
* @Description 居民预约记录请求对象
* @Date 2023-01-29 14:03
* @Param
* @return
**/
@Data
@ApiModel("居民预约记录请求对象")
public class ScreeningRecordApplyDTO implements Serializable {
/**
* 业务主键
*/
@ApiModelProperty("业务主键")
private String screeningId;
/**
* 居民业务主键
*/
@ApiModelProperty(value = "居民业务主键", required = true)
private String registerId;
/**
* 居民姓名
*/
@ApiModelProperty(value = "居民姓名", required = true)
private String residentName;
/**
* 状态1已预约 2取消预约 3已登记 4已完成
*/
@ApiModelProperty(value = "状态1已预约 2取消预约 3已登记 4已完成", hidden = true)
private String screeningStatus;
/**
* 基础疾病
*/
@ApiModelProperty(value = "基础疾病", required = true)
private String disease;
/**
* 医院编号
*/
@ApiModelProperty("医院编号")
private String deptId;
/**
* 医院名称
*/
@ApiModelProperty("医院名称")
private String deptName;
@ApiModelProperty("项目业务主键")
private String projectId;
/**
* 医院名称
*/
@ApiModelProperty("项目名称")
private String projectName;
/**
* 预约开始时间
*/
@ApiModelProperty(value = "预约开始时间", required = true)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date applyStartTime;
/**
* 预约结束时间
*/
@ApiModelProperty(value = "预约结束时间", required = true)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date applyEndTime;
/**
* 医生编号
*/
@ApiModelProperty("医生编号")
private String doctorId;
/**
* 医生名称
*/
@ApiModelProperty("医生名称")
private String doctorName;
/**
* 检查日期
*/
@ApiModelProperty("检查日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date screeningDate;
@ApiModelProperty("内容")
private String content;
@ApiModelProperty("诊断结果")
private String diagnosticResult;
@ApiModelProperty("附件一")
private String attachment;
@ApiModelProperty("附件二")
private String attachmentTwo;
@ApiModelProperty("预约码")
private String applyCode;
@ApiModelProperty(value = "预约条码")
private String applyBarcode;
@ApiModelProperty("登记日期")
private Date registrationDate;
@ApiModelProperty("登记码")
private String registrationCode;
@ApiModelProperty(value = "登记条码")
private String registrationBarcode;
@ApiModelProperty(value = "筛查种类1居民预约2医生推送")
private String screeningType;
private Date pushDate;
private String assessRecordId;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
}

View File

@ -0,0 +1,142 @@
package com.xinelu.manage.dto.screeningrecord;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.Data;
/**
* @Author mengkuiliang
* @Description 居民预约记录查询对象
* @Date 2023-01-29 14:03
* @Param
* @return
**/
@Data
@ApiModel("居民预约记录查询对象")
public class ScreeningRecordDTO extends BaseEntity {
/**
* 居民业务主键
*/
@ApiModelProperty(value = "居民业务主键")
private String registerId;
/**
* 居民姓名
*/
@ApiModelProperty(value = "居民姓名")
private String residentName;
/**
* 身份证号
*/
@ApiModelProperty(value = "身份证号")
private String identity;
/**
* 状态1已预约 2取消预约 3已登记 4已完成
*/
@ApiModelProperty(value = "状态1已预约 2取消预约 3已登记 4已完成")
private String screeningStatus;
/**
* 家庭住址
*/
@ApiModelProperty(value = "家庭住址")
private String address;
/**
* 医院编号
*/
@ApiModelProperty("医院编号")
private String deptId;
/**
* 医院名称
*/
@ApiModelProperty("医院名称")
private String deptName;
@ApiModelProperty("预约项目业务主键")
private String projectId;
@ApiModelProperty("预约项目名称")
private String projectName;
/**
* 医生编号
*/
@ApiModelProperty("医生编号")
private String doctorId;
/**
* 医生名称
*/
@ApiModelProperty("医生名称")
private String doctorName;
/**
* 检查开始时间
*/
@ApiModelProperty(value = "检查开始时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date screeningStartDate;
/**
* 检查结束时间
*/
@ApiModelProperty(value = "检查结束时间")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date screeningEndDate;
/**
* 预约开始时间
*/
@ApiModelProperty(value = "预约开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date applyStartDate;
/**
* 预约结束时间
*/
@ApiModelProperty(value = "预约结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date applyEndDate;
@ApiModelProperty("预约码")
private String applyCode;
@ApiModelProperty("登记状态0:未登记,1:已登记")
private String registrationStatus;
@ApiModelProperty("是否过期0:生效中,1:已过期")
private String exceedStatus;
@ApiModelProperty("是否生成筛查结果0:未生成,1:已生成")
private String hasResult;
@ApiModelProperty("是否诊断0:未诊断,1:已诊断")
private String hasDiagnose;
@ApiModelProperty(value = "筛查种类1居民预约2医生推送")
private String screeningType;
@ApiModelProperty(value = "评估业务主键")
private String assessRecordId;
/**
* 页码
*/
@ApiModelProperty("页码")
private Integer pageNum;
/**
* 页面大小
*/
@ApiModelProperty("页面大小")
private Integer pageSize;
}

View File

@ -0,0 +1,27 @@
package com.xinelu.manage.dto.screeningrecord;
import com.xinelu.manage.domain.screeningproject.ScreeningProject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import lombok.Data;
/**
* @description: 推送筛查预约项目传输类
* @author: haown
* @create: 2023-05-05 17:43
**/
@Data
@ApiModel("推送筛查预约项目传输类")
public class ScreeningRecordSaveDTO {
@ApiModelProperty("居民业务主键")
private String registerId;
@ApiModelProperty("筛查项目列表")
private List<ScreeningProject> projectList;
@ApiModelProperty("评估记录业务主键")
private String assessRecordId;
}

View File

@ -89,6 +89,14 @@ public interface PatientInfoMapper {
**/
PatientInfoVO getPatientInfoById(Long id);
/**
* 根据cardNo查询所有信息
*
* @param cardNo 用户身份证号
* @return PatientInfo 结果
**/
PatientInfoVO getPatientInfoByCardNo(String cardNo);
/**
* 新增被护理人基本信息
*

View File

@ -0,0 +1,31 @@
package com.xinelu.manage.mapper.screeningproject;
import com.xinelu.manage.domain.screeningproject.ScreeningProject;
import java.util.List;
import org.apache.ibatis.annotations.Param;
/**
* @author haown
* @description 针对表sd_project(项目表)的数据库操作Mapper
* @createDate 2023-01-16 15:06:38
* @Entity com.disease.business.domain.entity.Project
*/
public interface ScreeningProjectMapper {
List<ScreeningProject> findList(ScreeningProject project);
int deleteByPrimaryKey(String projectId);
int insert(ScreeningProject record);
int insertSelective(ScreeningProject record);
ScreeningProject selectByPrimaryKey(String projectId);
int updateByPrimaryKeySelective(ScreeningProject record);
int updateByPrimaryKey(ScreeningProject record);
Integer checkSameName(@Param("projectName") String projectName, @Param("deptId") String deptId, @Param("projectId") String projectId);
}

View File

@ -0,0 +1,101 @@
package com.xinelu.manage.mapper.screeningrecord;
import com.xinelu.common.core.domain.TimelineVo;
import com.xinelu.manage.domain.screeningrecord.ScreeningRecord;
import com.xinelu.manage.dto.screeningrecord.ScreeningRecordApplyDTO;
import com.xinelu.manage.dto.screeningrecord.ScreeningRecordDTO;
import com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
/**
* @author mengkuiliang
* @description 针对表sd_screening_record(居民预约记录表)的数据库操作Mapper
* @createDate 2023-01-29 13:53:13
* @Entity com.disease.business.domain.entity.ScreeningRecord
*/
public interface ScreeningRecordMapper {
/**
* @Author mengkuiliang
* @Description 新增
* @Date 2023-01-29 14:13
* @Param [body]
* @return void
**/
int insert(ScreeningRecordApplyDTO body);
/**
* @Author mengkuiliang
* @Description 修改
* @Date 2023-01-29 14:14
* @Param [record]
* @return int
**/
int update(ScreeningRecord record);
/**
* @Author mengkuiliang
* @Description 更新预约状态
* @Date 2023-01-29 14:14
* @Param [screeningId]
* @return void
**/
void updateStatus(@Param("screeningId") String screeningId, @Param("screeningStatus") String screeningStatus, @Param("screeningDate") Date screeningDate);
/**
* @Author mengkuiliang
* @Description 获取预约详情
* @Date 2023-01-29 14:14
* @Param [screeningId]
* @return com.disease.business.domain.vo.ScreeningRecordVo
**/
ScreeningRecordVo detail(String screeningId);
/**
* @Author mengkuiliang
* @Description 获取当前居民预约信息
* @Date 2023-01-29 14:51
* @Param [registerId]
* @return com.disease.business.domain.vo.ScreeningRecordVo
**/
ScreeningRecordVo getScreeningByRegisterId(String registerId);
/**
* @Author mengkuiliang
* @Description 获取预约记录
* @Date 2023-01-29 15:56
* @Param [query]
* @return java.util.List<com.disease.business.domain.vo.ScreeningRecordVo>
**/
List<ScreeningRecordVo> list(ScreeningRecordDTO query);
/**
* @Author mengkuiliang
* @Description 获取筛查结果记录
* @Date 2023-01-29 15:56
* @Param [query]
* @return java.util.List<com.disease.business.domain.vo.ScreeningRecordVo>
**/
List<ScreeningRecordVo> record(ScreeningRecordDTO query);
/**
* @Author mengkuiliang
* @Description 获取最新一次筛查结果
* @Date 2023-01-30 13:07
* @Param [registerId]
* @return com.disease.business.domain.vo.ScreeningRecordVo
**/
ScreeningRecordVo getScreeningOfLast(@Param("registerId") String registerId, @Param("screeningStatus")String screeningStatus, @Param("screeningType") String screeningType, @Param("projectId") String projectId);
ScreeningRecord selectByScreeningId(String screeningId);
List<TimelineVo> selectTimeLineList(@Param("registerId") String registerId);
List<ScreeningRecordVo> screeningList(ScreeningRecordDTO query);
}

View File

@ -10,6 +10,7 @@ import com.xinelu.common.utils.regex.RegexUtil;
import com.xinelu.manage.domain.hospitalinfo.HospitalInfo;
import com.xinelu.manage.mapper.hospitalinfo.HospitalInfoMapper;
import com.xinelu.manage.service.hospitalinfo.IHospitalInfoService;
import com.xinelu.manage.service.nursestationitem.INurseStationItemService;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
@ -36,8 +37,8 @@ public class HospitalInfoServiceImpl implements IHospitalInfoService {
private GenerateSystemCodeUtil generateSystemCodeUtil;
@Resource
private RegexUtil regexUtil;
//@Resource
//private INurseStationItemService nurseStationItemService;
@Resource
private INurseStationItemService nurseStationItemService;
/**
* 查询医院信息管理
@ -153,8 +154,7 @@ public class HospitalInfoServiceImpl implements IHospitalInfoService {
//修改路径
String substring = pictureUrl.substring(pictureUrl.indexOf("/profile"));
//删除医院简介富文本图片
//@TODO
//nurseStationItemService.deletePictureUrl(substring);
nurseStationItemService.deletePictureUrl(substring);
}
}
return AjaxResult.success();
@ -194,8 +194,7 @@ public class HospitalInfoServiceImpl implements IHospitalInfoService {
//修改路径
String substring = pictureUrl.substring(pictureUrl.indexOf("/profile"));
//删除富文本图片
// @TODO
//nurseStationItemService.deletePictureUrl(substring);
nurseStationItemService.deletePictureUrl(substring);
}
}
}

View File

@ -23,6 +23,14 @@ public interface IPatientInfoService {
*/
PatientInfoVO selectPatientInfoById(Long id);
/**
* 查询被护理人基本信息
*
* @param cardNo 被护理人基本信息主键
* @return 被护理人基本信息
*/
PatientInfoVO selectPatientInfoByCardNo(String cardNo);
/**
* 查询被护理人基本信息列表
*

View File

@ -73,7 +73,11 @@ public class PatientInfoServiceImpl implements IPatientInfoService {
return patientInfoById;
}
/**
@Override public PatientInfoVO selectPatientInfoByCardNo(String cardNo) {
return patientInfoMapper.getPatientInfoByCardNo(cardNo);
}
/**
* 查询被护理人基本信息列表
*
* @param patientInfo 被护理人基本信息

View File

@ -0,0 +1,31 @@
package com.xinelu.manage.service.screeningproject;
import com.xinelu.manage.domain.screeningproject.ScreeningProject;
import java.util.List;
/**
* @author haown
* @description 针对表sd_project(项目表)的数据库操作Service
* @createDate 2023-01-16 15:37:05
*/
public interface IScreeningProjectService {
List<ScreeningProject> findList(ScreeningProject project);
int insert(ScreeningProject project);
int update(ScreeningProject project);
void delete(ScreeningProject project);
/**
* 检验机构是否存在相同名称服务项目
* @param projectName 项目名称
* @param deptId 机构id
* @param projectId 项目业务主键
* @return {@link boolean}
* @author gaoyu
* @date 2022-11-23 10:20
*/
boolean checkSameProjectName(String projectName, String deptId, String projectId);
}

View File

@ -0,0 +1,48 @@
package com.xinelu.manage.service.screeningproject.impl;
import com.xinelu.manage.domain.screeningproject.ScreeningProject;
import com.xinelu.manage.mapper.screeningproject.ScreeningProjectMapper;
import com.xinelu.manage.service.screeningproject.IScreeningProjectService;
import com.xinelu.system.mapper.SysDeptMapper;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
/**
* @description: 项目管理实现类
* @author: haown
* @create: 2023-01-16 15:30
**/
@Service
public class ScreeningProjectServiceImpl implements IScreeningProjectService {
@Resource
private ScreeningProjectMapper projectMapper;
@Resource
private SysDeptMapper deptMapper;
@Override public List<ScreeningProject> findList(ScreeningProject project) {
return projectMapper.findList(project);
}
@Override public int insert(ScreeningProject project) {
// TODO 设置机构
// project.setDeptName(deptMapper.selectDeptById(project.getDeptId()).getDeptName());
return projectMapper.insertSelective(project);
}
@Override
public int update(ScreeningProject project) {
// TODO 设置机构
// project.setDeptName(deptMapper.selectDeptById(project.getDeptId()).getDeptName());
return projectMapper.updateByPrimaryKey(project);
}
@Override public void delete(ScreeningProject project) {
projectMapper.updateByPrimaryKeySelective(project);
}
@Override public boolean checkSameProjectName(String projectName, String deptId, String projectId) {
return projectMapper.checkSameName(projectName, deptId, projectId) != null;
}
}

View File

@ -0,0 +1,125 @@
package com.xinelu.manage.service.screeningrecord;
import com.alibaba.fastjson2.JSONObject;
import com.xinelu.common.core.domain.SelectVo;
import com.xinelu.manage.domain.screeningrecord.ScreeningRecord;
import com.xinelu.manage.dto.screeningrecord.ScreeningApplyDTO;
import com.xinelu.manage.dto.screeningrecord.ScreeningRecordDTO;
import com.xinelu.manage.dto.screeningrecord.ScreeningRecordSaveDTO;
import com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo;
import java.util.List;
/**
* @author mengkuiliang
* @description 针对表sd_screening_record(居民预约记录表)的数据库操作Service
* @createDate 2023-01-29 13:53:13
*/
public interface IScreeningRecordService {
List<ScreeningRecordVo> screeningList(ScreeningRecordDTO query);
/**
* @Author mengkuiliang
* @Description 获取预约记录
* @Date 2023-01-29 15:46
* @Param
* @return
**/
List<ScreeningRecordVo> list(ScreeningRecordDTO query);
/**
* @Author mengkuiliang
* @Description 获取筛查结果记录
* @Date 2023-01-30 13:30
* @Param [query]
* @return java.util.List<?>
**/
List<ScreeningRecordVo> record(ScreeningRecordDTO query);
/**
* @Author mengkuiliang
* @Description 预约保存
* @Date 2023-01-29 14:09
* @Param [body]
* @return void
**/
String save(ScreeningApplyDTO body) throws Exception;
/**
* 修改
* @param body
* @return
* @throws Exception
*/
Integer update(ScreeningRecord body);
/**
* @Author mengkuiliang
* @Description 取消预约
* @Date 2023-01-29 14:09
* @Param [screeningId]
* @return void
**/
void cancel(String screeningId);
/**
* @Author mengkuiliang
* @Description 获取预约详情
* @Date 2023-01-29 14:09
* @Param [screeningId]
* @return java.lang.Object
**/
ScreeningRecordVo detail(String screeningId);
void getRecordDetail(ScreeningRecordVo vo);
/**
* @Author mengkuiliang
* @Description 登记
* @Date 2023-01-29 14:31
* @Param [body]
* @return String 条码号
**/
String receive(String screeningId) throws Exception;
/**
* @Author mengkuiliang
* @Description 取消登记
* @Date 2023-01-29 14:31
* @Param [screeningId]
* @return void
**/
void cancelReceive(String screeningId);
/**
* @Author mengkuiliang
* @Description 获取当前居民预约信息
* @Date 2023-01-29 14:54
* @Param
* @return
**/
ScreeningRecordVo getScreeningByRegisterId(String registerId);
/**
* @Author mengkuiliang
* @Description 获取最新一次筛查结果
* @Date 2023-01-30 11:45
* @Param [registerId]
* @return void
**/
ScreeningRecordVo last(String registerId,String projectId);
/**
* @Author haown
* @Description 获取居民筛查记录时间轴
* @Date 2023-02-06 20:49
* @Param [registerId]
* @return void
**/
List<SelectVo> getTimelineList(String registerId);
Integer pushScreening(ScreeningRecordSaveDTO body) throws Exception;
JSONObject getInfo(String assessRecordId);
}

View File

@ -0,0 +1,457 @@
package com.xinelu.manage.service.screeningrecord.impl;
import com.alibaba.fastjson2.JSONObject;
import com.xinelu.common.constant.ScreeningProjectConstants;
import com.xinelu.common.core.domain.SelectVo;
import com.xinelu.common.core.domain.TimelineVo;
import com.xinelu.common.core.domain.model.LoginUser;
import com.xinelu.common.enums.UploadType;
import com.xinelu.common.utils.DateUtils;
import com.xinelu.common.utils.SecurityUtils;
import com.xinelu.common.utils.bean.BeanUtils;
import com.xinelu.common.utils.uuid.IdUtils;
import com.xinelu.manage.domain.screeningproject.ScreeningProject;
import com.xinelu.manage.domain.screeningrecord.ScreeningRecord;
import com.xinelu.manage.dto.screeningrecord.ScreeningApplyDTO;
import com.xinelu.manage.dto.screeningrecord.ScreeningRecordApplyDTO;
import com.xinelu.manage.dto.screeningrecord.ScreeningRecordDTO;
import com.xinelu.manage.dto.screeningrecord.ScreeningRecordSaveDTO;
import com.xinelu.manage.mapper.screeningrecord.ScreeningRecordMapper;
import com.xinelu.manage.service.patientinfo.IPatientInfoService;
import com.xinelu.manage.service.screeningrecord.IScreeningRecordService;
import com.xinelu.manage.vo.patientinfo.PatientInfoVO;
import com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
/**
* @author mengkuiliang
* @description 针对表sd_screening_record(居民预约记录表)的数据库操作Service实现
* @createDate 2023-01-29 13:53:13
*/
@Service
public class ScreeningRecordServiceImpl implements IScreeningRecordService {
@Resource
private ScreeningRecordMapper screeningRecordMapper;
@Resource
private IPatientInfoService patientService;
//@Resource
//private IScreeningProjectRecordService projectRecordService;
@Override
public List<ScreeningRecordVo> screeningList(ScreeningRecordDTO query) {
// TODO 通过机构查询
// query.setDeptId(SecurityUtils.getDeptId());
return screeningRecordMapper.screeningList(query);
}
/**
* @Author mengkuiliang
* @Description 获取预约记录
* @Date 2023-01-29 15:55
* @Param [query]
* @return java.util.List<com.disease.business.domain.vo.ScreeningRecordVo>
**/
@Override
public List<ScreeningRecordVo> list(ScreeningRecordDTO query) {
return screeningRecordMapper.list(query);
}
/**
* @Author mengkuiliang
* @Description 获取筛查结果记录
* @Date 2023-01-30 13:31
* @Param [query]
* @return java.util.List<com.disease.business.domain.vo.ScreeningRecordVo>
**/
@Override
public List<ScreeningRecordVo> record(ScreeningRecordDTO query) {
return screeningRecordMapper.record(query);
}
/**
* @Author mengkuiliang
* @Description 预约保存
* @Date 2023-01-29 14:10
* @Param [body]
* @return void
**/
@Override
@Transactional(rollbackFor = Exception.class)
public String save(ScreeningApplyDTO body) throws Exception {
// 校验是否已经注册
PatientInfoVO registerVo = patientService.selectPatientInfoByCardNo(body.getIdentity());
if(registerVo == null) {
throw new Exception("用户未注册");
}
// 查询 同一机构的同一筛查项目在同一天是否有预约
ScreeningRecordDTO query = new ScreeningRecordDTO();
query.setRegisterId(body.getRegisterId());
query.setDeptId(body.getDeptId());
query.setProjectId(body.getProjectId());
query.setApplyStartDate(body.getApplyStartTime());
query.setApplyEndDate(body.getApplyEndTime());
List<ScreeningRecordVo> recordList = list(query);
if (!CollectionUtils.isEmpty(recordList)) {
throw new Exception("已在" + DateUtils.formatDate(body.getApplyStartTime(), "yyyy年MM月dd日") + "预约了" + body.getProjectName() + "项目不能重复预约");
}
body.setScreeningId(IdUtils.fastSimpleUUID());
ScreeningRecordApplyDTO recordBody = new ScreeningRecordApplyDTO();
BeanUtils.copyProperties(body, recordBody);
recordBody.setScreeningStatus("1");
recordBody.setApplyCode(generateCode());
recordBody.setScreeningType("1");
// 预约条码
recordBody.setApplyBarcode(generateBarcode(UploadType.SCREENING_BARCODE.getCode(), recordBody.getScreeningId(), recordBody.getApplyCode()));
int flag = screeningRecordMapper.insert(recordBody);
if(flag > 0) {
// 推送消息
//JSONObject jsonObject = new JSONObject();
//jsonObject.fluentPut("recipientName", registerVo.getResidentName())
// .fluentPut("handleDate", recordBody.getApplyStartTime())
// .fluentPut("hospitalName", recordBody.getDeptName())
// .fluentPut("applyContent", recordBody.getProjectName())
// .fluentPut("recipientIdentity", registerVo.getIdentity())
// .fluentPut("sendTime", DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"))
// .fluentPut("messageType", "5")
// .fluentPut("messageCategory", "1")
// .fluentPut("templateType", MessageTypeEnum.SCREENING_APPLY.getType())
// .fluentPut("content", "预约成功,请准时赴约筛查!")
// .fluentPut("contentId", recordBody.getScreeningId());
//FdmpPushMegUtil.sendPost(jsonObject);
}
return body.getRegisterId();
}
@Override
public Integer update(ScreeningRecord body) {
// TODO 用户id
//body.setDoctorId(SecurityUtils.getUserId());
body.setDeptName(SecurityUtils.getLoginUser().getUser().getDept().getDeptName());
body.setScreeningStatus("4");
body.setScreeningDate(new Date());
int flag = screeningRecordMapper.update(body);
if (flag > 0) {
// TODO 推送提醒
//PatientInfoVO patientInfoVO = patientService.selectPatientInfoById(body.getRegisterId());
//JSONObject jsonObject = new JSONObject();
//jsonObject.fluentPut("senderNo", SecurityUtils.getUserId())
// .fluentPut("senderName", SecurityUtils.getLoginUser().getUser().getNickName())
// .fluentPut("recipientName", patientInfoVO.getPatientName())
// .fluentPut("recipientIdentity", patientInfoVO.getCardNo())
// .fluentPut("messageType", "6")
// .fluentPut("messageCategory", "1")
// .fluentPut("templateType", MessageTypeEnum.JTYSXXTZ.getType())
// .fluentPut("sendTime", DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"))
// .fluentPut("content", "您的筛查项目已检测完成,点击查看详情。")
// .fluentPut("contentId", body.getScreeningId());
//FdmpPushMegUtil.sendPost(jsonObject);
}
return flag;
}
/**
* @Author mengkuiliang
* @Description 取消预约
* @Date 2023-01-29 14:10
* @Param [screeningId]
* @return void
**/
@Override
public void cancel(String screeningId) {
screeningRecordMapper.updateStatus(screeningId, "2", null);
}
/**
* @Author mengkuiliang
* @Description 登记
* @Date 2023-01-29 14:31
* @Param [body]
* @return void
**/
@Override
public String receive(String screeningId) throws Exception {
LoginUser loginUser = SecurityUtils.getLoginUser();
ScreeningRecord screeningRecord = screeningRecordMapper.selectByScreeningId(screeningId);
// 判断预约是否过期是否已登记
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (sdf.parse(DateUtils.formatDate(screeningRecord.getApplyEndTime(), "yyyy-MM-dd")).before(sdf.parse(DateUtils.formatDate(new Date(), "yyyy-MM-dd")))){
throw new Exception("患者预约已过期,不可进行登记。");
}
if (StringUtils.equals("3", screeningRecord.getScreeningStatus()) || StringUtils.equals("4", screeningRecord.getScreeningStatus())) {
throw new Exception("该预约已登记,请勿重复登记。");
}
// TODO 当前登录用户id
//screeningRecord.setDoctorId(loginUser.getUserId());
screeningRecord.setDoctorName(loginUser.getUser().getNickName());
screeningRecord.setRegistrationDate(new Date());
screeningRecord.setScreeningStatus("3");
// 生成登记条码
screeningRecord.setRegistrationCode(generateCode());
screeningRecord.setRegistrationBarcode(generateBarcode(UploadType.REGISTRATION_BARCODE.getCode(), screeningRecord.getScreeningId(), screeningRecord.getRegistrationCode()));
int flag = screeningRecordMapper.update(screeningRecord);
return screeningRecord.getRegistrationCode();
}
/**
* @Author mengkuiliang
* @Description 取消登记
* @Date 2023-01-29 14:31
* @Param [screeningId]
* @return void
**/
@Override
public void cancelReceive(String screeningId) {
screeningRecordMapper.updateStatus(screeningId, "1", null);
}
/**
* @Author mengkuiliang
* @Description 获取预约详情
* @Date 2023-01-29 14:10
* @Param [screeningId]
* @return com.disease.business.domain.vo.ScreeningRecordVo
**/
@Override
public ScreeningRecordVo detail(String screeningId) {
ScreeningRecordVo recordVo = screeningRecordMapper.detail(screeningId);
if(recordVo == null) {
return null;
}
return recordVo;
}
/**
* @Author mengkuiliang
* @Description 获取当前居民预约信息
* @Date 2023-01-29 14:10
* @Param [screeningId]
* @return com.disease.business.domain.vo.ScreeningRecordVo
**/
@Override
public ScreeningRecordVo getScreeningByRegisterId(String registerId) {
ScreeningRecordVo recordVo = screeningRecordMapper.getScreeningByRegisterId(registerId);
if(recordVo == null) {
return null;
}
getRecordDetail(recordVo);
return recordVo;
}
/**
* @Author mengkuiliang
* @Description 获取最新一次筛查结果
* @Date 2023-01-30 11:46
* @Param [registerId]
* @return com.disease.business.domain.vo.ProjectRecordVo
**/
@Override
public ScreeningRecordVo last(String registerId,String projectId) {
ScreeningRecordVo recordVo = screeningRecordMapper.getScreeningOfLast(registerId, null, "1",projectId);
if(recordVo == null) {
return null;
}
// TODO 获取文件类型
//File fileInfo = sysFileService.getFile(recordVo.getAttachment());
//if (fileInfo != null) {
// recordVo.setFileType(fileInfo.getSuffix());
//}
if (!StringUtils.contains(recordVo.getProjectName(), ScreeningProjectConstants.ALZHEIMER)) {
getRecordDetail(recordVo);
}
return recordVo;
}
@Override public List<SelectVo> getTimelineList(String registerId) {
List<TimelineVo> timelineVos = screeningRecordMapper.selectTimeLineList(registerId);
// 按照年份进行分组
Map<String, List<TimelineVo>> groupByTime = timelineVos.stream().collect(Collectors.groupingBy(item-> DateUtils.formatDate(item.getCreateTime(), "yyyy")));
List<SelectVo> timeList = new ArrayList<>();
for (String time : groupByTime.keySet()) {
List<TimelineVo> timelineVoList = groupByTime.get(time);
List<SelectVo> children = timelineVoList.stream().map(child -> {
SelectVo result = new SelectVo();
result.setLabel(DateUtils.formatDate(child.getCreateTime(), "yyyy-MM-dd"));
result.setValue(child.getId());
return result;
}).collect(Collectors.toList());
timeList.add(SelectVo.builder()
.label(time)
.value(time)
.children(children).build());
}
return timeList;
}
@Override public Integer pushScreening(ScreeningRecordSaveDTO body) throws Exception {
List<ScreeningProject> projectList = body.getProjectList();
int flag = 0;
String assessRecordId = "";
// 查询居民最新一次评估记录
//List<RiskAssessRecord> riskAssessRecords = riskAssessRecordMapper.selectByPatientId(body.getRegisterId());
//if (riskAssessRecords != null && riskAssessRecords.size() > 0) {
// RiskAssessRecord riskAssessRecord = riskAssessRecords.get(riskAssessRecords.size() - 1);
// if (riskAssessRecord != null) {
// assessRecordId = riskAssessRecord.getAssessRecordId();
// }
//} else {
// throw new Exception("还未评估,请评估后推送");
//}
for (ScreeningProject project : projectList) {
ScreeningRecordApplyDTO screeningRecord = new ScreeningRecordApplyDTO();
screeningRecord.setAssessRecordId(assessRecordId);
screeningRecord.setScreeningId(IdUtils.fastSimpleUUID());
screeningRecord.setProjectId(project.getProjectId());
screeningRecord.setProjectName(project.getProjectName());
screeningRecord.setRegisterId(body.getRegisterId());
// TODO 用户id
//screeningRecord.setDoctorId(SecurityUtils.getUserId());
screeningRecord.setDoctorName(SecurityUtils.getLoginUser().getUser().getNickName());
// TODO 机构id
//screeningRecord.setDeptId(SecurityUtils.getDeptId());
screeningRecord.setDeptName(SecurityUtils.getLoginUser().getUser().getDept().getDeptName());
screeningRecord.setScreeningStatus("1");
screeningRecord.setScreeningType("2");
screeningRecord.setApplyStartTime(new Date());
flag += screeningRecordMapper.insert(screeningRecord);
}
if (flag > 0) {
// TODO 推送消息通知
//JSONObject jsonObject = new JSONObject();
//RegisterVo register = registerService.getByRegisterId(body.getRegisterId());
//jsonObject.fluentPut("senderNo", SecurityUtils.getUserId())
// .fluentPut("senderName", SecurityUtils.getLoginUser().getUser().getNickName())
// .fluentPut("doctorName", SecurityUtils.getLoginUser().getUser().getNickName())
// .fluentPut("recipientName", register.getResidentName())
// .fluentPut("recipientIdentity", register.getIdentity())
// .fluentPut("sendTime", DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss"))
// .fluentPut("messageType", "4")
// .fluentPut("messageCategory", "1")
// .fluentPut("templateType", MessageTypeEnum.JTYSXXTZ.getType())
// .fluentPut("content", "根据评估结果您需筛查,详情请点击查看。")
// .fluentPut("contentId", assessRecordId);
//FdmpPushMegUtil.sendPost(jsonObject);
}
return flag;
}
@Override public JSONObject getInfo(String assessRecordId) {
// 根据评估记录业务主键查询医生推荐筛查项目
JSONObject retObject = new JSONObject();
ScreeningRecordDTO query = new ScreeningRecordDTO();
query.setAssessRecordId(assessRecordId);
List<ScreeningRecordVo> screeningRecordVoList = list(query);
if (screeningRecordVoList != null && screeningRecordVoList.size() > 0) {
List<String> projectName = screeningRecordVoList.stream().map(ScreeningRecordVo::getProjectName).collect(Collectors.toList());
retObject.fluentPut("projectName", String.join("," , projectName))
.fluentPut("doctorName", screeningRecordVoList.get(0).getDoctorName());
// TODO 居民信息
//PatientInfoVO patientInfoVO = patientService.selectPatientInfoById(screeningRecordVoList.get(0).getRegisterId());
//retObject.fluentPut("name", patientInfoVO.getPatientName());
}
// 根据评估记录业务主键查询评估记录
//RiskAssessRecord riskAssessRecord = riskAssessRecordMapper.selectById(assessRecordId);
//if (riskAssessRecord != null) {
// String assessResult = "高血压等级:" + getRiskLevel(riskAssessRecord.getRiskLevelHbp()) +";糖尿病风险等级:" +getRiskLevel(riskAssessRecord.getRiskLevelDm());
// retObject.fluentPut("assessResult", assessResult);
//} else {
// retObject.fluentPut("assessResult", "未评估");
//}
return retObject;
}
private String getRiskLevel(String riskLevel) {
String value = "正常";
switch (riskLevel) {
case "0" :
value = "正常";
break;
case "1" :
value = "低危";
break;
case "2" :
value = "中危";
break;
case "3" :
value = "高危";
break;
}
return value;
}
/** 获取检测项目记录 */
@Override
public void getRecordDetail(ScreeningRecordVo vo) {
// 拼接预约时间区间
vo.setApplyTime(DateUtils.formatDate(vo.getApplyStartTime(), "yyyy年MM月dd日") + " " + DateUtils.formatDate(vo.getApplyStartTime(), "HH:mm") + "~" + DateUtils.formatDate(vo.getApplyEndTime(), "HH:mm"));
setAttachment(vo);
}
/** 获取图片附件转base64 */
private void setAttachment(ScreeningRecordVo record) {
// TODO 文件转换为base64
//if(!StringUtils.isBlank(record.getAttachment())) {
// File fileInfo = sysFileService.getFile(record.getAttachment());
// if(fileInfo != null) {
// record.setAttachment(FileUtils.PicToBase64(fileInfo.getFilePath()));
// }
//}
//if(!StringUtils.isBlank(record.getAttachmentTwo())) {
// File fileInfo = sysFileService.getFile(record.getAttachmentTwo());
// if(fileInfo != null) {
// record.setAttachmentTwo(FileUtils.PicToBase64(fileInfo.getFilePath()));
// }
//}
}
/**
* 生成预约码
* @return
*/
private String generateCode() {
return System.currentTimeMillis() + "";
}
/**
* 生成条码
* @param code
* @param screeningId
* @param content
*/
private String generateBarcode(String code, String screeningId, String content) {
// TODO 文件保存
//String fileDir = UploadType.getUploadType(code).getPath() + DateUtils.formatDate(new Date(), "yyyy-MM-dd") + "/";
//String fileName = screeningId + ".jpg";
//QrCodeUtils.createTxm(content, fileDir, fileName);
//File sysFile = new File();
//sysFile.setFileId(IdUtils.fastSimpleUUID());
//sysFile.setOriginalFilename(screeningId + ".jpg");
//sysFile.setFilePath(fileDir);
//sysFile.setContentType("image/jpeg");
//sysFile.setSuffix("jpg");
//sysFile.setUploadType(code);
//fileService.insert(sysFile);
//return sysFile.getFileId();
return null;
}
}

View File

@ -0,0 +1,194 @@
package com.xinelu.manage.vo.screeningrecord;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xinelu.manage.vo.patientinfo.PatientInfoVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.Data;
/**
* @Author mengkuiliang
* @Description 居民预约记录展示对象
* @Date 2023-01-29 14:06
* @Param
* @return
**/
@Data
@ApiModel("居民预约记录展示对象")
public class ScreeningRecordVo {
/** 居民信息 */
@ApiModelProperty("居民信息")
private PatientInfoVO patientInfoVO;
/**
* 业务主键
*/
@ApiModelProperty("业务主键")
private String screeningId;
/**
* 居民业务主键
*/
@ApiModelProperty("居民业务主键")
private String registerId;
/**
* 居民姓名
*/
@ApiModelProperty("居民姓名")
private String residentName;
/**
* 性别1 2
*/
private String gender;
/**
* 身份证号
*/
private String identity;
/**
* 出生日期
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date birthday;
/**
* 联系电话
*/
private String phone;
@ApiModelProperty("纳入管理状态")
private String manageStatus;
@ApiModelProperty("纳入管理时间")
private Date manageDate;
/**
* 状态1已预约 2取消预约 3已登记 4已完成
*/
@ApiModelProperty("状态1已预约 2取消预约 3已登记 4已完成")
private String screeningStatus;
/**
* 基础疾病
*/
@ApiModelProperty("基础疾病")
private String disease;
@ApiModelProperty("预约项目id")
private String projectId;
@ApiModelProperty("预约项目")
private String projectName;
@ApiModelProperty(value = "诊断结果")
private String diagnosticResult;
@ApiModelProperty("附件一")
private String attachment;
@ApiModelProperty("附件二")
private String attachmentTwo;
/**
* 医院编号
*/
@ApiModelProperty("医院编号")
private String deptId;
/**
* 医院名称
*/
@ApiModelProperty("医院名称")
private String deptName;
/**
* 医生编号
*/
@ApiModelProperty("医生编号")
private String doctorId;
/**
* 医生名称
*/
@ApiModelProperty("医生名称")
private String doctorName;
/**
* 检查日期
*/
@ApiModelProperty("检查日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date screeningDate;
/**
* 预约开始时间
*/
@ApiModelProperty("预约开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date applyStartTime;
/**
* 预约结束时间
*/
@ApiModelProperty("预约结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date applyEndTime;
/**
* 预约时间区间
*/
@ApiModelProperty("预约时间区间")
private String applyTime;
@ApiModelProperty("预约码")
private String applyCode;
@ApiModelProperty("预约条码")
private String applyBarcode;
@ApiModelProperty("登记日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
private Date registrationDate;
@ApiModelProperty("登记码")
private String registrationCode;
@ApiModelProperty(value = "登记条码")
private String registrationBarcode;
@ApiModelProperty("是否过期0:生效中,1:已过期")
private String exceedStatus;
@ApiModelProperty("是否生成筛查结果0:未生成,1:已生成")
private String hasResult;
@ApiModelProperty("是否诊断0:未诊断,1:已诊断")
private String hasDiagnose;
@ApiModelProperty(value = "筛查种类1居民预约2医生推送")
private String screeningType;
@ApiModelProperty(value = "医生推送日期")
private Date pushDate;
@ApiModelProperty(value = "评估业务主键")
private String assessRecordId;
/**
* 备注
*/
@ApiModelProperty("备注")
private String remark;
/**
* 文件类型
*/
@ApiModelProperty("文件类型")
private String fileType;
}

View File

@ -533,6 +533,44 @@
and del_flag = 0
</select>
<select id="getPatientInfoByCardNo" resultType="com.xinelu.manage.vo.patientinfo.PatientInfoVO">
SELECT id,
community_code,
area_code,
patient_code,
patient_name,
card_no,
user_id,
unionid,
openid,
phone,
address,
urgent_contact_name,
urgent_contact_phone,
community_alias_name,
home_longitude,
home_latitude,
head_picture_url,
password,
integral,
login_flag,
create_by,
create_time,
service_ids,
primary_account_flag,
del_flag,
invitation_patient_id,
total_sign_in_days,
sex,
birth_date,
personal_wechat_code_url,
disabling_condition,
disabling_reason
FROM patient_info
WHERE card_no = #{cardNo}
and del_flag = 0 limit 1
</select>
<insert id="insertAppletLoginPatientInfo" parameterType="PatientInfo" useGeneratedKeys="true"
keyProperty="id">
insert into patient_info

View File

@ -0,0 +1,196 @@
<?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.xinelu.manage.mapper.screeningproject.ScreeningProjectMapper">
<resultMap id="BaseResultMap" type="com.xinelu.manage.domain.screeningproject.ScreeningProject">
<id property="id" column="id" jdbcType="BIGINT"/>
<id property="projectId" column="project_id" jdbcType="VARCHAR"/>
<result property="projectName" column="project_name" jdbcType="VARCHAR"/>
<result property="projectType" column="project_type" jdbcType="CHAR"/>
<result property="price" column="price" jdbcType="DECIMAL"/>
<result property="discount" column="discount" jdbcType="INTEGER"/>
<result property="discountPrice" column="discount_price" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="CHAR"/>
<result property="deptId" column="dept_id" jdbcType="VARCHAR"/>
<result property="deptName" column="dept_name" jdbcType="VARCHAR"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="DATE"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
<result property="updateTime" column="update_time" jdbcType="DATE"/>
<result property="delFlag" column="del_flag" jdbcType="CHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,project_id,project_name,
project_type,price,discount,
discount_price,status,dept_id,
dept_name,create_by,create_time,
update_by,update_time,del_flag,
remark
</sql>
<select id="findList" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from sd_project
where del_flag = '0'
<if test="projectName != null and projectName != ''">
and project_name like concat( '%' ,#{projectName}, '%')
</if>
<if test="deptId != null and deptId != ''">
and dept_id = #{deptId}
</if>
<if test="projectType != null and projectType != ''">
and project_type = #{projectType}
</if>
<if test="status != null and status != ''">
and `status` = #{status}
</if>
<if test="createTime != null">
and date_format(create_time,'%Y%m%d') = date_format(#{createTime},'%Y%m%d')
</if>
order By id desc
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from sd_project
where project_id = #{projectId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from sd_project
where project_id = #{projectId,jdbcType=VARCHAR}
</delete>
<insert id="insert">
insert into sd_project
( id,project_id,project_name
,project_type,price,discount
,discount_price,status,dept_id
,dept_name,create_by,create_time
,update_by,update_time,del_flag
,remark)
values (#{id,jdbcType=BIGINT},#{projectId,jdbcType=VARCHAR},#{projectName,jdbcType=VARCHAR}
,#{projectType,jdbcType=CHAR},#{price,jdbcType=DECIMAL},#{discount,jdbcType=INTEGER}
,#{discountPrice,jdbcType=VARCHAR},#{status,jdbcType=CHAR},#{deptId,jdbcType=VARCHAR}
,#{deptName,jdbcType=VARCHAR},#{createBy,jdbcType=VARCHAR},#{createTime,jdbcType=DATE}
,#{updateBy,jdbcType=VARCHAR},#{updateTime,jdbcType=DATE},#{delFlag,jdbcType=CHAR}
,#{remark,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective">
insert into sd_project
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="projectId != null">project_id,</if>
<if test="projectName != null">project_name,</if>
<if test="projectType != null">project_type,</if>
<if test="price != null">price,</if>
<if test="discount != null">discount,</if>
<if test="discountPrice != null">discount_price,</if>
<if test="status != null">status,</if>
<if test="deptId != null">dept_id,</if>
<if test="deptName != null">dept_name,</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="delFlag != null">del_flag,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id,jdbcType=BIGINT},</if>
<if test="projectId != null">#{projectId,jdbcType=VARCHAR},</if>
<if test="projectName != null">#{projectName,jdbcType=VARCHAR},</if>
<if test="projectType != null">#{projectType,jdbcType=CHAR},</if>
<if test="price != null">#{price,jdbcType=DECIMAL},</if>
<if test="discount != null">#{discount,jdbcType=INTEGER},</if>
<if test="discountPrice != null">#{discountPrice,jdbcType=DECIMAL},</if>
<if test="status != null">#{status,jdbcType=CHAR},</if>
<if test="deptId != null">#{deptId,jdbcType=VARCHAR},</if>
<if test="deptName != null">#{deptName,jdbcType=VARCHAR},</if>
<if test="createBy != null">#{createBy,jdbcType=VARCHAR},</if>
<if test="createTime != null">#{createTime,jdbcType=DATE},</if>
<if test="updateBy != null">#{updateBy,jdbcType=VARCHAR},</if>
<if test="updateTime != null">#{updateTime,jdbcType=DATE},</if>
<if test="delFlag != null">#{delFlag,jdbcType=CHAR},</if>
<if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.xinelu.manage.domain.screeningproject.ScreeningProject">
update sd_project
<set>
<if test="projectName != null">
project_name = #{projectName,jdbcType=VARCHAR},
</if>
<if test="projectType != null">
project_type = #{projectType,jdbcType=CHAR},
</if>
<if test="price != null">
price = #{price,jdbcType=DECIMAL},
</if>
<if test="discount != null">
discount = #{discount,jdbcType=INTEGER},
</if>
<if test="discountPrice != null">
discount_price = #{discountPrice,jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status,jdbcType=CHAR},
</if>
<if test="deptId != null">
dept_id = #{deptId,jdbcType=VARCHAR},
</if>
<if test="deptName != null">
dept_name = #{deptName,jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=DATE},
</if>
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=DATE},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=CHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=VARCHAR},
</if>
</set>
where project_id = #{projectId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.xinelu.manage.domain.screeningproject.ScreeningProject">
update sd_project
set
project_name = #{projectName,jdbcType=VARCHAR},
project_type = #{projectType,jdbcType=CHAR},
price = #{price,jdbcType=DECIMAL},
discount = #{discount,jdbcType=INTEGER},
discount_price = #{discountPrice,jdbcType=VARCHAR},
status = #{status,jdbcType=CHAR},
dept_id = #{deptId,jdbcType=VARCHAR},
dept_name = #{deptName,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=DATE},
update_by = #{updateBy,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=DATE},
del_flag = #{delFlag,jdbcType=CHAR},
remark = #{remark,jdbcType=VARCHAR}
where project_id = #{projectId,jdbcType=VARCHAR}
</update>
<select id="checkSameName" resultType="java.lang.Integer">
select 1 from sd_project where del_flag = '0' and project_name = #{projectName} and dept_id = #{deptId}
<if test="projectId != null and projectId != ''">
and project_id != #{projectId}
</if>
limit 1
</select>
</mapper>

View File

@ -0,0 +1,365 @@
<?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.xinelu.manage.mapper.screeningrecord.ScreeningRecordMapper">
<resultMap id="BaseResultMap" type="com.xinelu.manage.domain.screeningrecord.ScreeningRecord">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="screeningId" column="screening_id" jdbcType="VARCHAR"/>
<result property="registerId" column="register_id" jdbcType="VARCHAR"/>
<result property="screeningStatus" column="screening_status" jdbcType="VARCHAR"/>
<result property="disease" column="disease" jdbcType="VARCHAR"/>
<result property="deptId" column="dept_id" jdbcType="VARCHAR"/>
<result property="deptName" column="dept_name" jdbcType="VARCHAR"/>
<result property="projectId" column="project_id" jdbcType="VARCHAR"/>
<result property="projectName" column="project_name" jdbcType="VARCHAR"/>
<result property="applyStartTime" column="apply_start_time" jdbcType="TIMESTAMP"/>
<result property="applyEndTime" column="apply_end_time" jdbcType="TIMESTAMP"/>
<result property="screeningDate" column="screening_date" jdbcType="DATE"/>
<result property="content" column="content" jdbcType="VARCHAR"/>
<result property="diagnosticResult" column="diagnostic_result" jdbcType="VARCHAR"/>
<result property="attachment" column="attachment" jdbcType="VARCHAR"/>
<result property="attachmentTwo" column="attachment_two" jdbcType="VARCHAR"/>
<result property="doctorId" column="doctor_id" jdbcType="VARCHAR"/>
<result property="doctorName" column="doctor_name" jdbcType="VARCHAR"/>
<result property="applyCode" column="apply_code" jdbcType="VARCHAR"/>
<result property="applyBarcode" column="apply_barcode" jdbcType="VARCHAR"/>
<result property="registrationDate" column="registration_date" jdbcType="TIMESTAMP"/>
<result property="registrationCode" column="registration_code" jdbcType="VARCHAR"/>
<result property="registrationBarcode" column="registration_barcode" jdbcType="VARCHAR"/>
<result property="screeningType" column="screening_type" jdbcType="VARCHAR"/>
<result property="pushDate" column="push_date" jdbcType="TIMESTAMP"/>
<result property="assessRecordId" column="assess_record_id" jdbcType="VARCHAR"/>
<result property="remark" column="remark" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id,screening_id,register_id,screening_status,
disease,dept_id,IFNULL(dept_name, '') as dept_name,
project_id, project_name,
apply_start_time,apply_end_time, screening_date,
content,diagnostic_result,attachment,attachment_two,
doctor_id,IFNULL(doctor_name,'') as doctor_name,apply_barcode,registration_date,screening_type,push_date,assess_record_id,
remark
</sql>
<sql id="Insert_Column">
screening_id,register_id,screening_status,
disease,dept_id,dept_name,
project_id, project_name,
apply_start_time, apply_end_time, screening_date,
content,diagnostic_result,attachment,attachment_two,
doctor_id,doctor_name,apply_code,apply_barcode,registration_date,screening_type,push_date,assess_record_id,remark
</sql>
<!-- 新增 -->
<insert id="insert">
insert into sd_screening_record (<include refid="Insert_Column"></include>)
values (#{screeningId}, #{registerId}, #{screeningStatus},
#{disease}, #{deptId}, #{deptName},
#{projectId},#{projectName},
#{applyStartTime}, #{applyEndTime},#{screeningDate},
#{content}, #{diagnosticResult},#{attachment},#{attachmentTwo},
#{doctorId}, #{doctorName},#{applyCode},#{applyBarcode},#{registrationDate},#{screeningType},#{pushDate},#{assessRecordId},#{remark})
</insert>
<!-- 修改 -->
<update id="update">
update sd_screening_record
<set>
<if test="disease != null">
disease = #{disease},
</if>
<if test="screeningStatus != null">
screening_status = #{screeningStatus},
</if>
<if test="deptId != null">
dept_id = #{deptId},
</if>
<if test="deptName != null">
dept_name = #{deptName},
</if>
<if test="projectId != null">
project_id = #{projectId},
</if>
<if test="projectName != null">
project_name = #{projectName},
</if>
<if test="applyStartTime != null">
apply_start_time = #{applyStartTime},
</if>
<if test="applyEndTime != null">
apply_end_time = #{applyEndTime},
</if>
<if test="screeningDate != null">
screening_date = #{screeningDate},
</if>
<if test="content != null">
content = #{content},
</if>
<if test="diagnosticResult != null">
diagnostic_result = #{diagnosticResult},
</if>
<if test="attachment != null">
attachment = #{attachment},
</if>
<if test="attachmentTwo != null">
attachment_two = #{attachmentTwo},
</if>
<if test="doctorId != null">
doctor_id = #{doctorId},
</if>
<if test="doctorName != null">
doctor_name = #{doctorName},
</if>
<if test="applyCode != null">
apply_code = #{applyCode},
</if>
<if test="applyBarcode != null">
apply_barcode = #{applyBarcode},
</if>
<if test="registrationDate != null">
registration_date = #{registrationDate},
</if>
<if test="registrationCode != null">
registration_code = #{registrationCode},
</if>
<if test="registrationBarcode != null">
registration_barcode = #{registrationBarcode},
</if>
<if test="screeningType != null">
screening_type = #{screeningType},
</if>
<if test="pushDate != null">
push_date = #{pushDate},
</if>
<if test="remark != null">
remark = #{remark},
</if>
</set>
where screening_id = #{screeningId}
</update>
<!-- 更新预约状态 -->
<update id="updateStatus">
update sd_screening_record set screening_status = #{screeningStatus}
<if test="screeningDate != null">
,screening_date = #{screeningDate}
</if>
where screening_id = #{screeningId}
</update>
<!-- 获取预约详情 -->
<select id="detail" resultType="com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo">
select <include refid="Base_Column_List"></include> from sd_screening_record where screening_id = #{screeningId}
</select>
<!-- 获取当前居民预约信息 -->
<select id="getScreeningByRegisterId" resultType="com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo">
select <include refid="Base_Column_List"></include> from sd_screening_record
where register_id = #{registerId} and screening_status in ('1', '3')
and screening_type = '1'
limit 1
</select>
<sql id="where">
<if test="screeningStatus != null and screeningStatus != ''">
and screening_status = #{screeningStatus}
</if>
<if test="registerId != null and registerId != ''">
and register_id = #{registerId}
</if>
<if test="residentName != null and residentName != ''">
and resident_name like concat(#{residentName}, '%')
</if>
<if test="identity != null and identity != ''">
and identity = #{identity}
</if>
<if test="address != null and address != ''">
and address like concat('%', #{address}, '%')
</if>
<if test="deptId != null and deptId != ''">
and dept_id = #{deptId}
</if>
<if test="deptName != null and deptName != ''">
and dept_name = #{deptName}
</if>
<if test="projectId != null and projectId != ''">
and project_id = #{projectId}
</if>
<if test="doctorId != null and doctorId != ''">
and doctor_id = #{doctorId}
</if>
<if test="doctorName != null and doctorName != ''">
and doctor_name = #{doctorName}
</if>
<if test="applyStartDate != null">
and date_format(apply_start_time, '%y%m%d') &gt;= date_format(#{applyStartDate}, '%y%m%d')
</if>
<if test="applyEndDate != null">
and date_format(apply_end_time, '%y%m%d') &lt;= date_format(#{applyEndDate}, '%y%m%d')
</if>
<if test="screeningStartDate != null">
and screening_date &gt;= #{screeningStartDate}
</if>
<if test="screeningEndDate != null">
and screening_date &lt;= #{screeningEndDate}
</if>
<if test="screeningType != null">
and screening_type = #{screeningType}
</if>
<if test="assessRecordId != null">
and assess_record_id = #{assessRecordId}
</if>
</sql>
<select id="screeningList" resultType="com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo">
select r.resident_name,r.gender,r.birthday,r.phone,r.`identity`
,r.manage_status,r.manage_time,d.screening_id,d.register_id,d.project_id,d.project_name
,d.dept_id,d.dept_name,d.apply_start_time,d.apply_end_time,
d.diagnostic_result,d.attachment,d.attachment_two,
d.registration_date,d.registration_code, d.registration_barcode,d.screening_type,d.push_date,
case when date_format(apply_end_time, '%y%m%d%H%i') &lt; date_format(now(), '%y%m%d%H%i') then '1'
else '0' end as exceedStatus,screening_status,
case when attachment is not null or attachment_two is not null then '1'
else '0' end as hasResult,
case when diagnostic_result is not null then '1'
else '0' end as hasDiagnose
from sd_screening_record d left join sd_register r on d.register_id = r.register_id
<where>
d.screening_status != '2' and r.del_flag = '0' and r.status = '0'
<if test="screeningStatus != null and screeningStatus != ''">
and d.screening_status = #{screeningStatus}
</if>
<if test="residentName != null and residentName != ''">
and r.resident_name like concat(#{residentName}, '%')
</if>
<if test="identity != null and identity != ''">
and r.identity = #{identity}
</if>
<if test="address != null and address != ''">
and r.address like concat('%', #{address}, '%')
</if>
<if test="deptId != null and deptId != ''">
and d.dept_id = #{deptId}
</if>
<if test="deptName != null and deptName != ''">
and d.dept_name = #{deptName}
</if>
<if test="projectId != null and projectId != ''">
and d.project_id = #{projectId}
</if>
<if test="applyStartDate != null">
and d.apply_start_time &gt;= #{applyStartDate}
</if>
<if test="applyEndDate != null">
and d.apply_end_time &lt;= #{applyEndDate}
</if>
<if test="applyCode != null and applyCode != ''">
and d.apply_code = #{applyCode}
</if>
<if test="registrationStatus != null and registrationStatus != ''">
<choose>
<when test="registrationStatus == '0'.toString()">
and d.screening_status &lt; '2'
</when>
<when test="registrationStatus == '1'.toString()">
and d.screening_status > '2'
</when>
</choose>
</if>
<if test="exceedStatus != null and exceedStatus != ''">
<choose>
<when test="exceedStatus == '0'.toString()">
and date_format(d.apply_end_time, '%Y%m%d%H%i') >= date_format(now(), '%Y%m%d%H%i')
</when>
<when test="exceedStatus == '1'.toString()">
and date_format(d.apply_end_time, '%Y%m%d%H%i') &lt; date_format(now(), '%Y%m%d%H%i')
</when>
</choose>
</if>
<if test="hasResult != null and hasResult != ''">
<choose>
<when test="hasResult == '0'.toString()">
and d.attachment is null and d.attachment_two is null
</when>
<when test="hasResult == '1'.toString()">
and (d.attachment is not null or d.attachment_two is not null)
</when>
</choose>
</if>
<if test="hasDiagnose != null and hasDiagnose != ''">
<choose>
<when test="hasDiagnose == '1'.toString()">
and d.diagnostic_result is not null
</when>
<when test="hasDiagnose == '0'.toString()">
and d.diagnostic_result is null
</when>
</choose>
</if>
<if test="screeningType != null">
and screening_type = #{screeningType}
</if>
</where>
order by apply_start_time desc
</select>
<!-- 获取预约记录 -->
<select id="list" resultType="com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo">
select <include refid="Base_Column_List"></include>,
case when date_format(apply_end_time, '%y%m%d%H%i') &lt; date_format(now(), '%y%m%d%H%i') then '1'
else '0' end as exceedStatus
from sd_screening_record record
where screening_status != '2'
<include refid="where"></include>
order by apply_start_time desc
</select>
<!-- 获取筛查结果记录 -->
<select id="record" resultType="com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo">
select ssr.id,ssr.screening_id,ssr.register_id,ssr.screening_status,
ssr.disease,ssr.dept_id,IFNULL(ssr.dept_name, '') as dept_name,ssr.project_id, ssr.project_name,
ssr.apply_start_time,ssr.apply_end_time, ssr.screening_date,ssr.content,ssr.diagnostic_result,ssr.attachment,ssr.attachment_two,
ssr.doctor_id,IFNULL(ssr.doctor_name,'') as doctor_name,ssr.apply_barcode,ssr.registration_date,ssr.screening_type,ssr.push_date,ssr.assess_record_id,
ssr.remark,sf.suffix as fileType
from sd_screening_record ssr
LEFT JOIN sys_file sf ON sf.file_id=ssr.attachment
where 1=1
<include refid="where"></include>
order by screening_date desc
</select>
<!-- 获取最新一次筛查结果 -->
<select id="getScreeningOfLast" resultType="com.xinelu.manage.vo.screeningrecord.ScreeningRecordVo">
select <include refid="Base_Column_List"></include> from sd_screening_record
where register_id = #{registerId}
<if test="screeningType != null">
and screening_type = #{screeningType}
</if>
<if test="projectId != null and projectId != ''">
and project_id = #{projectId}
</if>
<choose>
<when test="screeningStatus != null and screeningStatus != ''">
and screening_status = #{screeningStatus}
</when>
<otherwise>
and screening_status in ('1','3', '4')
</otherwise>
</choose>
order by id desc limit 1
</select>
<select id="selectByScreeningId" resultMap="BaseResultMap">
select <include refid="Base_Column_List"></include> from sd_screening_record
where screening_id = #{screeningId}
</select>
<select id="selectTimeLineList" parameterType="java.lang.String" resultType="com.xinelu.common.core.domain.TimelineVo">
select
screening_id as id, date_format(apply_start_time,'%Y-%m-%d') as createTime
from sd_screening_record
where
register_id = #{registerId} and screening_status in('1','3','4') and screening_type = '1'
order by apply_start_time desc
</select>
</mapper>