Commit e395b9c84f5ebdf60fd314a1d1bc22579829fe9a

Authored by shiyang
1 parent d96c94467c

儿童建档数据按儿童检查套餐分类定时任务。儿保检查新增、删除时改变BabyBuildClassifyModel状态

Showing 10 changed files with 942 additions and 0 deletions

platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyBookbuildingService.java View file @ e395b9c
1 1 package com.lyms.platform.biz.service;
2 2  
3 3 import com.lyms.platform.common.dao.operator.MongoQuery;
  4 +import com.lyms.platform.common.enums.MonthAgeTropeEnum;
4 5 import com.lyms.platform.common.utils.DateUtil;
5 6 import com.lyms.platform.pojo.*;
  7 +import com.lyms.platform.query.BabyBuildClassifyQuery;
6 8 import com.lyms.platform.query.BabyCheckModelQuery;
7 9 import com.lyms.platform.query.BabyModelQuery;
8 10 import com.lyms.platform.query.PatientsQuery;
... ... @@ -19,6 +21,7 @@
19 21 import com.lyms.platform.biz.dal.IBabyBookBuildingDao;
20 22 import com.lyms.platform.common.enums.YnEnums;
21 23  
  24 +import java.util.ArrayList;
22 25 import java.util.Date;
23 26 import java.util.List;
24 27  
25 28  
... ... @@ -29,7 +32,10 @@
29 32 private IBabyBookBuildingDao babyBookBuildingDao;
30 33 @Autowired
31 34 private PatientsService patientsService;
  35 + @Autowired
  36 + private BabyBuildClassifyService babyBuildClassifyService;
32 37  
  38 +
33 39 @Autowired
34 40 private MongoTemplate mongoTemplate;
35 41  
... ... @@ -199,6 +205,61 @@
199 205  
200 206 public void deleteFmHistoryRecord(MongoQuery mongoQuery) {
201 207 babyBookBuildingDao.deleteFmHistoryRecord(mongoQuery);
  208 + }
  209 +
  210 + /**
  211 + * 儿童建档数据按儿童检查套餐分类数据存储(1、3、6、8、12、18、24、30、36、48、60、72).定时任务每天0点执行
  212 + */
  213 + public void babyBuildClassify() {
  214 + BabyModelQuery babyQuery = new BabyModelQuery();
  215 + babyQuery.setYn(YnEnums.YES.getId());
  216 + List<Date> monthAgeList=new ArrayList<>();
  217 + monthAgeList.add(DateUtil.getMonth(-1));
  218 + monthAgeList.add(DateUtil.getMonth(-3));
  219 + monthAgeList.add(DateUtil.getMonth(-6));
  220 + monthAgeList.add(DateUtil.getMonth(-8));
  221 + monthAgeList.add(DateUtil.getMonth(-12));
  222 + monthAgeList.add(DateUtil.getMonth(-18));
  223 + monthAgeList.add(DateUtil.getMonth(-24));
  224 + monthAgeList.add(DateUtil.getMonth(-30));
  225 + monthAgeList.add(DateUtil.getMonth(-36));
  226 + monthAgeList.add(DateUtil.getMonth(-48));
  227 + monthAgeList.add(DateUtil.getMonth(-60));
  228 + monthAgeList.add(DateUtil.getMonth(-72));
  229 + for (int i=0;i<monthAgeList.size();i++) {
  230 + Date monthAge=monthAgeList.get(i);
  231 + babyQuery.setBirthStart(DateUtil.getDayFirstSecond(monthAge));
  232 + babyQuery.setBirthEnd(DateUtil.getDayLastSecond(monthAge));
  233 + MongoQuery query = babyQuery.convertToQuery();
  234 + List<BabyModel> babyModelList = babyBookBuildingDao.queryBabyWithQuery(query);
  235 + for (BabyModel babyModel : babyModelList) {
  236 + //防止重复
  237 + BabyBuildClassifyQuery classifyQuery=new BabyBuildClassifyQuery();
  238 + classifyQuery.setBabyId(babyModel.getId());
  239 + classifyQuery.setMonthAge(MonthAgeTropeEnum.getMonthAgeById(i));
  240 + List<BabyBuildClassifyModel> classifyModelList = babyBuildClassifyService.queryList(classifyQuery, null, null);
  241 + if(CollectionUtils.isEmpty(classifyModelList)) {
  242 + //保存
  243 + try {
  244 + BabyBuildClassifyModel ClassifyModel = new BabyBuildClassifyModel();
  245 + ClassifyModel.setHospitalId(babyModel.getHospitalId());
  246 + ClassifyModel.setMonthAge(MonthAgeTropeEnum.getMonthAgeById(i));
  247 + ClassifyModel.setBabyBuildDate(babyModel.getBuildDate());
  248 + ClassifyModel.setBabyId(babyModel.getId());
  249 + ClassifyModel.setIsCheck(0);
  250 + ClassifyModel.setName(babyModel.getName());
  251 + ClassifyModel.setSex(babyModel.getSex());
  252 + ClassifyModel.setBirth(babyModel.getBirth());
  253 + ClassifyModel.setmName(babyModel.getMname());
  254 + ClassifyModel.setmCardNo(babyModel.getMcertNo());
  255 + ClassifyModel.setmPhone(babyModel.getMphone());
  256 + babyBuildClassifyService.add(ClassifyModel);
  257 + } catch (Exception e) {
  258 + throw new RuntimeException(e);
  259 + }
  260 + }
  261 + }
  262 + }
202 263 }
203 264 }
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyBuildClassifyService.java View file @ e395b9c
  1 +package com.lyms.platform.biz.service;
  2 +
  3 +import com.lyms.platform.common.dao.BaseMongoDAOImpl;
  4 +import com.lyms.platform.common.dao.operator.MongoCondition;
  5 +import com.lyms.platform.common.dao.operator.MongoOper;
  6 +import com.lyms.platform.common.dao.operator.MongoQuery;
  7 +import com.lyms.platform.common.enums.YnEnums;
  8 +import com.lyms.platform.pojo.BabyBuildClassifyModel;
  9 +import com.lyms.platform.pojo.MedicineArticleModel;
  10 +import com.lyms.platform.query.BabyBuildClassifyQuery;
  11 +import com.lyms.platform.query.MedicineArticleQuery;
  12 +import org.apache.commons.lang.ArrayUtils;
  13 +import org.apache.commons.lang.StringUtils;
  14 +import org.springframework.data.domain.Sort;
  15 +import org.springframework.stereotype.Service;
  16 +
  17 +import java.util.Date;
  18 +import java.util.List;
  19 +
  20 +/**
  21 + * Created by shy on 2022/9/6.
  22 + * 儿童建档数据按儿童检查套餐分类数据 逻辑
  23 + */
  24 +
  25 +@Service("MedicineArticleService")
  26 +public class BabyBuildClassifyService extends BaseMongoDAOImpl<BabyBuildClassifyModel> {
  27 +
  28 + /**
  29 + * 新增
  30 + * @param model
  31 + * @return
  32 + */
  33 + public BabyBuildClassifyModel add(BabyBuildClassifyModel model) {
  34 + model.setCreated(new Date());
  35 + model.setYn(YnEnums.YES.getId());
  36 + mongoTemplate.insert(model);
  37 + return model;
  38 + }
  39 +
  40 + /**
  41 + * 根据query修改
  42 + * @param query
  43 + */
  44 + public void update(BabyBuildClassifyQuery query,BabyBuildClassifyModel model) {
  45 + model.setModified(new Date());
  46 + update(query.convertToQuery().convertToMongoQuery(), model);
  47 + }
  48 +
  49 + /**
  50 + * 删除
  51 + * @param id
  52 + */
  53 + public void deleteById(String id) {
  54 + BabyBuildClassifyModel obj = new BabyBuildClassifyModel();
  55 + obj.setYn(YnEnums.NO.getId());
  56 + obj.setId(id);
  57 + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj);
  58 + }
  59 +
  60 + /**
  61 + * 根据id查询
  62 + * @param id
  63 + * @return
  64 + */
  65 + public BabyBuildClassifyModel queryById(String id) {
  66 + BabyBuildClassifyQuery modelQuery = new BabyBuildClassifyQuery();
  67 + modelQuery.setId(id);
  68 + MongoQuery query = modelQuery.convertToQuery();
  69 + return findOne(query.convertToMongoQuery());
  70 + }
  71 +
  72 + /**
  73 + * 根据条件查询
  74 + * @param modelQuery 查询条件
  75 + * @param sortkeys 按什么字段排序(如null必须sort也为null表示不排序)
  76 + * @param sort 排序 ASC/DESC
  77 + * Need 给这个字段赋值代表需要分页,null不需要分页
  78 + * @return
  79 + */
  80 + public List<BabyBuildClassifyModel> queryList(BabyBuildClassifyQuery modelQuery, Sort.Direction sort, String[] sortkeys) {
  81 + MongoQuery query = modelQuery.convertToQuery();
  82 + if (StringUtils.isNotEmpty(modelQuery.getNeed())) {//是否需要分页
  83 + modelQuery.mysqlBuild((int)count(modelQuery.convertToQuery().convertToMongoQuery()));
  84 + query.start(modelQuery.getOffset()).end(modelQuery.getLimit());
  85 + }
  86 + if(ArrayUtils.isNotEmpty(sortkeys) && null!=sort){
  87 + for (String sortkey : sortkeys) {
  88 + query.addOrder(sort, sortkey);
  89 + }
  90 + }
  91 + return find(query.convertToMongoQuery());
  92 + }
  93 +
  94 +
  95 +
  96 +}
platform-common/src/main/java/com/lyms/platform/common/enums/MonthAgeEnum.java View file @ e395b9c
  1 +package com.lyms.platform.common.enums;
  2 +
  3 +/**
  4 + * 翻译检查套餐
  5 + */
  6 +public enum MonthAgeEnum {
  7 + month0(1, "1月龄检查套餐"),
  8 + month1(3, "3月龄检查套餐"),
  9 + month2(6, "6月龄检查套餐"),
  10 + month3(8, "8月龄检查套餐"),
  11 + month4(12, "12月龄检查套餐"),
  12 + month5(18, "18月龄检查套餐"),
  13 + month6(24, "24月龄检查套餐"),
  14 + month7(30, "30月龄检查套餐"),
  15 + month8(36, "3岁检查套餐"),
  16 + month9(48, "4岁检查套餐"),
  17 + month10(60, "5岁检查套餐"),
  18 + month11(72, "6岁检查套餐");
  19 +
  20 + private Integer id;
  21 + private String text;
  22 +
  23 +
  24 + MonthAgeEnum(int id, String text) {
  25 + this.id = id;
  26 + this.text = text;
  27 + }
  28 +
  29 + public static String getTextById(Integer id) {
  30 + if(id==null){
  31 + return "";
  32 + }
  33 + for (MonthAgeEnum ageEnum : values()) {
  34 + if (ageEnum.getId() == id) {
  35 + return ageEnum.getText();
  36 + }
  37 + }
  38 + return "";
  39 + }
  40 +
  41 + public Integer getId() {
  42 + return id;
  43 + }
  44 +
  45 + public void setId(Integer id) {
  46 + this.id = id;
  47 + }
  48 +
  49 + public String getText() {
  50 + return text;
  51 + }
  52 +
  53 + public void setText(String text) {
  54 + this.text = text;
  55 + }
  56 +}
platform-common/src/main/java/com/lyms/platform/common/enums/MonthAgeTropeEnum.java View file @ e395b9c
  1 +package com.lyms.platform.common.enums;
  2 +
  3 +/**
  4 + * 检查套餐转义(儿童建档数据按儿童检查套餐分类数据存储(1、3、6、8、12、18、24、30、36、48、60、72).定时任务每天0点执行)
  5 + */
  6 +public enum MonthAgeTropeEnum {
  7 + month0(0, 1),
  8 + month1(1, 3),
  9 + month2(2, 6),
  10 + month3(3, 8),
  11 + month4(4, 12),
  12 + month5(5, 18),
  13 + month6(6, 24),
  14 + month7(7, 30),
  15 + month8(8, 36),
  16 + month9(9, 48),
  17 + month10(10, 60),
  18 + month11(11, 72);
  19 +
  20 + private Integer id;
  21 + private Integer monthAge;
  22 +
  23 +
  24 + MonthAgeTropeEnum(int id, Integer monthAge) {
  25 + this.id = id;
  26 + this.monthAge = monthAge;
  27 + }
  28 +
  29 + public static Integer getMonthAgeById(Integer id) {
  30 + if(id==null){
  31 + return null;
  32 + }
  33 + for (MonthAgeTropeEnum ageEnum : values()) {
  34 + if (ageEnum.getId() == id) {
  35 + return ageEnum.getMonthAge();
  36 + }
  37 + }
  38 + return null;
  39 + }
  40 +
  41 + public Integer getId() {
  42 + return id;
  43 + }
  44 +
  45 + public void setId(Integer id) {
  46 + this.id = id;
  47 + }
  48 +
  49 + public Integer getMonthAge() {
  50 + return monthAge;
  51 + }
  52 +
  53 + public void setMonthAge(Integer monthAge) {
  54 + this.monthAge = monthAge;
  55 + }
  56 +}
platform-dal/src/main/java/com/lyms/platform/pojo/BabyBuildClassifyModel.java View file @ e395b9c
  1 +package com.lyms.platform.pojo;
  2 +
  3 +import com.lyms.platform.beans.SerialIdEnum;
  4 +import com.lyms.platform.common.result.BaseModel;
  5 +import com.lyms.platform.common.utils.PingYinUtil;
  6 +import org.springframework.data.mongodb.core.mapping.Document;
  7 +import org.springframework.data.mongodb.core.mapping.Field;
  8 +
  9 +import java.util.Date;
  10 +import java.util.List;
  11 +import java.util.Map;
  12 +
  13 +/**
  14 + * 儿童建档数据按儿童检查套餐分类数据
  15 + *
  16 + * @author Administrator
  17 + */
  18 +@Document(collection = "lyms_babyBuildClassifyModel")
  19 +public class BabyBuildClassifyModel extends BaseModel {
  20 + private String id;
  21 + private Date created;
  22 + private Date modified;
  23 + private Integer yn;
  24 + private String hospitalId;
  25 + /**
  26 + * 儿童建档id
  27 + */
  28 + private String babyId;
  29 + /**
  30 + * 儿童建档日期
  31 + */
  32 + private Date babyBuildDate;
  33 + /**
  34 + * 月龄套餐对应1-6岁月龄套餐(MonthAgeEnum)
  35 + */
  36 + private Integer monthAge;
  37 + /**
  38 + * 是否做儿保检查(0,1)
  39 + */
  40 + private Integer isCheck;
  41 + /**
  42 + * 姓名
  43 + */
  44 + private String name;
  45 + /**
  46 + * 性别
  47 + */
  48 + private Integer sex;
  49 + /**
  50 + * 儿童生日
  51 + */
  52 + private Date birth;
  53 + /**
  54 + *母亲姓名
  55 + */
  56 + private String mName;
  57 + /**
  58 + *母亲证件号
  59 + */
  60 + private String mCardNo;
  61 + /**
  62 + *母亲手机号码
  63 + */
  64 + private String mPhone;
  65 +
  66 + public String getId() {
  67 + return id;
  68 + }
  69 +
  70 + public void setId(String id) {
  71 + this.id = id;
  72 + }
  73 +
  74 + public Date getCreated() {
  75 + return created;
  76 + }
  77 +
  78 + public void setCreated(Date created) {
  79 + this.created = created;
  80 + }
  81 +
  82 + public Date getModified() {
  83 + return modified;
  84 + }
  85 +
  86 + public void setModified(Date modified) {
  87 + this.modified = modified;
  88 + }
  89 +
  90 + public Integer getYn() {
  91 + return yn;
  92 + }
  93 +
  94 + public void setYn(Integer yn) {
  95 + this.yn = yn;
  96 + }
  97 +
  98 + public String getBabyId() {
  99 + return babyId;
  100 + }
  101 +
  102 + public void setBabyId(String babyId) {
  103 + this.babyId = babyId;
  104 + }
  105 +
  106 + public Date getBabyBuildDate() {
  107 + return babyBuildDate;
  108 + }
  109 +
  110 + public void setBabyBuildDate(Date babyBuildDate) {
  111 + this.babyBuildDate = babyBuildDate;
  112 + }
  113 +
  114 + public Integer getMonthAge() {
  115 + return monthAge;
  116 + }
  117 +
  118 + public void setMonthAge(Integer monthAge) {
  119 + this.monthAge = monthAge;
  120 + }
  121 +
  122 + public Integer getIsCheck() {
  123 + return isCheck;
  124 + }
  125 +
  126 + public void setIsCheck(Integer isCheck) {
  127 + this.isCheck = isCheck;
  128 + }
  129 +
  130 + public String getName() {
  131 + return name;
  132 + }
  133 +
  134 + public void setName(String name) {
  135 + this.name = name;
  136 + }
  137 +
  138 + public Integer getSex() {
  139 + return sex;
  140 + }
  141 +
  142 + public void setSex(Integer sex) {
  143 + this.sex = sex;
  144 + }
  145 +
  146 + public Date getBirth() {
  147 + return birth;
  148 + }
  149 +
  150 + public void setBirth(Date birth) {
  151 + this.birth = birth;
  152 + }
  153 +
  154 + public String getmName() {
  155 + return mName;
  156 + }
  157 +
  158 + public void setmName(String mName) {
  159 + this.mName = mName;
  160 + }
  161 +
  162 + public String getmCardNo() {
  163 + return mCardNo;
  164 + }
  165 +
  166 + public void setmCardNo(String mCardNo) {
  167 + this.mCardNo = mCardNo;
  168 + }
  169 +
  170 + public String getmPhone() {
  171 + return mPhone;
  172 + }
  173 +
  174 + public void setmPhone(String mPhone) {
  175 + this.mPhone = mPhone;
  176 + }
  177 +
  178 + public String getHospitalId() {
  179 + return hospitalId;
  180 + }
  181 +
  182 + public void setHospitalId(String hospitalId) {
  183 + this.hospitalId = hospitalId;
  184 + }
  185 +}
platform-dal/src/main/java/com/lyms/platform/query/BabyBuildClassifyQuery.java View file @ e395b9c
  1 +package com.lyms.platform.query;
  2 +
  3 +import com.lyms.platform.common.base.IConvertToNativeQuery;
  4 +import com.lyms.platform.common.dao.BaseQuery;
  5 +import com.lyms.platform.common.dao.operator.MongoCondition;
  6 +import com.lyms.platform.common.dao.operator.MongoOper;
  7 +import com.lyms.platform.common.dao.operator.MongoQuery;
  8 +import com.lyms.platform.common.utils.StringUtils;
  9 +import org.apache.commons.collections.CollectionUtils;
  10 +import org.springframework.data.mongodb.core.query.Criteria;
  11 +
  12 +import java.util.Date;
  13 +import java.util.List;
  14 +
  15 +/**
  16 + * 儿童建档数据按儿童检查套餐分类数据 -操作
  17 + * <p>
  18 + * Created by Administrator on 2022/9/6 .
  19 + */
  20 +public class BabyBuildClassifyQuery extends BaseQuery implements IConvertToNativeQuery {
  21 + private String id;
  22 + /**
  23 + * 系统创建时间-开始
  24 + */
  25 + private Date createdStart;
  26 + /**
  27 + * 系统创建时间-结束
  28 + */
  29 + private Date createdEnd;
  30 + private Date modified;
  31 + private Integer yn;
  32 + private String hospitalId;
  33 + /**
  34 + * 儿童建档id
  35 + */
  36 + private String babyId;
  37 + /**
  38 + * 儿童建档日期开始
  39 + */
  40 + private Date babyBuildDateStart;
  41 + /**
  42 + * 儿童建档日期结束
  43 + */
  44 + private Date babyBuildDateEnd;
  45 + /**
  46 + * 月龄套餐对应1-6岁月龄套餐(MonthAgeEnum)
  47 + */
  48 + private Integer monthAge;
  49 + /**
  50 + * 月龄套餐对应1-6岁月龄套餐(MonthAgeEnum)-开始
  51 + */
  52 + private Integer monthAgeStart;
  53 + /**
  54 + * 月龄套餐对应1-6岁月龄套餐(MonthAgeEnum)-结束
  55 + */
  56 + private Integer monthAgeEnd;
  57 + /**
  58 + * 是否做儿保检查(0,1)
  59 + */
  60 + private Integer isCheck;
  61 + /**
  62 + * 姓名
  63 + */
  64 + private String name;
  65 + /**
  66 + * 性别
  67 + */
  68 + private Integer sex;
  69 + /**
  70 + * 儿童生日
  71 + */
  72 + private Date birthStart;
  73 + /**
  74 + * 儿童生日
  75 + */
  76 + private Date birthEnd;
  77 + /**
  78 + *母亲姓名
  79 + */
  80 + private String mName;
  81 + /**
  82 + *母亲证件号
  83 + */
  84 + private String mCardNo;
  85 + /**
  86 + *母亲手机号码
  87 + */
  88 + private String mPhone;
  89 + @Override
  90 + public MongoQuery convertToQuery() {
  91 + MongoCondition condition = MongoCondition.newInstance();
  92 + if (StringUtils.isNotEmpty( id)) {
  93 + condition = condition.and("id", id, MongoOper.IS);
  94 + }
  95 + if (StringUtils.isNotEmpty( babyId)) {
  96 + condition = condition.and("babyId", babyId, MongoOper.IS);
  97 + }
  98 + if (null != yn) {
  99 + condition = condition.and("yn", yn, MongoOper.IS);
  100 + }
  101 +
  102 + if (StringUtils.isNotEmpty(hospitalId)) {
  103 + condition = condition.and("hospitalId", hospitalId, MongoOper.IS);
  104 + }
  105 + if (null != isCheck) {
  106 + condition = condition.and("isCheck", isCheck, MongoOper.IS);
  107 + }
  108 + if (StringUtils.isNotEmpty( name)) {
  109 + condition = condition.and("name", name, MongoOper.IS);
  110 + }
  111 + if (null != sex) {
  112 + condition = condition.and("sex", sex, MongoOper.IS);
  113 + }
  114 + if (StringUtils.isNotEmpty( mName)) {
  115 + condition = condition.and("mName", mName, MongoOper.IS);
  116 + }
  117 + if (StringUtils.isNotEmpty( mCardNo)) {
  118 + condition = condition.and("mCardNo", mCardNo, MongoOper.IS);
  119 + }
  120 + if (StringUtils.isNotEmpty( mPhone)) {
  121 + condition = condition.and("mPhone", mPhone, MongoOper.IS);
  122 + }
  123 + if (null!=monthAge) {
  124 + condition = condition.and("monthAge", monthAge, MongoOper.IS);
  125 + }
  126 +
  127 + Criteria c = null;
  128 +
  129 + if (null != createdStart && createdEnd != null) {
  130 + if (null != c) {
  131 + c = c.and("created").gte(createdStart).lte(createdEnd);
  132 + } else {
  133 + c = Criteria.where("created").gte(createdStart).lte(createdEnd);
  134 + }
  135 + }
  136 + if (null != babyBuildDateStart && babyBuildDateEnd != null) {
  137 + if (null != c) {
  138 + c = c.and("babyBuildDate").gte(babyBuildDateStart).lte(babyBuildDateEnd);
  139 + } else {
  140 + c = Criteria.where("babyBuildDate").gte(babyBuildDateStart).lte(babyBuildDateEnd);
  141 + }
  142 + }
  143 + if (null != monthAgeStart && monthAgeEnd != null) {
  144 + if (null != c) {
  145 + c = c.and("monthAge").gte(monthAgeStart).lte(monthAgeEnd);
  146 + } else {
  147 + c = Criteria.where("monthAge").gte(monthAgeStart).lte(monthAgeEnd);
  148 + }
  149 + }
  150 + if (null != birthStart && birthEnd != null) {
  151 + if (null != c) {
  152 + c = c.and("birth").gte(birthStart).lte(birthEnd);
  153 + } else {
  154 + c = Criteria.where("birth").gte(birthStart).lte(birthEnd);
  155 + }
  156 + }
  157 +
  158 +
  159 + if (null != c) {
  160 + return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery();
  161 + }
  162 + return condition.toMongoQuery();
  163 + }
  164 +
  165 + public String getId() {
  166 + return id;
  167 + }
  168 +
  169 + public void setId(String id) {
  170 + this.id = id;
  171 + }
  172 +
  173 + public Date getModified() {
  174 + return modified;
  175 + }
  176 +
  177 + public void setModified(Date modified) {
  178 + this.modified = modified;
  179 + }
  180 +
  181 + public Integer getYn() {
  182 + return yn;
  183 + }
  184 +
  185 + public void setYn(Integer yn) {
  186 + this.yn = yn;
  187 + }
  188 +
  189 + public String getBabyId() {
  190 + return babyId;
  191 + }
  192 +
  193 + public void setBabyId(String babyId) {
  194 + this.babyId = babyId;
  195 + }
  196 +
  197 + public Date getBabyBuildDateStart() {
  198 + return babyBuildDateStart;
  199 + }
  200 +
  201 + public void setBabyBuildDateStart(Date babyBuildDateStart) {
  202 + this.babyBuildDateStart = babyBuildDateStart;
  203 + }
  204 +
  205 + public Date getBabyBuildDateEnd() {
  206 + return babyBuildDateEnd;
  207 + }
  208 +
  209 + public void setBabyBuildDateEnd(Date babyBuildDateEnd) {
  210 + this.babyBuildDateEnd = babyBuildDateEnd;
  211 + }
  212 +
  213 +
  214 + public Integer getIsCheck() {
  215 + return isCheck;
  216 + }
  217 +
  218 + public void setIsCheck(Integer isCheck) {
  219 + this.isCheck = isCheck;
  220 + }
  221 +
  222 + public String getName() {
  223 + return name;
  224 + }
  225 +
  226 + public void setName(String name) {
  227 + this.name = name;
  228 + }
  229 +
  230 + public Integer getSex() {
  231 + return sex;
  232 + }
  233 +
  234 + public void setSex(Integer sex) {
  235 + this.sex = sex;
  236 + }
  237 +
  238 + public String getmName() {
  239 + return mName;
  240 + }
  241 +
  242 + public void setmName(String mName) {
  243 + this.mName = mName;
  244 + }
  245 +
  246 + public String getmCardNo() {
  247 + return mCardNo;
  248 + }
  249 +
  250 + public void setmCardNo(String mCardNo) {
  251 + this.mCardNo = mCardNo;
  252 + }
  253 +
  254 + public String getmPhone() {
  255 + return mPhone;
  256 + }
  257 +
  258 + public void setmPhone(String mPhone) {
  259 + this.mPhone = mPhone;
  260 + }
  261 +
  262 + public String getHospitalId() {
  263 + return hospitalId;
  264 + }
  265 +
  266 + public void setHospitalId(String hospitalId) {
  267 + this.hospitalId = hospitalId;
  268 + }
  269 +
  270 + public Date getCreatedStart() {
  271 + return createdStart;
  272 + }
  273 +
  274 + public void setCreatedStart(Date createdStart) {
  275 + this.createdStart = createdStart;
  276 + }
  277 +
  278 + public Date getCreatedEnd() {
  279 + return createdEnd;
  280 + }
  281 +
  282 + public void setCreatedEnd(Date createdEnd) {
  283 + this.createdEnd = createdEnd;
  284 + }
  285 +
  286 + public Integer getMonthAgeStart() {
  287 + return monthAgeStart;
  288 + }
  289 +
  290 + public void setMonthAgeStart(Integer monthAgeStart) {
  291 + this.monthAgeStart = monthAgeStart;
  292 + }
  293 +
  294 + public Integer getMonthAgeEnd() {
  295 + return monthAgeEnd;
  296 + }
  297 +
  298 + public void setMonthAgeEnd(Integer monthAgeEnd) {
  299 + this.monthAgeEnd = monthAgeEnd;
  300 + }
  301 +
  302 + public Date getBirthStart() {
  303 + return birthStart;
  304 + }
  305 +
  306 + public void setBirthStart(Date birthStart) {
  307 + this.birthStart = birthStart;
  308 + }
  309 +
  310 + public Date getBirthEnd() {
  311 + return birthEnd;
  312 + }
  313 +
  314 + public void setBirthEnd(Date birthEnd) {
  315 + this.birthEnd = birthEnd;
  316 + }
  317 +
  318 + public Integer getMonthAge() {
  319 + return monthAge;
  320 + }
  321 +
  322 + public void setMonthAge(Integer monthAge) {
  323 + this.monthAge = monthAge;
  324 + }
  325 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBuildClassifyController.java View file @ e395b9c
  1 +package com.lyms.platform.operate.web.controller;
  2 +
  3 +import com.lyms.platform.common.annotation.TokenRequired;
  4 +import com.lyms.platform.common.base.BaseController;
  5 +import com.lyms.platform.common.base.LoginContext;
  6 +import com.lyms.platform.common.result.BaseResponse;
  7 +import com.lyms.platform.operate.web.facade.BabyBuildClassifyFacade;
  8 +import com.lyms.platform.operate.web.facade.MedicineArticleFacade;
  9 +import com.lyms.platform.pojo.MedicineArticleModel;
  10 +import com.lyms.platform.query.BabyBuildClassifyQuery;
  11 +import com.lyms.platform.query.MedicineArticleQuery;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.stereotype.Controller;
  14 +import org.springframework.web.bind.annotation.*;
  15 +
  16 +import javax.servlet.http.HttpServletRequest;
  17 +
  18 +
  19 +/**
  20 + * 儿童建档数据按儿童检查套餐分类数据
  21 + * Created by Administrator on 2022/9/6.
  22 + *
  23 + */
  24 +
  25 +@Controller
  26 +@RequestMapping("/BabyBuildClassify")
  27 +public class BabyBuildClassifyController extends BaseController {
  28 +
  29 + @Autowired
  30 + private BabyBuildClassifyFacade babyBuildClassifyFacade;
  31 +
  32 +
  33 + /**
  34 + * 文章列表列表
  35 + * @param modelQuery
  36 + * @return
  37 + */
  38 + @ResponseBody
  39 + @TokenRequired
  40 + @RequestMapping(value = "/queryListPage",method = RequestMethod.GET)
  41 + public BaseResponse queryListPage(BabyBuildClassifyQuery modelQuery) {
  42 + return babyBuildClassifyFacade.queryListPage(modelQuery);
  43 + }
  44 +
  45 +
  46 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBuildClassifyFacade.java View file @ e395b9c
  1 +package com.lyms.platform.operate.web.facade;
  2 +
  3 +import com.lyms.platform.biz.service.BabyBookbuildingService;
  4 +import com.lyms.platform.biz.service.BabyBuildClassifyService;
  5 +import com.lyms.platform.biz.service.BabyCheckService;
  6 +import com.lyms.platform.biz.service.MedicineArticleService;
  7 +import com.lyms.platform.common.constants.ErrorCodeConstants;
  8 +import com.lyms.platform.common.enums.MonthAgeEnum;
  9 +import com.lyms.platform.common.enums.OptActionEnums;
  10 +import com.lyms.platform.common.enums.SexEnum;
  11 +import com.lyms.platform.common.enums.YnEnums;
  12 +import com.lyms.platform.common.result.BaseObjectResponse;
  13 +import com.lyms.platform.common.result.BaseResponse;
  14 +import com.lyms.platform.common.utils.DateUtil;
  15 +import com.lyms.platform.common.utils.ReflectionUtils;
  16 +import com.lyms.platform.common.utils.StringUtils;
  17 +import com.lyms.platform.permission.dao.master.CouponMapper;
  18 +import com.lyms.platform.pojo.BabyBuildClassifyModel;
  19 +import com.lyms.platform.pojo.BabyCheckModel;
  20 +import com.lyms.platform.pojo.BabyModel;
  21 +import com.lyms.platform.pojo.MedicineArticleModel;
  22 +import com.lyms.platform.query.BabyBuildClassifyQuery;
  23 +import com.lyms.platform.query.BabyCheckModelQuery;
  24 +import com.lyms.platform.query.BabyModelQuery;
  25 +import com.lyms.platform.query.MedicineArticleQuery;
  26 +import org.apache.commons.collections.CollectionUtils;
  27 +import org.springframework.beans.factory.annotation.Autowired;
  28 +import org.springframework.data.domain.Sort;
  29 +import org.springframework.data.mongodb.core.MongoTemplate;
  30 +import org.springframework.stereotype.Component;
  31 +
  32 +import java.util.ArrayList;
  33 +import java.util.List;
  34 +import java.util.Map;
  35 +
  36 +/**
  37 + *
  38 + * Created by shy on 2022/9/6.
  39 + * 儿童建档数据按儿童检查套餐分类数据
  40 + *
  41 + */
  42 +@Component
  43 +public class BabyBuildClassifyFacade {
  44 + @Autowired
  45 + private AutoMatchFacade autoMatchFacade;
  46 + @Autowired
  47 + private CouponMapper couponMapper;
  48 + @Autowired
  49 + private BabyBuildClassifyService babyBuildClassifyService;
  50 +
  51 +
  52 + public BaseResponse queryListPage(BabyBuildClassifyQuery request) {
  53 + request.setYn(YnEnums.YES.getId());
  54 + request.setNeed("true");
  55 + if (request.getCreatedEnd() != null) {
  56 + request.setCreatedEnd(DateUtil.getDayLastSecond(request.getCreatedEnd()));
  57 + }
  58 + List<BabyBuildClassifyModel> resultList=babyBuildClassifyService.queryList(request, Sort.Direction.DESC,new String[]{"created"});
  59 + List<Map> result=new ArrayList<>();
  60 + for (BabyBuildClassifyModel model : resultList) {
  61 + Map<String,Object> map= ReflectionUtils.beanToMap(model);//对象转map
  62 + map.put("hospitalName",couponMapper.getHospitalName(model.getHospitalId()));
  63 + map.put("age",DateUtil.getAge(model.getBirth()));
  64 + map.put("sex", SexEnum.getTextById(model.getSex()));
  65 + map.put("babyBuildDate", DateUtil.getyyyy_MM_dd(model.getBabyBuildDate()));
  66 + map.put("birth", DateUtil.getyyyy_MM_dd(model.getBirth()));
  67 + map.put("isCheck", null!=model.getIsCheck()?(model.getIsCheck()==0?"未做检查":"已做检查"):"");
  68 + map.put("monthAge", MonthAgeEnum.getTextById(model.getMonthAge()));
  69 + result.add(map);
  70 + }
  71 +
  72 + BaseObjectResponse br = new BaseObjectResponse();
  73 + br.setErrorcode(ErrorCodeConstants.SUCCESS);
  74 + br.setData(result);
  75 + br.setPageInfo(request.getPageInfo());
  76 + br.setErrormsg("成功");
  77 + return br;
  78 + }
  79 +
  80 +
  81 +}
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyCheckFacade.java View file @ e395b9c
... ... @@ -145,6 +145,8 @@
145 145 private MedicineArticleService medicineArticleService;
146 146 @Autowired
147 147 private BabyFistRistRecordService babyFistRistRecordService;
  148 + @Autowired
  149 + private BabyBuildClassifyService babyBuildClassifyService;
148 150  
149 151 @Autowired
150 152 @Qualifier("cfCheckItemService")
... ... @@ -1129,6 +1131,15 @@
1129 1131 }
1130 1132 }
1131 1133 }
  1134 + //修改BabyBuildClassifyModel的isCheck检查状态,根据buildId和tcType修改
  1135 + if(StringUtils.isNotEmpty(model.getBuildId()) && null!=model.getTcType()){
  1136 + BabyBuildClassifyModel classifyModel=new BabyBuildClassifyModel();
  1137 + classifyModel.setIsCheck(1);
  1138 + BabyBuildClassifyQuery query=new BabyBuildClassifyQuery();
  1139 + query.setBabyId(model.getBuildId());
  1140 + query.setMonthAge(model.getTcType());
  1141 + babyBuildClassifyService.update(query,classifyModel);
  1142 + }
1132 1143 br.setErrorcode(ErrorCodeConstants.SUCCESS);
1133 1144 br.setErrormsg("成功");
1134 1145 br.setData(model.getId());
... ... @@ -1293,6 +1304,15 @@
1293 1304 }
1294 1305 //首次确诊高危改为删除状态
1295 1306 babyFistRistRecordService.deleteByPId(checkModels.get(0).getId());
  1307 + //删除BabyBuildClassifyModel的yn状态,根据buildId和tcType修改
  1308 + if(StringUtils.isNotEmpty(checkModels.get(0).getBuildId()) && null!=checkModels.get(0).getTcType()){
  1309 + BabyBuildClassifyModel classifyModel=new BabyBuildClassifyModel();
  1310 + classifyModel.setYn(0);
  1311 + BabyBuildClassifyQuery classifyQuery=new BabyBuildClassifyQuery();
  1312 + classifyQuery.setBabyId(checkModels.get(0).getBuildId());
  1313 + classifyQuery.setMonthAge(checkModels.get(0).getTcType());
  1314 + babyBuildClassifyService.update(classifyQuery,classifyModel);
  1315 + }
1296 1316 }
1297 1317  
1298 1318 }
platform-operate-api/src/main/resources/spring/applicationContext-quartz.xml View file @ e395b9c
... ... @@ -185,6 +185,21 @@
185 185 <!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 -->
186 186 <property name="concurrent" value="false"></property>
187 187 </bean>
  188 + <!--儿童建档数据按儿童检查套餐分类数据存储(1、3、6、8、12、18、24、30、36、48、60、72) -->
  189 + <bean id="babyBuildClassifyTimerWork" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
  190 + <!-- 要调用的bean -->
  191 + <property name="targetObject" ref="babyBookbuildingService"></property>
  192 + <!-- 要调用的Method -->
  193 + <property name="targetMethod" value="babyBuildClassify"></property>
  194 + <!-- 是否并发,false表示 如果发生错误也不影响下一次的调用 -->
  195 + <property name="concurrent" value="false"></property>
  196 + </bean>
  197 + <!-- 配置一个触发器 每天0点执行 -->
  198 + <bean id="babyBuildClassifyTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
  199 + <property name="jobDetail" ref="babyBuildClassifyTimerWork"></property>
  200 + <property name="cronExpression" value="0 0 0 * * ?"></property>
  201 +<!-- <property name="cronExpression" value="*/5 * * * * ?"></property>&lt;!&ndash;测试用每5秒执行&ndash;&gt;-->
  202 + </bean>
188 203  
189 204 <!-- 配置一个触发器 -->
190 205 <bean id="addSieveJobTrigger" class="org.springframework.scheduling.quartz.CronTriggerBean">
... ... @@ -689,6 +704,7 @@
689 704 <!--<ref bean="cdBsDataJobTrigger"/>-->
690 705 <!--<ref bean="zcChanJianTrigger"/>-->
691 706 <ref bean="patientSerivceEndJobTrigger"/>
  707 + <ref bean="babyBuildClassifyTrigger"/>
692 708 </list>
693 709 </property>
694 710 </bean>