|
@ -15,10 +15,12 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
@ -51,6 +53,8 @@ public class BaseProcessGuidanceEndpoint extends EnvelopRestEndpoint {
|
|
|
private BaseProcessGuidancePushLogService processGuidancePushLogService;
|
|
|
@Resource
|
|
|
private BaseProcessGuidancePresetDao processGuidancePresetDao;
|
|
|
@Resource
|
|
|
private JdbcTemplate jdbcTemplate;
|
|
|
|
|
|
@PostMapping(value = "saveProcessGuidance")
|
|
|
@ApiOperation(value = "保存或更新流程")
|
|
@ -58,56 +62,7 @@ public class BaseProcessGuidanceEndpoint extends EnvelopRestEndpoint {
|
|
|
@RequestParam(value = "jsonData") String jsonData) {
|
|
|
try {
|
|
|
BaseProcessGuidanceDO guidanceDO = toEntity(jsonData, BaseProcessGuidanceDO.class);
|
|
|
String guidanceId = guidanceDO.getId();
|
|
|
List<BaseProcessGuidanceDeptDO> deptDOList = guidanceDO.getDeptDOList();
|
|
|
List<BaseProcessGuidancePresetDO> presetDOList = guidanceDO.getPresetDOList();
|
|
|
if(StringUtils.isNotBlank(guidanceId)){
|
|
|
//更新的时候先删除关联
|
|
|
processGuidanceDeptDao.deleteByProcessGuidanceId(guidanceId);
|
|
|
processGuidancePresetDao.deleteByProcessGuidanceId(guidanceId);
|
|
|
|
|
|
BaseProcessGuidanceDO old = processGuidanceDao.findById(guidanceId).orElse(null);
|
|
|
if(old==null){
|
|
|
return ObjEnvelop.getError("参数错误,id不存在");
|
|
|
}
|
|
|
old.setStatus(guidanceDO.getStatus());
|
|
|
old.setName(guidanceDO.getName());
|
|
|
guidanceDO = processGuidanceDao.save(old);
|
|
|
|
|
|
if(deptDOList!=null&&deptDOList.size()>0){
|
|
|
deptDOList.forEach(one->{
|
|
|
one.setProcessGuidanceId(guidanceId);
|
|
|
});
|
|
|
processGuidanceDeptDao.saveAll(deptDOList);
|
|
|
}
|
|
|
if(presetDOList!=null&&presetDOList.size()>0){
|
|
|
presetDOList.forEach(one->{
|
|
|
one.setProcessGuidanceId(guidanceId);
|
|
|
one.setCreateTime(new Date());
|
|
|
});
|
|
|
processGuidancePresetDao.saveAll(presetDOList);
|
|
|
}
|
|
|
}else{
|
|
|
guidanceDO.setCreateTime(new Date());
|
|
|
guidanceDO = processGuidanceService.save(guidanceDO);
|
|
|
final String guidanceDOId = guidanceDO.getId();
|
|
|
|
|
|
if(deptDOList!=null&&deptDOList.size()>0){
|
|
|
deptDOList.forEach(one->{
|
|
|
one.setProcessGuidanceId(guidanceDOId);
|
|
|
});
|
|
|
processGuidanceDeptDao.saveAll(deptDOList);
|
|
|
}
|
|
|
if(presetDOList!=null&&presetDOList.size()>0){
|
|
|
presetDOList.forEach(one->{
|
|
|
one.setProcessGuidanceId(guidanceDOId);
|
|
|
one.setCreateTime(new Date());
|
|
|
});
|
|
|
processGuidancePresetDao.saveAll(presetDOList);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return success(guidanceDO);
|
|
|
return processGuidanceService.saveProcessGuidance(guidanceDO);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -126,22 +81,32 @@ public class BaseProcessGuidanceEndpoint extends EnvelopRestEndpoint {
|
|
|
@ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
|
|
|
@RequestParam(value = "page") int page,
|
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
|
@RequestParam(value = "size") int size) throws Exception {
|
|
|
List<BaseProcessGuidancePushLogDO> processGuidancePushLogDOS = processGuidancePushLogService.search(fields, filters, sorts, page, size);
|
|
|
processGuidancePushLogDOS.forEach(one->{
|
|
|
if(one.getSendType()==1){
|
|
|
one.setSendTypeName("wx模板");
|
|
|
}else {
|
|
|
one.setSendTypeName("短信");
|
|
|
}
|
|
|
if(one.getUserType()==1){
|
|
|
one.setUserTypeName("居民");
|
|
|
}else {
|
|
|
one.setUserTypeName("医生");
|
|
|
}
|
|
|
});
|
|
|
int count = (int) processGuidancePushLogService.getCount(filters);
|
|
|
return success(processGuidancePushLogDOS, count, page, size, BaseProcessGuidancePushLogDO.class);
|
|
|
@RequestParam(value = "size") int size){
|
|
|
try {
|
|
|
List<BaseProcessGuidancePushLogDO> processGuidancePushLogDOS = processGuidancePushLogService.search(fields, filters, sorts, page, size);
|
|
|
processGuidancePushLogDOS.forEach(one->{
|
|
|
if(one.getSendType()==1){
|
|
|
one.setSendTypeName("wx模板");
|
|
|
}else {
|
|
|
one.setSendTypeName("短信");
|
|
|
}
|
|
|
if(one.getUserType()==1){
|
|
|
one.setUserTypeName("居民");
|
|
|
}else {
|
|
|
one.setUserTypeName("医生");
|
|
|
}
|
|
|
if(one.getStatus()==1){
|
|
|
one.setStatusName("成功");
|
|
|
}else {
|
|
|
one.setStatusName("失败");
|
|
|
}
|
|
|
});
|
|
|
int count = (int) processGuidancePushLogService.getCount(filters);
|
|
|
return success(processGuidancePushLogDOS, count, page, size, BaseProcessGuidancePushLogDO.class);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return PageEnvelop.getError("查询失败");
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = "saveProcessGuidanceNodeSms")
|
|
@ -150,24 +115,7 @@ public class BaseProcessGuidanceEndpoint extends EnvelopRestEndpoint {
|
|
|
@RequestParam(value = "jsonData") String jsonData) {
|
|
|
try {
|
|
|
BaseProcessGuidanceNodeSmsDO nodeSmsDO = toEntity(jsonData, BaseProcessGuidanceNodeSmsDO.class);
|
|
|
if(StringUtils.isBlank(nodeSmsDO.getNodeId())){
|
|
|
return ObjEnvelop.getError("参数错误,节点id不能为空");
|
|
|
}
|
|
|
String nodeSmsDOId = nodeSmsDO.getId();
|
|
|
if(StringUtils.isNotBlank(nodeSmsDOId)){
|
|
|
BaseProcessGuidanceNodeSmsDO oldNodeSms = processGuidanceNodeSmsDao.findById(nodeSmsDOId).orElse(null);
|
|
|
if(oldNodeSms==null){
|
|
|
return ObjEnvelop.getError("参数错误,id不存在");
|
|
|
}
|
|
|
oldNodeSms.setContent(nodeSmsDO.getContent());
|
|
|
oldNodeSms.setIsPush(nodeSmsDO.getIsPush());
|
|
|
oldNodeSms.setTemplateId(nodeSmsDO.getTemplateId());
|
|
|
nodeSmsDO = processGuidanceNodeSmsDao.save(oldNodeSms);
|
|
|
}else{
|
|
|
nodeSmsDO = processGuidanceNodeSmsDao.save(nodeSmsDO);
|
|
|
}
|
|
|
|
|
|
return success(nodeSmsDO);
|
|
|
return processGuidanceService.saveProcessGuidanceNodeSms(nodeSmsDO);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -183,22 +131,7 @@ public class BaseProcessGuidanceEndpoint extends EnvelopRestEndpoint {
|
|
|
if(StringUtils.isBlank(nodeWxDO.getNodeId())){
|
|
|
return ObjEnvelop.getError("参数错误,节点id不能为空");
|
|
|
}
|
|
|
String nodeWxId = nodeWxDO.getId();
|
|
|
if(StringUtils.isNotBlank(nodeWxId)){
|
|
|
BaseProcessGuidanceNodeWxDO oldNodeWx = processGuidanceNodeWxDao.findById(nodeWxId).orElse(null);
|
|
|
if(oldNodeWx==null){
|
|
|
return ObjEnvelop.getError("参数错误,id不存在");
|
|
|
}
|
|
|
oldNodeWx.setIsPush(nodeWxDO.getIsPush());
|
|
|
oldNodeWx.setPreview(nodeWxDO.getPreview());
|
|
|
oldNodeWx.setTemplateId(nodeWxDO.getTemplateId());
|
|
|
oldNodeWx.setTemplateName(nodeWxDO.getTemplateName());
|
|
|
nodeWxDO = processGuidanceNodeWxDao.save(oldNodeWx);
|
|
|
}else{
|
|
|
nodeWxDO = processGuidanceNodeWxDao.save(nodeWxDO);
|
|
|
}
|
|
|
|
|
|
return success(nodeWxDO);
|
|
|
return processGuidanceService.saveProcessGuidanceNodeWx(nodeWxDO);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -223,44 +156,7 @@ public class BaseProcessGuidanceEndpoint extends EnvelopRestEndpoint {
|
|
|
@RequestParam(value = "jsonData") String jsonData) {
|
|
|
try {
|
|
|
BaseProcessGuidanceNodeDO nodeDO = toEntity(jsonData, BaseProcessGuidanceNodeDO.class);
|
|
|
String nodeId = nodeDO.getId();
|
|
|
List<BaseProcessGuidanceNodeAppDO> nodeAppDOList = nodeDO.getNodeAppDOList();
|
|
|
if(StringUtils.isNotBlank(nodeId)){
|
|
|
//更新的时候先删除关联应用
|
|
|
processGuidanceNodeAppDao.deleteByNodeId(nodeId);
|
|
|
|
|
|
BaseProcessGuidanceNodeDO oldNode = processGuidanceNodeDao.findById(nodeId).orElse(null);
|
|
|
if(oldNode==null){
|
|
|
return ObjEnvelop.getError("参数错误,id不存在");
|
|
|
}
|
|
|
oldNode.setStatus(nodeDO.getStatus());
|
|
|
oldNode.setNodeName(nodeDO.getNodeName());
|
|
|
oldNode.setNodeCode(nodeDO.getNodeCode());
|
|
|
oldNode.setNodeDescribe(nodeDO.getNodeDescribe());
|
|
|
oldNode.setNotice(nodeDO.getNotice());
|
|
|
nodeDO = processGuidanceNodeDao.save(oldNode);
|
|
|
|
|
|
if(nodeAppDOList!=null&&nodeAppDOList.size()>0){
|
|
|
nodeAppDOList.forEach(one->{
|
|
|
one.setCreateTime(new Date());
|
|
|
one.setNodeId(nodeId);
|
|
|
});
|
|
|
processGuidanceNodeAppDao.saveAll(nodeAppDOList);
|
|
|
}
|
|
|
}else{
|
|
|
nodeDO.setCreateTime(new Date());
|
|
|
nodeDO = processGuidanceNodeDao.save(nodeDO);
|
|
|
final String nodeId1 = nodeDO.getId();
|
|
|
|
|
|
if(nodeAppDOList!=null&&nodeAppDOList.size()>0){
|
|
|
nodeAppDOList.forEach(one->{
|
|
|
one.setCreateTime(new Date());
|
|
|
one.setNodeId(nodeId1);
|
|
|
});
|
|
|
processGuidanceNodeAppDao.saveAll(nodeAppDOList);
|
|
|
}
|
|
|
}
|
|
|
return success(nodeDO);
|
|
|
return processGuidanceService.saveProcessGuidanceNode(nodeDO);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -364,24 +260,57 @@ public class BaseProcessGuidanceEndpoint extends EnvelopRestEndpoint {
|
|
|
@RequestParam(value = "fields", required = false) String fields,
|
|
|
@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
|
|
|
@RequestParam(value = "filters", required = false) String filters,
|
|
|
@ApiParam(name = "deptName", value = "部门名称")
|
|
|
@RequestParam(value = "deptName", required = false) String deptName,
|
|
|
@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
|
|
|
@RequestParam(value = "sorts", required = false) String sorts,
|
|
|
@ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
|
|
|
@RequestParam(value = "page") int page,
|
|
|
@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
|
|
|
@RequestParam(value = "size") int size) throws Exception {
|
|
|
List<BaseProcessGuidanceDO> processGuidanceDOList = processGuidanceService.search(fields, filters, sorts, page, size);
|
|
|
processGuidanceDOList.forEach(one->{
|
|
|
if(one.getStatus()==1){
|
|
|
one.setStatusName("生效");
|
|
|
}else {
|
|
|
one.setStatusName("失效");
|
|
|
@RequestParam(value = "size") int size){
|
|
|
try {
|
|
|
if(StringUtils.isBlank(deptName)){
|
|
|
List<BaseProcessGuidanceDO> processGuidanceDOList = processGuidanceService.search(fields, filters, sorts, page, size);
|
|
|
processGuidanceDOList.forEach(one->{
|
|
|
if(one.getStatus()==1){
|
|
|
one.setStatusName("生效");
|
|
|
}else {
|
|
|
one.setStatusName("失效");
|
|
|
}
|
|
|
List<BaseProcessGuidanceDeptDO> deptDOList = processGuidanceDeptDao.findByProcessGuidanceId(one.getId());
|
|
|
one.setDeptDOList(deptDOList);
|
|
|
});
|
|
|
int count = (int) processGuidanceService.getCount(filters);
|
|
|
return success(processGuidanceDOList, count, page, size, BaseProcessGuidanceDO.class);
|
|
|
}
|
|
|
List<BaseProcessGuidanceDeptDO> deptDOList = processGuidanceDeptDao.findByProcessGuidanceId(one.getId());
|
|
|
one.setDeptDOList(deptDOList);
|
|
|
});
|
|
|
int count = (int) processGuidanceService.getCount(filters);
|
|
|
return success(processGuidanceDOList, count, page, size, BaseProcessGuidanceDO.class);
|
|
|
String sql = "SELECT DISTINCT g.* ";
|
|
|
String sqlCount = "SELECT count(DISTINCT g.id) ";
|
|
|
String filter = " FROM base_process_guidance g " +
|
|
|
"LEFT JOIN base_process_guidance_dept d on g.id = d.process_guidance_id " +
|
|
|
"WHERE (g.is_all_dept = 1 or d.dept_name like '%"+deptName+"%') ";
|
|
|
if(StringUtils.isNotBlank(filters)){
|
|
|
filter += " and g.name like '%"+filters.split("\\?")[1]+"%'";
|
|
|
}
|
|
|
String limit = " limit "+(page-1)*size+","+size;
|
|
|
Integer count = jdbcTemplate.queryForObject(sqlCount + filter,Integer.class);
|
|
|
List<BaseProcessGuidanceDO> processGuidanceDOList = new ArrayList<>();
|
|
|
if(count>0){
|
|
|
processGuidanceDOList = jdbcTemplate.query(sql+filter+limit,new BeanPropertyRowMapper<>(BaseProcessGuidanceDO.class));
|
|
|
processGuidanceDOList.forEach(one->{
|
|
|
if(one.getStatus()==1){
|
|
|
one.setStatusName("生效");
|
|
|
}else {
|
|
|
one.setStatusName("失效");
|
|
|
}
|
|
|
List<BaseProcessGuidanceDeptDO> deptDOList = processGuidanceDeptDao.findByProcessGuidanceId(one.getId());
|
|
|
one.setDeptDOList(deptDOList);
|
|
|
});
|
|
|
}
|
|
|
return success(processGuidanceDOList, count, page, size, BaseProcessGuidanceDO.class);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
return PageEnvelop.getError("查询失败");
|
|
|
}
|
|
|
|
|
|
@GetMapping(value = "getProcessGuidanceById")
|
|
@ -418,10 +347,7 @@ public class BaseProcessGuidanceEndpoint extends EnvelopRestEndpoint {
|
|
|
@ApiParam(name = "id", value = "id", required = true)
|
|
|
@RequestParam(value = "id") String id) {
|
|
|
try {
|
|
|
processGuidanceDeptDao.deleteByProcessGuidanceId(id);
|
|
|
processGuidancePresetDao.deleteByProcessGuidanceId(id);
|
|
|
processGuidanceDao.deleteById(id);
|
|
|
return success("删除成功");
|
|
|
return processGuidanceService.delProcessGuidance(id);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@ -434,9 +360,7 @@ public class BaseProcessGuidanceEndpoint extends EnvelopRestEndpoint {
|
|
|
@ApiParam(name = "id", value = "id", required = true)
|
|
|
@RequestParam(value = "id") String id) {
|
|
|
try {
|
|
|
processGuidanceNodeAppDao.deleteByNodeId(id);
|
|
|
processGuidanceNodeDao.deleteById(id);
|
|
|
return success("删除成功");
|
|
|
return processGuidanceService.delProcessGuidanceNode(id);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|