Commit 0edb0716 authored by zhangch's avatar zhangch

调试保存服务方案以及修改服务方案接口

parent 3bf8ce47
...@@ -9,6 +9,7 @@ import com.hungraim.ltc.pojo.vo.disable.DisableVO; ...@@ -9,6 +9,7 @@ import com.hungraim.ltc.pojo.vo.disable.DisableVO;
import com.hungraim.ltc.pojo.vo.disable.DistrictTreeVo; import com.hungraim.ltc.pojo.vo.disable.DistrictTreeVo;
import com.hungraim.ltc.service.DisableService; import com.hungraim.ltc.service.DisableService;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -101,7 +102,7 @@ public class DisableController { ...@@ -101,7 +102,7 @@ public class DisableController {
@RequestMapping("/fndDiseaseList") @RequestMapping("/fndDiseaseList")
public Result<List<ChFndDiseaseType>> fndDiseaseList(String parDiseTypeId) { public Result<List<ChFndDiseaseType>> fndDiseaseList(String parDiseTypeId) {
if (StrUtil.isNotBlank(parDiseTypeId)) { if (StrUtil.isNotBlank(parDiseTypeId)) {
return Result.failed("参数错误"); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
List<ChFndDiseaseType> chFndDiseaseTypes = disableService.fndDiseaseList(parDiseTypeId); List<ChFndDiseaseType> chFndDiseaseTypes = disableService.fndDiseaseList(parDiseTypeId);
return Result.success(chFndDiseaseTypes); return Result.success(chFndDiseaseTypes);
......
...@@ -17,32 +17,32 @@ public class ChSrvProgram { ...@@ -17,32 +17,32 @@ public class ChSrvProgram {
* 服务方案ID * 服务方案ID
*/ */
@TableId(type = IdType.INPUT) @TableId(type = IdType.INPUT)
private Integer programId; private Long programId;
/** /**
* 服务方案配置ID * 服务方案配置ID
*/ */
private Integer itemCfgId; private Long itemCfgId;
/** /**
* 服务机构ID * 服务机构ID
*/ */
private Integer srvOrganId; private Long srvOrganId;
/** /**
* 服务方式ID * 服务方式ID
*/ */
private Integer srvModeId; private Long srvModeId;
/** /**
* 失能人员ID * 失能人员ID
*/ */
private Integer disabInfoId; private Long disabInfoId;
/** /**
* 创建人 * 创建人
*/ */
private Integer defineEmp; private Long defineEmp;
/** /**
* 创建时间 * 创建时间
...@@ -52,7 +52,7 @@ public class ChSrvProgram { ...@@ -52,7 +52,7 @@ public class ChSrvProgram {
/** /**
* 终止人 * 终止人
*/ */
private Integer endEmp; private Long endEmp;
/** /**
* 终止时间 * 终止时间
...@@ -67,7 +67,7 @@ public class ChSrvProgram { ...@@ -67,7 +67,7 @@ public class ChSrvProgram {
/** /**
* 首次操作人 * 首次操作人
*/ */
private Integer fcu; private Long fcu;
/** /**
* 末次操作时间 * 末次操作时间
...@@ -77,7 +77,7 @@ public class ChSrvProgram { ...@@ -77,7 +77,7 @@ public class ChSrvProgram {
/** /**
* 末次操作人 * 末次操作人
*/ */
private Integer lcu; private Long lcu;
/** /**
* 服务方案状态 0:未生效、1:已生效、2:已终止 * 服务方案状态 0:未生效、1:已生效、2:已终止
...@@ -102,17 +102,17 @@ public class ChSrvProgram { ...@@ -102,17 +102,17 @@ public class ChSrvProgram {
/** /**
* 网厅创建人 * 网厅创建人
*/ */
private Integer webDefineEmp; private Long webDefineEmp;
/** /**
* 网厅终止人 * 网厅终止人
*/ */
private Integer webEndEmp; private Long webEndEmp;
/** /**
* 数据来源 网厅:0,核心:1 * 数据来源 网厅:0,核心:1
*/ */
private Integer dataFrom; private Long dataFrom;
/** /**
* 当前待遇起始日期 * 当前待遇起始日期
...@@ -147,11 +147,11 @@ public class ChSrvProgram { ...@@ -147,11 +147,11 @@ public class ChSrvProgram {
/** /**
* 计费方式(0,项目收费、1,时长收费,2,两者并存) * 计费方式(0,项目收费、1,时长收费,2,两者并存)
*/ */
private Integer chargeType; private Long chargeType;
/** /**
* 建床ID * 建床ID
*/ */
private Integer buildBedId; private Long buildBedId;
} }
...@@ -42,7 +42,7 @@ public class ChSrvProgramSet implements Serializable { ...@@ -42,7 +42,7 @@ public class ChSrvProgramSet implements Serializable {
/** /**
* 服务频次 * 服务频次
*/ */
private Short itemTimes; private Integer itemTimes;
/** /**
* 创建人 * 创建人
...@@ -112,12 +112,12 @@ public class ChSrvProgramSet implements Serializable { ...@@ -112,12 +112,12 @@ public class ChSrvProgramSet implements Serializable {
/** /**
* 服务项目分类 * 服务项目分类
*/ */
private Long itemType; private Integer itemType;
/** /**
* 是否必选 * 是否必选
*/ */
private Short chooseFlag; private Integer chooseFlag;
/** /**
* 付款类型 * 付款类型
......
...@@ -28,6 +28,11 @@ public class ProgramDetailVo { ...@@ -28,6 +28,11 @@ public class ProgramDetailVo {
private Long disabInfoId; private Long disabInfoId;
/** /**
* 服务方式id
*/
private Long srvModeId;
/**
* 失能人员所在省 * 失能人员所在省
*/ */
private String disableDistrictProvincial; private String disableDistrictProvincial;
...@@ -55,7 +60,7 @@ public class ProgramDetailVo { ...@@ -55,7 +60,7 @@ public class ProgramDetailVo {
/** /**
* 失能人员生日 * 失能人员生日
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd")
private Date birthday; private Date birthday;
/** /**
......
...@@ -35,7 +35,7 @@ public class ProgramSetAndProjectVo { ...@@ -35,7 +35,7 @@ public class ProgramSetAndProjectVo {
/** /**
* 频次 * 频次
*/ */
private Long itemTimes; private Integer itemTimes;
/** /**
* 频次类型(1:次/每月,2:必要时) * 频次类型(1:次/每月,2:必要时)
......
...@@ -7,40 +7,46 @@ import java.io.Serializable; ...@@ -7,40 +7,46 @@ import java.io.Serializable;
/** /**
* 常用的Result * 常用的Result
*
* @author hubin * @author hubin
*/ */
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public enum ResultCode implements IResultCode, Serializable { public enum ResultCode implements IResultCode, Serializable {
//成功 //成功
SUCCESS("00000", "一切ok"), SUCCESS("00000", "一切ok"),
//用户登陆异常 //用户登陆异常
USER_LOGIN_ERROR("U0001", "用户登录异常"), USER_LOGIN_ERROR("U0001", "用户登录异常"),
USER_NOT_EXIST("U0002", "用户不存在"), USER_NOT_EXIST("U0002", "用户不存在"),
MARKETER_NOT_EXIST("U0003", "营销员信息未找到"), MARKETER_NOT_EXIST("U0003", "营销员信息未找到"),
USERNAME_OR_PASSWORD_ERROR("U0003", "用户名密码错误"), USERNAME_OR_PASSWORD_ERROR("U0003", "用户名密码错误"),
//系统执行出错 //系统执行出错
SYSTEM_EXECUTION_ERROR("S0001", "系统异常"), SYSTEM_EXECUTION_ERROR("S0001", "系统异常"),
//客户端认证失败 //客户端认证失败
CLIENT_AUTHENTICATION_FAILED("A0001", "客户端认证失败"), CLIENT_AUTHENTICATION_FAILED("A0001", "客户端认证失败"),
//没有访问权限 //没有访问权限
NO_AUTHORITY("A0002", "没有访问权限"), NO_AUTHORITY("A0002", "没有访问权限"),
AUTHORIZED_ERROR("A0300", "访问权限异常"), AUTHORIZED_ERROR("A0300", "访问权限异常"),
ACCESS_UNAUTHORIZED("A0301", "访问未授权"), ACCESS_UNAUTHORIZED("A0301", "访问未授权"),
TOKEN_INVALID_OR_EXPIRED("A0230", "token无效或已过期"), TOKEN_INVALID_OR_EXPIRED("A0230", "token无效或已过期"),
// 请求参数错误,参数校验不通过
REQUEST_PARAM_ERROR("Q0001", "请求参数错误"),
/**
* 制定服务方案失败,请先终止其它服务方案
*/
REQUEST_PROGRAM_ADD_ERROR("Q0002", "制定服务方案失败,请先终止其它服务方案");;
; private String code;
private String code; private String msg;
private String msg; @Override
@Override public String getCode() {
public String getCode() { return code;
return code; }
}
@Override @Override
public String getMsg() { public String getMsg() {
return msg; return msg;
} }
} }
...@@ -5,12 +5,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -5,12 +5,16 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.governance.service.SrvProgramService; import com.hungraim.ltc.governance.service.SrvProgramService;
import com.hungraim.ltc.pojo.vo.governance.ProgramDetailVo; import com.hungraim.ltc.pojo.vo.governance.ProgramDetailVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramListVo; import com.hungraim.ltc.pojo.vo.governance.ProgramListVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramSetAndProjectVo;
import com.hungraim.ltc.pojo.vo.governance.SvrSendListVo; import com.hungraim.ltc.pojo.vo.governance.SvrSendListVo;
import com.hungraim.ltc.util.Result; import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController @RestController
@RequestMapping("/api.governance/srvProgram") @RequestMapping("/api.governance/srvProgram")
@Slf4j @Slf4j
...@@ -43,7 +47,7 @@ public class SrvProgramController { ...@@ -43,7 +47,7 @@ public class SrvProgramController {
@RequestMapping("/programList") @RequestMapping("/programList")
public Result getProgramList(Long srvOrganId, String realName, String realTel, String programStatus, Integer pageNum, Integer pageSize) { public Result getProgramList(Long srvOrganId, String realName, String realTel, String programStatus, Integer pageNum, Integer pageSize) {
if (pageNum == null || pageNum < 1) { if (pageNum == null || pageNum < 1) {
return Result.failed("参数错误"); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
if (pageSize == null || pageSize < 1) { if (pageSize == null || pageSize < 1) {
pageSize = 10; pageSize = 10;
...@@ -65,13 +69,13 @@ public class SrvProgramController { ...@@ -65,13 +69,13 @@ public class SrvProgramController {
@RequestMapping("/programSetList") @RequestMapping("/programSetList")
public Result getProgramSetList(Integer pageNum, Integer pageSize, Long disabInfoId, Long srvOrganId) { public Result getProgramSetList(Integer pageNum, Integer pageSize, Long disabInfoId, Long srvOrganId) {
if (pageNum == null || pageNum < 1 || disabInfoId == null || disabInfoId == 0 || srvOrganId == null || srvOrganId == 0) { if (pageNum == null || pageNum < 1 || disabInfoId == null || disabInfoId == 0 || srvOrganId == null || srvOrganId == 0) {
return Result.failed("参数错误"); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
if (pageSize == null || pageSize < 1) { if (pageSize == null || pageSize < 1) {
pageSize = 10; pageSize = 10;
} }
Page<ProgramListVo> page = new Page<>(pageNum, pageSize); Page<ProgramListVo> page = new Page<>(pageNum, pageSize);
page = srvProgramService.getProgramSetList(page, disabInfoId, srvOrganId); page = srvProgramService.getProgramSetList(page, disabInfoId, srvOrganId, null);
return Result.success(page); return Result.success(page);
} }
...@@ -84,7 +88,7 @@ public class SrvProgramController { ...@@ -84,7 +88,7 @@ public class SrvProgramController {
@RequestMapping("/programDetail") @RequestMapping("/programDetail")
public Result getProgramDetail(Long programId) { public Result getProgramDetail(Long programId) {
if (programId == null || programId == 0) { if (programId == null || programId == 0) {
return Result.failed("参数错误"); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
ProgramDetailVo programDetail = srvProgramService.getProgramDetail(programId); ProgramDetailVo programDetail = srvProgramService.getProgramDetail(programId);
return Result.success(programDetail); return Result.success(programDetail);
...@@ -100,7 +104,7 @@ public class SrvProgramController { ...@@ -100,7 +104,7 @@ public class SrvProgramController {
@RequestMapping("/programDetailWithAdd") @RequestMapping("/programDetailWithAdd")
public Result getProgramDetailWithAdd(Long disabInfoId, Long srvOrganId) { public Result getProgramDetailWithAdd(Long disabInfoId, Long srvOrganId) {
if (disabInfoId == null || disabInfoId == 0 || srvOrganId == null || srvOrganId == 0) { if (disabInfoId == null || disabInfoId == 0 || srvOrganId == null || srvOrganId == 0) {
return Result.failed("参数错误"); return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} }
ProgramDetailVo programDetail = srvProgramService.getProgramDetailWithAdd(disabInfoId, srvOrganId); ProgramDetailVo programDetail = srvProgramService.getProgramDetailWithAdd(disabInfoId, srvOrganId);
return Result.success(programDetail); return Result.success(programDetail);
...@@ -109,6 +113,27 @@ public class SrvProgramController { ...@@ -109,6 +113,27 @@ public class SrvProgramController {
@PostMapping("/programAndProgramSetList") @PostMapping("/programAndProgramSetList")
public Result programAndProgramSetList(ProgramDetailVo programDetailVo) { public Result programAndProgramSetList(ProgramDetailVo programDetailVo) {
log.info(JSONUtil.toJsonStr(programDetailVo)); log.info(JSONUtil.toJsonStr(programDetailVo));
// 参数校验
if (programDetailVo != null) {
if (null == programDetailVo.getSrvOrganId() || null == programDetailVo.getDisabInfoId() || programDetailVo.getProgramSetAndProjectVos() == null || programDetailVo.getProgramSetAndProjectVos().size() == 0) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
} else {
List<ProgramSetAndProjectVo> programSetAndProjectVos = programDetailVo.getProgramSetAndProjectVos();
for (ProgramSetAndProjectVo programSetAndProjectVo : programSetAndProjectVos) {
if (programSetAndProjectVo.getIsConf().intValue() == 1 && programSetAndProjectVo.getPlanningFrequency() == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
}
}
} else {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
Integer count = srvProgramService.getProgramSetCountByProgStatus(programDetailVo.getDisabInfoId(), programDetailVo.getSrvOrganId(), "2");
if (count > 0) {
return Result.failed(ResultCode.REQUEST_PROGRAM_ADD_ERROR);
}
// 进行添加或者修改操作
srvProgramService.addProgramAndProgramSetList(programDetailVo);
return Result.success(); return Result.success();
} }
} }
...@@ -17,12 +17,13 @@ public interface ChSrvProgramMapper extends BaseMapper<ChSrvProgram> { ...@@ -17,12 +17,13 @@ public interface ChSrvProgramMapper extends BaseMapper<ChSrvProgram> {
/** /**
* 个人照护方案列表查询 * 个人照护方案列表查询
* *
* @param page 分页参数 * @param page 分页参数
* @param disabInfoId 失能人员id * @param disabInfoId 失能人员id
* @param srvOrganId 服务机构id * @param srvOrganId 服务机构id
* @param programStatus 服务方案状态 0:未生效、1:已生效、2:已终止
* @return 返回个人照护方案列表 * @return 返回个人照护方案列表
*/ */
Page<ProgramListVo> getProgramList(Page<ProgramListVo> page, @Param("disabInfoId") Long disabInfoId, @Param("srvOrganId") Long srvOrganId); Page<ProgramListVo> getProgramList(Page<ProgramListVo> page, @Param("disabInfoId") Long disabInfoId, @Param("srvOrganId") Long srvOrganId, @Param("programStatus") String programStatus);
/** /**
* 查看服务方案详情 * 查看服务方案详情
......
...@@ -21,12 +21,23 @@ public interface SrvProgramService { ...@@ -21,12 +21,23 @@ public interface SrvProgramService {
/** /**
* 个人照护方案列表查询 * 个人照护方案列表查询
* *
* @param page 分页参数 * @param page 分页参数
* @param disabInfoId 失能人员id * @param disabInfoId 失能人员id
* @param srvOrganId 服务机构id * @param srvOrganId 服务机构id
* @param programStatus 服务方案状态 0:未生效、1:已生效、2:已终止
* @return 返回个人照护方案列表 * @return 返回个人照护方案列表
*/ */
Page<ProgramListVo> getProgramSetList(Page<ProgramListVo> page, Long disabInfoId, Long srvOrganId); Page<ProgramListVo> getProgramSetList(Page<ProgramListVo> page, Long disabInfoId, Long srvOrganId, String programStatus);
/**
* 个人照护方案记录条数,查询对应方案状态的记录条数
*
* @param disabInfoId 失能人员id
* @param srvOrganId 服务机构id
* @param programStatus 服务方案状态 0:未生效、1:已生效、2:已终止
* @return 返回条数
*/
Integer getProgramSetCountByProgStatus(Long disabInfoId, Long srvOrganId, String programStatus);
/** /**
* 查看服务方案详情 * 查看服务方案详情
...@@ -44,4 +55,6 @@ public interface SrvProgramService { ...@@ -44,4 +55,6 @@ public interface SrvProgramService {
* @return 返回添加服务方案需要展示的信息 * @return 返回添加服务方案需要展示的信息
*/ */
ProgramDetailVo getProgramDetailWithAdd(Long disabInfoId, Long srvOrganId); ProgramDetailVo getProgramDetailWithAdd(Long disabInfoId, Long srvOrganId);
void addProgramAndProgramSetList(ProgramDetailVo programDetailVo);
} }
package com.hungraim.ltc.governance.service.impl; package com.hungraim.ltc.governance.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hungraim.ltc.governance.dao.ChSrvProgramMapper; import com.hungraim.ltc.governance.dao.ChSrvProgramMapper;
import com.hungraim.ltc.governance.dao.ChSrvProgramSetMapper;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgramSet;
import com.hungraim.ltc.pojo.vo.governance.ProgramDetailVo; import com.hungraim.ltc.pojo.vo.governance.ProgramDetailVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramListVo; import com.hungraim.ltc.pojo.vo.governance.ProgramListVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramSetAndProjectVo;
import com.hungraim.ltc.pojo.vo.governance.SvrSendListVo; import com.hungraim.ltc.pojo.vo.governance.SvrSendListVo;
import com.hungraim.ltc.governance.dao.ChSrvSendMapper; import com.hungraim.ltc.governance.dao.ChSrvSendMapper;
import com.hungraim.ltc.governance.service.SrvProgramService; import com.hungraim.ltc.governance.service.SrvProgramService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service @Service
public class SrvProgramServiceImpl implements SrvProgramService { public class SrvProgramServiceImpl implements SrvProgramService {
...@@ -20,14 +28,25 @@ public class SrvProgramServiceImpl implements SrvProgramService { ...@@ -20,14 +28,25 @@ public class SrvProgramServiceImpl implements SrvProgramService {
@Autowired @Autowired
private ChSrvProgramMapper chSrvProgramMapper; private ChSrvProgramMapper chSrvProgramMapper;
@Autowired
private ChSrvProgramSetMapper chSrvProgramSetMapper;
@Override @Override
public Page<SvrSendListVo> getProgramList(Page<SvrSendListVo> page, Long srvOrganId, String realName, String realTel, String programStatus) { public Page<SvrSendListVo> getProgramList(Page<SvrSendListVo> page, Long srvOrganId, String realName, String realTel, String programStatus) {
return chSrvSendMapper.selectSrvSendList(page, srvOrganId, realName, realTel, programStatus); return chSrvSendMapper.selectSrvSendList(page, srvOrganId, realName, realTel, programStatus);
} }
@Override @Override
public Page<ProgramListVo> getProgramSetList(Page<ProgramListVo> page, Long disabInfoId, Long srvOrganId) { public Page<ProgramListVo> getProgramSetList(Page<ProgramListVo> page, Long disabInfoId, Long srvOrganId, String programStatus) {
return chSrvProgramMapper.getProgramList(page, disabInfoId, srvOrganId); return chSrvProgramMapper.getProgramList(page, disabInfoId, srvOrganId, programStatus);
}
@Override
public Integer getProgramSetCountByProgStatus(Long disabInfoId, Long srvOrganId, String programStatus) {
QueryWrapper<ChSrvProgram> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("DISAB_INFO_ID", disabInfoId).eq("SRV_ORGAN_ID", srvOrganId).ne("PROG_STATUS", programStatus);
Integer count = chSrvProgramMapper.selectCount(queryWrapper);
return count;
} }
@Override @Override
...@@ -39,4 +58,76 @@ public class SrvProgramServiceImpl implements SrvProgramService { ...@@ -39,4 +58,76 @@ public class SrvProgramServiceImpl implements SrvProgramService {
public ProgramDetailVo getProgramDetailWithAdd(Long disabInfoId, Long srvOrganId) { public ProgramDetailVo getProgramDetailWithAdd(Long disabInfoId, Long srvOrganId) {
return chSrvProgramMapper.getProgramDetailWithAdd(disabInfoId, srvOrganId); return chSrvProgramMapper.getProgramDetailWithAdd(disabInfoId, srvOrganId);
} }
@Override
public void addProgramAndProgramSetList(ProgramDetailVo programDetailVo) {
Date date = new Date();
Long programId = programDetailVo.getProgramId();
if (null == programId) {
// 添加服务方案操作
// 1.添加服务方案记录
ChSrvProgram chSrvProgram = new ChSrvProgram();
chSrvProgram.setSrvOrganId(programDetailVo.getSrvOrganId());
chSrvProgram.setDisabInfoId(programDetailVo.getDisabInfoId());
chSrvProgram.setSrvModeId(programDetailVo.getSrvModeId());
chSrvProgram.setProgramDate(programDetailVo.getProgramDate());
chSrvProgram.setProgramEdnDate(programDetailVo.getProgramEndDate());
chSrvProgram.setProgStatus(0);
chSrvProgram.setEffTime(date);
chSrvProgramMapper.insert(chSrvProgram);
// 2.使用服务方案记录的id来添加服务方案项目记录
Long newProgramId = chSrvProgram.getProgramId();
List<ProgramSetAndProjectVo> programSetAndProjectVos = programDetailVo.getProgramSetAndProjectVos();
for (ProgramSetAndProjectVo programSetAndProjectVo : programSetAndProjectVos) {
Short isConf = programSetAndProjectVo.getIsConf();
if (isConf.intValue() == 0) {
// 没有配置这条服务方案,直接略过这条记录,无需添加
continue;
}
this.addProgramSet(programDetailVo, date, newProgramId, programSetAndProjectVo);
}
} else {
// 修改操作,修改操作就是对服务方案项目进行修改,两种情况
List<ProgramSetAndProjectVo> programSetAndProjectVos = programDetailVo.getProgramSetAndProjectVos();
for (ProgramSetAndProjectVo programSetAndProjectVo : programSetAndProjectVos) {
Short isConf = programSetAndProjectVo.getIsConf();
if (programSetAndProjectVo.getSetId() != null) {
if (isConf.intValue() == 0) {
// 没有配置这条服务方案,直接删除对应的记录
}
// 修改原有的服务方案项目
ChSrvProgramSet chSrvProgramSet = new ChSrvProgramSet();
chSrvProgramSet.setSetId(programSetAndProjectVo.getSetId());
chSrvProgramSet.setPlanningFrequency(programSetAndProjectVo.getPlanningFrequency());
chSrvProgramSet.setPlanningFrequencyType(programSetAndProjectVo.getPlanningFrequencyType());
chSrvProgramSet.setRemark(programSetAndProjectVo.getRemark());
chSrvProgramSetMapper.updateById(chSrvProgramSet);
} else {
if (isConf.intValue() == 0) {
// 没有配置这条服务方案,直接略过这条记录,无需添加
continue;
}
// 新增一条新的服务方案项目
this.addProgramSet(programDetailVo, date, programId, programSetAndProjectVo);
}
}
}
}
private void addProgramSet(ProgramDetailVo programDetailVo, Date date, Long newProgramId, ProgramSetAndProjectVo programSetAndProjectVo) {
ChSrvProgramSet chSrvProgramSet = new ChSrvProgramSet();
chSrvProgramSet.setItemId(programSetAndProjectVo.getProjectId());
chSrvProgramSet.setIsConf(programSetAndProjectVo.getIsConf());
chSrvProgramSet.setItemTimes(programSetAndProjectVo.getItemTimes());
chSrvProgramSet.setEffTime(date);
chSrvProgramSet.setProgramId(newProgramId);
chSrvProgramSet.setSrvModeId(programDetailVo.getSrvModeId());
chSrvProgramSet.setItemType(programSetAndProjectVo.getCategoryType());
chSrvProgramSet.setChooseFlag(programSetAndProjectVo.getIsNeed());
chSrvProgramSet.setPlanningFrequency(programSetAndProjectVo.getPlanningFrequency());
chSrvProgramSet.setPlanningFrequencyType(programSetAndProjectVo.getPlanningFrequencyType());
chSrvProgramSet.setRemark(programSetAndProjectVo.getRemark());
chSrvProgramSetMapper.insert(chSrvProgramSet);
}
} }
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<result column="PROGRAM_ID" property="programId"/> <result column="PROGRAM_ID" property="programId"/>
<result column="SRV_ORGAN_ID" property="srvOrganId"/> <result column="SRV_ORGAN_ID" property="srvOrganId"/>
<result column="DISAB_INFO_ID" property="disabInfoId"/> <result column="DISAB_INFO_ID" property="disabInfoId"/>
<result column="SRV_MODE_ID" property="srvModeId"/>
<result column="DISTRICT_PROVINCIAL" property="disableDistrictProvincial"/> <result column="DISTRICT_PROVINCIAL" property="disableDistrictProvincial"/>
<result column="DISTRICT_CITY" property="disableDistrictCity"/> <result column="DISTRICT_CITY" property="disableDistrictCity"/>
<result column="DISTRICT_AREA" property="disableDistrictArea"/> <result column="DISTRICT_AREA" property="disableDistrictArea"/>
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
SELECT T1.PROGRAM_ID, SELECT T1.PROGRAM_ID,
T1.SRV_ORGAN_ID, T1.SRV_ORGAN_ID,
T1.DISAB_INFO_ID, T1.DISAB_INFO_ID,
T1.SRV_MODE_ID,
T2.DISTRICT_PROVINCIAL, T2.DISTRICT_PROVINCIAL,
T2.DISTRICT_CITY, T2.DISTRICT_CITY,
T2.DISTRICT_AREA, T2.DISTRICT_AREA,
...@@ -72,6 +74,7 @@ ...@@ -72,6 +74,7 @@
SELECT NULL PROGRAM_ID, SELECT NULL PROGRAM_ID,
T1.SRV_ORGAN_ID, T1.SRV_ORGAN_ID,
T1.DISAB_INFO_ID, T1.DISAB_INFO_ID,
T1.SRV_MODE_ID,
T2.DISTRICT_PROVINCIAL, T2.DISTRICT_PROVINCIAL,
T2.DISTRICT_CITY, T2.DISTRICT_CITY,
T2.DISTRICT_AREA, T2.DISTRICT_AREA,
...@@ -135,5 +138,8 @@ ...@@ -135,5 +138,8 @@
LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
WHERE T1.DISAB_INFO_ID = #{disabInfoId} WHERE T1.DISAB_INFO_ID = #{disabInfoId}
AND T1.SRV_ORGAN_ID = #{srvOrganId} AND T1.SRV_ORGAN_ID = #{srvOrganId}
<if test="programStatus != null and programStatus != ''">
T1.PROG_STATUS = #{programStatus}
</if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment