Commit 933cda0467f19f1090cb0254c8cea6b0c460c527
1 parent
91b18c5347
Exists in
master
and in
1 other branch
update code
Showing 37 changed files with 2193 additions and 1 deletions
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPersonDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IStopPregnancyDao.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PersonDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/StopPregnancyDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PersonService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/SmsConfigService.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/StopPregnancyService.java
- platform-common/src/main/java/com/lyms/platform/common/enums/AmsServiceTypeEnum.java
- platform-common/src/main/java/com/lyms/platform/common/enums/StopPregEnums.java
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-common/src/main/java/com/lyms/platform/common/utils/HttpRequest.java
- platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java
- platform-dal/src/main/java/com/lyms/platform/pojo/BabyModel.java
- platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PersonModel.java
- platform-dal/src/main/java/com/lyms/platform/pojo/StopPregModel.java
- platform-dal/src/main/java/com/lyms/platform/query/SmsConfigQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/StopPregQuery.java
- platform-data-api/src/main/java/com/lyms/platform/data/controller/SmsController.java
- platform-data-api/src/main/java/com/lyms/platform/data/pojo/MessageContent.java
- platform-data-api/src/main/java/com/lyms/platform/data/pojo/MessageListRequest.java
- platform-data-api/src/main/java/com/lyms/platform/data/pojo/MessageRequest.java
- platform-data-api/src/main/java/com/lyms/platform/data/pojo/MessageResponseEntity.java
- platform-data-api/src/main/java/com/lyms/platform/data/pojo/PageInfo.java
- platform-data-api/src/main/java/com/lyms/platform/data/pojo/Tag.java
- platform-data-api/src/main/java/com/lyms/platform/data/service/SmsService.java
- platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
- platform-data-api/src/main/java/com/lyms/platform/data/util/AmsMessageService.java
- platform-data-api/src/main/java/com/lyms/platform/data/util/SaveMessageService.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StopPregnancyController.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/BookbuildingFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/StopPregnancyFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyBookbuildingAddRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/StopPregRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/YunBookbuildingAddRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/StopPregResult.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IPersonDao.java
View file @
933cda0
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.pojo.PersonModel; | |
| 5 | +import com.lyms.platform.pojo.StopPregModel; | |
| 6 | + | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by Administrator on 2016/7/5. | |
| 11 | + */ | |
| 12 | +public interface IPersonDao { | |
| 13 | + | |
| 14 | + | |
| 15 | + public PersonModel addPerson(PersonModel model); | |
| 16 | + | |
| 17 | + public void updatePerson(PersonModel obj, String id); | |
| 18 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IStopPregnancyDao.java
View file @
933cda0
| 1 | +package com.lyms.platform.biz.dal; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 4 | +import com.lyms.platform.pojo.StopPregModel; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Created by Administrator on 2016/7/5. | |
| 10 | + */ | |
| 11 | +public interface IStopPregnancyDao { | |
| 12 | + | |
| 13 | + public List<StopPregModel> queryStopPreg(MongoQuery mongoQuery); | |
| 14 | + | |
| 15 | + public StopPregModel addStopPreg(StopPregModel model); | |
| 16 | + | |
| 17 | + public void updateStopPreg(StopPregModel obj, String id); | |
| 18 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PersonDaoImpl.java
View file @
933cda0
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IPersonDao; | |
| 4 | +import com.lyms.platform.biz.dal.ISmsTemplateDao; | |
| 5 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 8 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 9 | +import com.lyms.platform.pojo.PersonModel; | |
| 10 | +import com.lyms.platform.pojo.SmsTemplateModel; | |
| 11 | +import org.springframework.stereotype.Repository; | |
| 12 | + | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +@Repository("personDao") | |
| 16 | +public class PersonDaoImpl extends BaseMongoDAOImpl<PersonModel> implements IPersonDao { | |
| 17 | + | |
| 18 | + @Override | |
| 19 | + public PersonModel addPerson(PersonModel model) { | |
| 20 | + return save(model); | |
| 21 | + } | |
| 22 | + | |
| 23 | + @Override | |
| 24 | + public void updatePerson(PersonModel obj, String id) { | |
| 25 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj); | |
| 26 | + } | |
| 27 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/StopPregnancyDaoImpl.java
View file @
933cda0
| 1 | +package com.lyms.platform.biz.dal.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IStopPregnancyDao; | |
| 4 | +import com.lyms.platform.common.dao.BaseMongoDAOImpl; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.pojo.StopPregModel; | |
| 9 | +import org.springframework.stereotype.Repository; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +@Repository("stopPregnancyDao") | |
| 14 | +public class StopPregnancyDaoImpl extends BaseMongoDAOImpl<StopPregModel> implements IStopPregnancyDao { | |
| 15 | + | |
| 16 | + | |
| 17 | + @Override | |
| 18 | + public List<StopPregModel> queryStopPreg(MongoQuery mongoQuery) { | |
| 19 | + return find(mongoQuery.convertToMongoQuery()); | |
| 20 | + } | |
| 21 | + | |
| 22 | + @Override | |
| 23 | + public StopPregModel addStopPreg(StopPregModel model) { | |
| 24 | + return save(model); | |
| 25 | + } | |
| 26 | + | |
| 27 | + @Override | |
| 28 | + public void updateStopPreg(StopPregModel obj, String id) { | |
| 29 | + update(new MongoQuery(new MongoCondition("id", id, MongoOper.IS)).convertToMongoQuery(), obj); | |
| 30 | + } | |
| 31 | + | |
| 32 | + | |
| 33 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/PersonService.java
View file @
933cda0
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | + | |
| 4 | +import com.lyms.platform.biz.dal.IPersonDao; | |
| 5 | +import com.lyms.platform.pojo.PersonModel; | |
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | + | |
| 9 | + | |
| 10 | +@Service | |
| 11 | +public class PersonService { | |
| 12 | + | |
| 13 | + @Autowired | |
| 14 | + private IPersonDao personDao; | |
| 15 | + | |
| 16 | + public PersonModel addPerson(PersonModel obj){ | |
| 17 | + return personDao.addPerson(obj); | |
| 18 | + } | |
| 19 | + | |
| 20 | + public void updatePerson(PersonModel obj, String id){ | |
| 21 | + personDao.updatePerson(obj, id); | |
| 22 | + } | |
| 23 | + | |
| 24 | + | |
| 25 | +} |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/SmsConfigService.java
View file @
933cda0
| ... | ... | @@ -25,6 +25,10 @@ |
| 25 | 25 | return smsConfigDao.querySmsConfigByHid(query.convertToQuery()); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | + public List<SmsConfigModel> querySmsConfig(SmsConfigQuery query) { | |
| 29 | + return smsConfigDao.querySmsConfigByHid(query.convertToQuery()); | |
| 30 | + } | |
| 31 | + | |
| 28 | 32 | public SmsConfigModel addSmsConfig(SmsConfigModel model) { |
| 29 | 33 | return smsConfigDao.addSmsConfig(model); |
| 30 | 34 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/StopPregnancyService.java
View file @
933cda0
| 1 | +package com.lyms.platform.biz.service; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.dal.IStopPregnancyDao; | |
| 4 | + | |
| 5 | +import com.lyms.platform.pojo.StopPregModel; | |
| 6 | +import com.lyms.platform.query.StopPregQuery; | |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | +import org.springframework.stereotype.Service; | |
| 9 | + | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | + | |
| 13 | +@Service("stopPregnancyService") | |
| 14 | +public class StopPregnancyService { | |
| 15 | + | |
| 16 | + @Autowired | |
| 17 | + private IStopPregnancyDao stopPregnancyDao; | |
| 18 | + | |
| 19 | + public List<StopPregModel> queryStopPreg(StopPregQuery query) { | |
| 20 | + return stopPregnancyDao.queryStopPreg(query.convertToQuery()); | |
| 21 | + } | |
| 22 | + public StopPregModel addStopPreg(StopPregModel model) { | |
| 23 | + return stopPregnancyDao.addStopPreg(model); | |
| 24 | + } | |
| 25 | + | |
| 26 | + public void updateStopPreg(StopPregModel model, String id) { | |
| 27 | + stopPregnancyDao.updateStopPreg(model, id); | |
| 28 | + } | |
| 29 | +} |
platform-common/src/main/java/com/lyms/platform/common/enums/AmsServiceTypeEnum.java
View file @
933cda0
platform-common/src/main/java/com/lyms/platform/common/enums/StopPregEnums.java
View file @
933cda0
| 1 | +package com.lyms.platform.common.enums; | |
| 2 | + | |
| 3 | + | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.HashMap; | |
| 6 | +import java.util.List; | |
| 7 | +import java.util.Map; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 终止妊娠原因 | |
| 11 | + * Created by lqy on 2016/06/27 | |
| 12 | + */ | |
| 13 | +public enum StopPregEnums { | |
| 14 | + | |
| 15 | + | |
| 16 | + GFX(0,"高风险高危"),PTTZ(1,"胚胎停止发育"),FYYW(2,"妊娠早期服用药物"),CQZDYX(3,"产前诊断阳性"),OTHER(3,"其他"); | |
| 17 | + | |
| 18 | + StopPregEnums(int id, String name) { | |
| 19 | + this.id = id; | |
| 20 | + this.name = name; | |
| 21 | + } | |
| 22 | + | |
| 23 | + private int id; | |
| 24 | + private String name; | |
| 25 | + | |
| 26 | + public String getName() { | |
| 27 | + return name; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setName(String name) { | |
| 31 | + this.name = name; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public int getId() { | |
| 35 | + return id; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public void setId(int id) { | |
| 39 | + this.id = id; | |
| 40 | + } | |
| 41 | + | |
| 42 | + | |
| 43 | + public static List<Map> getStopPregEnums() { | |
| 44 | + List<Map> list = new ArrayList<>(); | |
| 45 | + for (StopPregEnums e : StopPregEnums.values()) { | |
| 46 | + Map rootMap = new HashMap(); | |
| 47 | + rootMap.put("id", e.getId()); | |
| 48 | + rootMap.put("name", e.getName()); | |
| 49 | + list.add(rootMap); | |
| 50 | + } | |
| 51 | + return list; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public static String getNameById(int id) { | |
| 55 | + for (StopPregEnums e : StopPregEnums.values()) { | |
| 56 | + if(e.getId() == id) | |
| 57 | + { | |
| 58 | + return e.getName(); | |
| 59 | + } | |
| 60 | + } | |
| 61 | + return ""; | |
| 62 | + } | |
| 63 | +} |
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
933cda0
| ... | ... | @@ -450,6 +450,23 @@ |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | |
| 453 | + /** | |
| 454 | + * 获取当前日期是星期几<br> | |
| 455 | + * | |
| 456 | + * @param dt | |
| 457 | + * @return 当前日期是星期几 | |
| 458 | + */ | |
| 459 | + public static String getWeekOfDate(Date dt) { | |
| 460 | + String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; | |
| 461 | + Calendar cal = Calendar.getInstance(); | |
| 462 | + cal.setTime(dt); | |
| 463 | + System.out.println(cal.get(Calendar.DAY_OF_WEEK)); | |
| 464 | + int w = cal.get(Calendar.DAY_OF_WEEK) - 1; | |
| 465 | + if (w < 0) | |
| 466 | + w = 0; | |
| 467 | + return weekDays[w]; | |
| 468 | + } | |
| 469 | + | |
| 453 | 470 | |
| 454 | 471 | public static void main(String[] arg) { |
| 455 | 472 | /* Date today = new Date(1448336360000L); |
platform-common/src/main/java/com/lyms/platform/common/utils/HttpRequest.java
View file @
933cda0
| 1 | +package com.lyms.platform.common.utils; | |
| 2 | + | |
| 3 | +import java.io.*; | |
| 4 | +import java.net.ConnectException; | |
| 5 | +import java.net.HttpURLConnection; | |
| 6 | +import java.net.URL; | |
| 7 | +import java.net.URLConnection; | |
| 8 | +import java.util.HashMap; | |
| 9 | +import java.util.Iterator; | |
| 10 | +import java.util.List; | |
| 11 | +import java.util.Map; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * Created by lqy on 2016/7/5. | |
| 15 | + */ | |
| 16 | +public class HttpRequest { | |
| 17 | + /** | |
| 18 | + * 向指定URL发送GET方法的请求 | |
| 19 | + * @param url | |
| 20 | + * 发送请求的URL | |
| 21 | + * @param param | |
| 22 | + * 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 | |
| 23 | + * @return URL 所代表远程资源的响应结果 | |
| 24 | + */ | |
| 25 | + public static String sendGet(String url, String param) { | |
| 26 | + String result = ""; | |
| 27 | + BufferedReader in = null; | |
| 28 | + try { | |
| 29 | + String urlNameString = url + "?" + param; | |
| 30 | + URL realUrl = new URL(urlNameString); | |
| 31 | + // 打开和URL之间的连接 | |
| 32 | + URLConnection connection = realUrl.openConnection(); | |
| 33 | + // 设置通用的请求属性 | |
| 34 | + connection.setRequestProperty("accept", "*/*"); | |
| 35 | + connection.setRequestProperty("connection", "Keep-Alive"); | |
| 36 | + connection.setRequestProperty("user-agent", | |
| 37 | + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); | |
| 38 | + connection.setRequestProperty("Authorization", "healthbaby2015"); | |
| 39 | + // 建立实际的连接 | |
| 40 | + connection.connect(); | |
| 41 | + // 获取所有响应头字段 | |
| 42 | + Map<String, List<String>> map = connection.getHeaderFields(); | |
| 43 | + // 遍历所有的响应头字段 | |
| 44 | + for (String key : map.keySet()) { | |
| 45 | + System.out.println(key + "--->" + map.get(key)); | |
| 46 | + } | |
| 47 | + // 定义 BufferedReader输入流来读取URL的响应 | |
| 48 | + in = new BufferedReader(new InputStreamReader( | |
| 49 | + connection.getInputStream())); | |
| 50 | + String line; | |
| 51 | + while ((line = in.readLine()) != null) { | |
| 52 | + result += line; | |
| 53 | + } | |
| 54 | + } catch (Exception e) { | |
| 55 | + System.out.println("发送GET请求出现异常!" + e); | |
| 56 | + e.printStackTrace(); | |
| 57 | + } | |
| 58 | + // 使用finally块来关闭输入流 | |
| 59 | + finally { | |
| 60 | + try { | |
| 61 | + if (in != null) { | |
| 62 | + in.close(); | |
| 63 | + } | |
| 64 | + } catch (Exception e2) { | |
| 65 | + e2.printStackTrace(); | |
| 66 | + } | |
| 67 | + } | |
| 68 | + return result; | |
| 69 | + } | |
| 70 | + /** | |
| 71 | + * 向指定URL发送GET方法的请求 | |
| 72 | + * @param url | |
| 73 | + * 发送请求的URL | |
| 74 | + * @param params | |
| 75 | + * 请求参数 | |
| 76 | + * @return URL 所代表远程资源的响应结果 | |
| 77 | + */ | |
| 78 | + public static String sendGet(String url, Map<String,String> params,Map<String,String> headers) { | |
| 79 | + String result = ""; | |
| 80 | + BufferedReader in = null; | |
| 81 | + StringBuffer sb = new StringBuffer(); | |
| 82 | + if(params!=null && !params.isEmpty()) { | |
| 83 | + Iterator<String> keys = params.keySet().iterator(); | |
| 84 | + while(keys.hasNext()){ | |
| 85 | + String key = keys.next(); | |
| 86 | + String value = params.get(key); | |
| 87 | + if(sb.length()==0)sb.append("?"); | |
| 88 | + else sb.append("&"); | |
| 89 | + sb.append(key+"="+value); | |
| 90 | + } | |
| 91 | + } | |
| 92 | + try { | |
| 93 | + | |
| 94 | + URL realUrl = new URL(url +sb); | |
| 95 | + // 打开和URL之间的连接 | |
| 96 | + URLConnection connection = realUrl.openConnection(); | |
| 97 | + // 设置通用的请求属性 | |
| 98 | + connection.setRequestProperty("accept", "*/*"); | |
| 99 | + connection.setRequestProperty("connection", "Keep-Alive"); | |
| 100 | + connection.setRequestProperty("user-agent", | |
| 101 | + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); | |
| 102 | + connection.setRequestProperty("Accept-Charset", "utf-8"); | |
| 103 | + if(headers!=null && !headers.isEmpty()) { | |
| 104 | + Iterator<String> keys = headers.keySet().iterator(); | |
| 105 | + while(keys.hasNext()){ | |
| 106 | + String key = keys.next(); | |
| 107 | + String value = headers.get(key); | |
| 108 | + System.out.println(key+"====="+value); | |
| 109 | + connection.setRequestProperty(key,value); | |
| 110 | + } | |
| 111 | + } | |
| 112 | +// connection.setRequestProperty("Authorization", "healthbaby2015"); | |
| 113 | + // 建立实际的连接 | |
| 114 | + connection.connect(); | |
| 115 | + // 获取所有响应头字段 | |
| 116 | + Map<String, List<String>> map = connection.getHeaderFields(); | |
| 117 | + // 遍历所有的响应头字段 | |
| 118 | + for (String key : map.keySet()) { | |
| 119 | + System.out.println(key + "--->" + map.get(key)); | |
| 120 | + } | |
| 121 | + // 定义 BufferedReader输入流来读取URL的响应 | |
| 122 | + in = new BufferedReader(new InputStreamReader( | |
| 123 | + connection.getInputStream(),"utf-8")); | |
| 124 | + String line; | |
| 125 | + while ((line = in.readLine()) != null) { | |
| 126 | + result += line; | |
| 127 | + } | |
| 128 | + } catch (Exception e) { | |
| 129 | + System.out.println("发送GET请求出现异常!" + e); | |
| 130 | + e.printStackTrace(); | |
| 131 | + } | |
| 132 | + // 使用finally块来关闭输入流 | |
| 133 | + finally { | |
| 134 | + try { | |
| 135 | + if (in != null) { | |
| 136 | + in.close(); | |
| 137 | + } | |
| 138 | + } catch (Exception e2) { | |
| 139 | + e2.printStackTrace(); | |
| 140 | + } | |
| 141 | + } | |
| 142 | + return result; | |
| 143 | + } | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * 向指定 URL 发送POST方法的请求 | |
| 147 | + * | |
| 148 | + * @param url | |
| 149 | + * 发送请求的 URL | |
| 150 | + * @param param | |
| 151 | + * 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 | |
| 152 | + * @return 所代表远程资源的响应结果 | |
| 153 | + */ | |
| 154 | + public static String sendPost(String url, String param) { | |
| 155 | + PrintWriter out = null; | |
| 156 | + BufferedReader in = null; | |
| 157 | + String result = ""; | |
| 158 | + try { | |
| 159 | + URL realUrl = new URL(url); | |
| 160 | + // 打开和URL之间的连接 | |
| 161 | + URLConnection conn = realUrl.openConnection(); | |
| 162 | + // 设置通用的请求属性 | |
| 163 | + conn.setRequestProperty("accept", "*/*"); | |
| 164 | + conn.setRequestProperty("connection", "Keep-Alive"); | |
| 165 | + conn.setRequestProperty("user-agent", | |
| 166 | + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); | |
| 167 | + // 发送POST请求必须设置如下两行 | |
| 168 | + conn.setDoOutput(true); | |
| 169 | + conn.setDoInput(true); | |
| 170 | + conn.setRequestProperty("Method","POST"); | |
| 171 | + conn.setRequestProperty("Charset", "UTF-8"); | |
| 172 | + // 获取URLConnection对象对应的输出流 | |
| 173 | + out = new PrintWriter(conn.getOutputStream()); | |
| 174 | + // 发送请求参数 | |
| 175 | + out.print(param); | |
| 176 | + // flush输出流的缓冲 | |
| 177 | + out.flush(); | |
| 178 | + // 定义BufferedReader输入流来读取URL的响应 | |
| 179 | + in = new BufferedReader( | |
| 180 | + new InputStreamReader(conn.getInputStream())); | |
| 181 | + String line; | |
| 182 | + while ((line = in.readLine()) != null) { | |
| 183 | + result += line; | |
| 184 | + } | |
| 185 | + } catch (Exception e) { | |
| 186 | + System.out.println("发送 POST 请求出现异常!"+e); | |
| 187 | + e.printStackTrace(); | |
| 188 | + } | |
| 189 | + //使用finally块来关闭输出流、输入流 | |
| 190 | + finally{ | |
| 191 | + try{ | |
| 192 | + if(out!=null){ | |
| 193 | + out.close(); | |
| 194 | + } | |
| 195 | + if(in!=null){ | |
| 196 | + in.close(); | |
| 197 | + } | |
| 198 | + } | |
| 199 | + catch(IOException ex){ | |
| 200 | + ex.printStackTrace(); | |
| 201 | + } | |
| 202 | + } | |
| 203 | + return result; | |
| 204 | + } | |
| 205 | + | |
| 206 | + public static String sendPost(String url, String param,String auth) { | |
| 207 | + PrintWriter out = null; | |
| 208 | + BufferedReader in = null; | |
| 209 | + String result = ""; | |
| 210 | + try { | |
| 211 | + URL realUrl = new URL(url); | |
| 212 | + // 打开和URL之间的连接 | |
| 213 | + URLConnection conn = realUrl.openConnection(); | |
| 214 | + // 设置通用的请求属性 | |
| 215 | + conn.setRequestProperty("accept", "*/*"); | |
| 216 | + conn.setRequestProperty("connection", "Keep-Alive"); | |
| 217 | + conn.setRequestProperty("Authorization",auth); | |
| 218 | + conn.setRequestProperty("Content-Type","application/json"); | |
| 219 | + conn.setRequestProperty("user-agent", | |
| 220 | + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); | |
| 221 | + // 发送POST请求必须设置如下两行 | |
| 222 | + conn.setDoOutput(true); | |
| 223 | + conn.setDoInput(true); | |
| 224 | + conn.setRequestProperty("Method","POST"); | |
| 225 | + conn.setRequestProperty("Charset", "UTF-8"); | |
| 226 | + // 获取URLConnection对象对应的输出流 | |
| 227 | + out = new PrintWriter(conn.getOutputStream()); | |
| 228 | + // 发送请求参数 | |
| 229 | + out.print(param); | |
| 230 | + // flush输出流的缓冲 | |
| 231 | + out.flush(); | |
| 232 | + // 定义BufferedReader输入流来读取URL的响应 | |
| 233 | + in = new BufferedReader( | |
| 234 | + new InputStreamReader(conn.getInputStream())); | |
| 235 | + String line; | |
| 236 | + while ((line = in.readLine()) != null) { | |
| 237 | + result += line; | |
| 238 | + } | |
| 239 | + } catch (Exception e) { | |
| 240 | + System.out.println("发送 POST 请求出现异常!"+e); | |
| 241 | + e.printStackTrace(); | |
| 242 | + } | |
| 243 | + //使用finally块来关闭输出流、输入流 | |
| 244 | + finally{ | |
| 245 | + try{ | |
| 246 | + if(out!=null){ | |
| 247 | + out.close(); | |
| 248 | + } | |
| 249 | + if(in!=null){ | |
| 250 | + in.close(); | |
| 251 | + } | |
| 252 | + } | |
| 253 | + catch(IOException ex){ | |
| 254 | + ex.printStackTrace(); | |
| 255 | + } | |
| 256 | + } | |
| 257 | + return result; | |
| 258 | + } | |
| 259 | + | |
| 260 | + public static String Send(String sendUrl,String param){ | |
| 261 | + String retValue = null; | |
| 262 | + HttpURLConnection con = null; | |
| 263 | + URL url = null; | |
| 264 | + try { | |
| 265 | + url = new URL(sendUrl); | |
| 266 | + con = (HttpURLConnection) url.openConnection(); | |
| 267 | + con.setRequestMethod("POST"); | |
| 268 | + con.setDoInput(true); | |
| 269 | + con.setDoOutput(true); | |
| 270 | + PrintWriter out = new PrintWriter(con.getOutputStream()); | |
| 271 | + out.println(param); | |
| 272 | + out.flush(); | |
| 273 | + DataInputStream bin = new DataInputStream(con.getInputStream()); | |
| 274 | + StringBuffer buff = new StringBuffer(); | |
| 275 | + String line; | |
| 276 | + while ( (line = bin.readLine()) != null) { | |
| 277 | + buff.append(line+"\n"); | |
| 278 | + } | |
| 279 | + retValue = buff.toString(); | |
| 280 | + out.close(); | |
| 281 | + bin.close(); | |
| 282 | + con.disconnect(); | |
| 283 | + } | |
| 284 | + catch (ConnectException ce) {ce.printStackTrace();} | |
| 285 | + catch (IOException ie) {ie.printStackTrace();} | |
| 286 | + catch (Exception e) {e.printStackTrace();} | |
| 287 | + return retValue; | |
| 288 | + } | |
| 289 | + | |
| 290 | + public static void main(String[] args) { | |
| 291 | +// sendGet("http://localhost:8080/message_develop/sendMMS","id=222222"); | |
| 292 | +// String str = sendGet("http://data.api.healthbaby.com.cn/v1/messages","hospitalId=1&tagName=,高血压,&page=1&limit=9999"); | |
| 293 | + Map<String, String> headers = new HashMap<String, String>(); | |
| 294 | + headers.put("Authorization", "healthbaby2015"); | |
| 295 | + Map<String, String> params = new HashMap<String, String>(); | |
| 296 | + params.put("hospitalId", "e66aafcf-1be5-4cd0-89bc-cf65db7297cc"); | |
| 297 | + params.put("tagName", "1周"); | |
| 298 | + params.put("page", "1"); | |
| 299 | + params.put("limit", "999"); | |
| 300 | + | |
| 301 | + String str = sendGet("http://data.api.healthbaby.com.cn/v1/messages", | |
| 302 | + params,headers); | |
| 303 | + System.out.println(str); | |
| 304 | + } | |
| 305 | +} |
platform-common/src/main/java/com/lyms/platform/common/utils/StringUtils.java
View file @
933cda0
| ... | ... | @@ -31,5 +31,18 @@ |
| 31 | 31 | } |
| 32 | 32 | return false; |
| 33 | 33 | } |
| 34 | + | |
| 35 | + /** | |
| 36 | + * //+表示1个或多个(如"3"或"225"),*表示0个或多个([0-9]*)(如""或"1"或"22"), | |
| 37 | + * ?表示0个或1个([0-9]?)(如""或"7") | |
| 38 | + * @param str | |
| 39 | + * @return | |
| 40 | + */ | |
| 41 | + public static boolean isNum(String str){ | |
| 42 | + if(!isEmpty(str)){ | |
| 43 | + return str.matches("[0-9]+"); | |
| 44 | + } | |
| 45 | + return false; | |
| 46 | + } | |
| 34 | 47 | } |
platform-dal/src/main/java/com/lyms/platform/pojo/BabyModel.java
View file @
933cda0
| ... | ... | @@ -186,6 +186,17 @@ |
| 186 | 186 | //体验类型 |
| 187 | 187 | private Integer expType; |
| 188 | 188 | |
| 189 | + //person表的主键 | |
| 190 | + private String pid; | |
| 191 | + | |
| 192 | + public String getPid() { | |
| 193 | + return pid; | |
| 194 | + } | |
| 195 | + | |
| 196 | + public void setPid(String pid) { | |
| 197 | + this.pid = pid; | |
| 198 | + } | |
| 199 | + | |
| 189 | 200 | public Integer getExpType() { |
| 190 | 201 | return expType; |
| 191 | 202 | } |
platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
View file @
933cda0
| ... | ... | @@ -219,6 +219,17 @@ |
| 219 | 219 | //体验类型 |
| 220 | 220 | private Integer expType; |
| 221 | 221 | |
| 222 | + //person表主键 | |
| 223 | + private String pid; | |
| 224 | + | |
| 225 | + public String getPid() { | |
| 226 | + return pid; | |
| 227 | + } | |
| 228 | + | |
| 229 | + public void setPid(String pid) { | |
| 230 | + this.pid = pid; | |
| 231 | + } | |
| 232 | + | |
| 222 | 233 | public Integer getExpType() { |
| 223 | 234 | return expType; |
| 224 | 235 | } |
platform-dal/src/main/java/com/lyms/platform/pojo/PersonModel.java
View file @
933cda0
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.result.BaseModel; | |
| 4 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 5 | + | |
| 6 | +import java.util.Date; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 基本信息 | |
| 10 | + * | |
| 11 | + * @author lqy | |
| 12 | + */ | |
| 13 | +@Document(collection = "lyms_person") | |
| 14 | +public class PersonModel extends BaseModel { | |
| 15 | + | |
| 16 | + /** | |
| 17 | + * | |
| 18 | + */ | |
| 19 | + private static final long serialVersionUID = 1L; | |
| 20 | + | |
| 21 | + private String id; | |
| 22 | + | |
| 23 | + //姓名 | |
| 24 | + private String name; | |
| 25 | + | |
| 26 | + //身份证号 | |
| 27 | + private String cardNo; | |
| 28 | + | |
| 29 | + //手机 | |
| 30 | + private String phone; | |
| 31 | + | |
| 32 | + //生日 | |
| 33 | + private Date birth; | |
| 34 | + | |
| 35 | + //类型 1 孕妇 2 儿童 | |
| 36 | + private Integer type; | |
| 37 | + | |
| 38 | + private Date created; | |
| 39 | + | |
| 40 | + private Date modified; | |
| 41 | + | |
| 42 | + private Integer yn; | |
| 43 | + | |
| 44 | + public String getId() { | |
| 45 | + return id; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setId(String id) { | |
| 49 | + this.id = id; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public String getName() { | |
| 53 | + return name; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setName(String name) { | |
| 57 | + this.name = name; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public String getCardNo() { | |
| 61 | + return cardNo; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public void setCardNo(String cardNo) { | |
| 65 | + this.cardNo = cardNo; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public String getPhone() { | |
| 69 | + return phone; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public void setPhone(String phone) { | |
| 73 | + this.phone = phone; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public Date getBirth() { | |
| 77 | + return birth; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public void setBirth(Date birth) { | |
| 81 | + this.birth = birth; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public Integer getType() { | |
| 85 | + return type; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public void setType(Integer type) { | |
| 89 | + this.type = type; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public Date getCreated() { | |
| 93 | + return created; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public void setCreated(Date created) { | |
| 97 | + this.created = created; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public Date getModified() { | |
| 101 | + return modified; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public void setModified(Date modified) { | |
| 105 | + this.modified = modified; | |
| 106 | + } | |
| 107 | + | |
| 108 | + public Integer getYn() { | |
| 109 | + return yn; | |
| 110 | + } | |
| 111 | + | |
| 112 | + public void setYn(Integer yn) { | |
| 113 | + this.yn = yn; | |
| 114 | + } | |
| 115 | +} |
platform-dal/src/main/java/com/lyms/platform/pojo/StopPregModel.java
View file @
933cda0
| 1 | +package com.lyms.platform.pojo; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.result.BaseModel; | |
| 4 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 5 | + | |
| 6 | +import java.util.Date; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * 终止妊娠对象 | |
| 10 | + * Created by Administrator on 2016/7/5. | |
| 11 | + */ | |
| 12 | +@Document(collection = "lyms_stoppreg") | |
| 13 | +public class StopPregModel extends BaseModel { | |
| 14 | + private String id; | |
| 15 | + //孕妇建档id | |
| 16 | + private String pid; | |
| 17 | + | |
| 18 | + //终止原因 | |
| 19 | + private String stopReason; | |
| 20 | + | |
| 21 | + //备注 | |
| 22 | + private String remark; | |
| 23 | + | |
| 24 | + //终止妊娠日期 | |
| 25 | + private Date stopDate; | |
| 26 | + | |
| 27 | + //录入人 | |
| 28 | + private String inPerson; | |
| 29 | + | |
| 30 | + private Integer yn; | |
| 31 | + | |
| 32 | + private Date created; | |
| 33 | + | |
| 34 | + private Date modified; | |
| 35 | + | |
| 36 | + public Date getCreated() { | |
| 37 | + return created; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setCreated(Date created) { | |
| 41 | + this.created = created; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public Date getModified() { | |
| 45 | + return modified; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setModified(Date modified) { | |
| 49 | + this.modified = modified; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public Integer getYn() { | |
| 53 | + return yn; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setYn(Integer yn) { | |
| 57 | + this.yn = yn; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public String getId() { | |
| 61 | + return id; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public void setId(String id) { | |
| 65 | + this.id = id; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public String getPid() { | |
| 69 | + return pid; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public void setPid(String pid) { | |
| 73 | + this.pid = pid; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public String getStopReason() { | |
| 77 | + return stopReason; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public void setStopReason(String stopReason) { | |
| 81 | + this.stopReason = stopReason; | |
| 82 | + } | |
| 83 | + | |
| 84 | + public String getRemark() { | |
| 85 | + return remark; | |
| 86 | + } | |
| 87 | + | |
| 88 | + public void setRemark(String remark) { | |
| 89 | + this.remark = remark; | |
| 90 | + } | |
| 91 | + | |
| 92 | + public Date getStopDate() { | |
| 93 | + return stopDate; | |
| 94 | + } | |
| 95 | + | |
| 96 | + public void setStopDate(Date stopDate) { | |
| 97 | + this.stopDate = stopDate; | |
| 98 | + } | |
| 99 | + | |
| 100 | + public String getInPerson() { | |
| 101 | + return inPerson; | |
| 102 | + } | |
| 103 | + | |
| 104 | + public void setInPerson(String inPerson) { | |
| 105 | + this.inPerson = inPerson; | |
| 106 | + } | |
| 107 | +} |
platform-dal/src/main/java/com/lyms/platform/query/SmsConfigQuery.java
View file @
933cda0
| ... | ... | @@ -34,7 +34,10 @@ |
| 34 | 34 | //医院ID |
| 35 | 35 | private Integer hospitalId; |
| 36 | 36 | |
| 37 | + //指导发送时间 周几发送 | |
| 38 | + private String guideTime; | |
| 37 | 39 | |
| 40 | + | |
| 38 | 41 | @Override |
| 39 | 42 | public MongoQuery convertToQuery() { |
| 40 | 43 | MongoCondition condition = MongoCondition.newInstance(); |
| 41 | 44 | |
| ... | ... | @@ -48,7 +51,19 @@ |
| 48 | 51 | if (-1 != yn) { |
| 49 | 52 | condition = condition.and("yn", yn, MongoOper.IS); |
| 50 | 53 | } |
| 54 | + if (null != guideTime) { | |
| 55 | + condition = condition.and("guideTime", guideTime, MongoOper.LIKE); | |
| 56 | + } | |
| 51 | 57 | return condition.toMongoQuery(); |
| 58 | + } | |
| 59 | + | |
| 60 | + | |
| 61 | + public String getGuideTime() { | |
| 62 | + return guideTime; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void setGuideTime(String guideTime) { | |
| 66 | + this.guideTime = guideTime; | |
| 52 | 67 | } |
| 53 | 68 | |
| 54 | 69 | public String getId() { |
platform-dal/src/main/java/com/lyms/platform/query/StopPregQuery.java
View file @
933cda0
| 1 | +package com.lyms.platform.query; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.base.IConvertToNativeQuery; | |
| 4 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.common.result.BaseModel; | |
| 9 | +import org.bson.types.ObjectId; | |
| 10 | +import org.springframework.data.mongodb.core.mapping.Document; | |
| 11 | + | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 终止妊娠查询对象 | |
| 16 | + * Created by lqy on 2016/7/5. | |
| 17 | + */ | |
| 18 | +public class StopPregQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 19 | + private String id; | |
| 20 | + //孕妇建档id | |
| 21 | + private String pid; | |
| 22 | + | |
| 23 | + //终止原因 | |
| 24 | + private List stopReason; | |
| 25 | + | |
| 26 | + //备注 | |
| 27 | + private String remark; | |
| 28 | + | |
| 29 | + //终止妊娠日期 | |
| 30 | + private String stopDate; | |
| 31 | + | |
| 32 | + //录入人 | |
| 33 | + private String inPerson; | |
| 34 | + | |
| 35 | + private Integer yn; | |
| 36 | + | |
| 37 | + @Override | |
| 38 | + public MongoQuery convertToQuery() { | |
| 39 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 40 | + | |
| 41 | + if (null != pid) { | |
| 42 | + condition = condition.and("pid", pid, MongoOper.IS); | |
| 43 | + } | |
| 44 | + if (null != id) { | |
| 45 | + condition = condition.and("id", new ObjectId(id), MongoOper.IS); | |
| 46 | + } | |
| 47 | + if (-1 != yn) { | |
| 48 | + condition = condition.and("yn", yn, MongoOper.IS); | |
| 49 | + } | |
| 50 | + | |
| 51 | + return condition.toMongoQuery(); | |
| 52 | + } | |
| 53 | + | |
| 54 | + public Integer getYn() { | |
| 55 | + return yn; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setYn(Integer yn) { | |
| 59 | + this.yn = yn; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public String getId() { | |
| 63 | + return id; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setId(String id) { | |
| 67 | + this.id = id; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public String getPid() { | |
| 71 | + return pid; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setPid(String pid) { | |
| 75 | + this.pid = pid; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public List getStopReason() { | |
| 79 | + return stopReason; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setStopReason(List stopReason) { | |
| 83 | + this.stopReason = stopReason; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public String getRemark() { | |
| 87 | + return remark; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setRemark(String remark) { | |
| 91 | + this.remark = remark; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public String getStopDate() { | |
| 95 | + return stopDate; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setStopDate(String stopDate) { | |
| 99 | + this.stopDate = stopDate; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public String getInPerson() { | |
| 103 | + return inPerson; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void setInPerson(String inPerson) { | |
| 107 | + this.inPerson = inPerson; | |
| 108 | + } | |
| 109 | +} |
platform-data-api/src/main/java/com/lyms/platform/data/controller/SmsController.java
View file @
933cda0
| 1 | +package com.lyms.platform.data.controller; | |
| 2 | + | |
| 3 | +import com.lyms.platform.data.pojo.MessageListRequest; | |
| 4 | +import com.lyms.platform.data.pojo.MessageRequest; | |
| 5 | +import com.lyms.platform.data.service.SmsService; | |
| 6 | +import com.lyms.platform.data.util.SaveMessageService; | |
| 7 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 8 | +import org.springframework.stereotype.Controller; | |
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 10 | + | |
| 11 | +import javax.servlet.http.HttpServletResponse; | |
| 12 | +import java.util.ArrayList; | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * Created by lqy on 2016/7/5. | |
| 17 | + */ | |
| 18 | +@Controller | |
| 19 | +@RequestMapping("/sms") | |
| 20 | +public class SmsController extends BaseController { | |
| 21 | + | |
| 22 | + @Autowired | |
| 23 | + private SmsService smsService; | |
| 24 | + /** | |
| 25 | + * 生成短信 | |
| 26 | + * @param response | |
| 27 | + */ | |
| 28 | + @RequestMapping(value = "/test") | |
| 29 | + public void productSms(HttpServletResponse response){ | |
| 30 | + MessageListRequest list = new MessageListRequest(); | |
| 31 | + List<MessageRequest> messages = new ArrayList<>(); | |
| 32 | + MessageRequest request = new MessageRequest(); | |
| 33 | + request.setTypeId(1); | |
| 34 | + request.setContent("aaaa"); | |
| 35 | + request.setObjType(1); | |
| 36 | + request.setPhone("123333"); | |
| 37 | + request.setPlanTime("2015-01-06 15:22:12"); | |
| 38 | + request.setServiceType(1); | |
| 39 | + messages.add(request); | |
| 40 | + list.setTypeId(1); | |
| 41 | + list.setMessages(messages); | |
| 42 | + SaveMessageService.saveSmsCenter(list); | |
| 43 | + writeString(response, "success"); | |
| 44 | + } | |
| 45 | +} |
platform-data-api/src/main/java/com/lyms/platform/data/pojo/MessageContent.java
View file @
933cda0
| 1 | +package com.lyms.platform.data.pojo; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | +import java.util.List; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Created by Administrator on 2016/7/5. | |
| 8 | + */ | |
| 9 | +public class MessageContent implements Serializable { | |
| 10 | + private static final long serialVersionUID = 1L; | |
| 11 | + private String id; | |
| 12 | + private String content; | |
| 13 | + private String title; | |
| 14 | + private List<Tag> tags; | |
| 15 | + public String getId() { | |
| 16 | + return id; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public void setId(String id) { | |
| 20 | + this.id = id; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public String getContent() { | |
| 24 | + return content; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void setContent(String content) { | |
| 28 | + this.content = content; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public String getTitle() { | |
| 32 | + return title; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setTitle(String title) { | |
| 36 | + this.title = title; | |
| 37 | + } | |
| 38 | + | |
| 39 | + public List<Tag> getTags() { | |
| 40 | + return tags; | |
| 41 | + } | |
| 42 | + | |
| 43 | + public void setTags(List<Tag> tags) { | |
| 44 | + this.tags = tags; | |
| 45 | + } | |
| 46 | + | |
| 47 | + @Override | |
| 48 | + public String toString() { | |
| 49 | + return "MessageContent [content=" + content + ", id=" + id + ", Tags=" | |
| 50 | + + tags + ", title=" + title + "]"; | |
| 51 | + } | |
| 52 | +} |
platform-data-api/src/main/java/com/lyms/platform/data/pojo/MessageListRequest.java
View file @
933cda0
| 1 | +package com.lyms.platform.data.pojo; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by Administrator on 2016/7/5. | |
| 7 | + */ | |
| 8 | +public class MessageListRequest { | |
| 9 | + private Integer typeId; | |
| 10 | + | |
| 11 | + private List<MessageRequest> messages; | |
| 12 | + | |
| 13 | + public Integer getTypeId() { | |
| 14 | + return typeId; | |
| 15 | + } | |
| 16 | + | |
| 17 | + public void setTypeId(Integer typeId) { | |
| 18 | + this.typeId = typeId; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public List<MessageRequest> getMessages() { | |
| 22 | + return messages; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setMessages(List<MessageRequest> messages) { | |
| 26 | + this.messages = messages; | |
| 27 | + } | |
| 28 | +} |
platform-data-api/src/main/java/com/lyms/platform/data/pojo/MessageRequest.java
View file @
933cda0
| 1 | +package com.lyms.platform.data.pojo; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + * Created by Administrator on 2016/7/5. | |
| 5 | + */ | |
| 6 | +public class MessageRequest { | |
| 7 | + private String phone; | |
| 8 | + private String content; | |
| 9 | + private Integer typeId; | |
| 10 | + private Integer status; | |
| 11 | + private Integer subTypeId; | |
| 12 | + | |
| 13 | + private String tableName; | |
| 14 | + | |
| 15 | + //计划发送时间 | |
| 16 | + private String planTime; | |
| 17 | + | |
| 18 | + //实际发送时间 | |
| 19 | + private String actualTime; | |
| 20 | + | |
| 21 | + //对象类型 | |
| 22 | + private Integer objType; | |
| 23 | + | |
| 24 | + //短信商 | |
| 25 | + private Integer serviceType; | |
| 26 | + | |
| 27 | + //发送次数 | |
| 28 | + private Integer sendCount; | |
| 29 | + | |
| 30 | + private String ext1; | |
| 31 | + | |
| 32 | + private String ext2; | |
| 33 | + | |
| 34 | + private String ext3; | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + public String getPhone() { | |
| 39 | + return phone; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setPhone(String phone) { | |
| 43 | + this.phone = phone; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getContent() { | |
| 47 | + return content; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setContent(String content) { | |
| 51 | + this.content = content; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public Integer getTypeId() { | |
| 55 | + return typeId; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setTypeId(Integer typeId) { | |
| 59 | + this.typeId = typeId; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public Integer getStatus() { | |
| 63 | + return status; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public void setStatus(Integer status) { | |
| 67 | + this.status = status; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public Integer getSubTypeId() { | |
| 71 | + return subTypeId; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setSubTypeId(Integer subTypeId) { | |
| 75 | + this.subTypeId = subTypeId; | |
| 76 | + } | |
| 77 | + | |
| 78 | + public String getTableName() { | |
| 79 | + return tableName; | |
| 80 | + } | |
| 81 | + | |
| 82 | + public void setTableName(String tableName) { | |
| 83 | + this.tableName = tableName; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public String getPlanTime() { | |
| 87 | + return planTime; | |
| 88 | + } | |
| 89 | + | |
| 90 | + public void setPlanTime(String planTime) { | |
| 91 | + this.planTime = planTime; | |
| 92 | + } | |
| 93 | + | |
| 94 | + public String getActualTime() { | |
| 95 | + return actualTime; | |
| 96 | + } | |
| 97 | + | |
| 98 | + public void setActualTime(String actualTime) { | |
| 99 | + this.actualTime = actualTime; | |
| 100 | + } | |
| 101 | + | |
| 102 | + public Integer getObjType() { | |
| 103 | + return objType; | |
| 104 | + } | |
| 105 | + | |
| 106 | + public void setObjType(Integer objType) { | |
| 107 | + this.objType = objType; | |
| 108 | + } | |
| 109 | + | |
| 110 | + public Integer getServiceType() { | |
| 111 | + return serviceType; | |
| 112 | + } | |
| 113 | + | |
| 114 | + public void setServiceType(Integer serviceType) { | |
| 115 | + this.serviceType = serviceType; | |
| 116 | + } | |
| 117 | + | |
| 118 | + public Integer getSendCount() { | |
| 119 | + return sendCount; | |
| 120 | + } | |
| 121 | + | |
| 122 | + public void setSendCount(Integer sendCount) { | |
| 123 | + this.sendCount = sendCount; | |
| 124 | + } | |
| 125 | + | |
| 126 | + public String getExt1() { | |
| 127 | + return ext1; | |
| 128 | + } | |
| 129 | + | |
| 130 | + public void setExt1(String ext1) { | |
| 131 | + this.ext1 = ext1; | |
| 132 | + } | |
| 133 | + | |
| 134 | + public String getExt2() { | |
| 135 | + return ext2; | |
| 136 | + } | |
| 137 | + | |
| 138 | + public void setExt2(String ext2) { | |
| 139 | + this.ext2 = ext2; | |
| 140 | + } | |
| 141 | + | |
| 142 | + public String getExt3() { | |
| 143 | + return ext3; | |
| 144 | + } | |
| 145 | + | |
| 146 | + public void setExt3(String ext3) { | |
| 147 | + this.ext3 = ext3; | |
| 148 | + } | |
| 149 | +} |
platform-data-api/src/main/java/com/lyms/platform/data/pojo/MessageResponseEntity.java
View file @
933cda0
| 1 | +package com.lyms.platform.data.pojo; | |
| 2 | + | |
| 3 | +import java.util.List; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by Administrator on 2016/7/5. | |
| 7 | + */ | |
| 8 | +public class MessageResponseEntity { | |
| 9 | + private String errormsg; | |
| 10 | + private PageInfo pageInfo; | |
| 11 | + private List<MessageContent> list ; | |
| 12 | + private int errorcode; | |
| 13 | + public String getErrormsg() { | |
| 14 | + return errormsg; | |
| 15 | + } | |
| 16 | + public void setErrormsg(String errormsg) { | |
| 17 | + this.errormsg = errormsg; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public PageInfo getPageInfo() { | |
| 21 | + return pageInfo; | |
| 22 | + } | |
| 23 | + public void setPageInfo(PageInfo pageInfo) { | |
| 24 | + this.pageInfo = pageInfo; | |
| 25 | + } | |
| 26 | + public List<MessageContent> getList() { | |
| 27 | + return list; | |
| 28 | + } | |
| 29 | + public void setList(List<MessageContent> list) { | |
| 30 | + this.list = list; | |
| 31 | + } | |
| 32 | + public int getErrorcode() { | |
| 33 | + return errorcode; | |
| 34 | + } | |
| 35 | + public void setErrorcode(int errorcode) { | |
| 36 | + this.errorcode = errorcode; | |
| 37 | + } | |
| 38 | + @Override | |
| 39 | + public String toString() { | |
| 40 | + return "MessageResponseEntity [errorcode=" + errorcode + ", errormsg=" | |
| 41 | + + errormsg + ", list=" + list + ", pageInfo=" + pageInfo + "]"; | |
| 42 | + } | |
| 43 | +} |
platform-data-api/src/main/java/com/lyms/platform/data/pojo/PageInfo.java
View file @
933cda0
| 1 | +package com.lyms.platform.data.pojo; | |
| 2 | + | |
| 3 | +/** | |
| 4 | + *lqy | |
| 5 | + */ | |
| 6 | +public class PageInfo { | |
| 7 | + private int count; | |
| 8 | + private int lastPage; | |
| 9 | + private int limit; | |
| 10 | + private int page; | |
| 11 | + private int size; | |
| 12 | + | |
| 13 | + public int getCount() { | |
| 14 | + return count; | |
| 15 | + } | |
| 16 | + | |
| 17 | + public void setCount(int count) { | |
| 18 | + this.count = count; | |
| 19 | + } | |
| 20 | + | |
| 21 | + public int getLastPage() { | |
| 22 | + return lastPage; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public void setLastPage(int lastPage) { | |
| 26 | + this.lastPage = lastPage; | |
| 27 | + } | |
| 28 | + | |
| 29 | + public int getLimit() { | |
| 30 | + return limit; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public void setLimit(int limit) { | |
| 34 | + this.limit = limit; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public int getPage() { | |
| 38 | + return page; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public void setPage(int page) { | |
| 42 | + this.page = page; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public int getSize() { | |
| 46 | + return size; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public void setSize(int size) { | |
| 50 | + this.size = size; | |
| 51 | + } | |
| 52 | + | |
| 53 | + @Override | |
| 54 | + public String toString() { | |
| 55 | + return "PageInfo [count=" + count + ", lastPage=" + lastPage | |
| 56 | + + ", limit=" + limit + ", page=" + page + ", size=" + size | |
| 57 | + + "]"; | |
| 58 | + } | |
| 59 | + | |
| 60 | +} |
platform-data-api/src/main/java/com/lyms/platform/data/pojo/Tag.java
View file @
933cda0
| 1 | +package com.lyms.platform.data.pojo; | |
| 2 | + | |
| 3 | +import java.io.Serializable; | |
| 4 | + | |
| 5 | +/** | |
| 6 | + * Created by Administrator on 2016/7/5. | |
| 7 | + */ | |
| 8 | +public class Tag implements Serializable { | |
| 9 | + | |
| 10 | + private static final long serialVersionUID = 1L; | |
| 11 | + private String tagId; | |
| 12 | + private String tagName; | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + public String getTagId() { | |
| 17 | + return tagId; | |
| 18 | + } | |
| 19 | + | |
| 20 | + public void setTagId(String tagId) { | |
| 21 | + this.tagId = tagId; | |
| 22 | + } | |
| 23 | + | |
| 24 | + public String getTagName() { | |
| 25 | + return tagName; | |
| 26 | + } | |
| 27 | + | |
| 28 | + public void setTagName(String tagName) { | |
| 29 | + this.tagName = tagName; | |
| 30 | + } | |
| 31 | + | |
| 32 | + @Override | |
| 33 | + public String toString() { | |
| 34 | + return "Tag [tagId=" + tagId + ", tagName=" + tagName + "]"; | |
| 35 | + } | |
| 36 | +} |
platform-data-api/src/main/java/com/lyms/platform/data/service/SmsService.java
View file @
933cda0
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
View file @
933cda0
| 1 | +package com.lyms.platform.data.service.impl; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.SmsConfigService; | |
| 4 | +import com.lyms.platform.common.enums.AmsServiceTypeEnum; | |
| 5 | +import com.lyms.platform.common.enums.YnEnums; | |
| 6 | +import com.lyms.platform.common.utils.DateUtil; | |
| 7 | +import com.lyms.platform.data.pojo.MessageContent; | |
| 8 | +import com.lyms.platform.data.service.SmsService; | |
| 9 | +import com.lyms.platform.data.util.AmsMessageService; | |
| 10 | +import com.lyms.platform.pojo.SmsConfigModel; | |
| 11 | +import com.lyms.platform.query.SmsConfigQuery; | |
| 12 | +import org.apache.commons.collections.CollectionUtils; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.stereotype.Service; | |
| 15 | + | |
| 16 | +import java.util.Date; | |
| 17 | +import java.util.List; | |
| 18 | +import java.util.Map; | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * 短信生成 | |
| 22 | + * Created by Administrator on 2016/7/5. | |
| 23 | + */ | |
| 24 | +@Service("smsService") | |
| 25 | +public class SmsServiceImpl implements SmsService{ | |
| 26 | + | |
| 27 | + @Autowired | |
| 28 | + private SmsConfigService smsConfigService; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * 生成孕妇ams指导短信 | |
| 32 | + */ | |
| 33 | + @Override | |
| 34 | + public void productYunAmsSms() { | |
| 35 | + | |
| 36 | + SmsConfigQuery query = new SmsConfigQuery(); | |
| 37 | + query.setYn(YnEnums.YES.getId()); | |
| 38 | + String week = DateUtil.getWeekOfDate(new Date()); | |
| 39 | + query.setGuideTime(week); | |
| 40 | + //查询出对应周几要发送的的医院配置 | |
| 41 | + List<SmsConfigModel> configs = smsConfigService.querySmsConfig(query); | |
| 42 | + | |
| 43 | + if (CollectionUtils.isNotEmpty(configs)) | |
| 44 | + { | |
| 45 | + for(SmsConfigModel config : configs) | |
| 46 | + { | |
| 47 | + Integer hospitalId = config.getHospitalId(); | |
| 48 | + if (hospitalId == null || hospitalId == 0) | |
| 49 | + { | |
| 50 | + continue; | |
| 51 | + } | |
| 52 | + | |
| 53 | + // 查询短信模板 从ams平台配置的短信通过医院ID | |
| 54 | + Map<String, List<MessageContent>> mt = AmsMessageService | |
| 55 | + .getMessageTemplateMap(String.valueOf(hospitalId), | |
| 56 | + AmsServiceTypeEnum.YUN_GUIDE); | |
| 57 | + } | |
| 58 | + } | |
| 59 | + | |
| 60 | + } | |
| 61 | +} |
platform-data-api/src/main/java/com/lyms/platform/data/util/AmsMessageService.java
View file @
933cda0
| 1 | +package com.lyms.platform.data.util; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.enums.AmsServiceTypeEnum; | |
| 4 | +import com.lyms.platform.common.utils.HttpRequest; | |
| 5 | +import com.lyms.platform.common.utils.StringUtils; | |
| 6 | +import com.lyms.platform.data.pojo.MessageContent; | |
| 7 | +import com.lyms.platform.data.pojo.MessageResponseEntity; | |
| 8 | +import com.lyms.platform.data.pojo.Tag; | |
| 9 | +import org.apache.log4j.Logger; | |
| 10 | +import org.codehaus.jackson.JsonParseException; | |
| 11 | +import org.codehaus.jackson.map.JsonMappingException; | |
| 12 | +import org.codehaus.jackson.map.ObjectMapper; | |
| 13 | + | |
| 14 | +import java.io.IOException; | |
| 15 | +import java.util.ArrayList; | |
| 16 | +import java.util.HashMap; | |
| 17 | +import java.util.List; | |
| 18 | +import java.util.Map; | |
| 19 | +/** | |
| 20 | + * Created by lqy on 2016/7/5. | |
| 21 | + */ | |
| 22 | + | |
| 23 | +/** | |
| 24 | + * ams 接口服务 | |
| 25 | + * | |
| 26 | + */ | |
| 27 | +public class AmsMessageService { | |
| 28 | + private static final Logger logger = Logger.getLogger(AmsMessageService.class); | |
| 29 | + private static final String AMS_URL = "http://data.api.healthbaby.com.cn/v1/messages"; | |
| 30 | + private static final String AUTHORIZATION = "healthbaby2015"; | |
| 31 | + | |
| 32 | + | |
| 33 | + public static List<MessageContent> getMessageTemplate(String hospitalId) { | |
| 34 | + /** | |
| 35 | + * 1、根据医院id查询医院短信模板 2、String -> jsonObject 3、判断 返回 结果 | |
| 36 | + */ | |
| 37 | + Map<String, String> headers = new HashMap<String, String>(); | |
| 38 | + headers.put("Authorization", AUTHORIZATION); | |
| 39 | + Map<String, String> params = new HashMap<String, String>(); | |
| 40 | + params.put("hospitalId", hospitalId); | |
| 41 | + params.put("page", "1"); | |
| 42 | + params.put("limit", "9999"); | |
| 43 | + String str = HttpRequest.sendGet(AMS_URL, | |
| 44 | + params, headers); | |
| 45 | + System.out.println(str); | |
| 46 | + ObjectMapper om = new ObjectMapper(); | |
| 47 | + MessageResponseEntity mre = null; | |
| 48 | + try { | |
| 49 | + mre = om.readValue(str, MessageResponseEntity.class); | |
| 50 | + System.out.println(mre); | |
| 51 | + } catch (JsonParseException e) { | |
| 52 | + e.printStackTrace(); | |
| 53 | + } catch (JsonMappingException e) { | |
| 54 | + e.printStackTrace(); | |
| 55 | + } catch (IOException e) { | |
| 56 | + e.printStackTrace(); | |
| 57 | + } | |
| 58 | + if(mre !=null){ | |
| 59 | + if(mre.getErrorcode()==0){//成功 | |
| 60 | + return mre.getList(); | |
| 61 | + }else{//失败 | |
| 62 | + logger.error("error info :errorcode="+mre.getErrorcode() | |
| 63 | + +" errormsg="+mre.getErrormsg()); | |
| 64 | + } | |
| 65 | + }else{ | |
| 66 | + logger.error("接口调用失败!!!"); | |
| 67 | + } | |
| 68 | + return null; | |
| 69 | + } | |
| 70 | + | |
| 71 | + | |
| 72 | + public static Map<String,List<MessageContent>> getMessageTemplateMap(String hospitalId,AmsServiceTypeEnum serviceType) { | |
| 73 | + /** | |
| 74 | + * 1、根据医院id查询医院短信模板 2、String -> jsonObject 3、判断 返回 结果 | |
| 75 | + */ | |
| 76 | + Map<String, String> headers = new HashMap<String, String>(); | |
| 77 | + headers.put("Authorization", AUTHORIZATION); | |
| 78 | + Map<String, String> params = new HashMap<String, String>(); | |
| 79 | + params.put("hospitalId", hospitalId); | |
| 80 | + params.put("page", "1"); | |
| 81 | + params.put("limit", "9999"); | |
| 82 | + String str = HttpRequest.sendGet(AMS_URL, | |
| 83 | + params, headers); | |
| 84 | + System.out.println(str); | |
| 85 | + ObjectMapper om = new ObjectMapper(); | |
| 86 | + MessageResponseEntity mre = null; | |
| 87 | + Map<String,List<MessageContent>> map = new HashMap<String, List<MessageContent>>(); | |
| 88 | + try { | |
| 89 | + mre = om.readValue(str, MessageResponseEntity.class); | |
| 90 | + System.out.println(mre); | |
| 91 | + } catch (JsonParseException e) { | |
| 92 | + e.printStackTrace(); | |
| 93 | + } catch (JsonMappingException e) { | |
| 94 | + e.printStackTrace(); | |
| 95 | + } catch (IOException e) { | |
| 96 | + e.printStackTrace(); | |
| 97 | + } | |
| 98 | + if(mre !=null){ | |
| 99 | + if(mre.getErrorcode()==0){//成功 | |
| 100 | + List<MessageContent> mcs=mre.getList(); | |
| 101 | + for(int i = 0;i<mcs.size();i++){ | |
| 102 | + MessageContent mc = mcs.get(i); | |
| 103 | + List<Tag> tags = mc.getTags(); | |
| 104 | + for (int j = 0; j < tags.size(); j++) { | |
| 105 | + Tag tag=tags.get(j); | |
| 106 | + String type = getTagType(tag, serviceType); | |
| 107 | + if(!StringUtils.isEmpty(type)){ | |
| 108 | + List<MessageContent> list = map.get(type); | |
| 109 | + if(list==null){ | |
| 110 | + list = new ArrayList<MessageContent>(); | |
| 111 | + } | |
| 112 | + list.add(mc); | |
| 113 | + map.put(type, list); | |
| 114 | + }else continue; | |
| 115 | + } | |
| 116 | + } | |
| 117 | + }else{//失败 | |
| 118 | + logger.error("error info :errorcode="+mre.getErrorcode() | |
| 119 | + +" errormsg="+mre.getErrormsg()); | |
| 120 | + } | |
| 121 | + }else{ | |
| 122 | + logger.error("接口调用失败!!!"); | |
| 123 | + } | |
| 124 | + return map; | |
| 125 | + } | |
| 126 | + | |
| 127 | + public static String getTagType(Tag tag,AmsServiceTypeEnum serviceType){ | |
| 128 | + String re = null; | |
| 129 | + if(tag==null) return re; | |
| 130 | + String tagName = tag.getTagName(); | |
| 131 | + switch (serviceType) { | |
| 132 | + case CHILD_GUIDE: | |
| 133 | + boolean boo = tagName.endsWith("周"); | |
| 134 | + if(boo) { | |
| 135 | + String str = tagName.substring(0,tagName.length()-1); | |
| 136 | + if(StringUtils.isNum(str)){ | |
| 137 | + re = str; | |
| 138 | + } | |
| 139 | + } | |
| 140 | + break; | |
| 141 | + case YUN_GUIDE: | |
| 142 | + boolean end = tagName.endsWith("周"); | |
| 143 | + boolean start = tagName.startsWith("孕"); | |
| 144 | + if(start&&end) { | |
| 145 | + String str = tagName.substring(1,tagName.length()-1); | |
| 146 | + if(StringUtils.isNum(str)){ | |
| 147 | + re = str; | |
| 148 | + } | |
| 149 | + } | |
| 150 | + break; | |
| 151 | + case CHAN_GUIDE: | |
| 152 | + end = tagName.endsWith("周"); | |
| 153 | + start = tagName.startsWith("产后"); | |
| 154 | + if(start&&end) { | |
| 155 | + String str = tagName.substring(2,tagName.length()-1); | |
| 156 | + if(StringUtils.isNum(str)){ | |
| 157 | + re = str; | |
| 158 | + } | |
| 159 | + } | |
| 160 | + break; | |
| 161 | + case YUN_WARN: | |
| 162 | + end = tagName.endsWith("周"); | |
| 163 | + start = tagName.startsWith("孕"); | |
| 164 | + if(!start && !end) { | |
| 165 | + re = tagName; | |
| 166 | + } | |
| 167 | + break; | |
| 168 | + default: | |
| 169 | + break; | |
| 170 | + } | |
| 171 | + return re; | |
| 172 | + } | |
| 173 | + | |
| 174 | + | |
| 175 | + public static void main(String[] args) { | |
| 176 | + getMessageTemplateMap("8be01f59-ad25-4ae6-968d-8450c9421e0b", | |
| 177 | + AmsServiceTypeEnum.CHILD_GUIDE); | |
| 178 | + } | |
| 179 | + | |
| 180 | +} |
platform-data-api/src/main/java/com/lyms/platform/data/util/SaveMessageService.java
View file @
933cda0
| 1 | +package com.lyms.platform.data.util; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.utils.HttpRequest; | |
| 4 | +import com.lyms.platform.common.utils.JsonUtil; | |
| 5 | +import com.lyms.platform.data.pojo.MessageListRequest; | |
| 6 | +import com.lyms.platform.data.pojo.MessageRequest; | |
| 7 | + | |
| 8 | +import java.util.ArrayList; | |
| 9 | +import java.util.List; | |
| 10 | + | |
| 11 | +/** | |
| 12 | + * Created by Administrator on 2016/7/5. | |
| 13 | + */ | |
| 14 | +public class SaveMessageService { | |
| 15 | + | |
| 16 | + public static final String URL = "http://localhost:8090/v1/saveCreatedSMS"; | |
| 17 | + | |
| 18 | + public static boolean saveSmsCenter(MessageListRequest list) | |
| 19 | + { | |
| 20 | + String json = JsonUtil.obj2JsonString(list); | |
| 21 | + String result = HttpRequest.sendPost(URL,json,"YMer2016"); | |
| 22 | + return false; | |
| 23 | + } | |
| 24 | + | |
| 25 | + public static void main(String[] areg) | |
| 26 | + { | |
| 27 | + MessageListRequest list = new MessageListRequest(); | |
| 28 | + List<MessageRequest> messages = new ArrayList<>(); | |
| 29 | + MessageRequest request = new MessageRequest(); | |
| 30 | + request.setTypeId(1); | |
| 31 | + request.setContent("aaaa"); | |
| 32 | + request.setObjType(1); | |
| 33 | + request.setPhone("123333"); | |
| 34 | + request.setPlanTime("2015-01-06 15:22:12"); | |
| 35 | + request.setServiceType(1); | |
| 36 | + messages.add(request); | |
| 37 | + list.setTypeId(1); | |
| 38 | + list.setMessages(messages); | |
| 39 | + saveSmsCenter(list); | |
| 40 | + } | |
| 41 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/StopPregnancyController.java
View file @
933cda0
| 1 | +package com.lyms.platform.operate.web.controller; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.base.BaseController; | |
| 4 | +import com.lyms.platform.common.result.BaseResponse; | |
| 5 | +import com.lyms.platform.common.utils.StringUtils; | |
| 6 | +import com.lyms.platform.operate.web.facade.StopPregnancyFacade; | |
| 7 | +import com.lyms.platform.operate.web.request.StopPregRequest; | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.stereotype.Controller; | |
| 10 | +import org.springframework.web.bind.annotation.*; | |
| 11 | + | |
| 12 | +import javax.validation.Valid; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * 终止妊娠 | |
| 16 | + * Created by lqy on 2016/7/5. | |
| 17 | + */ | |
| 18 | +@Controller | |
| 19 | +public class StopPregnancyController extends BaseController { | |
| 20 | + | |
| 21 | + | |
| 22 | + @Autowired | |
| 23 | + private StopPregnancyFacade stopPregnancyFacade; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * 添加/更新 终止妊娠 | |
| 27 | + * @param request | |
| 28 | + * @return | |
| 29 | + */ | |
| 30 | + @RequestMapping(method = RequestMethod.POST, value = "/addOrUpStopPreg") | |
| 31 | + @ResponseBody | |
| 32 | + public BaseResponse addOrUpStopPreg(@Valid @RequestBody StopPregRequest request) { | |
| 33 | + if (!StringUtils.isEmpty(request.getId())) | |
| 34 | + { | |
| 35 | + return stopPregnancyFacade.updateStopPreg(request); | |
| 36 | + } | |
| 37 | + return stopPregnancyFacade.addStopPreg(request); | |
| 38 | + } | |
| 39 | + | |
| 40 | + /** | |
| 41 | + *查询终止妊娠记录 | |
| 42 | + * @param pid 孕妇建档Id | |
| 43 | + * @return | |
| 44 | + */ | |
| 45 | + @RequestMapping(method = RequestMethod.GET, value = "/queryStopPreg/{pid}") | |
| 46 | + @ResponseBody | |
| 47 | + public BaseResponse queryStopPreg(@PathVariable("pid")String pid) { | |
| 48 | + return stopPregnancyFacade.queryStopPreg(pid); | |
| 49 | + } | |
| 50 | + | |
| 51 | + | |
| 52 | + /** | |
| 53 | + * 返回该医院可选择的录入人 | |
| 54 | + * @param hospitalId 医院Id | |
| 55 | + * @return | |
| 56 | + */ | |
| 57 | + @RequestMapping(method = RequestMethod.GET, value = "/queryStopPreg/{hospitalId}") | |
| 58 | + @ResponseBody | |
| 59 | + public BaseResponse queryInPerson(@PathVariable("hospitalId")Integer hospitalId) { | |
| 60 | + return stopPregnancyFacade.queryInPerson(hospitalId); | |
| 61 | + } | |
| 62 | + | |
| 63 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
933cda0
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.dal.IPersonDao; | |
| 3 | 4 | import com.lyms.platform.biz.service.*; |
| 4 | 5 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | 6 | import com.lyms.platform.common.enums.*; |
| ... | ... | @@ -55,6 +56,10 @@ |
| 55 | 56 | @Autowired |
| 56 | 57 | private AntenatalExaminationFacade antenatalExaminationFacade; |
| 57 | 58 | |
| 59 | + | |
| 60 | + @Autowired | |
| 61 | + private PersonService personService; | |
| 62 | + | |
| 58 | 63 | /** |
| 59 | 64 | * 修改儿童建档 |
| 60 | 65 | * @param request |
| ... | ... | @@ -63,6 +68,20 @@ |
| 63 | 68 | public BaseResponse updateBabyBookbuilding(BabyBookbuildingAddRequest request) { |
| 64 | 69 | BabyModel model = getBabyModel(request); |
| 65 | 70 | model.setModified(new Date()); |
| 71 | + if (!StringUtils.isEmpty(request.getPid())) | |
| 72 | + { | |
| 73 | + PersonModel pmodel = new PersonModel(); | |
| 74 | + pmodel.setName(request.getBabyName()); | |
| 75 | + pmodel.setBirth(DateUtil.parseYMD(request.getBabyBirthday())); | |
| 76 | + pmodel.setPhone(request.getMommyPhone()); | |
| 77 | + pmodel.setCardNo(request.getMommyCertificateNum()); | |
| 78 | + pmodel.setType(1); | |
| 79 | + pmodel.setYn(YnEnums.YES.getId()); | |
| 80 | + pmodel.setModified(new Date()); | |
| 81 | + personService.updatePerson(pmodel, request.getPid()); | |
| 82 | + } | |
| 83 | + | |
| 84 | + | |
| 66 | 85 | babyBookbuildingService.updateBabyBuild(model, request.getId()); |
| 67 | 86 | return new BaseResponse().setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("成功"); |
| 68 | 87 | } |
| 69 | 88 | |
| ... | ... | @@ -115,7 +134,20 @@ |
| 115 | 134 | patients = yunBookbuildingService.addPregnantBookbuilding(patient); |
| 116 | 135 | } |
| 117 | 136 | |
| 137 | + | |
| 138 | + PersonModel pmodel = new PersonModel(); | |
| 139 | + pmodel.setName(request.getBabyName()); | |
| 140 | + pmodel.setBirth(DateUtil.parseYMD(request.getBabyBirthday())); | |
| 141 | + pmodel.setPhone(request.getMommyPhone()); | |
| 142 | + pmodel.setCardNo(request.getMommyCertificateNum()); | |
| 143 | + pmodel.setType(1); | |
| 144 | + pmodel.setYn(YnEnums.YES.getId()); | |
| 145 | + pmodel.setModified(new Date()); | |
| 146 | + pmodel.setCreated(new Date()); | |
| 147 | + PersonModel resultModel = personService.addPerson(pmodel); | |
| 148 | + | |
| 118 | 149 | BabyModel model = getBabyModel(request); |
| 150 | + model.setPid(resultModel.getId()); | |
| 119 | 151 | |
| 120 | 152 | model.setParentId(patients.getId()); |
| 121 | 153 | model.setCreated(new Date()); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BookbuildingFacade.java
View file @
933cda0
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.dal.IPersonDao; | |
| 3 | 4 | import com.lyms.platform.biz.service.BasicConfigService; |
| 5 | +import com.lyms.platform.biz.service.PersonService; | |
| 4 | 6 | import com.lyms.platform.common.enums.*; |
| 5 | 7 | import com.lyms.platform.common.result.BaseListResponse; |
| 8 | +import com.lyms.platform.common.utils.JsonUtil; | |
| 6 | 9 | import com.lyms.platform.common.utils.StringUtils; |
| 7 | 10 | import com.lyms.platform.common.utils.SystemConfig; |
| 8 | 11 | import com.lyms.platform.operate.web.request.BookbuildingQueryRequest; |
| ... | ... | @@ -12,6 +15,7 @@ |
| 12 | 15 | import com.lyms.platform.permission.model.Organization; |
| 13 | 16 | import com.lyms.platform.permission.service.OrganizationService; |
| 14 | 17 | import com.lyms.platform.pojo.BasicConfig; |
| 18 | +import com.lyms.platform.pojo.PersonModel; | |
| 15 | 19 | import com.lyms.platform.query.BasicConfigQuery; |
| 16 | 20 | import com.lyms.platform.query.PatientsQuery; |
| 17 | 21 | import org.apache.commons.collections.CollectionUtils; |
| ... | ... | @@ -42,6 +46,10 @@ |
| 42 | 46 | @Autowired |
| 43 | 47 | private OrganizationService organizationService; |
| 44 | 48 | |
| 49 | + | |
| 50 | + @Autowired | |
| 51 | + private PersonService personService; | |
| 52 | + | |
| 45 | 53 | /** |
| 46 | 54 | * 添加孕妇建档 |
| 47 | 55 | * @param yunRequest |
| 48 | 56 | |
| ... | ... | @@ -65,7 +73,23 @@ |
| 65 | 73 | return br; |
| 66 | 74 | } |
| 67 | 75 | |
| 76 | + PersonModel pmodel = new PersonModel(); | |
| 77 | + pmodel.setName(yunRequest.getPregnantName()); | |
| 78 | + pmodel.setBirth(DateUtil.parseYMD(yunRequest.getBirthday())); | |
| 79 | + pmodel.setPhone(yunRequest.getPregnantPhone()); | |
| 80 | + pmodel.setCardNo(yunRequest.getPregnantCertificateNum()); | |
| 81 | + pmodel.setType(1); | |
| 82 | + pmodel.setYn(YnEnums.YES.getId()); | |
| 83 | + pmodel.setCreated(new Date()); | |
| 84 | + pmodel.setModified(new Date()); | |
| 85 | + PersonModel resperson = personService.addPerson(pmodel); | |
| 86 | + | |
| 68 | 87 | Patients patient = getPatientsData(yunRequest); |
| 88 | + if (resperson != null) | |
| 89 | + { | |
| 90 | + patient.setPid(resperson.getId()); | |
| 91 | + } | |
| 92 | + | |
| 69 | 93 | patient.setCreated(new Date()); |
| 70 | 94 | patient.setModified(new Date()); |
| 71 | 95 | Patients p = yunBookbuildingService.addPregnantBookbuilding(patient); |
| ... | ... | @@ -74,7 +98,8 @@ |
| 74 | 98 | { |
| 75 | 99 | br.setErrorcode(ErrorCodeConstants.SYSTEM_ERROR); |
| 76 | 100 | br.setErrormsg("失败"); |
| 77 | - | |
| 101 | + return br; | |
| 102 | + | |
| 78 | 103 | } |
| 79 | 104 | br.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 80 | 105 | br.setErrormsg("成功"); |
| ... | ... | @@ -92,6 +117,20 @@ |
| 92 | 117 | |
| 93 | 118 | Patients patient = getPatientsData(yunRequest); |
| 94 | 119 | patient.setModified(new Date()); |
| 120 | + | |
| 121 | + if (!StringUtils.isEmpty(yunRequest.getPid())) | |
| 122 | + { | |
| 123 | + PersonModel pmodel = new PersonModel(); | |
| 124 | + pmodel.setName(yunRequest.getPregnantName()); | |
| 125 | + pmodel.setBirth(DateUtil.parseYMD(yunRequest.getBirthday())); | |
| 126 | + pmodel.setPhone(yunRequest.getPregnantPhone()); | |
| 127 | + pmodel.setCardNo(yunRequest.getPregnantCertificateNum()); | |
| 128 | + pmodel.setType(1); | |
| 129 | + pmodel.setYn(YnEnums.YES.getId()); | |
| 130 | + pmodel.setModified(new Date()); | |
| 131 | + personService.updatePerson(pmodel,yunRequest.getPid()); | |
| 132 | + } | |
| 133 | + | |
| 95 | 134 | yunBookbuildingService.updatePregnant(patient, id); |
| 96 | 135 | } |
| 97 | 136 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/StopPregnancyFacade.java
View file @
933cda0
| 1 | +package com.lyms.platform.operate.web.facade; | |
| 2 | + | |
| 3 | +import com.lyms.platform.biz.service.AntenatalExaminationService; | |
| 4 | +import com.lyms.platform.biz.service.BasicConfigService; | |
| 5 | +import com.lyms.platform.biz.service.PatientsService; | |
| 6 | +import com.lyms.platform.biz.service.StopPregnancyService; | |
| 7 | +import com.lyms.platform.common.constants.ErrorCodeConstants; | |
| 8 | +import com.lyms.platform.common.enums.StopPregEnums; | |
| 9 | +import com.lyms.platform.common.enums.YnEnums; | |
| 10 | +import com.lyms.platform.common.result.BaseObjectResponse; | |
| 11 | +import com.lyms.platform.common.result.BaseResponse; | |
| 12 | +import com.lyms.platform.common.utils.DateUtil; | |
| 13 | +import com.lyms.platform.common.utils.JsonUtil; | |
| 14 | +import com.lyms.platform.common.utils.StringUtils; | |
| 15 | +import com.lyms.platform.operate.web.request.StopPregRequest; | |
| 16 | +import com.lyms.platform.operate.web.result.AntexListResult; | |
| 17 | +import com.lyms.platform.operate.web.result.StopPregResult; | |
| 18 | +import com.lyms.platform.permission.model.Users; | |
| 19 | +import com.lyms.platform.permission.model.UsersQuery; | |
| 20 | +import com.lyms.platform.permission.service.UsersService; | |
| 21 | +import com.lyms.platform.pojo.AntExChuModel; | |
| 22 | +import com.lyms.platform.pojo.BasicConfig; | |
| 23 | +import com.lyms.platform.pojo.Patients; | |
| 24 | +import com.lyms.platform.pojo.StopPregModel; | |
| 25 | +import com.lyms.platform.query.AntExChuQuery; | |
| 26 | +import com.lyms.platform.query.PatientsQuery; | |
| 27 | +import com.lyms.platform.query.StopPregQuery; | |
| 28 | +import org.apache.commons.collections.CollectionUtils; | |
| 29 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 30 | +import org.springframework.stereotype.Component; | |
| 31 | + | |
| 32 | +import java.util.*; | |
| 33 | + | |
| 34 | +/** | |
| 35 | + * Created by Administrator on 2016/7/5. | |
| 36 | + */ | |
| 37 | +@Component | |
| 38 | +public class StopPregnancyFacade { | |
| 39 | + | |
| 40 | + @Autowired | |
| 41 | + private StopPregnancyService stopPregnancyService; | |
| 42 | + | |
| 43 | + @Autowired | |
| 44 | + private UsersService usersService; | |
| 45 | + | |
| 46 | + @Autowired | |
| 47 | + private AntenatalExaminationService antenatalExaminationService; | |
| 48 | + @Autowired | |
| 49 | + private PatientsService patientsService; | |
| 50 | + | |
| 51 | + @Autowired | |
| 52 | + private BasicConfigService basicConfigService; | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 更新终止妊娠 | |
| 56 | + * @param request | |
| 57 | + * @return | |
| 58 | + */ | |
| 59 | + public BaseResponse updateStopPreg(StopPregRequest request) { | |
| 60 | + StopPregModel model = getStopPregModel(request); | |
| 61 | + model.setModified(new Date()); | |
| 62 | + | |
| 63 | + stopPregnancyService.updateStopPreg(model,request.getId()); | |
| 64 | + BaseResponse objectResponse = new BaseResponse(); | |
| 65 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 66 | + objectResponse.setErrormsg("成功"); | |
| 67 | + return objectResponse; | |
| 68 | + } | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * 添加终止妊娠 | |
| 72 | + * @param request | |
| 73 | + * @return | |
| 74 | + */ | |
| 75 | + public BaseResponse addStopPreg(StopPregRequest request) { | |
| 76 | + | |
| 77 | + StopPregModel model = getStopPregModel(request); | |
| 78 | + model.setCreated(new Date()); | |
| 79 | + model.setModified(new Date()); | |
| 80 | + | |
| 81 | + stopPregnancyService.addStopPreg(model); | |
| 82 | + BaseResponse objectResponse = new BaseResponse(); | |
| 83 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 84 | + objectResponse.setErrormsg("成功"); | |
| 85 | + return objectResponse; | |
| 86 | + } | |
| 87 | + | |
| 88 | + private StopPregModel getStopPregModel(StopPregRequest request) { | |
| 89 | + StopPregModel model = new StopPregModel(); | |
| 90 | + | |
| 91 | + model.setPid(request.getPid()); | |
| 92 | + model.setYn(YnEnums.YES.getId()); | |
| 93 | + model.setInPerson(request.getInPerson()); | |
| 94 | + model.setRemark(request.getRemark()); | |
| 95 | + model.setStopDate(DateUtil.parseYMD(request.getStopDate())); | |
| 96 | + model.setStopReason(JsonUtil.obj2JsonString(request.getStopReason())); | |
| 97 | + | |
| 98 | + return model; | |
| 99 | + } | |
| 100 | + | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * 查询终止妊娠 | |
| 104 | + * @param pid | |
| 105 | + * @return | |
| 106 | + */ | |
| 107 | + public BaseResponse queryStopPreg(String pid) { | |
| 108 | + | |
| 109 | + Map map = new HashMap(); | |
| 110 | + StopPregQuery query = new StopPregQuery(); | |
| 111 | + query.setYn(YnEnums.YES.getId()); | |
| 112 | + query.setPid(pid); | |
| 113 | + StopPregResult result = null; | |
| 114 | + List<StopPregModel> stopPregs = stopPregnancyService.queryStopPreg(query); | |
| 115 | + if (CollectionUtils.isNotEmpty(stopPregs)) | |
| 116 | + { | |
| 117 | + StopPregModel model = stopPregs.get(0); | |
| 118 | + result = new StopPregResult(); | |
| 119 | + result.setPid(model.getPid()); | |
| 120 | + result.setRemark(model.getRemark()); | |
| 121 | + result.setId(model.getId()); | |
| 122 | + result.setStopDate(DateUtil.getyyyy_MM_dd(model.getStopDate())); | |
| 123 | + result.setStopReason(JsonUtil.str2Obj(model.getStopReason(), Map.class)); | |
| 124 | + | |
| 125 | + String inperson = model.getInPerson(); | |
| 126 | + Map pmap = new HashMap(); | |
| 127 | + if (!StringUtils.isEmpty(inperson)) | |
| 128 | + { | |
| 129 | + UsersQuery usersQuery = new UsersQuery(); | |
| 130 | + usersQuery.setYn(YnEnums.YES.getId()); | |
| 131 | + usersQuery.setId(Integer.parseInt(inperson)); | |
| 132 | + List<Users> users = usersService.queryUsers2(usersQuery); | |
| 133 | + if (CollectionUtils.isNotEmpty(users)) | |
| 134 | + { | |
| 135 | + pmap.put("inPerson",inperson); | |
| 136 | + pmap.put("personName", users.get(0) == null ? "" : users.get(0).getName()); | |
| 137 | + } | |
| 138 | + | |
| 139 | + } | |
| 140 | + result.setInPerson(pmap); | |
| 141 | + } | |
| 142 | + | |
| 143 | + //查询孕妇的基本信息 | |
| 144 | + AntexListResult antexListResult = null; | |
| 145 | + if(!StringUtils.isEmpty(pid)) | |
| 146 | + { | |
| 147 | + Patients patients = null; | |
| 148 | + | |
| 149 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 150 | + patientsQuery.setId(pid); | |
| 151 | + patientsQuery.setYn(YnEnums.YES.getId()); | |
| 152 | + | |
| 153 | + List<Patients> listPatiens = patientsService.queryPatient(patientsQuery); | |
| 154 | + if (CollectionUtils.isNotEmpty(listPatiens)) { | |
| 155 | + patients = listPatiens.get(0); | |
| 156 | + } | |
| 157 | + | |
| 158 | + if (null != patients) { | |
| 159 | + antexListResult = new AntexListResult(); | |
| 160 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 161 | + antExChuQuery.setParentId(patients.getId()); | |
| 162 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 163 | + //获取初诊记录 | |
| 164 | + List<AntExChuModel> antExChulist = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
| 165 | + AntExChuModel antExChuModel = null; | |
| 166 | + if (CollectionUtils.isNotEmpty(antExChulist)) { | |
| 167 | + antExChuModel = antExChulist.get(0); | |
| 168 | + } | |
| 169 | + //查询产前检查记录 | |
| 170 | + List list = antenatalExaminationService.findAllByParentId(patients.getId()); | |
| 171 | + List data = new ArrayList(); | |
| 172 | + if (null != antExChuModel && org.apache.commons.lang.StringUtils.isNotEmpty(antExChuModel.getHighrisk())) { | |
| 173 | + List l = JsonUtil.toList(antExChuModel.getHighrisk(), List.class); | |
| 174 | + data = queryRiskName(l); | |
| 175 | + } | |
| 176 | + | |
| 177 | + antexListResult.convertToResult(list, patients, antExChuModel); | |
| 178 | + | |
| 179 | + antexListResult.setRiskFactor(data); | |
| 180 | + } | |
| 181 | + | |
| 182 | + } | |
| 183 | + | |
| 184 | + | |
| 185 | + //原因枚举 | |
| 186 | + map.put("stopPregEnums", StopPregEnums.getStopPregEnums()); | |
| 187 | + | |
| 188 | + //终止妊娠信息 | |
| 189 | + map.put("stopPregInfo", result); | |
| 190 | + | |
| 191 | + //终止妊娠初始化时间 | |
| 192 | + map.put("stopPregDate", DateUtil.getyyyy_MM_dd(new Date())); | |
| 193 | + | |
| 194 | + //孕妇基本信息 | |
| 195 | + map.put("patientInfo",antexListResult); | |
| 196 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 197 | + objectResponse.setData(map); | |
| 198 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 199 | + objectResponse.setErrormsg("成功"); | |
| 200 | + return objectResponse; | |
| 201 | + } | |
| 202 | + | |
| 203 | + private List queryRiskName(List l) { | |
| 204 | + List data = new ArrayList(); | |
| 205 | + for (int i = 0; i < l.size(); i++) { | |
| 206 | + String key = (String) l.get(i); | |
| 207 | + BasicConfig basicConfig = basicConfigService.getOneBasicConfigById(key); | |
| 208 | + if (null != basicConfig) { | |
| 209 | + data.add(basicConfig.getName()); | |
| 210 | + } | |
| 211 | + } | |
| 212 | + return data; | |
| 213 | + } | |
| 214 | + | |
| 215 | + /** | |
| 216 | + * 返回该医院可选择的录入人 | |
| 217 | + * @param hospitalId | |
| 218 | + * @return | |
| 219 | + */ | |
| 220 | + public BaseResponse queryInPerson(Integer hospitalId) { | |
| 221 | + | |
| 222 | + UsersQuery usersQuery = new UsersQuery(); | |
| 223 | + usersQuery.setYn(YnEnums.YES.getId()); | |
| 224 | + usersQuery.setOrgId(hospitalId); | |
| 225 | + List<Users> users = usersService.queryUsers2(usersQuery); | |
| 226 | + Map pmap = new HashMap(); | |
| 227 | + if (CollectionUtils.isNotEmpty(users)) | |
| 228 | + { | |
| 229 | + for(Users user : users) | |
| 230 | + { | |
| 231 | + pmap.put("id",user.getId()); | |
| 232 | + pmap.put("name",user.getName()); | |
| 233 | + } | |
| 234 | + } | |
| 235 | + | |
| 236 | + BaseObjectResponse objectResponse = new BaseObjectResponse(); | |
| 237 | + objectResponse.setData(pmap); | |
| 238 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 239 | + objectResponse.setErrormsg("成功"); | |
| 240 | + return objectResponse; | |
| 241 | + } | |
| 242 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyBookbuildingAddRequest.java
View file @
933cda0
| ... | ... | @@ -152,6 +152,17 @@ |
| 152 | 152 | //是否高危 0 非高危 1高危 |
| 153 | 153 | private Integer highRisk; |
| 154 | 154 | |
| 155 | + //person表 | |
| 156 | + private String pid; | |
| 157 | + | |
| 158 | + public String getPid() { | |
| 159 | + return pid; | |
| 160 | + } | |
| 161 | + | |
| 162 | + public void setPid(String pid) { | |
| 163 | + this.pid = pid; | |
| 164 | + } | |
| 165 | + | |
| 155 | 166 | public void setDeliverOrg(String deliverOrg) { |
| 156 | 167 | this.deliverOrg = deliverOrg; |
| 157 | 168 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/StopPregRequest.java
View file @
933cda0
| 1 | +package com.lyms.platform.operate.web.request; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.core.annotation.form.FormParam; | |
| 4 | +import org.hibernate.validator.constraints.NotEmpty; | |
| 5 | + | |
| 6 | +import java.util.List; | |
| 7 | +import java.util.Map; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * 终止妊娠对象 | |
| 11 | + * Created by Administrator on 2016/7/5. | |
| 12 | + */ | |
| 13 | +public class StopPregRequest { | |
| 14 | + private String id; | |
| 15 | + //孕妇建档id | |
| 16 | + @FormParam | |
| 17 | + @NotEmpty(message = "孕妇建档id不能为空.") | |
| 18 | + private String pid; | |
| 19 | + | |
| 20 | + //终止原因 | |
| 21 | + private Map stopReason; | |
| 22 | + | |
| 23 | + //备注 | |
| 24 | + private String remark; | |
| 25 | + | |
| 26 | + //终止妊娠日期 | |
| 27 | + @FormParam | |
| 28 | + @NotEmpty(message = "终止妊娠日期不能为空.") | |
| 29 | + private String stopDate; | |
| 30 | + | |
| 31 | + //录入人 | |
| 32 | + @FormParam | |
| 33 | + @NotEmpty(message = "录入人不能为空.") | |
| 34 | + private String inPerson; | |
| 35 | + | |
| 36 | + public String getId() { | |
| 37 | + return id; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setId(String id) { | |
| 41 | + this.id = id; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public String getPid() { | |
| 45 | + return pid; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setPid(String pid) { | |
| 49 | + this.pid = pid; | |
| 50 | + } | |
| 51 | + | |
| 52 | + public Map getStopReason() { | |
| 53 | + return stopReason; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public void setStopReason(Map stopReason) { | |
| 57 | + this.stopReason = stopReason; | |
| 58 | + } | |
| 59 | + | |
| 60 | + public String getRemark() { | |
| 61 | + return remark; | |
| 62 | + } | |
| 63 | + | |
| 64 | + public void setRemark(String remark) { | |
| 65 | + this.remark = remark; | |
| 66 | + } | |
| 67 | + | |
| 68 | + public String getStopDate() { | |
| 69 | + return stopDate; | |
| 70 | + } | |
| 71 | + | |
| 72 | + public void setStopDate(String stopDate) { | |
| 73 | + this.stopDate = stopDate; | |
| 74 | + } | |
| 75 | + | |
| 76 | + public String getInPerson() { | |
| 77 | + return inPerson; | |
| 78 | + } | |
| 79 | + | |
| 80 | + public void setInPerson(String inPerson) { | |
| 81 | + this.inPerson = inPerson; | |
| 82 | + } | |
| 83 | +} |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/YunBookbuildingAddRequest.java
View file @
933cda0
| ... | ... | @@ -27,6 +27,8 @@ |
| 27 | 27 | //民族 |
| 28 | 28 | private String pregnantNationId; |
| 29 | 29 | //生日 |
| 30 | + @FormParam | |
| 31 | + @NotEmpty(message = "生日不能为空.") | |
| 30 | 32 | private String birthday; |
| 31 | 33 | //户籍类型 |
| 32 | 34 | private String pregnantCensusTypeId; |
| ... | ... | @@ -152,6 +154,18 @@ |
| 152 | 154 | |
| 153 | 155 | //孕妇体验类型 |
| 154 | 156 | private Integer expType; |
| 157 | + | |
| 158 | + //person表主键 | |
| 159 | + @FormParam | |
| 160 | + private String pid; | |
| 161 | + | |
| 162 | + public String getPid() { | |
| 163 | + return pid; | |
| 164 | + } | |
| 165 | + | |
| 166 | + public void setPid(String pid) { | |
| 167 | + this.pid = pid; | |
| 168 | + } | |
| 155 | 169 | |
| 156 | 170 | public Integer getExpType() { |
| 157 | 171 | return expType; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/StopPregResult.java
View file @
933cda0
| 1 | +package com.lyms.platform.operate.web.result; | |
| 2 | + | |
| 3 | + | |
| 4 | +import java.util.Map; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * Created by Administrator on 2016/7/5. | |
| 8 | + */ | |
| 9 | +public class StopPregResult { | |
| 10 | + private String id; | |
| 11 | + //孕妇建档id | |
| 12 | + private String pid; | |
| 13 | + | |
| 14 | + //终止原因 | |
| 15 | + private Map stopReason; | |
| 16 | + | |
| 17 | + //备注 | |
| 18 | + private String remark; | |
| 19 | + | |
| 20 | + //终止妊娠日期 | |
| 21 | + private String stopDate; | |
| 22 | + | |
| 23 | + //录入人 | |
| 24 | + private Map inPerson; | |
| 25 | + | |
| 26 | + public String getId() { | |
| 27 | + return id; | |
| 28 | + } | |
| 29 | + | |
| 30 | + public void setId(String id) { | |
| 31 | + this.id = id; | |
| 32 | + } | |
| 33 | + | |
| 34 | + public String getPid() { | |
| 35 | + return pid; | |
| 36 | + } | |
| 37 | + | |
| 38 | + public void setPid(String pid) { | |
| 39 | + this.pid = pid; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public Map getStopReason() { | |
| 43 | + return stopReason; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public void setStopReason(Map stopReason) { | |
| 47 | + this.stopReason = stopReason; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public String getRemark() { | |
| 51 | + return remark; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public void setRemark(String remark) { | |
| 55 | + this.remark = remark; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public String getStopDate() { | |
| 59 | + return stopDate; | |
| 60 | + } | |
| 61 | + | |
| 62 | + public void setStopDate(String stopDate) { | |
| 63 | + this.stopDate = stopDate; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public Map getInPerson() { | |
| 67 | + return inPerson; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public void setInPerson(Map inPerson) { | |
| 71 | + this.inPerson = inPerson; | |
| 72 | + } | |
| 73 | +} |