Commit 8ed1f00429e18076ce7ac1559fdcb7053ed539f8
1 parent
11abcc12f5
Exists in
master
and in
8 other branches
增加退出登录接口
Showing 2 changed files with 60 additions and 11 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/VisitFacade.java
View file @
8ed1f00
... | ... | @@ -71,10 +71,23 @@ |
71 | 71 | */ |
72 | 72 | public BaseObjectResponse findOneByCardNo(String cardNo) { |
73 | 73 | Patients puerperaModel = findOnePuerperaByCardNo(cardNo, 3); |
74 | - if (null == puerperaModel) { | |
75 | - return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.DEPT_NOT_EXISTS).setErrormsg("产妇信息不存在"); | |
74 | + if (null != puerperaModel) { | |
75 | + return doBiz(puerperaModel); | |
76 | 76 | } |
77 | - return doBiz(puerperaModel); | |
77 | + BabyModelQuery babyModelQuery =new BabyModelQuery(); | |
78 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
79 | + babyModelQuery.setMphone(cardNo); | |
80 | + List<BabyModel> babyModels = babyService.queryBabyWithQuery(babyModelQuery); | |
81 | + | |
82 | + if(CollectionUtils.isNotEmpty(babyModels)){ | |
83 | + VisitResult data = new VisitResult(); | |
84 | + BabyModel babyModel = babyModels.get(0); | |
85 | + data.convertToResult1(babyModel, CommonsHelper.fullAddress(babyModel, basicConfigService)); | |
86 | + data.setData(Collections.EMPTY_LIST); | |
87 | + return new BaseObjectResponse().setData(data).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); | |
88 | + } | |
89 | + | |
90 | + return new BaseObjectResponse().setErrorcode(ErrorCodeConstants.DEPT_NOT_EXISTS).setErrormsg("产妇信息不存在"); | |
78 | 91 | } |
79 | 92 | |
80 | 93 | /** |
... | ... | @@ -160,14 +173,7 @@ |
160 | 173 | } else { |
161 | 174 | // 表示是新的产妇直接新增 |
162 | 175 | // parentId = puerperaService.addPuerpera(visitRequest.getPuerpera().build()).getId(); |
163 | - Patients patients = visitRequest.getPatients(); | |
164 | - patients.setType(3); | |
165 | - patients.setYn(YnEnums.YES.getId()); | |
166 | - patients.setId(null); | |
167 | - patients.setCreated(new Date()); | |
168 | - patients.setModified(new Date()); | |
169 | - patients.setIsVisit(VisitStatusEnums.UNVISIT.getId()); | |
170 | - parentId = patientsService.addPatient(patients).getId(); | |
176 | + parentId= addOnePatients(visitRequest.getPatients()); | |
171 | 177 | } |
172 | 178 | |
173 | 179 | // 如果为空表示新增 |
... | ... | @@ -191,6 +197,31 @@ |
191 | 197 | patients.setModified(new Date()); |
192 | 198 | patientsService.updatePatient(patients); |
193 | 199 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
200 | + } | |
201 | + | |
202 | + /** | |
203 | + * | |
204 | + * 增加一个患者并根据患者的手机号去关联小孩的数据 | |
205 | + * | |
206 | + * @param patients | |
207 | + * @return | |
208 | + */ | |
209 | + public String addOnePatients(Patients patients){ | |
210 | + patients.setType(3); | |
211 | + patients.setYn(YnEnums.YES.getId()); | |
212 | + patients.setId(null); | |
213 | + patients.setCreated(new Date()); | |
214 | + patients.setModified(new Date()); | |
215 | + patients.setIsVisit(VisitStatusEnums.UNVISIT.getId()); | |
216 | + String parentId = patientsService.addPatient(patients).getId(); | |
217 | + | |
218 | + BabyModelQuery babyModelQuery = new BabyModelQuery(); | |
219 | + babyModelQuery.setMphone(patients.getPhone()); | |
220 | + babyModelQuery.setYn(YnEnums.YES.getId()); | |
221 | + BabyModel babyModel = new BabyModel(); | |
222 | + babyModel.setParentId(parentId); | |
223 | + babyService.findAndModify(babyModelQuery.convertToQuery(),babyModel); | |
224 | + return parentId; | |
194 | 225 | } |
195 | 226 | |
196 | 227 | /** |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/VisitResult.java
View file @
8ed1f00
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | |
7 | 7 | import com.lyms.platform.common.utils.DateUtil; |
8 | 8 | import com.lyms.platform.common.utils.JsonUtil; |
9 | +import com.lyms.platform.pojo.BabyModel; | |
9 | 10 | import com.lyms.platform.pojo.Patients; |
10 | 11 | import com.lyms.platform.pojo.PuerperaModel; |
11 | 12 | |
... | ... | @@ -128,6 +129,23 @@ |
128 | 129 | setDueDate(DateUtil.getyyyy_MM_dd(model.getDueDate())); |
129 | 130 | setDueType(model.getDueType()==null?"":model.getDueType()); |
130 | 131 | setName(model.getUsername()); |
132 | + } | |
133 | + | |
134 | + public void convertToResult1(BabyModel model,Address address) { | |
135 | + try { | |
136 | + setAddress(address); | |
137 | + } catch (Exception e) { | |
138 | + } | |
139 | + try { | |
140 | + setAge(DateUtil.getyyyy_MM_dd(model.getBirth())); | |
141 | + }catch (Exception e){ | |
142 | + } | |
143 | + setPhone(model.getMphone()); | |
144 | +// setId(model.getId()); | |
145 | +// setCardNo(null==model.getCardNo()?"":model.getCardNo()); | |
146 | + setCardNo(null==model.getMphone()?"":model.getMphone()); | |
147 | + setDueDate(DateUtil.getyyyy_MM_dd(model.getBirth())); | |
148 | + setName(model.getMname()); | |
131 | 149 | } |
132 | 150 | } |