Commit 0041b0a0f0336fe5f024d0baf6d43da5c7a7d13c
Exists in
master
and in
8 other branches
Merge remote-tracking branch 'origin/master'
Showing 14 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntenatalExaminationDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PostReviewDaoImpl.java
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MongoSyncService.java
- platform-common/src/main/java/com/lyms/platform/common/dao/BaseMongoDAOImpl.java
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-common/src/main/java/com/lyms/platform/common/utils/LymsEncodeUtil.java
- platform-common/src/main/java/com/lyms/platform/common/utils/MongoSyncUtil.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-data-api/src/main/java/com/lyms/platform/data/controller/SmsController.java
- platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
- platform-data-api/src/main/resources/config.properties
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MongoSyncController.java
- platform-operate-api/src/main/resources/database.properties
- pom.xml
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntenatalExaminationDaoImpl.java
View file @
0041b0a
... | ... | @@ -71,7 +71,7 @@ |
71 | 71 | @Override |
72 | 72 | public List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date startDate,String hospitalId,String pid) { |
73 | 73 | |
74 | - AggregationOperation match = Aggregation.match(Criteria.where("nextCheckTime").gte("startDate").lte(startDate).and("parentId").is("pid").and("hospitalId").is(hospitalId)); | |
74 | + AggregationOperation match = Aggregation.match(Criteria.where("nextCheckTime").gte(startDate).and("parentId").is("pid").and("hospitalId").is(hospitalId)); | |
75 | 75 | AggregationOperation group = Aggregation.group("parentId").max("created").as("created"); |
76 | 76 | Aggregation aggregation = Aggregation.newAggregation(match, group); |
77 | 77 | AggregationResults<AntenatalExaminationModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_antex", AntenatalExaminationModel.class); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/PostReviewDaoImpl.java
View file @
0041b0a
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 | } |
87 | 87 | @Override |
88 | 88 | public List<PostReviewModel> queryPostOrder(Date orderDate, String hospitalId,String parentId) { |
89 | - AggregationOperation match = Aggregation.match(Criteria.where("nextCheckDate").gte(orderDate).lte(orderDate).and("hospitalId").is(hospitalId).and("parentId").is(parentId)); | |
89 | + AggregationOperation match = Aggregation.match(Criteria.where("nextCheckDate").gte(orderDate).and("hospitalId").is(hospitalId).and("parentId").is(parentId)); | |
90 | 90 | AggregationOperation group = Aggregation.group("parentId").max("created").as("created"); |
91 | 91 | Aggregation aggregation = Aggregation.newAggregation(match, group); |
92 | 92 | AggregationResults<PostReviewModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_postreview", PostReviewModel.class); |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/MongoSyncService.java
View file @
0041b0a
1 | +package com.lyms.platform.biz.service; | |
2 | + | |
3 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
4 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
5 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
6 | +import com.lyms.platform.common.utils.*; | |
7 | +import org.springframework.beans.factory.annotation.Autowired; | |
8 | +import org.springframework.data.mongodb.core.MongoTemplate; | |
9 | +import org.springframework.data.mongodb.core.query.Update; | |
10 | +import org.springframework.stereotype.Service; | |
11 | +import org.springframework.util.Assert; | |
12 | + | |
13 | +/** | |
14 | + * Created by Administrator on 2016/9/13 0013. | |
15 | + */ | |
16 | +@Service("mongoSyncService") | |
17 | +public class MongoSyncService { | |
18 | + | |
19 | + /** | |
20 | + * spring mongodb 集成操作类 | |
21 | + */ | |
22 | + @Autowired | |
23 | + protected MongoTemplate mongoTemplate; | |
24 | + | |
25 | + public static String mongo_crypto_key = Config.getItem("mongo_crypto_key", "0"); | |
26 | + | |
27 | + public boolean syncData(String action, String id, String className, String json) { | |
28 | + System.out.println(mongo_crypto_key); | |
29 | + System.out.println(action); | |
30 | + System.out.println(id); | |
31 | + System.out.println(className); | |
32 | + System.out.println(json); | |
33 | + try { | |
34 | + if ("ADD".equals(action)) { | |
35 | + Object entity = JsonUtil.str2Obj(LymsEncodeUtil.aesDecrypt(json, mongo_crypto_key), Class.forName(LymsEncodeUtil.aesDecrypt(className, mongo_crypto_key))); | |
36 | + Assert.notNull(entity, "execute insert method must not null."); | |
37 | + mongoTemplate.save(entity); | |
38 | + return true; | |
39 | + } else if ("UPDATE".equals(action)) { | |
40 | + Class cla = Class.forName(LymsEncodeUtil.aesDecrypt(className, mongo_crypto_key)); | |
41 | + Object obj = JsonUtil.str2Obj(LymsEncodeUtil.aesDecrypt(json, mongo_crypto_key), cla); | |
42 | + Update update = MongoConvertHelper.convertToNativeUpdate(ReflectionUtils.getUpdateField(obj)); | |
43 | + Assert.notNull(update, "execute update method must not null."); | |
44 | + mongoTemplate.updateMulti(new MongoQuery(new MongoCondition("id", LymsEncodeUtil.aesDecrypt(id, mongo_crypto_key), MongoOper.IS)).convertToMongoQuery(), update, cla); | |
45 | + return true; | |
46 | + } else if ("DELETE".equals(action)) { | |
47 | + Class cla = Class.forName(LymsEncodeUtil.aesDecrypt(className, mongo_crypto_key)); | |
48 | + mongoTemplate.findAllAndRemove(new MongoQuery(new MongoCondition("id", LymsEncodeUtil.aesDecrypt(id, mongo_crypto_key), MongoOper.IS)).convertToMongoQuery(), cla); | |
49 | + return true; | |
50 | + } | |
51 | + return false; | |
52 | + } catch (Exception e) { | |
53 | + e.printStackTrace(); | |
54 | + return false; | |
55 | + } | |
56 | + } | |
57 | + | |
58 | + | |
59 | +} |
platform-common/src/main/java/com/lyms/platform/common/dao/BaseMongoDAOImpl.java
View file @
0041b0a
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | |
3 | 3 | import com.lyms.platform.common.dao.operator.Page; |
4 | 4 | import com.lyms.platform.common.utils.MongoConvertHelper; |
5 | +import com.lyms.platform.common.utils.MongoSyncUtil; | |
5 | 6 | import com.lyms.platform.common.utils.ReflectionUtils; |
6 | 7 | import org.apache.commons.collections.CollectionUtils; |
7 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
8 | 9 | |
9 | 10 | |
... | ... | @@ -47,13 +48,19 @@ |
47 | 48 | Update update = MongoConvertHelper |
48 | 49 | .convertToNativeUpdate(ReflectionUtils.getUpdateField(obj)); |
49 | 50 | Assert.notNull(update, "execute update method must not null."); |
51 | +// query.getQueryObject().get() | |
50 | 52 | mongoTemplate.updateMulti(query, update, this.getEntityClass()); |
53 | + Object id = query.getQueryObject().get("id"); | |
54 | + if (id != null) { | |
55 | + MongoSyncUtil.sync("UPDATE", obj, id.toString()); | |
56 | + } | |
51 | 57 | } |
52 | 58 | |
53 | 59 | @Override |
54 | 60 | public T save(T entity) { |
55 | 61 | Assert.notNull(entity, "execute insert method must not null."); |
56 | 62 | mongoTemplate.insert(entity); |
63 | + MongoSyncUtil.sync("ADD", entity, ""); | |
57 | 64 | return entity; |
58 | 65 | } |
59 | 66 | |
... | ... | @@ -97,6 +104,10 @@ |
97 | 104 | } |
98 | 105 | |
99 | 106 | public void delete(Query query) { |
107 | + Object id = query.getQueryObject().get("id"); | |
108 | + if (id != null) { | |
109 | + MongoSyncUtil.sync("DELETE", "", id.toString()); | |
110 | + } | |
100 | 111 | mongoTemplate.findAllAndRemove(query, this.getEntityClass()); |
101 | 112 | } |
102 | 113 | public void delete(Query query,Class clazz) { |
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
0041b0a
... | ... | @@ -742,12 +742,15 @@ |
742 | 742 | // System.out.println(s); |
743 | 743 | // Date s = addDay(parseYMD("2016-02-26"), 168); |
744 | 744 | |
745 | - int start = 0; | |
746 | - int end = 1; | |
745 | + int start = 42; | |
746 | + int end = 42; | |
747 | 747 | |
748 | 748 | |
749 | - Date startDate = DateUtil.getNewDate(-end-1,"周",0); | |
750 | - Date endDate = DateUtil.getNewDate(-start,"周",0); | |
749 | +// Date startDate = DateUtil.getNewDate(-end-1,"周",1+1); | |
750 | +// Date endDate = DateUtil.getNewDate(-start,"周",0+1); | |
751 | + | |
752 | + Date startDate = DateUtil.getNewDate(-end,"天",1); | |
753 | + Date endDate = DateUtil.getNewDate(-start,"天",1); | |
751 | 754 | |
752 | 755 | System.out.println(startDate + "==="+ endDate); |
753 | 756 | } catch (Exception e) |
platform-common/src/main/java/com/lyms/platform/common/utils/LymsEncodeUtil.java
View file @
0041b0a
1 | +package com.lyms.platform.common.utils; | |
2 | + | |
3 | +import org.apache.commons.lang.*; | |
4 | +import sun.misc.BASE64Decoder; | |
5 | +import sun.misc.BASE64Encoder; | |
6 | + | |
7 | +import javax.crypto.Cipher; | |
8 | +import javax.crypto.KeyGenerator; | |
9 | +import javax.crypto.spec.SecretKeySpec; | |
10 | +import java.math.BigInteger; | |
11 | +import java.security.MessageDigest; | |
12 | +import java.security.SecureRandom; | |
13 | + | |
14 | +/** | |
15 | + * Created by Administrator on 2016/9/13 0013. | |
16 | + */ | |
17 | +public class LymsEncodeUtil { | |
18 | + | |
19 | + public static void main(String[] args) throws Exception { | |
20 | + String content = "我爱你"; | |
21 | + System.out.println("加密前:" + content); | |
22 | + | |
23 | + String key = "123456"; | |
24 | + System.out.println("加密密钥和解密密钥:" + key); | |
25 | + | |
26 | + String encrypt = aesEncrypt(content, key); | |
27 | + System.out.println("加密后:" + encrypt); | |
28 | + | |
29 | + String decrypt = aesDecrypt(encrypt, key); | |
30 | + System.out.println("解密后:" + decrypt); | |
31 | + } | |
32 | + | |
33 | + /** | |
34 | + * 将byte[]转为各种进制的字符串 | |
35 | + * @param bytes byte[] | |
36 | + * @param radix 可以转换进制的范围,从Character.MIN_RADIX到Character.MAX_RADIX,超出范围后变为10进制 | |
37 | + * @return 转换后的字符串 | |
38 | + */ | |
39 | + public static String binary(byte[] bytes, int radix){ | |
40 | + return new BigInteger(1, bytes).toString(radix);// 这里的1代表正数 | |
41 | + } | |
42 | + | |
43 | + /** | |
44 | + * base 64 encode | |
45 | + * @param bytes 待编码的byte[] | |
46 | + * @return 编码后的base 64 code | |
47 | + */ | |
48 | + public static String base64Encode(byte[] bytes){ | |
49 | + return new BASE64Encoder().encode(bytes); | |
50 | + } | |
51 | + | |
52 | + /** | |
53 | + * base 64 decode | |
54 | + * @param base64Code 待解码的base 64 code | |
55 | + * @return 解码后的byte[] | |
56 | + * @throws Exception | |
57 | + */ | |
58 | + public static byte[] base64Decode(String base64Code) throws Exception{ | |
59 | + return StringUtils.isEmpty(base64Code) ? null : new BASE64Decoder().decodeBuffer(base64Code); | |
60 | + } | |
61 | + | |
62 | + /** | |
63 | + * 获取byte[]的md5值 | |
64 | + * @param bytes byte[] | |
65 | + * @return md5 | |
66 | + * @throws Exception | |
67 | + */ | |
68 | + public static byte[] md5(byte[] bytes) throws Exception { | |
69 | + MessageDigest md = MessageDigest.getInstance("MD5"); | |
70 | + md.update(bytes); | |
71 | + | |
72 | + return md.digest(); | |
73 | + } | |
74 | + | |
75 | + /** | |
76 | + * 获取字符串md5值 | |
77 | + * @param msg | |
78 | + * @return md5 | |
79 | + * @throws Exception | |
80 | + */ | |
81 | + public static byte[] md5(String msg) throws Exception { | |
82 | + return StringUtils.isEmpty(msg) ? null : md5(msg.getBytes()); | |
83 | + } | |
84 | + | |
85 | + /** | |
86 | + * 结合base64实现md5加密 | |
87 | + * @param msg 待加密字符串 | |
88 | + * @return 获取md5后转为base64 | |
89 | + * @throws Exception | |
90 | + */ | |
91 | + public static String md5Encrypt(String msg) throws Exception{ | |
92 | + return StringUtils.isEmpty(msg) ? null : base64Encode(md5(msg)); | |
93 | + } | |
94 | + | |
95 | + /** | |
96 | + * AES加密 | |
97 | + * @param content 待加密的内容 | |
98 | + * @param encryptKey 加密密钥 | |
99 | + * @return 加密后的byte[] | |
100 | + * @throws Exception | |
101 | + */ | |
102 | + public static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception { | |
103 | + KeyGenerator kgen = KeyGenerator.getInstance("AES"); | |
104 | + kgen.init(128, new SecureRandom(encryptKey.getBytes())); | |
105 | + | |
106 | + Cipher cipher = Cipher.getInstance("AES"); | |
107 | + cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(kgen.generateKey().getEncoded(), "AES")); | |
108 | + | |
109 | + return cipher.doFinal(content.getBytes("utf-8")); | |
110 | + } | |
111 | + | |
112 | + /** | |
113 | + * AES加密为base 64 code | |
114 | + * @param content 待加密的内容 | |
115 | + * @param encryptKey 加密密钥 | |
116 | + * @return 加密后的base 64 code | |
117 | + * @throws Exception | |
118 | + */ | |
119 | + public static String aesEncrypt(String content, String encryptKey) throws Exception { | |
120 | + return base64Encode(aesEncryptToBytes(content, encryptKey)); | |
121 | + } | |
122 | + | |
123 | + /** | |
124 | + * AES解密 | |
125 | + * @param encryptBytes 待解密的byte[] | |
126 | + * @param decryptKey 解密密钥 | |
127 | + * @return 解密后的String | |
128 | + * @throws Exception | |
129 | + */ | |
130 | + public static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception { | |
131 | + KeyGenerator kgen = KeyGenerator.getInstance("AES"); | |
132 | + kgen.init(128, new SecureRandom(decryptKey.getBytes())); | |
133 | + | |
134 | + Cipher cipher = Cipher.getInstance("AES"); | |
135 | + cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(kgen.generateKey().getEncoded(), "AES")); | |
136 | + byte[] decryptBytes = cipher.doFinal(encryptBytes); | |
137 | + | |
138 | + return new String(decryptBytes); | |
139 | + } | |
140 | + | |
141 | + /** | |
142 | + * 将base 64 code AES解密 | |
143 | + * @param encryptStr 待解密的base 64 code | |
144 | + * @param decryptKey 解密密钥 | |
145 | + * @return 解密后的string | |
146 | + * @throws Exception | |
147 | + */ | |
148 | + public static String aesDecrypt(String encryptStr, String decryptKey) throws Exception { | |
149 | + return StringUtils.isEmpty(encryptStr) ? null : aesDecryptByBytes(base64Decode(encryptStr), decryptKey); | |
150 | + } | |
151 | + | |
152 | +} |
platform-common/src/main/java/com/lyms/platform/common/utils/MongoSyncUtil.java
View file @
0041b0a
1 | +package com.lyms.platform.common.utils; | |
2 | + | |
3 | +import com.lyms.platform.common.base.LoginContext; | |
4 | +import com.lyms.platform.common.base.PageInfo; | |
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.mchange.lang.LongUtils; | |
9 | +import org.apache.commons.httpclient.HttpClient; | |
10 | +import org.apache.commons.httpclient.NameValuePair; | |
11 | +import org.apache.commons.httpclient.methods.PostMethod; | |
12 | + | |
13 | +import java.util.HashMap; | |
14 | +import java.util.Map; | |
15 | + | |
16 | +/** | |
17 | + * Created by Administrator on 2016/9/13 0013. | |
18 | + */ | |
19 | +public class MongoSyncUtil { | |
20 | + | |
21 | + public static String mongo_sync = Config.getItem("mongo_sync", "0"); | |
22 | + public static String mongo_sync_url = Config.getItem("mongo_sync_url", "0"); | |
23 | + public static String mongo_sync_token = Config.getItem("mongo_sync_token", "0"); | |
24 | + public static String mongo_crypto_key = Config.getItem("mongo_crypto_key", "0"); | |
25 | + | |
26 | + public static boolean sync(String action, Object data, String id) { | |
27 | + System.out.println(mongo_sync +" :: "+id+" -- "+action); | |
28 | + if ("1".equals(mongo_sync)) { | |
29 | + boolean boo = false; | |
30 | + try { | |
31 | + HttpClient client = new HttpClient(); | |
32 | + client.getHttpConnectionManager().getParams().setConnectionTimeout(3000); | |
33 | + client.getHttpConnectionManager().getParams().setSoTimeout(3000); | |
34 | + PostMethod post = new MessageUtil.UTF8PostMethod(mongo_sync_url); | |
35 | + NameValuePair[] pairs = { | |
36 | + new NameValuePair("action", action), | |
37 | + new NameValuePair("token", mongo_sync_token), | |
38 | + new NameValuePair("className", LymsEncodeUtil.aesEncrypt(data.getClass().getName(), mongo_crypto_key)), | |
39 | + new NameValuePair("jsonData", LymsEncodeUtil.aesEncrypt(JsonUtil.obj2JsonString(data), mongo_crypto_key)), | |
40 | + new NameValuePair("id", LymsEncodeUtil.aesEncrypt(id, mongo_crypto_key)), | |
41 | + }; | |
42 | + post.setRequestBody(pairs); | |
43 | + client.executeMethod(post); | |
44 | + int statusCode = post.getStatusCode(); | |
45 | + System.out.println(post.getResponseBodyAsString()); | |
46 | + post.releaseConnection(); | |
47 | + if (200 == statusCode) { | |
48 | + boo = true; | |
49 | + } | |
50 | + return boo; | |
51 | + } catch (Exception e) { | |
52 | + e.printStackTrace(); | |
53 | + return boo; | |
54 | + } | |
55 | + } | |
56 | + return true; | |
57 | + } | |
58 | + | |
59 | + public static void main(String[] a) throws Exception { | |
60 | + System.out.println(MongoSyncUtil.mongo_sync); | |
61 | + MongoSyncUtil util = new MongoSyncUtil(); | |
62 | + System.out.println(util.getClass().getName()); | |
63 | + PageInfo info = new PageInfo(); | |
64 | + info.setCount(123); | |
65 | + info.setLimit(456); | |
66 | + Object aaa = JsonUtil.str2Obj(JsonUtil.obj2JsonString(info), Class.forName(info.getClass().getName())); | |
67 | + System.out.println(MD5Utils.md5(aaa.getClass().getName())); | |
68 | + System.out.println(LymsEncodeUtil.aesEncrypt("com.lyms.platform.common.utils.MongoSyncUtil", "Lymsh@2016")); | |
69 | + System.out.println(LymsEncodeUtil.aesDecrypt("JusDAcSiQQ6QmFo+VYVuS1YL8F3IPj0IXSd3zoNE6frCm+5TpiA0RRsD4MiXuh9e","Lymsh@2016123")); | |
70 | + } | |
71 | + | |
72 | +} |
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
0041b0a
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | import com.lyms.platform.common.utils.StringUtils; |
9 | 9 | import org.springframework.data.mongodb.core.query.Criteria; |
10 | 10 | |
11 | +import java.util.Arrays; | |
11 | 12 | import java.util.Date; |
12 | 13 | import java.util.List; |
13 | 14 | |
... | ... | @@ -504,7 +505,7 @@ |
504 | 505 | |
505 | 506 | MongoCondition condition12 = MongoCondition.newInstance("buildType", buildType, MongoOper.NE); |
506 | 507 | |
507 | - condition = condition.orCondition(new MongoCondition[]{condition12,condition1}); | |
508 | + condition = condition.orCondition(new MongoCondition[]{condition12, condition1}); | |
508 | 509 | }else if(null!=buildTypeList){ |
509 | 510 | MongoCondition mongoCondition=MongoCondition.newInstance("buildType",3,MongoOper.IS); |
510 | 511 | MongoCondition condition1=mongoCondition.and("enable", "1", MongoOper.IS); |
... | ... | @@ -596,8 +597,9 @@ |
596 | 597 | |
597 | 598 | |
598 | 599 | if (null != orServiceStatus && orServiceStatus.length > 1) { |
599 | - Criteria c = Criteria.where("serviceStatus").in(orServiceStatus[0], orServiceStatus[1]); | |
600 | - condition.andCondition(new MongoCondition(c)); | |
600 | + condition = condition.and("serviceStatus", Arrays.asList(orServiceStatus), MongoOper.IN); | |
601 | +// Criteria c = Criteria.where("serviceStatus").in(orServiceStatus[0], orServiceStatus[1]); | |
602 | +// condition.andCondition(new MongoCondition(c)); | |
601 | 603 | } |
602 | 604 | if (null != hcertificateNum) { |
603 | 605 | condition = condition.and("hcertificateNum", hcertificateNum, MongoOper.LIKE); |
platform-data-api/src/main/java/com/lyms/platform/data/controller/SmsController.java
View file @
0041b0a
... | ... | @@ -23,25 +23,34 @@ |
23 | 23 | @RequestMapping(value = "/template") |
24 | 24 | public void productSms(HttpServletResponse response){ |
25 | 25 | smsService.productTemplateSms(); |
26 | + smsService.productChanAmsSms(); | |
27 | + smsService.productYunAmsSms(); | |
28 | + smsService.productChildAmsSms(); | |
29 | + writeString(response, "success"); | |
30 | + } | |
26 | 31 | |
27 | -// smsService.productChanAmsSms(); | |
28 | -// smsService.productYunAmsSms(); | |
29 | -// smsService.productChildAmsSms(); | |
32 | + @RequestMapping(value = "/smsTemplate") | |
33 | + public void smsTemplate(HttpServletResponse response){ | |
34 | + smsService.productTemplateSms(); | |
35 | + writeString(response, "sms template success"); | |
36 | + } | |
30 | 37 | |
31 | -// MessageListRequest list = new MessageListRequest(); | |
32 | -// List<MessageRequest> messages = new ArrayList<>(); | |
33 | -// MessageRequest request = new MessageRequest(); | |
34 | -// request.setTypeId(1); | |
35 | -// request.setContent("aaaa"); | |
36 | -// request.setObjType(1); | |
37 | -// request.setPhone("123333"); | |
38 | -// request.setPlanTime("2015-01-06 15:22:12"); | |
39 | -// request.setServiceType(1); | |
40 | -// messages.add(request); | |
41 | -// list.setTypeId(1); | |
42 | -// list.setMessages(messages); | |
43 | -// SaveMessageService.saveSmsCenter(list); | |
44 | - writeString(response, "success"); | |
38 | + @RequestMapping(value = "/productChanAmsSms") | |
39 | + public void productChanAmsSms(HttpServletResponse response){ | |
40 | + smsService.productChanAmsSms(); | |
41 | + writeString(response, "chan ams success"); | |
42 | + } | |
43 | + | |
44 | + @RequestMapping(value = "/productYunAmsSms") | |
45 | + public void productYunAmsSms(HttpServletResponse response){ | |
46 | + smsService.productYunAmsSms(); | |
47 | + writeString(response, "yun ams success"); | |
48 | + } | |
49 | + | |
50 | + @RequestMapping(value = "/productChildAmsSms") | |
51 | + public void productChildAmsSms(HttpServletResponse response){ | |
52 | + smsService.productChildAmsSms(); | |
53 | + writeString(response, "child ams success"); | |
45 | 54 | } |
46 | 55 | } |
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
View file @
0041b0a
... | ... | @@ -2,10 +2,7 @@ |
2 | 2 | |
3 | 3 | import com.lyms.platform.biz.service.*; |
4 | 4 | import com.lyms.platform.common.enums.*; |
5 | -import com.lyms.platform.common.utils.DateUtil; | |
6 | -import com.lyms.platform.common.utils.JsonUtil; | |
7 | -import com.lyms.platform.common.utils.Lunar; | |
8 | -import com.lyms.platform.common.utils.StringUtils; | |
5 | +import com.lyms.platform.common.utils.*; | |
9 | 6 | import com.lyms.platform.data.pojo.HighScoreResult; |
10 | 7 | import com.lyms.platform.data.pojo.MessageContent; |
11 | 8 | import com.lyms.platform.data.pojo.MessageListRequest; |
... | ... | @@ -36,6 +33,9 @@ |
36 | 33 | @Service("smsService") |
37 | 34 | public class SmsServiceImpl implements SmsService{ |
38 | 35 | |
36 | + | |
37 | + public static final String SEND_TIME= PropertiesUtils.getPropertyValue("send_time"); | |
38 | + | |
39 | 39 | @Autowired |
40 | 40 | private SmsConfigService smsConfigService; |
41 | 41 | |
... | ... | @@ -386,6 +386,7 @@ |
386 | 386 | |
387 | 387 | BabyModelQuery babyQuery = new BabyModelQuery(); |
388 | 388 | babyQuery.setYn(YnEnums.YES.getId()); |
389 | + babyQuery.setHospitalId(hospitalId); | |
389 | 390 | |
390 | 391 | |
391 | 392 | //儿童年龄满三岁就不在提供短信服务 |
... | ... | @@ -511,6 +512,7 @@ |
511 | 512 | |
512 | 513 | PatientsQuery patientsQuery = new PatientsQuery(); |
513 | 514 | patientsQuery.setYn(YnEnums.YES.getId()); |
515 | + patientsQuery.setHospitalId(hospitalId); | |
514 | 516 | //1孕妇 3 产妇 |
515 | 517 | patientsQuery.setType(3); |
516 | 518 | patientsQuery.setDueStatus(0); |
... | ... | @@ -550,12 +552,7 @@ |
550 | 552 | { |
551 | 553 | for(MessageContent message : messageContents) |
552 | 554 | { |
553 | - //判断当前短信是否已经发送 通过短信ID和孕妇ID | |
554 | - boolean isExist = SaveMessageService.isExistSms(pat.getId(), message.getId()); | |
555 | - if (isExist) | |
556 | - { | |
557 | - continue; | |
558 | - } | |
555 | + | |
559 | 556 | String messageContent = "【"+messagePrefix+"】" + message.getContent(); |
560 | 557 | |
561 | 558 | MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.CHANOBJ.getId(), SmsServiceEnums.YBZD.getId(), |
... | ... | @@ -623,7 +620,7 @@ |
623 | 620 | SmsConfigQuery configQuery = new SmsConfigQuery(); |
624 | 621 | configQuery.setYn(YnEnums.YES.getId()); |
625 | 622 | configQuery.setPrefixTypes(new Integer[]{0, 1}); |
626 | -// configQuery.setHospitalId(221+""); | |
623 | +// configQuery.setHospitalId(221 + ""); | |
627 | 624 | |
628 | 625 | //查询出对应医院配置 |
629 | 626 | List<SmsConfigModel> configs = smsConfigService.querySmsConfig(configQuery); |
... | ... | @@ -764,7 +761,7 @@ |
764 | 761 | |
765 | 762 | if (start != null && end != null) |
766 | 763 | { |
767 | - Date startDate = DateUtil.getNewDate(-end-1,"周",sendTimeType); | |
764 | + Date startDate = DateUtil.getNewDate(-end-1,"周",sendTimeType+1); | |
768 | 765 | Date endDate = DateUtil.getNewDate(-start,"周",sendTimeType); |
769 | 766 | patientsQuery.setLastMensesStart(startDate); |
770 | 767 | patientsQuery.setLastMensesEnd(endDate); |
... | ... | @@ -1427,8 +1424,8 @@ |
1427 | 1424 | if (start != null && end != null) { |
1428 | 1425 | Date startDate = DateUtil.getNewDate(-end, "天", sendTimeType); |
1429 | 1426 | Date endDate = DateUtil.getNewDate(-start, "天", sendTimeType); |
1430 | - patientsQuery.setBirthStart(startDate); | |
1431 | - patientsQuery.setBirthEnd(endDate); | |
1427 | + patientsQuery.setFmDateStart(startDate); | |
1428 | + patientsQuery.setFmDateEnd(endDate); | |
1432 | 1429 | List<Patients> patientses = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); |
1433 | 1430 | for(Patients pat : patientses) |
1434 | 1431 | { |
... | ... | @@ -2117,7 +2114,15 @@ |
2117 | 2114 | List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery); |
2118 | 2115 | for (AntExChuModel chu : chus) |
2119 | 2116 | { |
2120 | - idset.add(chu.getParentId()); | |
2117 | + AntExQuery antExQuery = new AntExQuery(); | |
2118 | + antExQuery.setParentId(chu.getParentId()); | |
2119 | + antExQuery.setYn(YnEnums.YES.getId()); | |
2120 | + //复诊不存在 才添加 | |
2121 | + List<AntenatalExaminationModel> list = antenatalExaminationService.queryAntenatalExamination(antExQuery.convertToQuery()); | |
2122 | + if (CollectionUtils.isNotEmpty(list)) | |
2123 | + { | |
2124 | + idset.add(chu.getParentId()); | |
2125 | + } | |
2121 | 2126 | } |
2122 | 2127 | List<AntenatalExaminationModel> fuzs = antenatalExaminationService.queryYuyueAntenatalExamination(yuYueDate, tempHid); |
2123 | 2128 | |
... | ... | @@ -2185,7 +2190,7 @@ |
2185 | 2190 | request.setObjType(serviceObj); |
2186 | 2191 | request.setPhone(phone); |
2187 | 2192 | //计划发送时间 |
2188 | - request.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
2193 | + request.setPlanTime(DateUtil.getyyyy_MM_dd(new Date())+ SEND_TIME +":00"); | |
2189 | 2194 | //短信商 |
2190 | 2195 | request.setServiceType(SmsProviderEnums.YM.getId()); |
2191 | 2196 | request.setSubTypeId(smsType); |
platform-data-api/src/main/resources/config.properties
View file @
0041b0a
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MongoSyncController.java
View file @
0041b0a
1 | +package com.lyms.platform.operate.web.controller; | |
2 | + | |
3 | +import com.lyms.platform.biz.service.MongoSyncService; | |
4 | +import com.lyms.platform.common.base.BaseController; | |
5 | +import com.lyms.platform.common.utils.Config; | |
6 | +import org.apache.commons.lang.StringUtils; | |
7 | +import org.springframework.beans.factory.annotation.Autowired; | |
8 | +import org.springframework.stereotype.Controller; | |
9 | +import org.springframework.web.bind.annotation.RequestMapping; | |
10 | +import org.springframework.web.bind.annotation.RequestMethod; | |
11 | +import org.springframework.web.bind.annotation.ResponseBody; | |
12 | + | |
13 | +/** | |
14 | + * Created by Administrator on 2016/9/13 0013. | |
15 | + */ | |
16 | +@Controller | |
17 | +public class MongoSyncController extends BaseController { | |
18 | + | |
19 | + public static String mongo_sync_token = Config.getItem("mongo_sync_token", "0"); | |
20 | + | |
21 | + @Autowired | |
22 | + private MongoSyncService mongoSyncService; | |
23 | + | |
24 | + @ResponseBody | |
25 | + @RequestMapping(method = RequestMethod.POST,value = "/syncmongo") | |
26 | + public String syncmongo(String action, String token, String className, String jsonData, String id){ | |
27 | + if (StringUtils.isNotBlank(token) && mongo_sync_token.equals(token)) { | |
28 | + boolean boo = mongoSyncService.syncData(action,id, className, jsonData); | |
29 | + if (boo) { | |
30 | + return "success"; | |
31 | + } | |
32 | + return "fail"; | |
33 | + } | |
34 | + return "token vaild"; | |
35 | + } | |
36 | + | |
37 | +} |
platform-operate-api/src/main/resources/database.properties
View file @
0041b0a