Commit 1f791e3ae4c5b919fbe4ae7334d762a890179fd3
1 parent
3fa691599c
Exists in
master
and in
8 other branches
code update
Showing 3 changed files with 120 additions and 2 deletions
platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java
View file @
1f791e3
... | ... | @@ -159,6 +159,16 @@ |
159 | 159 | } |
160 | 160 | |
161 | 161 | |
162 | + public static String replaceName(String name,String repalceStr) | |
163 | + { | |
164 | + if (StringUtils.isNotEmpty(repalceStr)) | |
165 | + { | |
166 | + return repalceStr.replace("{{姓名}}",name); | |
167 | + } | |
168 | + return repalceStr; | |
169 | + } | |
170 | + | |
171 | + | |
162 | 172 | // public static void main(String[] arg) { |
163 | 173 | // System.out.print(encryPhone("18382670036")); |
164 | 174 | // } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBookbuildingController.java
View file @
1f791e3
... | ... | @@ -16,6 +16,7 @@ |
16 | 16 | import org.springframework.web.bind.annotation.*; |
17 | 17 | |
18 | 18 | import javax.servlet.http.HttpServletRequest; |
19 | +import javax.servlet.http.HttpServletResponse; | |
19 | 20 | import javax.validation.Valid; |
20 | 21 | import java.io.UnsupportedEncodingException; |
21 | 22 | |
... | ... | @@ -107,7 +108,7 @@ |
107 | 108 | param.setVcCardNo(vcCardNo); |
108 | 109 | param.setHospitalId(hospitalId); |
109 | 110 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
110 | - return babyBookbuildingFacade.queryBabyBuildRecord(param,loginState.getId()); | |
111 | + return babyBookbuildingFacade.queryBabyBuildRecord(param, loginState.getId()); | |
111 | 112 | } |
112 | 113 | |
113 | 114 | |
... | ... | @@ -193,6 +194,42 @@ |
193 | 194 | request.setPage(page); |
194 | 195 | |
195 | 196 | return babyBookbuildingFacade.queryBabyList(request,loginState.getId()); |
197 | + } | |
198 | + | |
199 | + | |
200 | + @RequestMapping(value = "/exportChilds", method = RequestMethod.GET) | |
201 | + @ResponseBody | |
202 | + @TokenRequired | |
203 | + public void exportChilds(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse, | |
204 | + @RequestParam(value = "mcardNo", required = false) String mcardNo, | |
205 | + @RequestParam(value = "bcardNo", required = false) String bcardNo, | |
206 | + @RequestParam(value = "mphone", required = false) String mphone, | |
207 | + @RequestParam(value = "startMonthAge", required = false) Integer startMonthAge, | |
208 | + @RequestParam(value = "endMonthAge", required = false) Integer endMonthAge, | |
209 | + @RequestParam(value = "birth", required = false) String birth, | |
210 | + @RequestParam(value = "nextDate", required = false) String nextDate, | |
211 | + @RequestParam(value = "expVip", required = false) Integer expVip, | |
212 | + @RequestParam(value = "serviceType", required = false) Integer serviceType, | |
213 | + @RequestParam(value = "name", required = false) String name, | |
214 | + @RequestParam(value = "highRiskType", required = false) Integer highRiskType, | |
215 | + @RequestParam(value = "diagnose", required = false) String diagnose){ | |
216 | + LoginContext loginState = (LoginContext) httpServletRequest.getAttribute("loginContext"); | |
217 | + BabyManageRequest request = new BabyManageRequest(); | |
218 | + request.setBcardNo(bcardNo); | |
219 | + request.setMcardNo(mcardNo); | |
220 | + request.setMphone(mphone); | |
221 | + request.setMonthAgeStart(startMonthAge); | |
222 | + request.setMonthAgeEnd(endMonthAge); | |
223 | + request.setBirth(birth); | |
224 | + request.setNextDate(nextDate); | |
225 | + request.setExpVip(expVip); | |
226 | + request.setHighRiskType(highRiskType); | |
227 | + request.setServiceType(serviceType); | |
228 | + request.setDiagnose(diagnose); | |
229 | + request.setName(name); | |
230 | + | |
231 | + | |
232 | + babyBookbuildingFacade.exportChilds(request,loginState.getId(),httpServletResponse); | |
196 | 233 | } |
197 | 234 | |
198 | 235 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
1f791e3
... | ... | @@ -22,6 +22,9 @@ |
22 | 22 | import org.springframework.data.domain.Sort; |
23 | 23 | import org.springframework.stereotype.Component; |
24 | 24 | |
25 | +import javax.servlet.http.HttpServletResponse; | |
26 | +import java.io.IOException; | |
27 | +import java.io.OutputStream; | |
25 | 28 | import java.util.*; |
26 | 29 | |
27 | 30 | /** |
... | ... | @@ -605,7 +608,8 @@ |
605 | 608 | MessageListRequest smsList = new MessageListRequest(); |
606 | 609 | List<MessageRequest> messages = new ArrayList<>(); |
607 | 610 | MessageRequest mr = new MessageRequest(); |
608 | - mr.setContent("【" + messagePrefix + "】" + templateModel.getContent()); | |
611 | + String content = "【" + messagePrefix + "】" + templateModel.getContent(); | |
612 | + mr.setContent(StringUtils.replaceName(babyModel.getName(),content)); | |
609 | 613 | mr.setObjType(ServiceObjEnums.BABYOBJ.getId()); |
610 | 614 | mr.setPhone(babyModel.getMphone()); |
611 | 615 | //短信商 |
... | ... | @@ -1720,6 +1724,73 @@ |
1720 | 1724 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
1721 | 1725 | objectResponse.setErrormsg("成功"); |
1722 | 1726 | return objectResponse; |
1727 | + } | |
1728 | + | |
1729 | + public void exportChilds(BabyManageRequest request, Integer userId, HttpServletResponse httpServletResponse) { | |
1730 | + try { | |
1731 | + String hospitalId = ""; | |
1732 | + //得到当前登录的医院id | |
1733 | + if (userId != null) | |
1734 | + { | |
1735 | + Users dbuser = usersService.getUsers(userId); | |
1736 | + if (dbuser != null) { | |
1737 | + hospitalId = String.valueOf(dbuser.getOrgId()); | |
1738 | + } | |
1739 | + } | |
1740 | + List<Map<String,Object>> datas = new ArrayList<>(); | |
1741 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
1742 | + babyQuery.setHospitalId(String.valueOf(hospitalId)); | |
1743 | + List<BabyModel> models = getBabayListByCondition(request, false, babyQuery); | |
1744 | + if (CollectionUtils.isNotEmpty(models)) { | |
1745 | + for (BabyModel model : models) { | |
1746 | + Map<String,Object> data = new HashMap<>(); | |
1747 | + if (model.getHighRisk() == null || model.getHighRisk() == 0) { | |
1748 | + data.put("highRisk", "健康"); | |
1749 | + } else { | |
1750 | + data.put("highRisk", "高危"); | |
1751 | + } | |
1752 | + data.put("sex",StringUtils.emptyDeal(SexEnum.getTextById(model.getSex()))); | |
1753 | + data.put("babyName",StringUtils.emptyDeal(model.getName())); | |
1754 | + data.put("birthday", StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(model.getBirth()))); | |
1755 | + data.put("mommyName", StringUtils.emptyDeal(model.getMname())); | |
1756 | + data.put("mommnyPhone", StringUtils.emptyDeal(model.getMphone())); | |
1757 | + data.put("serviceStatus", StringUtils.emptyDeal(model.getServiceStatus() == null ? "" : ServiceStatusEnums.getNameById(model.getServiceStatus()))); | |
1758 | + data.put("nextDate", StringUtils.emptyDeal(DateUtil.getyyyy_MM_dd(model.getNextDate()))); | |
1759 | + data.put("monthAge", StringUtils.emptyDeal(DateUtil.getBabyMonthAge(model.getBirth(), new Date()))); | |
1760 | + | |
1761 | + String diagnose = ""; | |
1762 | + if (StringUtils.isNotEmpty(model.getPid())) | |
1763 | + { | |
1764 | + List diagList = babyCheckFacade.getBabyLastDiagnose(model.getPid()); | |
1765 | + if (CollectionUtils.isNotEmpty(diagList)) { | |
1766 | + for (Object obj : diagList) { | |
1767 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById((String) obj); | |
1768 | + if (basicConfig != null) { | |
1769 | + diagnose += basicConfig.getName() + " "; | |
1770 | + } | |
1771 | + } | |
1772 | + } | |
1773 | + } | |
1774 | + data.put("diagnose", diagnose); | |
1775 | + datas.add(data); | |
1776 | + } | |
1777 | + } | |
1778 | + OutputStream out = httpServletResponse.getOutputStream(); | |
1779 | + Map<String,String> cnames = new HashMap<>(); | |
1780 | + cnames.put("highRisk", "是否健康"); | |
1781 | + cnames.put("sex","性别"); | |
1782 | + cnames.put("babyName","儿童姓名"); | |
1783 | + cnames.put("birthday", "儿童生日"); | |
1784 | + cnames.put("mommyName", "母亲姓名"); | |
1785 | + cnames.put("mommnyPhone", "联系方式"); | |
1786 | + cnames.put("serviceStatus", "服务状态"); | |
1787 | + cnames.put("nextDate","下次预约时间"); | |
1788 | + cnames.put("monthAge","月龄"); | |
1789 | + cnames.put("diagnose","高危诊断"); | |
1790 | + ExcelUtil.toExcel(out,datas,cnames); | |
1791 | + } catch (IOException e) { | |
1792 | + e.printStackTrace(); | |
1793 | + } | |
1723 | 1794 | } |
1724 | 1795 | } |