diff --git a/platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/HospitalCheckItemConfMapper.java b/platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/HospitalCheckItemConfMapper.java new file mode 100644 index 0000000..3644ca4 --- /dev/null +++ b/platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/HospitalCheckItemConfMapper.java @@ -0,0 +1,15 @@ +package com.lyms.platform.permission.dao.master; + + + +import com.lyms.platform.pojo.HospitalCheckItemConf; +import com.lyms.platform.query.HospitalCheckItemConfQuery; + +import java.util.List; + +public interface HospitalCheckItemConfMapper { + void updateHospitalCheckItemConf(HospitalCheckItemConf record); + void addHospitalCheckItemConf(HospitalCheckItemConf record); + List selectHospitalCheckItemConfList(HospitalCheckItemConfQuery query); + +} \ No newline at end of file diff --git a/platform-biz-service/src/main/java/com/lyms/platform/permission/service/HospitalCheckItemConfService.java b/platform-biz-service/src/main/java/com/lyms/platform/permission/service/HospitalCheckItemConfService.java new file mode 100644 index 0000000..b258438 --- /dev/null +++ b/platform-biz-service/src/main/java/com/lyms/platform/permission/service/HospitalCheckItemConfService.java @@ -0,0 +1,16 @@ +package com.lyms.platform.permission.service; + + +import com.lyms.platform.pojo.HospitalCheckItemConf; +import com.lyms.platform.pojo.TServiceTimeRecord; +import com.lyms.platform.query.HospitalCheckItemConfQuery; +import com.lyms.platform.query.TServiceTimeRecordQuery; + +import java.util.List; + +public interface HospitalCheckItemConfService { + void updateHospitalCheckItemConf(HospitalCheckItemConf record); + void addHospitalCheckItemConf(HospitalCheckItemConf record); + List selectHospitalCheckItemConfList(HospitalCheckItemConfQuery query); + +} \ No newline at end of file diff --git a/platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/HospitalCheckItemConfServiceImpl.java b/platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/HospitalCheckItemConfServiceImpl.java new file mode 100644 index 0000000..6172f68 --- /dev/null +++ b/platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/HospitalCheckItemConfServiceImpl.java @@ -0,0 +1,31 @@ +package com.lyms.platform.permission.service.impl; + +import com.lyms.platform.permission.dao.master.HospitalCheckItemConfMapper; +import com.lyms.platform.permission.service.HospitalCheckItemConfService; +import com.lyms.platform.pojo.HospitalCheckItemConf; +import com.lyms.platform.query.HospitalCheckItemConfQuery; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@Service +public class HospitalCheckItemConfServiceImpl implements HospitalCheckItemConfService { + + @Resource + private HospitalCheckItemConfMapper hospitalCheckItemConfMapper; + @Override + public void updateHospitalCheckItemConf(HospitalCheckItemConf record) { + hospitalCheckItemConfMapper.updateHospitalCheckItemConf(record); + } + + @Override + public void addHospitalCheckItemConf(HospitalCheckItemConf record) { + hospitalCheckItemConfMapper.addHospitalCheckItemConf(record); + } + + @Override + public List selectHospitalCheckItemConfList(HospitalCheckItemConfQuery query) { + return hospitalCheckItemConfMapper.selectHospitalCheckItemConfList(query); + } +} diff --git a/platform-biz-service/src/main/resources/mainOrm/master/HospitalCheckItemConf.xml b/platform-biz-service/src/main/resources/mainOrm/master/HospitalCheckItemConf.xml new file mode 100644 index 0000000..d46bdc8 --- /dev/null +++ b/platform-biz-service/src/main/resources/mainOrm/master/HospitalCheckItemConf.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + insert into hosptial_check_itme_conf + (hospital_id,start_week,end_week,need_check_item,backup_check_item,yn,type + ,create_time,update_time) values + (#{hospitalId},#{startWeek},#{endWeek}, + #{needCheckItem},#{backupCheckItem},#{yn},#{type},#{createTime},#{updateTime}) + + + + + + + update hosptial_check_itme_conf + + + start_week = #{startWeek,jdbcType=INTEGER}, + + + end_week = #{endWeek,jdbcType=INTEGER}, + + + need_check_item = #{needCheckItem,jdbcType=VARCHAR}, + + + backup_check_item = #{backupCheckItem,jdbcType=VARCHAR}, + + + yn = #{yn,jdbcType=INTEGER}, + + + type = #{type,jdbcType=INTEGER}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + + where id = #{id,jdbcType=INTEGER} + + + + + + 1 = 1 + + and id = #{id,jdbcType=INTEGER} + + + and hospital_id = #{hospitalId,jdbcType=INTEGER} + + + and yn = #{yn,jdbcType=INTEGER} + + + and type = #{type,jdbcType=INTEGER} + + + + = #{startWeek,jdbcType=INTEGER} ]]> + + + + + + + + + + + + order by ${sort} + + limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER} + + + + + \ No newline at end of file diff --git a/platform-dal/src/main/java/com/lyms/platform/pojo/HospitalCheckItemConf.java b/platform-dal/src/main/java/com/lyms/platform/pojo/HospitalCheckItemConf.java new file mode 100644 index 0000000..20e8823 --- /dev/null +++ b/platform-dal/src/main/java/com/lyms/platform/pojo/HospitalCheckItemConf.java @@ -0,0 +1,178 @@ +package com.lyms.platform.pojo; + +import java.util.Date; + +/** + * 服务周期表 + */ +public class HospitalCheckItemConf { + private Integer id; + /** + * 医院ID + */ + private Integer hospitalId; + + /** + * 开始孕周 + */ + private Integer startWeek; + + /** + * 结束孕周 + */ + private Integer endWeek; + + /** + * 必检项目,多个逗号隔开 + */ + private String needCheckItem; + + /** + * 必检项目名称,多个逗号隔开 + */ + private String needCheckItemName; + + /** + * 备检项目,多个逗号隔开 + */ + private String backupCheckItem; + + /** + * 备检项目,多个逗号隔开 + */ + private String backupCheckItemName; + + /** + * 类型 1孕妇 2 儿童 + */ + private Integer type; + + /** + * 有效标识 + */ + private Integer yn; + + /** + * 创建时间 + */ + private Date createTime; + /** + * 更新时间 + */ + private Date updateTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getHospitalId() { + return hospitalId; + } + + public void setHospitalId(Integer hospitalId) { + this.hospitalId = hospitalId; + } + + public Integer getStartWeek() { + return startWeek; + } + + public void setStartWeek(Integer startWeek) { + this.startWeek = startWeek; + } + + public Integer getEndWeek() { + return endWeek; + } + + public void setEndWeek(Integer endWeek) { + this.endWeek = endWeek; + } + + public String getNeedCheckItem() { + return needCheckItem; + } + + public void setNeedCheckItem(String needCheckItem) { + this.needCheckItem = needCheckItem; + } + + public String getBackupCheckItem() { + return backupCheckItem; + } + + public void setBackupCheckItem(String backupCheckItem) { + this.backupCheckItem = backupCheckItem; + } + + public Integer getYn() { + return yn; + } + + public void setYn(Integer yn) { + this.yn = yn; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getNeedCheckItemName() { + return needCheckItemName; + } + + public void setNeedCheckItemName(String needCheckItemName) { + this.needCheckItemName = needCheckItemName; + } + + public String getBackupCheckItemName() { + return backupCheckItemName; + } + + public void setBackupCheckItemName(String backupCheckItemName) { + this.backupCheckItemName = backupCheckItemName; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + + @Override + public String toString() { + return "HospitalCheckItemConf{" + + "id=" + id + + ", hospitalId=" + hospitalId + + ", startWeek=" + startWeek + + ", endWeek=" + endWeek + + ", needCheckItem='" + needCheckItem + '\'' + + ", needCheckItemName='" + needCheckItemName + '\'' + + ", backupCheckItem='" + backupCheckItem + '\'' + + ", backupCheckItemName='" + backupCheckItemName + '\'' + + ", type=" + type + + ", yn=" + yn + + ", createTime=" + createTime + + ", updateTime=" + updateTime + + '}'; + } +} \ No newline at end of file diff --git a/platform-dal/src/main/java/com/lyms/platform/query/HospitalCheckItemConfQuery.java b/platform-dal/src/main/java/com/lyms/platform/query/HospitalCheckItemConfQuery.java new file mode 100644 index 0000000..fd81f37 --- /dev/null +++ b/platform-dal/src/main/java/com/lyms/platform/query/HospitalCheckItemConfQuery.java @@ -0,0 +1,109 @@ +package com.lyms.platform.query; + + + +import com.lyms.platform.common.dao.BaseQuery; + +import java.util.Date; + + +public class HospitalCheckItemConfQuery extends BaseQuery { + + private Integer id; + /** + * 医院ID + */ + private Integer hospitalId; + + /** + * 开始孕周 + */ + private Integer startWeek; + + /** + * 结束孕周 + */ + private Integer endWeek; + + /** + * 必检项目 + */ + private String needCheckItem; + + /** + * 备检项目 + */ + private String backupCheckItem; + + /** + * 有效标识 + */ + private Integer yn; + + private Integer type; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getHospitalId() { + return hospitalId; + } + + public void setHospitalId(Integer hospitalId) { + this.hospitalId = hospitalId; + } + + public Integer getStartWeek() { + return startWeek; + } + + public void setStartWeek(Integer startWeek) { + this.startWeek = startWeek; + } + + public Integer getEndWeek() { + return endWeek; + } + + public void setEndWeek(Integer endWeek) { + this.endWeek = endWeek; + } + + public String getNeedCheckItem() { + return needCheckItem; + } + + public void setNeedCheckItem(String needCheckItem) { + this.needCheckItem = needCheckItem; + } + + public String getBackupCheckItem() { + return backupCheckItem; + } + + public void setBackupCheckItem(String backupCheckItem) { + this.backupCheckItem = backupCheckItem; + } + + public Integer getYn() { + return yn; + } + + public void setYn(Integer yn) { + this.yn = yn; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } +} \ No newline at end of file diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HospitalCheckItemConfController.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HospitalCheckItemConfController.java new file mode 100644 index 0000000..02a86b4 --- /dev/null +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/HospitalCheckItemConfController.java @@ -0,0 +1,212 @@ +package com.lyms.platform.operate.web.controller; + +import com.lyms.platform.common.base.BaseController; +import com.lyms.platform.common.constants.ErrorCodeConstants; +import com.lyms.platform.common.enums.YnEnums; +import com.lyms.platform.common.utils.ResultUtils; +import com.lyms.platform.common.utils.StringUtils; +import com.lyms.platform.operate.web.result.FrontEndResult; +import com.lyms.platform.operate.web.utils.CollectionUtils; +import com.lyms.platform.permission.model.CheckItem; +import com.lyms.platform.permission.service.CheckItemService; +import com.lyms.platform.permission.service.HospitalCheckItemConfService; +import com.lyms.platform.pojo.HospitalCheckItemConf; +import com.lyms.platform.query.HospitalCheckItemConfQuery; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.*; + +@Controller +@RequestMapping("/hospitalCheckItemConf") +public class HospitalCheckItemConfController extends BaseController { + + @Autowired + private HospitalCheckItemConfService hospitalCheckItemConfService; + + @Autowired + @Qualifier("cfCheckItemService") + private CheckItemService checkItemService; + + @RequestMapping(value = "/list", method = RequestMethod.GET) + @ResponseBody + public FrontEndResult queryHospitalCheckItemConfList(@RequestParam(value = "hospitalId") Integer hospitalId, + @RequestParam(value = "type") Integer type) { + FrontEndResult frontEndResult = new FrontEndResult(); + frontEndResult.setErrorcode(ErrorCodeConstants.SUCCESS); + if(hospitalId == null){ + frontEndResult.setErrorcode(ErrorCodeConstants.PARAMETER_ERROR); + frontEndResult.setErrormsg("机构信息必须填写"); + return frontEndResult; + } + HospitalCheckItemConfQuery checkItemConfQuery = new HospitalCheckItemConfQuery(); + checkItemConfQuery.setSort("start_week asc"); + checkItemConfQuery.setHospitalId(hospitalId); + checkItemConfQuery.setType(type); + checkItemConfQuery.setYn(YnEnums.YES.getId()); + List hospitalCheckItemConfs = hospitalCheckItemConfService.selectHospitalCheckItemConfList(checkItemConfQuery); + //查询医院的孕妇类型的所有产检项目 + Map param = new HashMap(); + param.put("type",1); + param.put("hospitalId",hospitalId); + List checkItems = checkItemService.getCheckItemList(param); + + StringBuffer needCheckItemNames = new StringBuffer(); + StringBuffer backupCheckItemNames = new StringBuffer(); + for(HospitalCheckItemConf checkItemConf: hospitalCheckItemConfs){ + needCheckItemNames.setLength(0); + backupCheckItemNames.setLength(0); + String needCheckItem = checkItemConf.getNeedCheckItem(); + if(StringUtils.isNotEmpty(needCheckItem)){ + String[] needCheckItemIds = needCheckItem.split(","); + for(String id: needCheckItemIds){ + if(StringUtils.isEmpty(id)){ + continue; + } + for(CheckItem checkItem: checkItems){ + if(checkItem.getId() == Integer.parseInt(id)){ + needCheckItemNames.append(checkItem.getProject()+","); + } + } + } + + + } + String backupCheckItems= checkItemConf.getBackupCheckItem(); + if(StringUtils.isNotEmpty(backupCheckItems)){ + String[] backupCheckItemIds = backupCheckItems.split(","); + for(String id: backupCheckItemIds){ + if(StringUtils.isEmpty(id)){ + continue; + } + for(CheckItem checkItem: checkItems){ + if(checkItem.getId() == Integer.parseInt(id)){ + backupCheckItemNames.append(checkItem.getProject()+","); + } + } + } + + + } + if(needCheckItemNames.length() > 0){ + checkItemConf.setNeedCheckItemName(needCheckItemNames.deleteCharAt(needCheckItemNames.length() - 1).toString()); + } + if(backupCheckItemNames.length() > 0){ + checkItemConf.setBackupCheckItemName(backupCheckItemNames.deleteCharAt(backupCheckItemNames.length()-1).toString()); + } + + } + frontEndResult.setData(hospitalCheckItemConfs); + return frontEndResult; + } + + @RequestMapping(method = RequestMethod.POST, value = "/add") + //@TokenRequired + public void addHospitalCheckItemConf(@RequestBody HospitalCheckItemConf checkItemConf, HttpServletResponse response){ + + if(checkItemConf.getHospitalId()== null || + checkItemConf.getStartWeek() == null|| + checkItemConf.getEndWeek() == null){ + ResultUtils.buildParameterErrorResultAndWrite(response, "请填写必须项!"); + return; + } + + if(checkItemConf.getStartWeek() > checkItemConf.getEndWeek()){ + ResultUtils.buildParameterErrorResultAndWrite(response, "起始周不能大于结束周!"); + return; + } + HospitalCheckItemConfQuery query = new HospitalCheckItemConfQuery(); + query.setHospitalId(checkItemConf.getHospitalId()); + query.setYn(YnEnums.YES.getId()); + List hospitalCheckItemConfs = hospitalCheckItemConfService.selectHospitalCheckItemConfList(query); + + boolean noRepeat = true; + if (CollectionUtils.isNotEmpty(hospitalCheckItemConfs)) { + for (HospitalCheckItemConf hospitalCheckItemConf : hospitalCheckItemConfs) { + if(!(checkItemConf.getStartWeek() > hospitalCheckItemConf.getEndWeek() + || checkItemConf.getEndWeek() < hospitalCheckItemConf.getStartWeek())){ + noRepeat = false; + } + } + } + + if(noRepeat){ + checkItemConf.setYn(YnEnums.YES.getId()); + checkItemConf.setCreateTime(new Date()); + checkItemConf.setUpdateTime(new Date()); + hospitalCheckItemConfService.addHospitalCheckItemConf(checkItemConf); + ResultUtils.buildSuccessResultAndWrite(response); + }else{ + ResultUtils.buildParameterErrorResultAndWrite(response, "此范围孕周与已有数据有重合,请确认!"); + } + + } + + @RequestMapping(method = RequestMethod.POST, value = "/update") + //@TokenRequired + public void updateHospitalCheckItemConf(@RequestBody HospitalCheckItemConf checkItemConf, HttpServletResponse response){ + + if (null == checkItemConf.getId()) { + ResultUtils.buildParameterErrorResultAndWrite(response, "请选择要修改的数据"); + return; + } + if (checkItemConf.getStartWeek() > checkItemConf.getEndWeek()) { + ResultUtils.buildParameterErrorResultAndWrite(response, "起始周不能大于结束周!"); + return; + } + + HospitalCheckItemConfQuery query = new HospitalCheckItemConfQuery(); + query.setHospitalId(checkItemConf.getHospitalId()); + query.setYn(YnEnums.YES.getId()); + List hospitalCheckItemConfs = hospitalCheckItemConfService.selectHospitalCheckItemConfList(query); + + boolean noRepeat = true; + if (CollectionUtils.isNotEmpty(hospitalCheckItemConfs)) { + for (HospitalCheckItemConf hospitalCheckItemConf : hospitalCheckItemConfs) { + if(hospitalCheckItemConf.getId() != checkItemConf.getId() && + !(checkItemConf.getStartWeek() > hospitalCheckItemConf.getEndWeek() + || checkItemConf.getEndWeek() < hospitalCheckItemConf.getStartWeek())){ + noRepeat = false; + } + } + } + + if(noRepeat){ + checkItemConf.setYn(YnEnums.YES.getId()); + checkItemConf.setUpdateTime(new Date()); + hospitalCheckItemConfService.updateHospitalCheckItemConf(checkItemConf); + ResultUtils.buildSuccessResultAndWrite(response); + }else{ + ResultUtils.buildParameterErrorResultAndWrite(response, "此范围孕周与已有数据有重合,请确认!"); + } + + } + + @RequestMapping(value = "/delete", method = RequestMethod.POST) + public void deleteHospitalCheckItemConf(HttpServletResponse response, @RequestParam("id") Integer id) { + if (null == id) { + ResultUtils.buildParameterErrorResultAndWrite(response, "请选择需要删除的数据"); + return; + } + + HospitalCheckItemConfQuery query = new HospitalCheckItemConfQuery(); + query.setId(id); + List hospitalCheckItemConfs = hospitalCheckItemConfService.selectHospitalCheckItemConfList(query); + + if (CollectionUtils.isNotEmpty(hospitalCheckItemConfs)) { + HospitalCheckItemConf checkItemConf = hospitalCheckItemConfs.get(0); + checkItemConf.setYn(YnEnums.NO.getId()); + checkItemConf.setUpdateTime(new Date()); + hospitalCheckItemConfService.updateHospitalCheckItemConf(checkItemConf); + ResultUtils.buildSuccessResultAndWrite(response, "删除成功!"); + + } else { + ResultUtils.buildParameterErrorResultAndWrite(response, "删除数据失败!!"); + } + } + + +}