Commit 62b3920b2bbcec17c4e331e7cb47f5edb8f99734
1 parent
2b74e1a374
Exists in
master
and in
6 other branches
update
Showing 5 changed files with 151 additions and 13 deletions
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/MessagesResult.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyCheckPageResult.java
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
62b3920
... | ... | @@ -1578,10 +1578,10 @@ |
1578 | 1578 | public static void main(String[] args) { |
1579 | 1579 | |
1580 | 1580 | Date bir = parseYMD("1992-03-29"); |
1581 | - Date bir1 = parseYMD("2020-03-29"); | |
1581 | + Date bir1 = parseYMD("2020-03-25"); | |
1582 | 1582 | |
1583 | - Integer i = getAge(bir, bir1); | |
1584 | - System.out.println(i); | |
1583 | + Date i = addDay(bir1, 280); | |
1584 | + System.out.println(getyyyy_MM_dd(i)); | |
1585 | 1585 | |
1586 | 1586 | } |
1587 | 1587 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/ViewController.java
View file @
62b3920
... | ... | @@ -832,6 +832,19 @@ |
832 | 832 | return viewFacade.getBabyCheckPageInfo(id); |
833 | 833 | } |
834 | 834 | |
835 | + | |
836 | + /** | |
837 | + * 儿童检查页面打印获ams短信内容显示 | |
838 | + * @param buildId | |
839 | + * @param checkDate | |
840 | + * @return | |
841 | + */ | |
842 | + @RequestMapping(value = "/getBabyCheckMessage", method = RequestMethod.GET) | |
843 | + @ResponseBody | |
844 | + public BaseObjectResponse getBabyCheckMessage(@RequestParam String buildId,@RequestParam String checkDate) { | |
845 | + return viewFacade.getBabyCheckMessage(buildId,checkDate); | |
846 | + } | |
847 | + | |
835 | 848 | /** |
836 | 849 | * 根据儿童ID获取儿童量表数据 |
837 | 850 | * |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/ViewFacade.java
View file @
62b3920
... | ... | @@ -18,7 +18,12 @@ |
18 | 18 | import java.util.Set; |
19 | 19 | |
20 | 20 | import com.lyms.hospitalapi.qhdfy.QhdfyHisService; |
21 | +import com.lyms.platform.common.utils.*; | |
22 | +import com.lyms.platform.common.utils.HttpClientUtil; | |
23 | +import com.lyms.platform.operate.web.request.MessagesResult; | |
21 | 24 | import com.lyms.platform.operate.web.result.*; |
25 | +import com.lyms.platform.operate.web.utils.*; | |
26 | +import net.sf.json.JSONArray; | |
22 | 27 | import org.apache.commons.collections.CollectionUtils; |
23 | 28 | import org.apache.commons.collections.MapUtils; |
24 | 29 | import org.apache.commons.collections.map.HashedMap; |
25 | 30 | |
... | ... | @@ -87,19 +92,9 @@ |
87 | 92 | import com.lyms.platform.common.result.BaseObjectResponse; |
88 | 93 | import com.lyms.platform.common.result.BaseResponse; |
89 | 94 | import com.lyms.platform.common.result.RespBuilder; |
90 | -import com.lyms.platform.common.utils.DateUtil; | |
91 | -import com.lyms.platform.common.utils.ExceptionUtils; | |
92 | -import com.lyms.platform.common.utils.JsonUtil; | |
93 | -import com.lyms.platform.common.utils.SystemConfig; | |
94 | 95 | import com.lyms.platform.operate.web.request.AntExcAddOther; |
95 | 96 | import com.lyms.platform.operate.web.request.MatDeliverAddRequest; |
96 | 97 | import com.lyms.platform.operate.web.service.BabyEvaluationCriterionService; |
97 | -import com.lyms.platform.operate.web.utils.CommonsHelper; | |
98 | -import com.lyms.platform.operate.web.utils.FunvCommonUtil; | |
99 | -import com.lyms.platform.operate.web.utils.MongoUtil; | |
100 | -import com.lyms.platform.operate.web.utils.ResolveUtils; | |
101 | -import com.lyms.platform.operate.web.utils.UnitConstants; | |
102 | -import com.lyms.platform.operate.web.utils.UnitUtils; | |
103 | 98 | import com.lyms.platform.permission.dao.master.CouponMapper; |
104 | 99 | import com.lyms.platform.permission.model.Organization; |
105 | 100 | import com.lyms.platform.permission.model.OrganizationQuery; |
... | ... | @@ -147,6 +142,9 @@ |
147 | 142 | */ |
148 | 143 | @Component |
149 | 144 | public class ViewFacade { |
145 | + | |
146 | + public static final String AMS_URL = PropertiesUtils.getPropertyValue("ams_url"); | |
147 | + | |
150 | 148 | @Autowired |
151 | 149 | private BasicConfigService basicConfigService; |
152 | 150 | @Autowired |
153 | 151 | |
... | ... | @@ -5094,8 +5092,10 @@ |
5094 | 5092 | if (CollectionUtils.isNotEmpty(models)) { |
5095 | 5093 | babyModel = models.get(0); |
5096 | 5094 | } |
5095 | + | |
5097 | 5096 | result = getBabyCheckResult(checkModel, babyModel); |
5098 | 5097 | |
5098 | + | |
5099 | 5099 | /** 优惠券编号 */ |
5100 | 5100 | result.setCouponCode(couponService.findByType(id, 8)); |
5101 | 5101 | /** 优惠券编号血红蛋白 */ |
... | ... | @@ -5111,6 +5111,92 @@ |
5111 | 5111 | br.setErrormsg("成功"); |
5112 | 5112 | return br; |
5113 | 5113 | } |
5114 | + | |
5115 | + | |
5116 | + /** | |
5117 | + * | |
5118 | + * @param id 儿童档案id | |
5119 | + * @param checkDate 儿童检查日期 | |
5120 | + * @return | |
5121 | + */ | |
5122 | + public BaseObjectResponse getBabyCheckMessage(String id,String checkDate) { | |
5123 | + BabyModelQuery babyQuery = new BabyModelQuery(); | |
5124 | + babyQuery.setId(id); | |
5125 | + babyQuery.setYn(YnEnums.YES.getId()); | |
5126 | + BabyModel babyModel = null; | |
5127 | + | |
5128 | + BaseObjectResponse br = new BaseObjectResponse(); | |
5129 | + List<String> list = null; | |
5130 | + List<BabyModel> models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); | |
5131 | + if (CollectionUtils.isNotEmpty(models)) { | |
5132 | + babyModel = models.get(0); | |
5133 | + list = getBabyMessage(babyModel, checkDate); | |
5134 | + } | |
5135 | + | |
5136 | + br.setData(list); | |
5137 | + br.setErrorcode(ErrorCodeConstants.SUCCESS); | |
5138 | + br.setErrormsg("成功"); | |
5139 | + return br; | |
5140 | + } | |
5141 | + | |
5142 | + /** | |
5143 | + * 从ams获取对应儿童周龄的短信消息 | |
5144 | + */ | |
5145 | + private List<String> getBabyMessage(BabyModel babyModel,String checkDate) | |
5146 | + { | |
5147 | + List<String> contents = new ArrayList<>(); | |
5148 | + try { | |
5149 | + Date birth = babyModel.getBirth(); | |
5150 | + int week = DateUtil.getWeek(birth, DateUtil.parseYMD(checkDate)); | |
5151 | + StringBuffer sb = new StringBuffer(); | |
5152 | + if (week <= 154) | |
5153 | + { | |
5154 | + sb.append(week); | |
5155 | + sb.append(","); | |
5156 | + sb.append(week+1); | |
5157 | + sb.append(","); | |
5158 | + sb.append(week+2); | |
5159 | + sb.append(""); | |
5160 | + } | |
5161 | + else | |
5162 | + { | |
5163 | + sb.append("154"); | |
5164 | + sb.append(","); | |
5165 | + sb.append("155"); | |
5166 | + sb.append(","); | |
5167 | + sb.append("156"); | |
5168 | + } | |
5169 | + Map<String,String> param = new HashMap<>(); | |
5170 | + param.put("versionId","2"); | |
5171 | + param.put("title", sb.toString()); | |
5172 | + | |
5173 | + String url = AMS_URL +"/v1/getMessages"; | |
5174 | + String json = HttpClientUtil.doGet(url, param, "utf-8", ""); | |
5175 | + | |
5176 | + | |
5177 | + net.sf.json.JSONObject jsonObject = JsonUtil.getObj(json); | |
5178 | + if (jsonObject != null && jsonObject.getJSONArray("list") != null) { | |
5179 | + JSONArray jsonArray = jsonObject.getJSONArray("list"); | |
5180 | + String list = jsonArray.toString(); | |
5181 | + | |
5182 | + List<MessagesResult> messages = JsonUtil.toList(list, MessagesResult.class); | |
5183 | + if (messages != null && CollectionUtils.isNotEmpty(messages)) | |
5184 | + { | |
5185 | + for (MessagesResult msg : messages) | |
5186 | + { | |
5187 | + contents.add(msg.getContent()); | |
5188 | + } | |
5189 | + } | |
5190 | + } | |
5191 | + | |
5192 | + }catch (Exception e) | |
5193 | + { | |
5194 | + ExceptionUtils.catchException(e,"getMessages error"); | |
5195 | + } | |
5196 | + return contents; | |
5197 | + | |
5198 | + } | |
5199 | + | |
5114 | 5200 | |
5115 | 5201 | |
5116 | 5202 | private BabyCheckPageResult getBabyCheckResult(BabyCheckModel checkModel, BabyModel babyModel) { |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/MessagesResult.java
View file @
62b3920
1 | +package com.lyms.platform.operate.web.request; | |
2 | + | |
3 | + | |
4 | +/** | |
5 | + * Created by Administrator on 2020-06-10. | |
6 | + */ | |
7 | +public class MessagesResult { | |
8 | + | |
9 | + private String id; | |
10 | + private String content; | |
11 | + | |
12 | + public String getId() { | |
13 | + return id; | |
14 | + } | |
15 | + | |
16 | + public void setId(String id) { | |
17 | + this.id = id; | |
18 | + } | |
19 | + | |
20 | + public String getContent() { | |
21 | + return content; | |
22 | + } | |
23 | + | |
24 | + public void setContent(String content) { | |
25 | + this.content = content; | |
26 | + } | |
27 | + | |
28 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/BabyCheckPageResult.java
View file @
62b3920
... | ... | @@ -509,6 +509,17 @@ |
509 | 509 | private String socialContactIA; |
510 | 510 | private String socialContactDQ; |
511 | 511 | |
512 | + | |
513 | + private List<String> messages; | |
514 | + | |
515 | + public List<String> getMessages() { | |
516 | + return messages; | |
517 | + } | |
518 | + | |
519 | + public void setMessages(List<String> messages) { | |
520 | + this.messages = messages; | |
521 | + } | |
522 | + | |
512 | 523 | public String getExerciseIA() { |
513 | 524 | return exerciseIA; |
514 | 525 | } |