Commit 5e35320f9abf6461eb637d2e6eb181e6ff60d833
Exists in
master
and in
8 other branches
Merge remote-tracking branch 'origin/master'
Showing 10 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBabyDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyService.java
- platform-common/src/main/java/com/lyms/platform/common/dao/BaseMongoDAOImpl.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BabyModel.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/VisitFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyVisitResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CommonsHelper.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IBabyDao.java
View file @
5e35320
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/BabyDaoImpl.java
View file @
5e35320
| ... | ... | @@ -49,5 +49,9 @@ |
| 49 | 49 | public Page<BabyModel> findPageWithQuery(MongoQuery query) { |
| 50 | 50 | return findPage(query.convertToMongoQuery()); |
| 51 | 51 | } |
| 52 | + | |
| 53 | + public void findAndModify(MongoQuery query,BabyModel babyModel){ | |
| 54 | + findAndModify(query.convertToMongoQuery(),babyModel); | |
| 55 | + } | |
| 52 | 56 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/BabyService.java
View file @
5e35320
| ... | ... | @@ -50,7 +50,11 @@ |
| 50 | 50 | |
| 51 | 51 | return iBabyDao.queryBabyWithQuery(query.addOrder(Direction.ASC, "id")); |
| 52 | 52 | } |
| 53 | - | |
| 53 | + | |
| 54 | + | |
| 55 | + public void findAndModify(MongoQuery query,BabyModel babyModel){ | |
| 56 | + iBabyDao.findAndModify(query,babyModel); | |
| 57 | + } | |
| 54 | 58 | |
| 55 | 59 | public Page<BabyModel> findPageWithQuery(MongoQuery query){ |
| 56 | 60 | return iBabyDao.findPageWithQuery(MongoCondition.newInstance().toMongoQuery().addOrder(Direction.ASC, "id")); |
platform-common/src/main/java/com/lyms/platform/common/dao/BaseMongoDAOImpl.java
View file @
5e35320
| ... | ... | @@ -100,6 +100,15 @@ |
| 100 | 100 | mongoTemplate.findAllAndRemove(query, this.getEntityClass()); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | + | |
| 104 | + public void findAndModify(Query query,T obj){ | |
| 105 | + Assert.notNull(obj, "execute findAndModify method must not null."); | |
| 106 | + Update update = MongoConvertHelper | |
| 107 | + .convertToNativeUpdate(ReflectionUtils.getUpdateField(obj)); | |
| 108 | + Assert.notNull(update, "execute findAndModify method must not null.update:"+update); | |
| 109 | + mongoTemplate.findAndModify(query,update,this.getEntityClass()); | |
| 110 | + } | |
| 111 | + | |
| 103 | 112 | /** |
| 104 | 113 | * 获取需要操作的实体类class |
| 105 | 114 | * |
platform-dal/src/main/java/com/lyms/platform/pojo/BabyModel.java
View file @
5e35320
| ... | ... | @@ -32,6 +32,18 @@ |
| 32 | 32 | |
| 33 | 33 | private Date created; |
| 34 | 34 | private Date modified; |
| 35 | + /** | |
| 36 | + * 社区id | |
| 37 | + */ | |
| 38 | + private String communityId; | |
| 39 | + | |
| 40 | + public String getCommunityId() { | |
| 41 | + return communityId; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public void setCommunityId(String communityId) { | |
| 45 | + this.communityId = communityId; | |
| 46 | + } | |
| 35 | 47 | |
| 36 | 48 | public Date getCreated() { |
| 37 | 49 | return created; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java
View file @
5e35320
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | -import java.util.*; | |
| 4 | - | |
| 5 | -import com.lyms.platform.biz.service.*; | |
| 6 | -import com.lyms.platform.common.utils.DateUtil; | |
| 7 | -import com.lyms.platform.common.utils.JsonUtil; | |
| 8 | -import com.lyms.platform.pojo.CommunityConfig; | |
| 9 | -import com.lyms.platform.pojo.Patients; | |
| 10 | -import com.lyms.platform.query.PatientsQuery; | |
| 11 | -import org.apache.commons.collections.CollectionUtils; | |
| 12 | -import org.apache.commons.lang.StringUtils; | |
| 13 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | -import org.springframework.stereotype.Component; | |
| 15 | - | |
| 3 | +import com.lyms.platform.biz.service.BabyService; | |
| 4 | +import com.lyms.platform.biz.service.CommunityConfigService; | |
| 5 | +import com.lyms.platform.biz.service.PatientsService; | |
| 6 | +import com.lyms.platform.biz.service.PuerperaService; | |
| 16 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 17 | 8 | import com.lyms.platform.common.enums.YnEnums; |
| 18 | 9 | import com.lyms.platform.common.result.BaseListResponse; |
| 19 | 10 | import com.lyms.platform.common.result.BaseResponse; |
| 11 | +import com.lyms.platform.common.utils.DateUtil; | |
| 20 | 12 | import com.lyms.platform.operate.web.request.BabyManagerQueryRequest; |
| 21 | 13 | import com.lyms.platform.operate.web.request.BabyManagerUpdateRequest; |
| 22 | 14 | import com.lyms.platform.operate.web.result.BabyResult; |
| 23 | 15 | import com.lyms.platform.pojo.BabyModel; |
| 16 | +import com.lyms.platform.pojo.CommunityConfig; | |
| 17 | +import com.lyms.platform.pojo.Patients; | |
| 24 | 18 | import com.lyms.platform.pojo.PuerperaModel; |
| 25 | 19 | import com.lyms.platform.query.BabyModelQuery; |
| 26 | -import com.lyms.platform.query.PuerperaModelQuery; | |
| 20 | +import org.apache.commons.collections.CollectionUtils; | |
| 21 | +import org.apache.commons.lang.StringUtils; | |
| 22 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 23 | +import org.springframework.stereotype.Component; | |
| 27 | 24 | |
| 25 | +import java.util.ArrayList; | |
| 26 | +import java.util.Date; | |
| 27 | +import java.util.HashMap; | |
| 28 | +import java.util.List; | |
| 29 | + | |
| 28 | 30 | @Component |
| 29 | 31 | public class BabyManagerFacade { |
| 30 | 32 | |
| ... | ... | @@ -42,7 +44,7 @@ |
| 42 | 44 | |
| 43 | 45 | /** |
| 44 | 46 | * 根据条件查询符合条件的新生儿 |
| 45 | - * | |
| 47 | + * | |
| 46 | 48 | * @param babyManagerRequest |
| 47 | 49 | * @return |
| 48 | 50 | */ |
| 49 | 51 | |
| 50 | 52 | |
| 51 | 53 | |
| 52 | 54 | |
| ... | ... | @@ -97,30 +99,36 @@ |
| 97 | 99 | // 根据关键字先查询产妇信息 |
| 98 | 100 | |
| 99 | 101 | |
| 100 | - | |
| 101 | - babyQuery.setNeed("y"); | |
| 102 | - List<BabyModel> babies = babyService.queryBabyWithQuery(babyQuery); | |
| 103 | - if (CollectionUtils.isNotEmpty(babies)) { | |
| 104 | - for (BabyModel baby : babies) { | |
| 105 | - data.add(buildResult(baby,"")); | |
| 102 | + babyQuery.setNeed("y"); | |
| 103 | + List<BabyModel> babies = babyService.queryBabyWithQuery(babyQuery); | |
| 104 | + if (CollectionUtils.isNotEmpty(babies)) { | |
| 105 | + String communityId=""; | |
| 106 | + for (BabyModel baby : babies) { | |
| 107 | + if (StringUtils.isNotEmpty(baby.getParentId())) { | |
| 108 | + //查询患者 | |
| 109 | + Patients patients = patientsService.findOnePatientById(baby.getParentId()); | |
| 110 | + if(null!=patients){ | |
| 111 | + communityId = patients.getCommunityId(); | |
| 112 | + } | |
| 106 | 113 | } |
| 114 | + data.add(buildResult(baby, communityId)); | |
| 107 | 115 | } |
| 116 | + } | |
| 108 | 117 | |
| 109 | 118 | return new BaseListResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(data).setPageInfo(babyQuery.getPageInfo()); |
| 110 | 119 | } |
| 111 | 120 | |
| 112 | 121 | /** |
| 113 | 122 | * 删除一条新生儿数据 |
| 114 | - * | |
| 115 | - * @param id | |
| 116 | - * 新生儿id | |
| 123 | + * | |
| 124 | + * @param id 新生儿id | |
| 117 | 125 | * @return 返回结果 |
| 118 | 126 | */ |
| 119 | 127 | public BaseResponse deleteOneBabyById(String id) { |
| 120 | 128 | BabyModel obj = new BabyModel(); |
| 121 | 129 | obj.setYn(YnEnums.NO.getId()); |
| 122 | 130 | obj.setId(id); |
| 123 | - babyService.updateOneBaby(obj,id); | |
| 131 | + babyService.updateOneBaby(obj, id); | |
| 124 | 132 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
| 125 | 133 | } |
| 126 | 134 | |
| ... | ... | @@ -130,7 +138,7 @@ |
| 130 | 138 | |
| 131 | 139 | /** |
| 132 | 140 | * 构建放回的数据 |
| 133 | - * | |
| 141 | + * | |
| 134 | 142 | * @param baby |
| 135 | 143 | * @param puerModel |
| 136 | 144 | * @return |
| ... | ... | @@ -152,6 +160,7 @@ |
| 152 | 160 | babyResult.setCommunity(StringUtils.isEmpty(puerModel.getCommunityId()) ? "" : puerModel.getCommunityId()); |
| 153 | 161 | return babyResult; |
| 154 | 162 | } |
| 163 | + | |
| 155 | 164 | public BabyResult buildResult(BabyModel baby, Patients puerModel) { |
| 156 | 165 | BabyResult babyResult = new BabyResult(); |
| 157 | 166 | |
| ... | ... | @@ -169,7 +178,8 @@ |
| 169 | 178 | babyResult.setCommunity(StringUtils.isEmpty(puerModel.getCommunityId()) ? "" : puerModel.getCommunityId()); |
| 170 | 179 | return babyResult; |
| 171 | 180 | } |
| 172 | - public BabyResult buildResult(BabyModel patients,String communityId){ | |
| 181 | + | |
| 182 | + public BabyResult buildResult(BabyModel patients, String communityId) { | |
| 173 | 183 | BabyResult babyResult = new BabyResult(); |
| 174 | 184 | /* String addr = ""; |
| 175 | 185 | if (StringUtils.isNotEmpty(patients.getAddress())) { |
| 176 | 186 | |
| 177 | 187 | |
| 178 | 188 | |
| 179 | 189 | |
| 180 | 190 | |
| ... | ... | @@ -183,30 +193,30 @@ |
| 183 | 193 | babyResult.setAddress(patients.getAddress()); |
| 184 | 194 | |
| 185 | 195 | babyResult.setCommunityId(StringUtils.isEmpty(communityId) ? "" : communityId); |
| 186 | - String comm="未分配"; | |
| 187 | - /* if(StringUtils.isNotEmpty(patients.getCommunityId())){ | |
| 196 | + String comm = "未分配"; | |
| 197 | + if(StringUtils.isNotEmpty(patients.getCommunityId())){ | |
| 188 | 198 | CommunityConfig communityConfig = communityConfigService.getCommunityById(patients.getCommunityId()); |
| 189 | 199 | if(null!=communityConfig){ |
| 190 | 200 | comm= communityConfig.getName(); |
| 191 | 201 | } |
| 192 | - }*/ | |
| 193 | - String gender= "未知"; | |
| 194 | - if("1".equals(patients.getSex()+"")){ | |
| 195 | - gender="男"; | |
| 196 | - }else { | |
| 197 | - gender="女"; | |
| 198 | 202 | } |
| 203 | + String gender = "未知"; | |
| 204 | + if ("1".equals(patients.getSex() + "")) { | |
| 205 | + gender = "男"; | |
| 206 | + } else { | |
| 207 | + gender = "女"; | |
| 208 | + } | |
| 199 | 209 | babyResult.setName(patients.getName()); |
| 200 | 210 | babyResult.setBirth(DateUtil.getyyyy_MM_dd(patients.getBirth())); |
| 201 | 211 | babyResult.setSex(gender); |
| 202 | 212 | babyResult.setCommunity(comm); |
| 203 | - babyResult.setMotherName("母亲名字"); | |
| 213 | + babyResult.setMotherName(patients.getMname()); | |
| 204 | 214 | babyResult.setMotherPhone(patients.getMphone()); |
| 205 | 215 | babyResult.setId(patients.getId()); |
| 206 | - String tips= visitFacade.getFindTips(patients.getId()); | |
| 216 | + String tips = visitFacade.getFindTips(patients.getId()); | |
| 207 | 217 | babyResult.setVisit(tips); |
| 208 | 218 | babyResult.setVisitStatus(patients.getVisitstatus()); |
| 209 | - return babyResult; | |
| 219 | + return babyResult; | |
| 210 | 220 | } |
| 211 | 221 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/PatientFacade.java
View file @
5e35320
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.service.BabyService; | |
| 3 | 4 | import com.lyms.platform.biz.service.CommunityConfigService; |
| 4 | 5 | import com.lyms.platform.biz.service.PatientsService; |
| 5 | 6 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 6 | 7 | |
| ... | ... | @@ -12,8 +13,10 @@ |
| 12 | 13 | import com.lyms.platform.operate.web.request.PuerperaManagerUpdateRequest; |
| 13 | 14 | import com.lyms.platform.operate.web.request.PuerperaMatcherCommunityRequest; |
| 14 | 15 | import com.lyms.platform.operate.web.result.PuerperaResult; |
| 16 | +import com.lyms.platform.pojo.BabyModel; | |
| 15 | 17 | import com.lyms.platform.pojo.CommunityConfig; |
| 16 | 18 | import com.lyms.platform.pojo.Patients; |
| 19 | +import com.lyms.platform.query.BabyModelQuery; | |
| 17 | 20 | import com.lyms.platform.query.PatientsQuery; |
| 18 | 21 | import org.apache.commons.collections.CollectionUtils; |
| 19 | 22 | import org.apache.commons.lang.StringUtils; |
| ... | ... | @@ -36,6 +39,8 @@ |
| 36 | 39 | private CommunityConfigService communityConfigService; |
| 37 | 40 | @Autowired |
| 38 | 41 | private VisitFacade visitFacade; |
| 42 | + @Autowired | |
| 43 | + private BabyService babyService; | |
| 39 | 44 | |
| 40 | 45 | |
| 41 | 46 | /** |
| 42 | 47 | |
| 43 | 48 | |
| ... | ... | @@ -46,9 +51,20 @@ |
| 46 | 51 | */ |
| 47 | 52 | public BaseResponse matchCommunity(PuerperaMatcherCommunityRequest puerperaMatcherCommunityRequest) { |
| 48 | 53 | Patients puerperaModel = patientsService.findOnePatientById(puerperaMatcherCommunityRequest.getParentId()); |
| 54 | + | |
| 49 | 55 | Assert.notNull(puerperaModel, "产妇信息不存在"); |
| 56 | + | |
| 50 | 57 | puerperaModel.setCommunityId(puerperaMatcherCommunityRequest.getCommunityId()); |
| 51 | 58 | patientsService.updatePatient(puerperaModel); |
| 59 | + | |
| 60 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 61 | + babyModelQuery.setParentId(puerperaModel.getId()); | |
| 62 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
| 63 | + | |
| 64 | + BabyModel babyModel = new BabyModel(); | |
| 65 | + babyModel.setCommunityId(puerperaMatcherCommunityRequest.getCommunityId()); | |
| 66 | + babyModel.setMphone(puerperaModel.getPhone()); | |
| 67 | + babyService.findAndModify(babyModelQuery.convertToQuery(),babyModel); | |
| 52 | 68 | //TODO 产妇分配了社区,需要给对应的社区提示消息 |
| 53 | 69 | return new BaseResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS); |
| 54 | 70 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/VisitFacade.java
View file @
5e35320
| ... | ... | @@ -8,10 +8,12 @@ |
| 8 | 8 | import com.lyms.platform.operate.web.request.BabyVisitAddRequest; |
| 9 | 9 | import com.lyms.platform.operate.web.request.VisitAddRequest; |
| 10 | 10 | import com.lyms.platform.operate.web.request.VisitAddRequest.SimpleVisitPuerpera; |
| 11 | -import com.lyms.platform.operate.web.result.*; | |
| 11 | +import com.lyms.platform.operate.web.result.AddressInner; | |
| 12 | +import com.lyms.platform.operate.web.result.BabyVisitResult; | |
| 12 | 13 | import com.lyms.platform.operate.web.result.BabyVisitResult.BabyVisit; |
| 13 | -import com.lyms.platform.permission.model.Regions; | |
| 14 | -import com.lyms.platform.permission.service.RegionsService; | |
| 14 | +import com.lyms.platform.operate.web.result.SimpleVisit; | |
| 15 | +import com.lyms.platform.operate.web.result.VisitResult; | |
| 16 | +import com.lyms.platform.operate.web.utils.CommonsHelper; | |
| 15 | 17 | import com.lyms.platform.pojo.*; |
| 16 | 18 | import com.lyms.platform.query.BabyModelQuery; |
| 17 | 19 | import com.lyms.platform.query.PatientsQuery; |
| ... | ... | @@ -62,7 +64,7 @@ |
| 62 | 64 | * @return |
| 63 | 65 | */ |
| 64 | 66 | public BaseObjectResponse findOneByCardNo(String cardNo) { |
| 65 | - Patients puerperaModel = findOnePuerperaByCardNo(cardNo,3); | |
| 67 | + Patients puerperaModel = findOnePuerperaByCardNo(cardNo, 3); | |
| 66 | 68 | if (null == puerperaModel) { |
| 67 | 69 | return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.DEPT_NOT_EXISTS).setErrormsg("产妇信息不存在"); |
| 68 | 70 | } |
| ... | ... | @@ -78,7 +80,7 @@ |
| 78 | 80 | private BaseObjectResponse doBiz(Patients puerperaModel) { |
| 79 | 81 | VisitResult data = new VisitResult(); |
| 80 | 82 | if (null != puerperaModel) { |
| 81 | - data.convertToResult1(puerperaModel, fullAddress(puerperaModel)); | |
| 83 | + data.convertToResult1(puerperaModel, CommonsHelper.fullAddress(puerperaModel,basicConfigService)); | |
| 82 | 84 | VisitQuery visitQuery = new VisitQuery(); |
| 83 | 85 | visitQuery.setParentId(puerperaModel.getId()); |
| 84 | 86 | List<VisitModel> visits = visitService.queryVisit(visitQuery); |
| 85 | 87 | |
| ... | ... | @@ -96,47 +98,12 @@ |
| 96 | 98 | } |
| 97 | 99 | |
| 98 | 100 | /** |
| 99 | - * 填充地址信息 | |
| 100 | - * | |
| 101 | - * @param puerperaModel | |
| 102 | - * @return | |
| 103 | - */ | |
| 104 | - private Address fullAddress(Patients puerperaModel) { | |
| 105 | - Address address = new Address(); | |
| 106 | - address.setArea(getName(puerperaModel.getAreaId())); | |
| 107 | - address.setCity(getName(puerperaModel.getCityId())); | |
| 108 | - address.setProvince(getName(puerperaModel.getProvinceId())); | |
| 109 | - address.setAddress(puerperaModel.getAddress()); | |
| 110 | - return address; | |
| 111 | - } | |
| 112 | - | |
| 113 | - private Address fullAddress(BabyModel puerperaModel) { | |
| 114 | - Address address = new Address(); | |
| 115 | - address.setArea(getName(puerperaModel.getAreaId())); | |
| 116 | - address.setCity(getName(puerperaModel.getCityId())); | |
| 117 | - address.setProvince(getName(puerperaModel.getProvinceId())); | |
| 118 | - address.setAddress(puerperaModel.getAddress()); | |
| 119 | - return address; | |
| 120 | - } | |
| 121 | - | |
| 122 | - private AddressInner getName(String id) { | |
| 123 | - AddressInner addressInner= new AddressInner(); | |
| 124 | - addressInner.setId(id); | |
| 125 | - BasicConfig config = basicConfigService.getOneBasicConfigById(id); | |
| 126 | - if (null == config) { | |
| 127 | - return addressInner; | |
| 128 | - } | |
| 129 | - addressInner.setName(config.getName()); | |
| 130 | - return addressInner; | |
| 131 | - } | |
| 132 | - | |
| 133 | - /** | |
| 134 | 101 | * 根据身份证号码获取产妇信息 |
| 135 | 102 | * |
| 136 | 103 | * @param cardNo 身份证号码 |
| 137 | 104 | * @return 产妇信息 |
| 138 | 105 | */ |
| 139 | - private Patients findOnePuerperaByCardNo(String cardNo,int type) { | |
| 106 | + private Patients findOnePuerperaByCardNo(String cardNo, int type) { | |
| 140 | 107 | PatientsQuery query = new PatientsQuery(); |
| 141 | 108 | //先根据传入的手机号 |
| 142 | 109 | // query.setCardNo(cardNo); |
| ... | ... | @@ -177,7 +144,7 @@ |
| 177 | 144 | // parentId = puerperaService.addPuerpera(visitRequest.getPuerpera().build()).getId(); |
| 178 | 145 | Patients patients = visitRequest.getPatients(); |
| 179 | 146 | patients.setType(3); |
| 180 | - patients.setYn(1); | |
| 147 | + patients.setYn(YnEnums.YES.getId()); | |
| 181 | 148 | patients.setId(null); |
| 182 | 149 | parentId = patientsService.addPatient(patients).getId(); |
| 183 | 150 | } |
| 184 | 151 | |
| 185 | 152 | |
| 186 | 153 | |
| ... | ... | @@ -214,15 +181,24 @@ |
| 214 | 181 | |
| 215 | 182 | public BaseResponse addOrUpdateBabyAndVisit(BabyVisitAddRequest babyVisitAddRequest) { |
| 216 | 183 | |
| 217 | - String babyId= babyVisitAddRequest.getParentId(); | |
| 184 | + String babyId = babyVisitAddRequest.getParentId(); | |
| 218 | 185 | // 访视记录id为空表示新增 |
| 219 | - BabyVisitModel babyVisitModel = babyVisitAddRequest.convertToDataModel(); | |
| 186 | + BabyVisitModel babyVisitModel = babyVisitAddRequest.convertToDataModel(); | |
| 220 | 187 | //表示需要新增小孩的数据 |
| 221 | - if(StringUtils.isBlank(babyId)){ | |
| 222 | - babyId = babyService.addOneBaby(babyVisitAddRequest.getBabyModel()).getId(); | |
| 223 | - }else{ | |
| 188 | + if (StringUtils.isBlank(babyId)) { | |
| 189 | + //根据母亲的手机号去查询产妇id | |
| 190 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 191 | + patientsQuery.setPhone(babyVisitAddRequest.getMphone()); | |
| 192 | + patientsQuery.setType(3); | |
| 193 | + List<Patients> patientses = patientsService.queryPatient(patientsQuery); | |
| 194 | + BabyModel babyModel = babyVisitAddRequest.getBabyModel(); | |
| 195 | + if (CollectionUtils.isNotEmpty(patientses)) { | |
| 196 | + babyModel.setParentId(patientses.get(0).getId()); | |
| 197 | + } | |
| 198 | + babyId = babyService.addOneBaby(babyModel).getId(); | |
| 199 | + } else { | |
| 224 | 200 | //修改小孩基本信息 |
| 225 | - babyService.updateOneBaby(babyVisitAddRequest.getBabyModel(),babyId); | |
| 201 | + babyService.updateOneBaby(babyVisitAddRequest.getBabyModel(), babyId); | |
| 226 | 202 | } |
| 227 | 203 | babyVisitModel.setParentId(babyId); |
| 228 | 204 | //表示新增访视记录 |
| 229 | 205 | |
| ... | ... | @@ -233,10 +209,10 @@ |
| 233 | 209 | babyVisitService.updateOneBabyVisit(babyVisitAddRequest.convertToDataModel(), babyVisitAddRequest.getId()); |
| 234 | 210 | } |
| 235 | 211 | //添加成功后修改新生儿的访视状态 |
| 236 | - BabyModel babyModel =new BabyModel(); | |
| 212 | + BabyModel babyModel = new BabyModel(); | |
| 237 | 213 | babyModel.setId(babyId); |
| 238 | 214 | babyModel.setVisitstatus(1); |
| 239 | - babyService.updateOneBaby(babyModel,babyId); | |
| 215 | + babyService.updateOneBaby(babyModel, babyId); | |
| 240 | 216 | |
| 241 | 217 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
| 242 | 218 | } |
| ... | ... | @@ -262,7 +238,7 @@ |
| 262 | 238 | return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.DEPT_NOT_EXISTS).setErrormsg("产妇信息不存在"); |
| 263 | 239 | } |
| 264 | 240 | return findBabyVisit(puerperaModel);*/ |
| 265 | - BabyModel babyModel = findOneBabyByMphone(cardNo); | |
| 241 | + BabyModel babyModel = findOneBabyByMphone(cardNo); | |
| 266 | 242 | if (null == babyModel) { |
| 267 | 243 | return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.DEPT_NOT_EXISTS).setErrormsg("新生儿信息不存在"); |
| 268 | 244 | } |
| 269 | 245 | |
| 270 | 246 | |
| 271 | 247 | |
| 272 | 248 | |
| ... | ... | @@ -270,22 +246,20 @@ |
| 270 | 246 | } |
| 271 | 247 | |
| 272 | 248 | /** |
| 273 | - * | |
| 274 | 249 | * 根据母亲手机号查询新生儿 |
| 275 | 250 | * |
| 276 | - * @param mPhone 母亲的手机号 | |
| 277 | - * | |
| 251 | + * @param mPhone 母亲的手机号 | |
| 278 | 252 | * @return 新生儿 |
| 279 | 253 | */ |
| 280 | - public BabyModel findOneBabyByMphone(String mPhone){ | |
| 281 | - BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 282 | - babyModelQuery.setYn(1); | |
| 254 | + public BabyModel findOneBabyByMphone(String mPhone) { | |
| 255 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
| 256 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
| 283 | 257 | babyModelQuery.setMphone(mPhone); |
| 284 | - List<BabyModel> babyList = babyService.queryBabyWithQuery(babyModelQuery); | |
| 285 | - if(CollectionUtils.isEmpty(babyList)){ | |
| 258 | + List<BabyModel> babyList = babyService.queryBabyWithQuery(babyModelQuery); | |
| 259 | + if (CollectionUtils.isEmpty(babyList)) { | |
| 286 | 260 | return null; |
| 287 | 261 | } |
| 288 | - return babyList.get(0); | |
| 262 | + return babyList.get(0); | |
| 289 | 263 | } |
| 290 | 264 | |
| 291 | 265 | |
| ... | ... | @@ -309,7 +283,7 @@ |
| 309 | 283 | |
| 310 | 284 | // TODO 需要转换成具体的result对象 |
| 311 | 285 | // 设置产妇的信息 |
| 312 | - babyVisitResult.convertToResult1(babyModel, fullAddress(babyModel)); | |
| 286 | + babyVisitResult.convertToResult1(babyModel, CommonsHelper.fullAddress(babyModel, basicConfigService)); | |
| 313 | 287 | babyVisitResult.setData(data); |
| 314 | 288 | return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功").setData(babyVisitResult); |
| 315 | 289 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyVisitResult.java
View file @
5e35320
| ... | ... | @@ -778,7 +778,6 @@ |
| 778 | 778 | setmName(destModel.getMname()); |
| 779 | 779 | setAge(DateUtil.getAge(destModel.getBirth())); |
| 780 | 780 | setmCardNo(destModel.getCardNo()); |
| 781 | - setmName(destModel.getName()); | |
| 782 | 781 | setAddress(address); |
| 783 | 782 | setMbirth(DateUtil.getyyyy_MM_dd(destModel.getMbirth())); |
| 784 | 783 | setMjob(destModel.getMjob()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/CommonsHelper.java
View file @
5e35320
| 1 | +package com.lyms.platform.operate.web.utils; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.BasicConfigService; | |
| 4 | +import com.lyms.platform.operate.web.result.Address; | |
| 5 | +import com.lyms.platform.operate.web.result.AddressInner; | |
| 6 | +import com.lyms.platform.pojo.BabyModel; | |
| 7 | +import com.lyms.platform.pojo.BasicConfig; | |
| 8 | +import com.lyms.platform.pojo.Patients; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * Created by Administrator on 2016/5/1 0001. | |
| 12 | + */ | |
| 13 | +public final class CommonsHelper { | |
| 14 | + /** | |
| 15 | + * 填充地址信息 | |
| 16 | + * | |
| 17 | + * @param puerperaModel | |
| 18 | + * @return | |
| 19 | + */ | |
| 20 | + public static Address fullAddress(Patients puerperaModel,BasicConfigService basicConfigService) { | |
| 21 | + Address address = new Address(); | |
| 22 | + address.setArea(getName(puerperaModel.getAreaId(),basicConfigService)); | |
| 23 | + address.setCity(getName(puerperaModel.getCityId(),basicConfigService)); | |
| 24 | + address.setProvince(getName(puerperaModel.getProvinceId(),basicConfigService)); | |
| 25 | + address.setAddress(puerperaModel.getAddress()); | |
| 26 | + return address; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public static Address fullAddress(BabyModel puerperaModel,BasicConfigService basicConfigService) { | |
| 30 | + Address address = new Address(); | |
| 31 | + address.setArea(getName(puerperaModel.getAreaId(),basicConfigService)); | |
| 32 | + address.setCity(getName(puerperaModel.getCityId(),basicConfigService)); | |
| 33 | + address.setProvince(getName(puerperaModel.getProvinceId(),basicConfigService)); | |
| 34 | + address.setAddress(puerperaModel.getAddress()); | |
| 35 | + return address; | |
| 36 | + } | |
| 37 | + private static AddressInner getName(String id,BasicConfigService basicConfigService) { | |
| 38 | + AddressInner addressInner = new AddressInner(); | |
| 39 | + addressInner.setId(id); | |
| 40 | + BasicConfig config = basicConfigService.getOneBasicConfigById(id); | |
| 41 | + if (null == config) { | |
| 42 | + return addressInner; | |
| 43 | + } | |
| 44 | + addressInner.setName(config.getName()); | |
| 45 | + return addressInner; | |
| 46 | + } | |
| 47 | +} |