Commit b1fa9a67c8133c86f13d049746e48d3a66292d1b
1 parent
8c641f6406
Exists in
dev
#fix:新增儿保小程序通知公告管理模块
Showing 14 changed files with 1028 additions and 73 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/BabyMsgDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyMsgDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyMsgService.java
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BabyMsgModel.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BabyMsgModelRecord.java
- platform-dal/src/main/java/com/lyms/platform/query/MsgQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyMsgController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientServiceController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyMsgFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/YxzhVO.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/BabyMsgDao.java
View file @
b1fa9a6
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.pojo.BabyMsgModel; | |
| 5 | +import com.lyms.platform.pojo.MsgModel; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +public interface BabyMsgDao { | |
| 10 | + public int queryMsgListCount(MongoQuery mongoQuery); | |
| 11 | + | |
| 12 | + public List<BabyMsgModel> queryMsgList(MongoQuery query); | |
| 13 | + | |
| 14 | + public void addMsg(BabyMsgModel model); | |
| 15 | + | |
| 16 | + public void updateMsg(MongoQuery mongoQuery, BabyMsgModel model); | |
| 17 | + | |
| 18 | + void updateReadCount(MongoQuery id, BabyMsgModel model); | |
| 19 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyMsgDaoImpl.java
View file @
b1fa9a6
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.BabyMsgDao; | |
| 4 | +import com.lyms.platform.biz.dal.MsgDao; | |
| 5 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 7 | +import com.lyms.platform.pojo.BabyMsgModel; | |
| 8 | +import com.lyms.platform.pojo.MsgModel; | |
| 9 | +import org.springframework.stereotype.Repository; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +@Repository("babyMsgDao") | |
| 14 | +public class BabyMsgDaoImpl extends BaseMongoDAOImpl<BabyMsgModel> implements BabyMsgDao { | |
| 15 | + | |
| 16 | + @Override | |
| 17 | + public int queryMsgListCount(MongoQuery mongoQuery) { | |
| 18 | + return (int)count(mongoQuery.convertToMongoQuery()); | |
| 19 | + } | |
| 20 | + | |
| 21 | + @Override | |
| 22 | + public List<BabyMsgModel> queryMsgList(MongoQuery query) { | |
| 23 | + return find(query.convertToMongoQuery()); | |
| 24 | + } | |
| 25 | + | |
| 26 | + @Override | |
| 27 | + public void addMsg(BabyMsgModel model) { | |
| 28 | + save(model); | |
| 29 | + } | |
| 30 | + | |
| 31 | + @Override | |
| 32 | + public void updateMsg(MongoQuery mongoQuery, BabyMsgModel model) { | |
| 33 | + update(mongoQuery.convertToMongoQuery(),model); | |
| 34 | + } | |
| 35 | + | |
| 36 | + @Override | |
| 37 | + public void updateReadCount(MongoQuery id, BabyMsgModel model) { | |
| 38 | + update(id.convertToMongoQuery(),model); | |
| 39 | + } | |
| 40 | + | |
| 41 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyMsgService.java
View file @
b1fa9a6
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.lyms.platform.biz.dal.BabyMsgDao; | |
| 5 | +import com.lyms.platform.biz.dal.ICourseEvalDao; | |
| 6 | +import com.lyms.platform.biz.dal.MsgDao; | |
| 7 | +import com.lyms.platform.biz.dal.ReviewDao; | |
| 8 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 9 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 10 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 11 | +import com.lyms.platform.common.enums.YnEnums; | |
| 12 | +import com.lyms.platform.common.utils.MongoConvertHelper; | |
| 13 | +import com.lyms.platform.common.utils.ReflectionUtils; | |
| 14 | +import com.lyms.platform.pojo.*; | |
| 15 | +import com.lyms.platform.query.CourseEvalQuery; | |
| 16 | +import com.lyms.platform.query.MsgQuery; | |
| 17 | +import com.lyms.platform.query.ReviewQuery; | |
| 18 | +import org.apache.commons.collections.CollectionUtils; | |
| 19 | +import org.apache.commons.lang.StringUtils; | |
| 20 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 21 | +import org.springframework.data.domain.Sort; | |
| 22 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 23 | +import org.springframework.stereotype.Service; | |
| 24 | + | |
| 25 | +import java.util.List; | |
| 26 | + | |
| 27 | + | |
| 28 | +@Service | |
| 29 | +public class BabyMsgService { | |
| 30 | + | |
| 31 | + | |
| 32 | + @Autowired | |
| 33 | + private BabyMsgDao msgDao; | |
| 34 | + | |
| 35 | + @Autowired | |
| 36 | + private MongoTemplate mongoTemplate; | |
| 37 | + | |
| 38 | + public List<BabyMsgModel> queryMsgList(MsgQuery msgQuery) { | |
| 39 | + MongoQuery query = msgQuery.convertToQuery(); | |
| 40 | + if (StringUtils.isNotEmpty(msgQuery.getNeed())) { | |
| 41 | + msgQuery.mysqlBuild(msgDao.queryMsgListCount(msgQuery.convertToQuery())); | |
| 42 | + query.start(msgQuery.getOffset()).end(msgQuery.getLimit()); | |
| 43 | + } | |
| 44 | + return msgDao.queryMsgList(query.addOrder(Sort.Direction.DESC, "created")); | |
| 45 | + } | |
| 46 | + | |
| 47 | + public List<BabyMsgModelRecord> queryMsgRecordList(MsgQuery msgQuery) { | |
| 48 | + MongoQuery query = msgQuery.convertToQuery(); | |
| 49 | + if (StringUtils.isNotEmpty(msgQuery.getNeed())) { | |
| 50 | + msgQuery.mysqlBuild((int)mongoTemplate.count(query.convertToMongoQuery(),BabyMsgModelRecord.class)); | |
| 51 | + query.start(msgQuery.getOffset()).end(msgQuery.getLimit()); | |
| 52 | + } | |
| 53 | + query.addOrder(Sort.Direction.DESC, "created"); | |
| 54 | + return mongoTemplate.find(query.convertToMongoQuery(),BabyMsgModelRecord.class); | |
| 55 | + } | |
| 56 | + | |
| 57 | + | |
| 58 | + public void addMsg(BabyMsgModel model) { | |
| 59 | + msgDao.addMsg(model); | |
| 60 | + } | |
| 61 | + | |
| 62 | + public void updateRecordMsg(BabyMsgModelRecord model) { | |
| 63 | + mongoTemplate.upsert(new MongoQuery(new MongoCondition("id", model.getId(), MongoOper.IS)).convertToMongoQuery(),MongoConvertHelper | |
| 64 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(model)),BabyMsgModelRecord.class); | |
| 65 | + } | |
| 66 | + | |
| 67 | + | |
| 68 | + public void updateMsg(BabyMsgModel model) { | |
| 69 | + msgDao.updateMsg(new MongoQuery(new MongoCondition("id", model.getId(), MongoOper.IS)), model); | |
| 70 | + } | |
| 71 | + | |
| 72 | + | |
| 73 | + public void updateMsgReadCount(BabyMsgModel model) { | |
| 74 | + msgDao.updateReadCount(new MongoQuery(new MongoCondition("id", model.getId(), MongoOper.IS)), model); | |
| 75 | + } | |
| 76 | + | |
| 77 | +} |
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
b1fa9a6
| ... | ... | @@ -1987,6 +1987,46 @@ |
| 1987 | 1987 | DateTime dateTime = new DateTime(date); |
| 1988 | 1988 | return dateTime.plusDays(days).toDate(); |
| 1989 | 1989 | } |
| 1990 | + | |
| 1991 | + public static String getDayOfWeek(){ | |
| 1992 | + // 获取当前日期的 Calendar 实例 | |
| 1993 | + Calendar calendar = Calendar.getInstance(); | |
| 1994 | + | |
| 1995 | + // 获取星期几,返回值为1(星期日)到7(星期六) | |
| 1996 | + int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); | |
| 1997 | + | |
| 1998 | + // 根据返回值输出星期几 | |
| 1999 | + String dayName; | |
| 2000 | + switch (dayOfWeek) { | |
| 2001 | + case Calendar.SUNDAY: | |
| 2002 | + dayName = "星期日"; | |
| 2003 | + break; | |
| 2004 | + case Calendar.MONDAY: | |
| 2005 | + dayName = "星期一"; | |
| 2006 | + break; | |
| 2007 | + case Calendar.TUESDAY: | |
| 2008 | + dayName = "星期二"; | |
| 2009 | + break; | |
| 2010 | + case Calendar.WEDNESDAY: | |
| 2011 | + dayName = "星期三"; | |
| 2012 | + break; | |
| 2013 | + case Calendar.THURSDAY: | |
| 2014 | + dayName = "星期四"; | |
| 2015 | + break; | |
| 2016 | + case Calendar.FRIDAY: | |
| 2017 | + dayName = "星期五"; | |
| 2018 | + break; | |
| 2019 | + case Calendar.SATURDAY: | |
| 2020 | + dayName = "星期六"; | |
| 2021 | + break; | |
| 2022 | + default: | |
| 2023 | + dayName = "未知"; | |
| 2024 | + break; | |
| 2025 | + } | |
| 2026 | + | |
| 2027 | + return dayName; | |
| 2028 | + } | |
| 2029 | + | |
| 1990 | 2030 | public static void main(String[] args) { |
| 1991 | 2031 | /* String cardNo="140224199503115242"; |
| 1992 | 2032 | System.out.println(DateUtil.getBirthFromIdCard(cardNo)); |
platform-dal/src/main/java/com/lyms/platform/pojo/BabyMsgModel.java
View file @
b1fa9a6
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.beans.SerialIdEnum; | |
| 4 | +import com.lyms.platform.common.result.BaseModel; | |
| 5 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 6 | + | |
| 7 | +import java.util.Date; | |
| 8 | + | |
| 9 | +@Document(collection="lyms_baby_msg") | |
| 10 | +public class BabyMsgModel extends BaseModel { | |
| 11 | + private static final long serialVersionUID = SerialIdEnum.ModularFunctionConfigModel.getCid(); | |
| 12 | + | |
| 13 | + //消息id | |
| 14 | + private String id; | |
| 15 | + //消息内容 | |
| 16 | + private String content; | |
| 17 | + //发布人id | |
| 18 | + private Integer publishId; | |
| 19 | + //发布人名称 | |
| 20 | + private String publishName; | |
| 21 | + //1.有效 2.无效 | |
| 22 | + private Integer yn; | |
| 23 | + //最后修改时间 | |
| 24 | + | |
| 25 | + private Date modified; | |
| 26 | + //创建时间 | |
| 27 | + private Date created; | |
| 28 | + //状态 0.未读 1.已读 | |
| 29 | + private Integer state; | |
| 30 | + //标题 | |
| 31 | + private String title; | |
| 32 | + | |
| 33 | + private String hospitalId; | |
| 34 | + | |
| 35 | + //阅读量 | |
| 36 | + private Integer readNum; | |
| 37 | + | |
| 38 | + private String img; | |
| 39 | + //发送人群 1已开通服务 2是未开通服务 3是全部 | |
| 40 | + private Integer crowd; | |
| 41 | + //发送人数 | |
| 42 | + private Integer crowdNum; | |
| 43 | + //状态 0是未发布 1发布 | |
| 44 | + private Integer status; | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + public Integer getStatus() { | |
| 49 | + return status; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public void setStatus(Integer status) { | |
| 53 | + this.status = status; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public Integer getCrowd() { | |
| 57 | + return crowd; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public void setCrowd(Integer crowd) { | |
| 61 | + this.crowd = crowd; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public Integer getCrowdNum() { | |
| 65 | + return crowdNum; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public void setCrowdNum(Integer crowdNum) { | |
| 69 | + this.crowdNum = crowdNum; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public String getImg() { | |
| 73 | + return img; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public void setImg(String img) { | |
| 77 | + this.img = img; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public Integer getReadNum() { | |
| 81 | + return readNum; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public void setReadNum(Integer readNum) { | |
| 85 | + this.readNum = readNum; | |
| 86 | + } | |
| 87 | + | |
| 88 | + | |
| 89 | + public String getHospitalId() { | |
| 90 | + return hospitalId; | |
| 91 | + } | |
| 92 | + | |
| 93 | + public void setHospitalId(String hospitalId) { | |
| 94 | + this.hospitalId = hospitalId; | |
| 95 | + } | |
| 96 | + | |
| 97 | + public String getId() { | |
| 98 | + return id; | |
| 99 | + } | |
| 100 | + | |
| 101 | + public void setId(String id) { | |
| 102 | + this.id = id; | |
| 103 | + } | |
| 104 | + | |
| 105 | + public String getContent() { | |
| 106 | + return content; | |
| 107 | + } | |
| 108 | + | |
| 109 | + public void setContent(String content) { | |
| 110 | + this.content = content; | |
| 111 | + } | |
| 112 | + | |
| 113 | + public Integer getPublishId() { | |
| 114 | + return publishId; | |
| 115 | + } | |
| 116 | + | |
| 117 | + public void setPublishId(Integer publishId) { | |
| 118 | + this.publishId = publishId; | |
| 119 | + } | |
| 120 | + | |
| 121 | + public String getPublishName() { | |
| 122 | + return publishName; | |
| 123 | + } | |
| 124 | + | |
| 125 | + public void setPublishName(String publishName) { | |
| 126 | + this.publishName = publishName; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public Integer getYn() { | |
| 130 | + return yn; | |
| 131 | + } | |
| 132 | + | |
| 133 | + public void setYn(Integer yn) { | |
| 134 | + this.yn = yn; | |
| 135 | + } | |
| 136 | + | |
| 137 | + public Date getModified() { | |
| 138 | + return modified; | |
| 139 | + } | |
| 140 | + | |
| 141 | + public void setModified(Date modified) { | |
| 142 | + this.modified = modified; | |
| 143 | + } | |
| 144 | + | |
| 145 | + public Date getCreated() { | |
| 146 | + return created; | |
| 147 | + } | |
| 148 | + | |
| 149 | + public void setCreated(Date created) { | |
| 150 | + this.created = created; | |
| 151 | + } | |
| 152 | + | |
| 153 | + public Integer getState() { | |
| 154 | + return state; | |
| 155 | + } | |
| 156 | + | |
| 157 | + public void setState(Integer state) { | |
| 158 | + this.state = state; | |
| 159 | + } | |
| 160 | + | |
| 161 | + public String getTitle() { | |
| 162 | + return title; | |
| 163 | + } | |
| 164 | + | |
| 165 | + public void setTitle(String title) { | |
| 166 | + this.title = title; | |
| 167 | + } | |
| 168 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/BabyMsgModelRecord.java
View file @
b1fa9a6
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.beans.SerialIdEnum; | |
| 4 | +import com.lyms.platform.common.result.BaseModel; | |
| 5 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 6 | + | |
| 7 | +import java.util.Date; | |
| 8 | + | |
| 9 | +@Document(collection="lyms_baby_msg_record") | |
| 10 | +public class BabyMsgModelRecord extends BaseModel { | |
| 11 | + private static final long serialVersionUID = SerialIdEnum.ModularFunctionConfigModel.getCid(); | |
| 12 | + //消息id | |
| 13 | + private String id; | |
| 14 | + //消息内容 | |
| 15 | + private String content; | |
| 16 | + //发布人id | |
| 17 | + private Integer publishId; | |
| 18 | + //发布人名称 | |
| 19 | + private String publishName; | |
| 20 | + //1.有效 2.无效 | |
| 21 | + private Integer yn; | |
| 22 | + //最后修改时间 | |
| 23 | + private Date modified; | |
| 24 | + //创建时间 | |
| 25 | + private Date created; | |
| 26 | + //状态 0.未读 1.已读 | |
| 27 | + private Integer state; | |
| 28 | + //标题 | |
| 29 | + private String title; | |
| 30 | + //阅读量 | |
| 31 | + private Integer readNum; | |
| 32 | + private String hospitalId; | |
| 33 | + | |
| 34 | + private String img; | |
| 35 | + private String msgId; | |
| 36 | + private String babyId; | |
| 37 | + | |
| 38 | + public String getMsgId() { | |
| 39 | + return msgId; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setMsgId(String msgId) { | |
| 43 | + this.msgId = msgId; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getBabyId() { | |
| 47 | + return babyId; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setBabyId(String babyId) { | |
| 51 | + this.babyId = babyId; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public String getImg() { | |
| 55 | + return img; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setImg(String img) { | |
| 59 | + this.img = img; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public String getHospitalId() { | |
| 63 | + return hospitalId; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setHospitalId(String hospitalId) { | |
| 67 | + this.hospitalId = hospitalId; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public String getId() { | |
| 71 | + return id; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setId(String id) { | |
| 75 | + this.id = id; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public String getContent() { | |
| 79 | + return content; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setContent(String content) { | |
| 83 | + this.content = content; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public Integer getPublishId() { | |
| 87 | + return publishId; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setPublishId(Integer publishId) { | |
| 91 | + this.publishId = publishId; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public String getPublishName() { | |
| 95 | + return publishName; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setPublishName(String publishName) { | |
| 99 | + this.publishName = publishName; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public Integer getYn() { | |
| 103 | + return yn; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void setYn(Integer yn) { | |
| 107 | + this.yn = yn; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public Date getModified() { | |
| 111 | + return modified; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setModified(Date modified) { | |
| 115 | + this.modified = modified; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public Date getCreated() { | |
| 119 | + return created; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public void setCreated(Date created) { | |
| 123 | + this.created = created; | |
| 124 | + } | |
| 125 | + | |
| 126 | + public Integer getState() { | |
| 127 | + return state; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public void setState(Integer state) { | |
| 131 | + this.state = state; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public Integer getReadNum() { | |
| 135 | + return readNum; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public void setReadNum(Integer readNum) { | |
| 139 | + this.readNum = readNum; | |
| 140 | + } | |
| 141 | + | |
| 142 | + public String getTitle() { | |
| 143 | + return title; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public void setTitle(String title) { | |
| 147 | + this.title = title; | |
| 148 | + } | |
| 149 | +} |
platform-dal/src/main/java/com/lyms/platform/query/MsgQuery.java
View file @
b1fa9a6
| ... | ... | @@ -5,6 +5,7 @@ |
| 5 | 5 | import com.lyms.platform.common.dao.operator.MongoCondition; |
| 6 | 6 | import com.lyms.platform.common.dao.operator.MongoOper; |
| 7 | 7 | import com.lyms.platform.common.dao.operator.MongoQuery; |
| 8 | +import com.lyms.platform.common.utils.StringUtils; | |
| 8 | 9 | |
| 9 | 10 | import java.util.Date; |
| 10 | 11 | |
| ... | ... | @@ -32,6 +33,9 @@ |
| 32 | 33 | private Integer status; |
| 33 | 34 | // |
| 34 | 35 | private String parentId; |
| 36 | + | |
| 37 | + private String babyId; | |
| 38 | + | |
| 35 | 39 | //标题0.医生停诊通知 1.检查停诊通知 2.医院放假通知 |
| 36 | 40 | private Integer title; |
| 37 | 41 | |
| ... | ... | @@ -45,6 +49,14 @@ |
| 45 | 49 | |
| 46 | 50 | private String img; |
| 47 | 51 | |
| 52 | + public String getBabyId() { | |
| 53 | + return babyId; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setBabyId(String babyId) { | |
| 57 | + this.babyId = babyId; | |
| 58 | + } | |
| 59 | + | |
| 48 | 60 | public Integer getStatus() { |
| 49 | 61 | return status; |
| 50 | 62 | } |
| ... | ... | @@ -206,7 +218,11 @@ |
| 206 | 218 | condition = condition.and("state", state, MongoOper.IS); |
| 207 | 219 | }if(null != parentId){ |
| 208 | 220 | condition = condition.and("patientId", parentId, MongoOper.IS); |
| 209 | - }if(null != title){ | |
| 221 | + } | |
| 222 | + if (StringUtils.isNotEmpty(babyId)){ | |
| 223 | + condition = condition.and("babyId", babyId, MongoOper.IS); | |
| 224 | + } | |
| 225 | + if(null != title){ | |
| 210 | 226 | condition = condition.and("title", title, MongoOper.IS); |
| 211 | 227 | } |
| 212 | 228 | if (null!=status){ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyMsgController.java
View file @
b1fa9a6
| 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.BabyMsgFacade; | |
| 8 | +import com.lyms.platform.pojo.BabyMsgModel; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.stereotype.Controller; | |
| 11 | +import org.springframework.web.bind.annotation.*; | |
| 12 | + | |
| 13 | +import javax.servlet.http.HttpServletRequest; | |
| 14 | + | |
| 15 | +@Controller | |
| 16 | +@RequestMapping("/baby") | |
| 17 | +public class BabyMsgController extends BaseController { | |
| 18 | + @Autowired | |
| 19 | + private BabyMsgFacade babyMsgService; | |
| 20 | + | |
| 21 | + @RequestMapping(method = RequestMethod.GET, value = "/msgList") | |
| 22 | + @ResponseBody | |
| 23 | + @TokenRequired | |
| 24 | + public BaseResponse msgList(@RequestParam Integer page, | |
| 25 | + @RequestParam Integer limit, | |
| 26 | + Integer status, | |
| 27 | + HttpServletRequest request) { | |
| 28 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 29 | + return babyMsgService.msgList(page,limit,status,loginState.getId()); | |
| 30 | + } | |
| 31 | + /* | |
| 32 | + * 添加消息 | |
| 33 | + * */ | |
| 34 | + @RequestMapping(method = RequestMethod.POST, value = "/msgAdd") | |
| 35 | + @ResponseBody | |
| 36 | + @TokenRequired | |
| 37 | + public BaseResponse msgAdd(@RequestBody BabyMsgModel model) { | |
| 38 | + return babyMsgService.msgAdd(model); | |
| 39 | + } | |
| 40 | + /* | |
| 41 | + * 发布消息 | |
| 42 | + * */ | |
| 43 | + @RequestMapping(method = RequestMethod.GET, value = "/msgSend") | |
| 44 | + @ResponseBody | |
| 45 | + @TokenRequired | |
| 46 | + public BaseResponse msgSend(String msgId, HttpServletRequest request) { | |
| 47 | + return babyMsgService.msgSend(msgId,getUserId(request)); | |
| 48 | + } | |
| 49 | + | |
| 50 | + /* | |
| 51 | + * 编辑消息 | |
| 52 | + * */ | |
| 53 | + @RequestMapping(method = RequestMethod.POST, value = "/msgUpdate") | |
| 54 | + @ResponseBody | |
| 55 | + @TokenRequired | |
| 56 | + public BaseResponse msgUpdate(@RequestBody BabyMsgModel model, | |
| 57 | + HttpServletRequest request) { | |
| 58 | + return babyMsgService.msgUpdate(model,getUserId(request)); | |
| 59 | + } | |
| 60 | + | |
| 61 | + /** | |
| 62 | + * 删除消息 | |
| 63 | + * @param id | |
| 64 | + * @return | |
| 65 | + */ | |
| 66 | + @RequestMapping(method = RequestMethod.DELETE, value = "/deleteMsgById/{id}") | |
| 67 | + @ResponseBody | |
| 68 | + @TokenRequired | |
| 69 | + public BaseResponse deleteMsgById(@PathVariable(value = "id") String id) { | |
| 70 | + return babyMsgService.deleteMsgById(id); | |
| 71 | + } | |
| 72 | + | |
| 73 | + | |
| 74 | + /* | |
| 75 | + * 消息通知列表 | |
| 76 | + * */ | |
| 77 | + @RequestMapping(method = RequestMethod.GET, value = "/getMsgList") | |
| 78 | + @ResponseBody | |
| 79 | + public BaseResponse msgList( | |
| 80 | + String babyId,Integer limit,Integer page) { | |
| 81 | + return babyMsgService.getMsgList(babyId,limit,page); | |
| 82 | + } | |
| 83 | + | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 消息详情 | |
| 87 | + * @param msgId | |
| 88 | + * @return | |
| 89 | + */ | |
| 90 | + @RequestMapping(method = RequestMethod.GET, value = "/getMsgById") | |
| 91 | + @ResponseBody | |
| 92 | + public BaseResponse getMsgById(String msgId) { | |
| 93 | + return babyMsgService.getMsgById(msgId); | |
| 94 | + } | |
| 95 | + | |
| 96 | + | |
| 97 | + /** | |
| 98 | + * 未读数量 | |
| 99 | + * @param babyId | |
| 100 | + * @return | |
| 101 | + */ | |
| 102 | + @RequestMapping(method = RequestMethod.GET, value = "/getMsgCountById") | |
| 103 | + @ResponseBody | |
| 104 | + public BaseResponse getMsgCountById(@RequestParam(required = false) String babyId) { | |
| 105 | + return babyMsgService.getMsgCountById(babyId); | |
| 106 | + } | |
| 107 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PatientServiceController.java
View file @
b1fa9a6
| ... | ... | @@ -157,6 +157,10 @@ |
| 157 | 157 | if(CollectionUtils.isEmpty(patientsList)){ |
| 158 | 158 | baseResponse.setErrorcode(ErrorCodeConstants.DATA_EXIST); |
| 159 | 159 | baseResponse.setErrormsg("档案信息不存在,请核实"); |
| 160 | + //大同开通服务但未建档的 发送建档短信提醒 | |
| 161 | + if ("50".equals(yxzhVO.getHospitalId())&&StringUtils.isNotEmpty(yxzhVO.getPhone())){ | |
| 162 | + patientServiceFacade.sendServiceMsg(yxzhVO); | |
| 163 | + } | |
| 160 | 164 | return baseResponse; |
| 161 | 165 | } |
| 162 | 166 | Patients patients = patientsList.get(0); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
b1fa9a6
| ... | ... | @@ -26,16 +26,16 @@ |
| 26 | 26 | import com.lyms.platform.operate.web.service.ICommonServer; |
| 27 | 27 | import com.lyms.platform.operate.web.service.ITrackDownService; |
| 28 | 28 | import com.lyms.platform.operate.web.utils.*; |
| 29 | -import com.lyms.platform.permission.dao.master.MasterLisMapper; | |
| 29 | + | |
| 30 | 30 | import com.lyms.platform.permission.model.*; |
| 31 | -import com.lyms.platform.permission.model.LisReportQuery; | |
| 31 | + | |
| 32 | 32 | import com.lyms.platform.permission.service.*; |
| 33 | 33 | import com.lyms.platform.pojo.*; |
| 34 | 34 | import com.lyms.platform.query.*; |
| 35 | 35 | import org.apache.commons.collections.CollectionUtils; |
| 36 | -import org.apache.commons.lang.time.DateUtils; | |
| 36 | + | |
| 37 | 37 | import org.apache.commons.lang3.math.NumberUtils; |
| 38 | -import org.apache.velocity.runtime.directive.Break; | |
| 38 | + | |
| 39 | 39 | import org.springframework.beans.factory.annotation.Autowired; |
| 40 | 40 | import org.springframework.beans.factory.annotation.Qualifier; |
| 41 | 41 | import org.springframework.data.domain.Sort; |
| ... | ... | @@ -45,8 +45,6 @@ |
| 45 | 45 | import org.springframework.data.mongodb.core.query.Update; |
| 46 | 46 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 47 | 47 | import org.springframework.stereotype.Component; |
| 48 | -import org.springframework.web.bind.annotation.ResponseBody; | |
| 49 | -import scala.util.parsing.combinator.testing.Str; | |
| 50 | 48 | |
| 51 | 49 | import javax.servlet.http.HttpServletResponse; |
| 52 | 50 | import java.io.IOException; |
| 53 | 51 | |
| 54 | 52 | |
| 55 | 53 | |
| 56 | 54 | |
| 57 | 55 | |
| 58 | 56 | |
| 59 | 57 | |
| 60 | 58 | |
| 61 | 59 | |
| ... | ... | @@ -6795,75 +6793,77 @@ |
| 6795 | 6793 | return new BaseListResponse().setData(list).setPageInfo(babyModelQuery.getPageInfo()).setErrormsg("成功").setErrorcode(0); |
| 6796 | 6794 | } |
| 6797 | 6795 | |
| 6796 | + | |
| 6798 | 6797 | /** |
| 6799 | - * 每天下午17点推送儿保服务名目通知 | |
| 6798 | + * 每周一、周三下午16点推送儿保服务名目通知 | |
| 6800 | 6799 | * 开通精准医疗服务后给推送 |
| 6801 | 6800 | */ |
| 6802 | 6801 | public void buildingSync() { |
| 6803 | - PatientServiceQuery patientServiceQuery = new PatientServiceQuery(); | |
| 6804 | - patientServiceQuery.setSerStatus(1); | |
| 6805 | - patientServiceQuery.setPerType(2); | |
| 6806 | - patientServiceQuery.setUpdateStartDate(DateUtil.getDayFirstSecond(new Date())); | |
| 6807 | - patientServiceQuery.setUpdateEndDate(DateUtil.getDayLastSecond(new Date())); | |
| 6808 | - final List<PatientService> serviceList = patientServiceService.queryPatientService(patientServiceQuery); | |
| 6809 | - if (CollectionUtils.isNotEmpty(serviceList)) { | |
| 6802 | + String dayName=DateUtil.getDayOfWeek(); | |
| 6803 | + if ("星期一".equals(dayName)||"星期三".equals(dayName)) { | |
| 6804 | + PatientServiceQuery patientServiceQuery = new PatientServiceQuery(); | |
| 6805 | + patientServiceQuery.setSerStatus(1); | |
| 6806 | + patientServiceQuery.setPerType(2); | |
| 6807 | + patientServiceQuery.setUpdateStartDate(DateUtil.getDayFirstSecond(new Date())); | |
| 6808 | + patientServiceQuery.setUpdateEndDate(DateUtil.getDayLastSecond(new Date())); | |
| 6809 | + final List<PatientService> serviceList = patientServiceService.queryPatientService(patientServiceQuery); | |
| 6810 | + if (CollectionUtils.isNotEmpty(serviceList)) { | |
| 6810 | 6811 | |
| 6811 | - logger.info("buildingSync startup"); | |
| 6812 | - commonThreadPool.execute(new Runnable() { | |
| 6813 | - @Override | |
| 6814 | - public void run() { | |
| 6815 | - BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 6816 | - babyModelQuery.setYn(1); | |
| 6817 | - babyModelQuery.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
| 6818 | - babyModelQuery.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
| 6819 | - for (int i = 0, j = serviceList.size(); i < j; i++) { | |
| 6820 | - PatientService patientService = serviceList.get(i); | |
| 6821 | - babyModelQuery.setPid(patientService.getPid()); | |
| 6822 | - List<BabyModel> modelList= babyService.queryBabyWithQuery(babyModelQuery); | |
| 6823 | - if (CollectionUtils.isNotEmpty(modelList)){ | |
| 6824 | - BabyModel babyModel= modelList.get(0); | |
| 6825 | - logger.info("BabyModel is not null,id "+babyModel.getId()); | |
| 6812 | + logger.info("buildingSync startup"); | |
| 6813 | + commonThreadPool.execute(new Runnable() { | |
| 6814 | + @Override | |
| 6815 | + public void run() { | |
| 6816 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 6817 | + babyModelQuery.setYn(1); | |
| 6818 | + babyModelQuery.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
| 6819 | + babyModelQuery.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
| 6820 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 6821 | + for (int i = 0, j = serviceList.size(); i < j; i++) { | |
| 6822 | + PatientService patientService = serviceList.get(i); | |
| 6823 | + babyModelQuery.setPid(patientService.getPid()); | |
| 6824 | + List<BabyModel> modelList= babyService.queryBabyWithQuery(babyModelQuery); | |
| 6825 | + if (CollectionUtils.isNotEmpty(modelList)){ | |
| 6826 | + BabyModel babyModel= modelList.get(0); | |
| 6827 | + logger.info("BabyModel is not null,id "+babyModel.getId()); | |
| 6826 | 6828 | |
| 6827 | - String hospitalId = babyModel.getHospitalId(); | |
| 6828 | - Organization organization = organizationService.getOrganization(Integer.valueOf(hospitalId)); | |
| 6829 | + String hospitalId = babyModel.getHospitalId(); | |
| 6830 | + Organization organization = organizationService.getOrganization(Integer.valueOf(hospitalId)); | |
| 6829 | 6831 | |
| 6830 | - List<MsgRequest> messages = new ArrayList<>(); | |
| 6831 | - MsgRequest mr = new MsgRequest(); | |
| 6832 | - mr.setPhone(babyModel.getMphone()); | |
| 6833 | - mr.setMemberId(null); | |
| 6834 | - mr.setTypeId(ProjectTypeEnums.YNXT.getId()); | |
| 6835 | - mr.setStatus(SmsStatusEnums.WFS.getId()); | |
| 6836 | - mr.setHospitalId(hospitalId); | |
| 6837 | - mr.setTempId(patientService.getId()); | |
| 6838 | - mr.setPatientId(babyModel.getId()); | |
| 6839 | - mr.setSmsStatus(SmsStatusEnums.WFS.getId()); | |
| 6840 | - mr.setServiceType(1); //判断发送类型 | |
| 6841 | - mr.setFirst("【服务名目通知】");// | |
| 6842 | - mr.setObjType(ServiceObjEnums.BABYOBJ.getId()); | |
| 6843 | - mr.setSubTypeId(SmsServiceEnums.YBZD.getId()); | |
| 6844 | - int weeks = DateUtil.daysBetween(babyModel.getBirth(), new Date()) / 7; | |
| 6845 | - String weekAge = String.valueOf(weeks) + "周"; | |
| 6846 | - mr.setKeyword1(weekAge);// | |
| 6847 | - String keyWord2 = "服务名目通知(点此查看详情)"; | |
| 6832 | + MsgRequest mr = new MsgRequest(); | |
| 6833 | + mr.setPhone(babyModel.getMphone()); | |
| 6834 | + mr.setMemberId(null); | |
| 6835 | + mr.setTypeId(ProjectTypeEnums.YNXT.getId()); | |
| 6836 | + mr.setStatus(SmsStatusEnums.WFS.getId()); | |
| 6837 | + mr.setHospitalId(hospitalId); | |
| 6838 | + mr.setTempId(patientService.getId()); | |
| 6839 | + mr.setPatientId(babyModel.getId()); | |
| 6840 | + mr.setSmsStatus(SmsStatusEnums.WFS.getId()); | |
| 6841 | + mr.setServiceType(1); //判断发送类型 | |
| 6842 | + mr.setFirst("【服务名目通知】");// | |
| 6843 | + mr.setObjType(ServiceObjEnums.BABYOBJ.getId()); | |
| 6844 | + mr.setSubTypeId(SmsServiceEnums.YBZD.getId()); | |
| 6845 | + int weeks = DateUtil.daysBetween(babyModel.getBirth(), new Date()) / 7; | |
| 6846 | + String weekAge = String.valueOf(weeks) + "周"; | |
| 6847 | + mr.setKeyword1(weekAge);// | |
| 6848 | + String keyWord2 = "服务名目通知(点此查看详情)"; | |
| 6848 | 6849 | |
| 6849 | - //planTime 和 timeType为必填 否则推送中心会推送异常 | |
| 6850 | - mr.setTimeType(SmsTimeTypeEnums.ONTIME.getId()); | |
| 6851 | - mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 6852 | - mr.setKeyword2(keyWord2); | |
| 6853 | - mr.setRemark(organization.getName()); | |
| 6854 | - mr.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 6855 | - mr.setWxTempId(WxTempleteIdEnums.BABY_YI_BAN_ZHI_DAO.getId()); | |
| 6856 | - messages.add(mr); | |
| 6857 | - smsConfigFacade.saveMsg(messages, hospitalId); | |
| 6858 | - } | |
| 6850 | + //planTime 和 timeType为必填 否则推送中心会推送异常 | |
| 6851 | + mr.setTimeType(SmsTimeTypeEnums.ONTIME.getId()); | |
| 6852 | + mr.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 6853 | + mr.setKeyword2(keyWord2); | |
| 6854 | + mr.setRemark(organization.getName()); | |
| 6855 | + mr.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 6856 | + mr.setWxTempId(WxTempleteIdEnums.BABY_YI_BAN_ZHI_DAO.getId()); | |
| 6857 | + messages.add(mr); | |
| 6859 | 6858 | |
| 6859 | + } | |
| 6860 | + } | |
| 6861 | + smsConfigFacade.saveMsg(messages, null); | |
| 6860 | 6862 | } |
| 6861 | - } | |
| 6862 | - }); | |
| 6863 | - logger.info("buildingSync end"); | |
| 6863 | + }); | |
| 6864 | + logger.info("buildingSync end"); | |
| 6865 | + } | |
| 6864 | 6866 | } |
| 6865 | - | |
| 6866 | - | |
| 6867 | 6867 | } |
| 6868 | 6868 | private static final int BATCH_SIZE = 10; |
| 6869 | 6869 | public BaseResponse saveBabyDiagnose(List<HisNewbornRequest> models){ |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyMsgFacade.java
View file @
b1fa9a6
| 1 | +package com.lyms.platform.operate.web.facade; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.BabyMsgService; | |
| 4 | +import com.lyms.platform.biz.service.BabyService; | |
| 5 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 6 | +import com.lyms.platform.common.enums.ServiceStatusEnums; | |
| 7 | +import com.lyms.platform.common.enums.ServiceTypeEnums; | |
| 8 | +import com.lyms.platform.common.enums.YnEnums; | |
| 9 | +import com.lyms.platform.common.result.BaseListResponse; | |
| 10 | +import com.lyms.platform.common.result.BaseResponse; | |
| 11 | +import com.lyms.platform.common.utils.MongoConvertHelper; | |
| 12 | +import com.lyms.platform.common.utils.ReflectionUtils; | |
| 13 | +import com.lyms.platform.operate.web.utils.CollectionUtils; | |
| 14 | +import com.lyms.platform.pojo.*; | |
| 15 | +import com.lyms.platform.query.BabyModelQuery; | |
| 16 | +import com.lyms.platform.query.MsgQuery; | |
| 17 | +import org.apache.commons.lang3.StringUtils; | |
| 18 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 19 | +import org.springframework.beans.factory.annotation.Qualifier; | |
| 20 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
| 21 | +import org.springframework.data.mongodb.core.query.Update; | |
| 22 | +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
| 23 | +import org.springframework.stereotype.Component; | |
| 24 | + | |
| 25 | +import java.util.ArrayList; | |
| 26 | +import java.util.Date; | |
| 27 | +import java.util.List; | |
| 28 | + | |
| 29 | +@Component | |
| 30 | +public class BabyMsgFacade { | |
| 31 | + @Autowired | |
| 32 | + private BabyMsgService babyMsgService; | |
| 33 | + @Autowired | |
| 34 | + private AutoMatchFacade autoMatchFacade; | |
| 35 | + @Autowired | |
| 36 | + private MongoTemplate mongoTemplate; | |
| 37 | + @Autowired | |
| 38 | + @Qualifier("commonThreadPool") | |
| 39 | + private ThreadPoolTaskExecutor commonThreadPool; | |
| 40 | + @Autowired | |
| 41 | + private BabyService babyService; | |
| 42 | + | |
| 43 | + public BaseResponse msgList(Integer page, Integer limit, Integer status, Integer userId) { | |
| 44 | + String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 45 | + MsgQuery msgQuery = new MsgQuery(); | |
| 46 | + if (status!=null){ | |
| 47 | + msgQuery.setStatus(status); | |
| 48 | + } | |
| 49 | + msgQuery.setYn(YnEnums.YES.getId()); | |
| 50 | + msgQuery.setNeed("true"); | |
| 51 | + msgQuery.setLimit(limit); | |
| 52 | + msgQuery.setPage(page); | |
| 53 | + msgQuery.setHospitalId(hospitalId); | |
| 54 | + BaseListResponse objectResponse = new BaseListResponse(); | |
| 55 | + List<BabyMsgModel> models = babyMsgService.queryMsgList(msgQuery); | |
| 56 | + objectResponse.setData(models); | |
| 57 | + objectResponse.setPageInfo(msgQuery.getPageInfo()); | |
| 58 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 59 | + objectResponse.setErrormsg("成功"); | |
| 60 | + return objectResponse; | |
| 61 | + } | |
| 62 | + public BaseResponse msgAdd(BabyMsgModel model) { | |
| 63 | + BaseResponse objectResponse = new BaseResponse(); | |
| 64 | + model.setCreated(new Date()); | |
| 65 | + model.setState(0); | |
| 66 | + model.setYn(YnEnums.YES.getId()); | |
| 67 | + model.setStatus(0); | |
| 68 | + babyMsgService.addMsg(model); | |
| 69 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 70 | + objectResponse.setErrormsg("成功"); | |
| 71 | + return objectResponse; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public BaseResponse msgUpdate(BabyMsgModel model,Integer userId) { | |
| 75 | + MsgQuery msgQuery=new MsgQuery(); | |
| 76 | + msgQuery.setId(model.getId()); | |
| 77 | + msgQuery.setYn(1); | |
| 78 | + List<BabyMsgModel> list= babyMsgService.queryMsgList(msgQuery); | |
| 79 | + BaseResponse objectResponse = new BaseResponse(); | |
| 80 | + if (CollectionUtils.isNotEmpty(list)){ | |
| 81 | + BabyMsgModel msgModel= list.get(0); | |
| 82 | + if (msgModel==null ||(msgModel.getStatus()!=null && msgModel.getStatus()==1)){ | |
| 83 | + objectResponse.setErrorcode(-1); | |
| 84 | + objectResponse.setErrormsg("已经发布的通知不能做修改"); | |
| 85 | + return objectResponse; | |
| 86 | + } | |
| 87 | + model.setModified(new Date()); | |
| 88 | + model.setState(0); | |
| 89 | + //操作人为当前用户id | |
| 90 | + model.setPublishId(userId); | |
| 91 | + babyMsgService.updateMsg(model); | |
| 92 | + } | |
| 93 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 94 | + objectResponse.setErrormsg("成功"); | |
| 95 | + return objectResponse; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public BaseResponse deleteMsgById(String id) { | |
| 99 | + BaseResponse objectResponse = new BaseResponse(); | |
| 100 | + | |
| 101 | + MsgQuery msgQuery=new MsgQuery(); | |
| 102 | + msgQuery.setId(id); | |
| 103 | + msgQuery.setYn(1); | |
| 104 | + | |
| 105 | + List<BabyMsgModel> list= babyMsgService.queryMsgList(msgQuery); | |
| 106 | + if (CollectionUtils.isNotEmpty(list)){ | |
| 107 | + BabyMsgModel msgModel= list.get(0); | |
| 108 | + if (msgModel==null || (msgModel.getStatus()!=null &&msgModel.getStatus()==1)){ | |
| 109 | + objectResponse.setErrorcode(-1); | |
| 110 | + objectResponse.setErrormsg("已经发布的通知不能删除"); | |
| 111 | + return objectResponse; | |
| 112 | + } | |
| 113 | + | |
| 114 | + if (StringUtils.isNotEmpty(id)) | |
| 115 | + { | |
| 116 | + BabyMsgModel model = new BabyMsgModel(); | |
| 117 | + model.setYn(YnEnums.NO.getId()); | |
| 118 | + model.setId(id); | |
| 119 | + model.setModified(new Date()); | |
| 120 | + babyMsgService.updateMsg(model); | |
| 121 | + } | |
| 122 | + } | |
| 123 | + | |
| 124 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 125 | + objectResponse.setErrormsg("成功"); | |
| 126 | + return objectResponse; | |
| 127 | + } | |
| 128 | + | |
| 129 | + public BaseResponse getMsgList(String babyId,Integer limit,Integer page) { | |
| 130 | + MsgQuery msgQuery = new MsgQuery(); | |
| 131 | + msgQuery.setYn(YnEnums.YES.getId()); | |
| 132 | + msgQuery.setNeed("true"); | |
| 133 | + msgQuery.setLimit(limit); | |
| 134 | + msgQuery.setPage(page); | |
| 135 | + msgQuery.setBabyId(babyId); | |
| 136 | + BaseListResponse objectResponse = new BaseListResponse(); | |
| 137 | + List<BabyMsgModelRecord> models= babyMsgService.queryMsgRecordList(msgQuery); | |
| 138 | + objectResponse.setData(models); | |
| 139 | + objectResponse.setPageInfo(msgQuery.getPageInfo()); | |
| 140 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 141 | + objectResponse.setErrormsg("成功"); | |
| 142 | + return objectResponse; | |
| 143 | + } | |
| 144 | + | |
| 145 | + public BaseResponse getMsgById(String msgId) { | |
| 146 | + MsgQuery msgQuery = new MsgQuery(); | |
| 147 | + msgQuery.setYn(YnEnums.YES.getId()); | |
| 148 | + msgQuery.setId(msgId); | |
| 149 | + BaseResponse objectResponse = new BaseResponse(); | |
| 150 | + List<BabyMsgModelRecord> models = babyMsgService.queryMsgRecordList(msgQuery); | |
| 151 | + if (CollectionUtils.isNotEmpty(models)){ | |
| 152 | + BabyMsgModelRecord msgModelRecord= models.get(0); | |
| 153 | + if (msgModelRecord.getState()==0){ | |
| 154 | + msgModelRecord.setState(1); | |
| 155 | + Update update= MongoConvertHelper | |
| 156 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(msgModelRecord)); | |
| 157 | + mongoTemplate.updateMulti(msgQuery.convertToQuery().convertToMongoQuery(),update, MsgModelRecord.class); | |
| 158 | + msgQuery.setId(msgModelRecord.getMsgId()); | |
| 159 | + List<BabyMsgModel> msgModels= babyMsgService.queryMsgList(msgQuery); | |
| 160 | + BabyMsgModel msgModel= msgModels.get(0); | |
| 161 | + msgModel.setReadNum(msgModel.getReadNum()!=null?msgModel.getReadNum()+1:1); | |
| 162 | + babyMsgService.updateMsg(msgModel); | |
| 163 | + msgModelRecord.setReadNum(msgModel.getReadNum()); | |
| 164 | + babyMsgService.updateRecordMsg(msgModelRecord); | |
| 165 | + } | |
| 166 | + objectResponse.setObject(msgModelRecord); | |
| 167 | + } | |
| 168 | + | |
| 169 | + | |
| 170 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 171 | + objectResponse.setErrormsg("成功"); | |
| 172 | + return objectResponse; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public BaseResponse getMsgCountById(String babyId) { | |
| 176 | + BaseResponse baseResponse = new BaseResponse(); | |
| 177 | + MsgQuery msgQuery = new MsgQuery(); | |
| 178 | + msgQuery.setYn(YnEnums.YES.getId()); | |
| 179 | + msgQuery.setState(0); | |
| 180 | + msgQuery.setBabyId(babyId); | |
| 181 | + List<BabyMsgModelRecord> models = babyMsgService.queryMsgRecordList(msgQuery); | |
| 182 | + /* msgQuery.setNeed("true"); | |
| 183 | + List<MsgModel> models = courseEvalService.queryMsgList(msgQuery); | |
| 184 | + // 初始化计数器 | |
| 185 | + int notContainCount = 0; | |
| 186 | + // 遍历 models 列表 | |
| 187 | + for (MsgModel model : models) { | |
| 188 | + // 获取当前消息的 readCount | |
| 189 | + String readCount = model.getReadCount(); | |
| 190 | + // 检查 readCount 是否为空,或者是否不包含当前登录人的 ID | |
| 191 | + if (readCount == null || !readCount.contains(parentId)) { | |
| 192 | + // readCount 为空,或者不包含当前登录人的 ID,则增加计数器 | |
| 193 | + notContainCount++; | |
| 194 | + } | |
| 195 | + }*/ | |
| 196 | + baseResponse.setObject(models.size()); | |
| 197 | + baseResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 198 | + baseResponse.setErrormsg("成功"); | |
| 199 | + return baseResponse; | |
| 200 | + } | |
| 201 | + | |
| 202 | + public BaseResponse msgSend( String msgId,Integer userId) { | |
| 203 | + BaseResponse objectResponse = new BaseResponse(); | |
| 204 | + final String hospitalId = autoMatchFacade.getHospitalId(userId); | |
| 205 | + Date day=new Date(); | |
| 206 | + MsgQuery msgQuery = new MsgQuery(); | |
| 207 | + msgQuery.setId(msgId); | |
| 208 | + msgQuery.setState(0); | |
| 209 | + msgQuery.setHospitalId(hospitalId); | |
| 210 | + List<BabyMsgModel> msgModels= babyMsgService.queryMsgList(msgQuery); | |
| 211 | + if(org.apache.commons.collections.CollectionUtils.isEmpty(msgModels)){ | |
| 212 | + objectResponse.setErrorcode(-1); | |
| 213 | + objectResponse.setErrormsg("当前通知状态异常"); | |
| 214 | + return objectResponse; | |
| 215 | + } | |
| 216 | + final BabyMsgModel model= msgModels.get(0); | |
| 217 | + model.setModified(day); | |
| 218 | + model.setStatus(1); | |
| 219 | + model.setReadNum(0); | |
| 220 | + //操作人为当前用户id | |
| 221 | + model.setPublishId(userId); | |
| 222 | + babyMsgService.updateMsg(model); | |
| 223 | + | |
| 224 | + final Integer crowd=model.getCrowd(); | |
| 225 | + //发送通知 | |
| 226 | + commonThreadPool.execute(new Runnable() { | |
| 227 | + @Override | |
| 228 | + public void run() { | |
| 229 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 230 | + babyModelQuery.setYn(1); | |
| 231 | + babyModelQuery.setHospitalId(hospitalId); | |
| 232 | + List<BabyModel> babyModels = null; | |
| 233 | + if (crowd != null) { | |
| 234 | + //发送人群 1已开通服务 2是未开通服务 3是全部 | |
| 235 | + if (crowd == 1) { | |
| 236 | + //已开通服务 | |
| 237 | + babyModelQuery.setServiceType(ServiceTypeEnums.ADD_SERVICE.getId()); | |
| 238 | + babyModelQuery.setServiceStatus(ServiceStatusEnums.ADD_OPEN.getId()); | |
| 239 | + babyModels = babyService.queryBabyWithQuery(babyModelQuery); | |
| 240 | + } else if (crowd == 2) { | |
| 241 | + //2是未开通服务 | |
| 242 | + babyModelQuery.setServiceTypeIsExist(false); | |
| 243 | + babyModels = babyService.queryBabyWithQuery(babyModelQuery); | |
| 244 | + } else if (crowd == 3) { | |
| 245 | + babyModels = babyService.queryBabyWithQuery(babyModelQuery); | |
| 246 | + } | |
| 247 | + if (org.apache.commons.collections.CollectionUtils.isNotEmpty(babyModels)) { | |
| 248 | + List<BabyMsgModelRecord> msgModelRecords = new ArrayList<>(); | |
| 249 | + for (BabyModel babyModel : babyModels) { | |
| 250 | + BabyMsgModelRecord msgModelRecord = getRecord(model); | |
| 251 | + msgModelRecord.setBabyId(babyModel.getId()); | |
| 252 | + msgModelRecords.add(msgModelRecord); | |
| 253 | + } | |
| 254 | + mongoTemplate.insertAll(msgModelRecords); | |
| 255 | + model.setCrowdNum(babyModels.size()); | |
| 256 | + babyMsgService.updateMsg(model); | |
| 257 | + } | |
| 258 | + } | |
| 259 | + } | |
| 260 | + }); | |
| 261 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 262 | + objectResponse.setErrormsg("成功"); | |
| 263 | + return objectResponse; | |
| 264 | + } | |
| 265 | + public BabyMsgModelRecord getRecord(BabyMsgModel msgModel){ | |
| 266 | + BabyMsgModelRecord msgModelRecord=new BabyMsgModelRecord(); | |
| 267 | + msgModelRecord.setMsgId(msgModel.getId()); | |
| 268 | + msgModelRecord.setContent(msgModel.getContent()); | |
| 269 | + msgModelRecord.setCreated(msgModel.getCreated()); | |
| 270 | + msgModelRecord.setHospitalId(msgModel.getHospitalId()); | |
| 271 | + msgModelRecord.setImg(msgModel.getImg()); | |
| 272 | + msgModelRecord.setState(msgModel.getState()); | |
| 273 | + msgModelRecord.setPublishId(msgModel.getPublishId()); | |
| 274 | + msgModelRecord.setPublishName(msgModel.getPublishName()); | |
| 275 | + msgModelRecord.setTitle(msgModel.getTitle()); | |
| 276 | + msgModelRecord.setYn(1); | |
| 277 | + msgModelRecord.setReadNum(0); | |
| 278 | + return msgModelRecord; | |
| 279 | + } | |
| 280 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientServiceFacade.java
View file @
b1fa9a6
| ... | ... | @@ -8,10 +8,7 @@ |
| 8 | 8 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 9 | 9 | import com.lyms.platform.common.result.BaseResponse; |
| 10 | 10 | import com.lyms.platform.common.utils.*; |
| 11 | -import com.lyms.platform.operate.web.request.BabyBookbuildingAddRequest; | |
| 12 | -import com.lyms.platform.operate.web.request.BasePageQueryRequest; | |
| 13 | -import com.lyms.platform.operate.web.request.CjStatisticsQueryRequest; | |
| 14 | -import com.lyms.platform.operate.web.request.JdStatisticsQueryRequest; | |
| 11 | +import com.lyms.platform.operate.web.request.*; | |
| 15 | 12 | import com.lyms.platform.operate.web.result.*; |
| 16 | 13 | import com.lyms.platform.operate.web.utils.CommonsHelper; |
| 17 | 14 | import com.lyms.platform.permission.dao.master.CouponMapper; |
| ... | ... | @@ -1856,5 +1853,41 @@ |
| 1856 | 1853 | return baseResponse; |
| 1857 | 1854 | } |
| 1858 | 1855 | |
| 1856 | + | |
| 1857 | + public void sendServiceMsg(YxzhVO yxzhVO) { | |
| 1858 | + try { | |
| 1859 | + logger.info("sendServiceMsg startup"); | |
| 1860 | + List<MsgRequest> messages = new ArrayList<>(); | |
| 1861 | + final String hospitalId = "2100002419"; | |
| 1862 | + MsgRequest request = new MsgRequest(); | |
| 1863 | + String title = "五色管理提醒短信"; | |
| 1864 | + String messageContent = "【大同市第一人民医院】提醒:请尽快完善信息享受五色高危管理服务,请点击以下链接截图保存二维码,用微信识别,关注“美生孕育”公众号,点击开通成功提醒《产科预约建档》,请您务必填写您就诊的医生姓名,信息填写完成后点击提交即可。等待10分钟就可以点击公众号的开通成功提醒《产科已有档案》,输入您建档时填写的姓名+手机号,获取验证码成功登录宝贝孕程小程序。请确保登录成功并持续关注“美生孕育”公众号,享受五色高危管理和个性化精准医疗服务。【https://dev-rp-api.healthbaby.com.cn/id_photo/2100002419/2100002419.png】"; | |
| 1865 | + request.setServiceType(3); | |
| 1866 | + //短信发送状态 | |
| 1867 | + request.setSmsStatus(SmsStatusEnums.WFS.getId()); | |
| 1868 | + //平台ID | |
| 1869 | + request.setTypeId(ProjectTypeEnums.YNXT.getId()); | |
| 1870 | + //服务对象 1孕妇 2儿童 3产妇 | |
| 1871 | + request.setObjType(1); | |
| 1872 | + request.setWxTempId("tx-UmDE3YMgYaAeFccXB7HITuG_tiP9LMdX2bvBpus"); | |
| 1873 | + request.setPhone(yxzhVO.getPhone()); | |
| 1874 | + request.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 1875 | + request.setSubTypeId(SmsServiceEnums.FWKT.getId()); | |
| 1876 | + request.setStatus(MsgStatusEnums.NO_SEND.getId()); | |
| 1877 | + request.setTimeType(1); | |
| 1878 | + request.setHospitalId(hospitalId); | |
| 1879 | + request.setPatientId(yxzhVO.getIdno()); | |
| 1880 | + request.setTempId(yxzhVO.getIdno()); | |
| 1881 | + request.setCreated(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 1882 | + request.setFirst(messageContent); | |
| 1883 | + request.setKeyword1(title); | |
| 1884 | + request.setKeyword2(DateUtil.getyyyy_MM_dd(new Date())); | |
| 1885 | + messages.add(request); | |
| 1886 | + smsConfigFacade.saveMsg(messages, hospitalId); | |
| 1887 | + logger.info("sendServiceMsg end"); | |
| 1888 | + } catch (Exception e) { | |
| 1889 | + logger.error("sendServiceMsg Exception " + e); | |
| 1890 | + } | |
| 1891 | + } | |
| 1859 | 1892 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/YxzhVO.java
View file @
b1fa9a6
| ... | ... | @@ -2,6 +2,10 @@ |
| 2 | 2 | |
| 3 | 3 | public class YxzhVO { |
| 4 | 4 | |
| 5 | + private String hospitalId; | |
| 6 | + | |
| 7 | + private String phone; | |
| 8 | + | |
| 5 | 9 | private String idno; |
| 6 | 10 | |
| 7 | 11 | private String name; |
| ... | ... | @@ -13,6 +17,22 @@ |
| 13 | 17 | */ |
| 14 | 18 | private Integer renew; |
| 15 | 19 | |
| 20 | + | |
| 21 | + public String getHospitalId() { | |
| 22 | + return hospitalId; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setHospitalId(String hospitalId) { | |
| 26 | + this.hospitalId = hospitalId; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public String getPhone() { | |
| 30 | + return phone; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setPhone(String phone) { | |
| 34 | + this.phone = phone; | |
| 35 | + } | |
| 16 | 36 | |
| 17 | 37 | public String getIdno() { |
| 18 | 38 | return idno; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/SyncDataTaskService.java
View file @
b1fa9a6
| ... | ... | @@ -60,6 +60,7 @@ |
| 60 | 60 | //urls.put("area-zhucheng-api.healthbaby.com.cn:12356","诸城市妇幼保健院"); |
| 61 | 61 | //urls.put("area-weihai-api.healthbaby.com.cn:12356","威海市妇幼"); |
| 62 | 62 | urls.put("area-chengde-api.healthbaby.com.cn:12356","承德"); |
| 63 | + urls.put("area-nanhe-api.healthbaby.com.cn:12356","南和"); | |
| 63 | 64 | urls.put("area-dt-api.healthbaby.com.cn:12356","大同"); |
| 64 | 65 | //urls.put("area-lingcheng-api.healthbaby.com.cn:12356","陵城"); |
| 65 | 66 | } |