Commit b8e9d658a7ef891e8fb02c995feab0066c486907
Exists in
master
and in
8 other branches
Merge remote-tracking branch 'origin/master'
# Conflicts: # platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
Showing 11 changed files
- platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IAntenatalExaminationDao.java
- 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/service/AntenatalExaminationService.java
- platform-common/src/main/java/com/lyms/platform/common/enums/SendFrequencyEnums.java
- platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
- platform-common/src/main/java/com/lyms/platform/common/utils/Lunar.java
- platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
- platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
- platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBookbuildingController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/IAntenatalExaminationDao.java
View file @
b8e9d65
| ... | ... | @@ -66,6 +66,7 @@ |
| 66 | 66 | |
| 67 | 67 | public Page<AntenatalExaminationModel> findPage(MongoQuery query); |
| 68 | 68 | |
| 69 | - List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date yuYueDate,String hospitalId); | |
| 69 | + List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date startDate,String hospitalId); | |
| 70 | + List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date startDate,String hospitalId,String pid); | |
| 70 | 71 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/dal/impl/AntenatalExaminationDaoImpl.java
View file @
b8e9d65
| ... | ... | @@ -67,5 +67,14 @@ |
| 67 | 67 | AggregationResults<AntenatalExaminationModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_antex", AntenatalExaminationModel.class); |
| 68 | 68 | return result.getMappedResults(); |
| 69 | 69 | } |
| 70 | + @Override | |
| 71 | + public List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date startDate,String hospitalId,String pid) { | |
| 72 | + | |
| 73 | + AggregationOperation match = Aggregation.match(Criteria.where("nextCheckTime").gte("startDate").and("parentId").is("pid").and("hospitalId").is(hospitalId)); | |
| 74 | + AggregationOperation group = Aggregation.group("parentId").max("modified").as("mtime"); | |
| 75 | + Aggregation aggregation = Aggregation.newAggregation(match, group); | |
| 76 | + AggregationResults<AntenatalExaminationModel> result = this.mongoTemplate.aggregate(aggregation, "lyms_antex", AntenatalExaminationModel.class); | |
| 77 | + return result.getMappedResults(); | |
| 78 | + } | |
| 70 | 79 | } |
platform-biz-patient-service/src/main/java/com/lyms/platform/biz/service/AntenatalExaminationService.java
View file @
b8e9d65
| ... | ... | @@ -132,5 +132,8 @@ |
| 132 | 132 | public List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date yuYueDate,String hospitalId) { |
| 133 | 133 | return iAntenatalExaminationDao.queryYuyueAntenatalExamination(yuYueDate, hospitalId); |
| 134 | 134 | } |
| 135 | + public List<AntenatalExaminationModel> queryYuyueAntenatalExamination(Date startDate,String hospitalId,String pid) { | |
| 136 | + return iAntenatalExaminationDao.queryYuyueAntenatalExamination(startDate, hospitalId,pid); | |
| 137 | + } | |
| 135 | 138 | } |
platform-common/src/main/java/com/lyms/platform/common/enums/SendFrequencyEnums.java
View file @
b8e9d65
platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java
View file @
b8e9d65
| ... | ... | @@ -33,19 +33,7 @@ |
| 33 | 33 | } |
| 34 | 34 | return days; |
| 35 | 35 | } |
| 36 | - public static void orderDate(List<Date> dates){ | |
| 37 | - Collections.sort(dates, new Comparator<Date>() { | |
| 38 | - @Override | |
| 39 | - public int compare(Date o1, Date o2) { | |
| 40 | - if(o1.before(o2)){ | |
| 41 | - return -1; | |
| 42 | - }else if(o1.after(o2)){ | |
| 43 | - return 1; | |
| 44 | - } | |
| 45 | - return 0; | |
| 46 | - } | |
| 47 | - }); | |
| 48 | - } | |
| 36 | + | |
| 49 | 37 | public static Integer minute2Index(Date date) { |
| 50 | 38 | DateTime dt = new DateTime(date.getTime()); |
| 51 | 39 | return dt.getMinuteOfDay() / 10; |
| 52 | 40 | |
| ... | ... | @@ -504,21 +492,11 @@ |
| 504 | 492 | int s = getBabyAgeMonth(parseYMD("2016-05-26"), new Date()); |
| 505 | 493 | SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd "); |
| 506 | 494 | // System.out.println(getBabyAgeMonth(parseYMD("2016-05-23"), new Date())); |
| 507 | - /* System.out.println(DateUtil.getyyyy_MM_dd_hms(DateUtil.addDay(new Date(),-108))); | |
| 508 | - System.out.println(DateUtil.getyyyy_MM_dd_hms(DateUtil.addDay(new Date(), -146))); */ | |
| 495 | + System.out.println(DateUtil.getyyyy_MM_dd_hms(DateUtil.addDay(new Date(),-108))); | |
| 496 | + System.out.println(DateUtil.getyyyy_MM_dd_hms(DateUtil.addDay(new Date(), -146))); | |
| 509 | 497 | // System.out.print(1457688652-23341); |
| 510 | 498 | //1457711993 |
| 511 | 499 | // 1426089600 |
| 512 | - List<Date> data =new ArrayList<>(); | |
| 513 | - data.add(parseYMD("2016-01-26")); | |
| 514 | - data.add(parseYMD("2016-04-26")); | |
| 515 | - data.add(parseYMD("2016-02-26")); | |
| 516 | - data.add(parseYMD("2016-05-26")); | |
| 517 | - data.add(parseYMD("2016-03-26")); | |
| 518 | - orderDate(data); | |
| 519 | - for(Date d:data){ | |
| 520 | - System.out.print(simpleDateFormat.format(d)); | |
| 521 | - } | |
| 522 | 500 | } |
| 523 | 501 | } |
platform-common/src/main/java/com/lyms/platform/common/utils/Lunar.java
View file @
b8e9d65
| 1 | +package com.lyms.platform.common.utils; | |
| 2 | + | |
| 3 | +import java.text.ParseException; | |
| 4 | +import java.text.SimpleDateFormat; | |
| 5 | +import java.util.Calendar; | |
| 6 | +import java.util.Date; | |
| 7 | + | |
| 8 | +public class Lunar { | |
| 9 | + private int year; | |
| 10 | + private int month; | |
| 11 | + private int day; | |
| 12 | + private boolean leap; | |
| 13 | + final static String chineseNumber[] = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"}; | |
| 14 | + static SimpleDateFormat chineseDateFormat = new SimpleDateFormat("yyyy-MM-dd"); | |
| 15 | + final static long[] lunarInfo = new long[] | |
| 16 | + {0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, | |
| 17 | + 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, | |
| 18 | + 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, | |
| 19 | + 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, | |
| 20 | + 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, | |
| 21 | + 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5d0, 0x14573, 0x052d0, 0x0a9a8, 0x0e950, 0x06aa0, | |
| 22 | + 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, | |
| 23 | + 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b5a0, 0x195a6, | |
| 24 | + 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, | |
| 25 | + 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, | |
| 26 | + 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, | |
| 27 | + 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, | |
| 28 | + 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, | |
| 29 | + 0x05aa0, 0x076a3, 0x096d0, 0x04bd7, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, | |
| 30 | + 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0}; | |
| 31 | + | |
| 32 | + //====== 传回农历 y年的总天数 | |
| 33 | + final private static int yearDays(int y) { | |
| 34 | + int i, sum = 348; | |
| 35 | + for (i = 0x8000; i > 0x8; i >>= 1) { | |
| 36 | + if ((lunarInfo[y - 1900] & i) != 0) sum += 1; | |
| 37 | + } | |
| 38 | + return (sum + leapDays(y)); | |
| 39 | + } | |
| 40 | + | |
| 41 | + //====== 传回农历 y年闰月的天数 | |
| 42 | + final private static int leapDays(int y) { | |
| 43 | + if (leapMonth(y) != 0) { | |
| 44 | + if ((lunarInfo[y - 1900] & 0x10000) != 0) | |
| 45 | + return 30; | |
| 46 | + else | |
| 47 | + return 29; | |
| 48 | + } else | |
| 49 | + return 0; | |
| 50 | + } | |
| 51 | + | |
| 52 | + //====== 传回农历 y年闰哪个月 1-12 , 没闰传回 0 | |
| 53 | + final private static int leapMonth(int y) { | |
| 54 | + return (int) (lunarInfo[y - 1900] & 0xf); | |
| 55 | + } | |
| 56 | + | |
| 57 | + //====== 传回农历 y年m月的总天数 | |
| 58 | + final private static int monthDays(int y, int m) { | |
| 59 | + if ((lunarInfo[y - 1900] & (0x10000 >> m)) == 0) | |
| 60 | + return 29; | |
| 61 | + else | |
| 62 | + return 30; | |
| 63 | + } | |
| 64 | + | |
| 65 | + //====== 传回农历 y年的生肖 | |
| 66 | + final public String animalsYear() { | |
| 67 | + final String[] Animals = new String[]{"鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"}; | |
| 68 | + return Animals[(year - 4) % 12]; | |
| 69 | + } | |
| 70 | + | |
| 71 | + //====== 传入 月日的offset 传回干支, 0=甲子 | |
| 72 | + final private static String cyclicalm(int num) { | |
| 73 | + final String[] Gan = new String[]{"甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"}; | |
| 74 | + final String[] Zhi = new String[]{"子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"}; | |
| 75 | + return (Gan[num % 10] + Zhi[num % 12]); | |
| 76 | + } | |
| 77 | + | |
| 78 | + //====== 传入 offset 传回干支, 0=甲子 | |
| 79 | + final public String cyclical() { | |
| 80 | + int num = year - 1900 + 36; | |
| 81 | + return (cyclicalm(num)); | |
| 82 | + } | |
| 83 | + | |
| 84 | + /** *//** | |
| 85 | + * 传出y年m月d日对应的农历. | |
| 86 | + * yearCyl3:农历年与1864的相差数 ? | |
| 87 | + * monCyl4:从1900年1月31日以来,闰月数 | |
| 88 | + * dayCyl5:与1900年1月31日相差的天数,再加40 ? | |
| 89 | + * @param cal | |
| 90 | + * @return | |
| 91 | + */ | |
| 92 | + public Lunar(Calendar cal) { | |
| 93 | + @SuppressWarnings("unused") int yearCyl, monCyl, dayCyl; | |
| 94 | + int leapMonth = 0; | |
| 95 | + Date baseDate = null; | |
| 96 | + try { | |
| 97 | + baseDate = chineseDateFormat.parse("1900-01-31"); | |
| 98 | + } catch (ParseException e) { | |
| 99 | + e.printStackTrace(); //To change body of catch statement use Options | File Templates. | |
| 100 | + } | |
| 101 | + | |
| 102 | + //求出和1900年1月31日相差的天数 | |
| 103 | + int offset = (int) ((cal.getTime().getTime() - baseDate.getTime()) / 86400000L); | |
| 104 | + dayCyl = offset + 40; | |
| 105 | + monCyl = 14; | |
| 106 | + | |
| 107 | + //用offset减去每农历年的天数 | |
| 108 | + // 计算当天是农历第几天 | |
| 109 | + //i最终结果是农历的年份 | |
| 110 | + //offset是当年的第几天 | |
| 111 | + int iYear, daysOfYear = 0; | |
| 112 | + for (iYear = 1900; iYear < 2050 && offset > 0; iYear++) { | |
| 113 | + daysOfYear = yearDays(iYear); | |
| 114 | + offset -= daysOfYear; | |
| 115 | + monCyl += 12; | |
| 116 | + } | |
| 117 | + if (offset < 0) { | |
| 118 | + offset += daysOfYear; | |
| 119 | + iYear--; | |
| 120 | + monCyl -= 12; | |
| 121 | + } | |
| 122 | + //农历年份 | |
| 123 | + year = iYear; | |
| 124 | + | |
| 125 | + yearCyl = iYear - 1864; | |
| 126 | + leapMonth = leapMonth(iYear); //闰哪个月,1-12 | |
| 127 | + leap = false; | |
| 128 | + | |
| 129 | + //用当年的天数offset,逐个减去每月(农历)的天数,求出当天是本月的第几天 | |
| 130 | + int iMonth, daysOfMonth = 0; | |
| 131 | + for (iMonth = 1; iMonth < 13 && offset > 0; iMonth++) { | |
| 132 | + //闰月 | |
| 133 | + if (leapMonth > 0 && iMonth == (leapMonth + 1) && !leap) { | |
| 134 | + --iMonth; | |
| 135 | + leap = true; | |
| 136 | + daysOfMonth = leapDays(year); | |
| 137 | + } else | |
| 138 | + daysOfMonth = monthDays(year, iMonth); | |
| 139 | + | |
| 140 | + offset -= daysOfMonth; | |
| 141 | + //解除闰月 | |
| 142 | + if (leap && iMonth == (leapMonth + 1)) leap = false; | |
| 143 | + if (!leap) monCyl++; | |
| 144 | + } | |
| 145 | + //offset为0时,并且刚才计算的月份是闰月,要校正 | |
| 146 | + if (offset == 0 && leapMonth > 0 && iMonth == leapMonth + 1) { | |
| 147 | + if (leap) { | |
| 148 | + leap = false; | |
| 149 | + } else { | |
| 150 | + leap = true; | |
| 151 | + --iMonth; | |
| 152 | + --monCyl; | |
| 153 | + } | |
| 154 | + } | |
| 155 | + //offset小于0时,也要校正 | |
| 156 | + if (offset < 0) { | |
| 157 | + offset += daysOfMonth; | |
| 158 | + --iMonth; | |
| 159 | + --monCyl; | |
| 160 | + } | |
| 161 | + month = iMonth; | |
| 162 | + day = offset + 1; | |
| 163 | + } | |
| 164 | + | |
| 165 | + public static String getChinaDayString(int day) { | |
| 166 | + String chineseTen[] = {"初", "十", "廿", "卅"}; | |
| 167 | + int n = day % 10 == 0 ? 9 : day % 10 - 1; | |
| 168 | + if (day > 30) | |
| 169 | + return ""; | |
| 170 | + if (day == 10) | |
| 171 | + return "初十"; | |
| 172 | + else | |
| 173 | + return chineseTen[day / 10] + chineseNumber[n]; | |
| 174 | + } | |
| 175 | + | |
| 176 | + public String getString() { | |
| 177 | + | |
| 178 | + String m = ""; | |
| 179 | + if (month < 10 ) | |
| 180 | + { | |
| 181 | + m = "0"+month; | |
| 182 | + } | |
| 183 | + else | |
| 184 | + { | |
| 185 | + m = month +""; | |
| 186 | + } | |
| 187 | + String d = ""; | |
| 188 | + if (day < 10 ) | |
| 189 | + { | |
| 190 | + d = "0"+day; | |
| 191 | + } | |
| 192 | + else | |
| 193 | + { | |
| 194 | + d = day+""; | |
| 195 | + } | |
| 196 | + return year +"-"+ m +"-" + d; | |
| 197 | + } | |
| 198 | + | |
| 199 | + public static void main(String[] args) throws ParseException { | |
| 200 | + Calendar today = Calendar.getInstance(); | |
| 201 | + today.setTime(chineseDateFormat.parse("2011-07-14")); | |
| 202 | + Lunar lunar = new Lunar(today); | |
| 203 | + | |
| 204 | + System.out.println(lunar.getString()); | |
| 205 | + } | |
| 206 | +} |
platform-dal/src/main/java/com/lyms/platform/query/AntExChuQuery.java
View file @
b8e9d65
| ... | ... | @@ -22,6 +22,8 @@ |
| 22 | 22 | private Date end; |
| 23 | 23 | |
| 24 | 24 | private Date nextCheckTime; |
| 25 | + private Date nextCheckTimeStart; | |
| 26 | + private Date nextCheckTimeEnd; | |
| 25 | 27 | |
| 26 | 28 | public Date getNextCheckTime() { |
| 27 | 29 | return nextCheckTime; |
| ... | ... | @@ -31,6 +33,22 @@ |
| 31 | 33 | this.nextCheckTime = nextCheckTime; |
| 32 | 34 | } |
| 33 | 35 | |
| 36 | + public Date getNextCheckTimeEnd() { | |
| 37 | + return nextCheckTimeEnd; | |
| 38 | + } | |
| 39 | + | |
| 40 | + public void setNextCheckTimeEnd(Date nextCheckTimeEnd) { | |
| 41 | + this.nextCheckTimeEnd = nextCheckTimeEnd; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public Date getNextCheckTimeStart() { | |
| 45 | + return nextCheckTimeStart; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public void setNextCheckTimeStart(Date nextCheckTimeStart) { | |
| 49 | + this.nextCheckTimeStart = nextCheckTimeStart; | |
| 50 | + } | |
| 51 | + | |
| 34 | 52 | public Date getEnd() { |
| 35 | 53 | return end; |
| 36 | 54 | } |
| ... | ... | @@ -70,6 +88,9 @@ |
| 70 | 88 | if(null!=nextCheckTime){ |
| 71 | 89 | condition= condition.and("nextCheckTime",nextCheckTime, MongoOper.IS); |
| 72 | 90 | } |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 73 | 94 | boolean isAddStart = Boolean.FALSE; |
| 74 | 95 | Criteria c = null; |
| 75 | 96 | if (null != start) { |
| ... | ... | @@ -85,6 +106,18 @@ |
| 85 | 106 | } |
| 86 | 107 | isAddStart = Boolean.TRUE; |
| 87 | 108 | } |
| 109 | + | |
| 110 | + if (null != nextCheckTimeStart) { | |
| 111 | + if (c == null) | |
| 112 | + { | |
| 113 | + c = Criteria.where("nextCheckTime").gte(nextCheckTimeStart); | |
| 114 | + } | |
| 115 | + else | |
| 116 | + { | |
| 117 | + c.and("nextCheckTime").gte(nextCheckTimeStart); | |
| 118 | + } | |
| 119 | + } | |
| 120 | + | |
| 88 | 121 | if (isAddStart) { |
| 89 | 122 | return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); |
| 90 | 123 | } |
platform-dal/src/main/java/com/lyms/platform/query/PatientsQuery.java
View file @
b8e9d65
| ... | ... | @@ -99,6 +99,8 @@ |
| 99 | 99 | * 生日 |
| 100 | 100 | */ |
| 101 | 101 | private Date birthStart; |
| 102 | + | |
| 103 | + private Date birth; | |
| 102 | 104 | /** |
| 103 | 105 | * 就诊卡号 |
| 104 | 106 | */ |
| ... | ... | @@ -141,6 +143,16 @@ |
| 141 | 143 | |
| 142 | 144 | private String hospitalId; |
| 143 | 145 | |
| 146 | + private String hcertificateNum; | |
| 147 | + | |
| 148 | + public String getHcertificateNum() { | |
| 149 | + return hcertificateNum; | |
| 150 | + } | |
| 151 | + | |
| 152 | + public void setHcertificateNum(String hcertificateNum) { | |
| 153 | + this.hcertificateNum = hcertificateNum; | |
| 154 | + } | |
| 155 | + | |
| 144 | 156 | public Integer[] getOrServiceStatus() { |
| 145 | 157 | return orServiceStatus; |
| 146 | 158 | } |
| 147 | 159 | |
| ... | ... | @@ -434,12 +446,19 @@ |
| 434 | 446 | condition = condition.and("serviceStatus", serviceStatus, MongoOper.IS); |
| 435 | 447 | } |
| 436 | 448 | |
| 449 | + if (null != birth) { | |
| 450 | + condition = condition.and("birth", birth, MongoOper.IS); | |
| 451 | + } | |
| 437 | 452 | |
| 438 | 453 | if (null != orServiceStatus && orServiceStatus.length > 1) { |
| 439 | 454 | MongoCondition con1 = MongoCondition.newInstance("serviceStatus", orServiceStatus[0], MongoOper.IS); |
| 440 | 455 | MongoCondition con = MongoCondition.newInstance("serviceStatus", orServiceStatus[1], MongoOper.IS); |
| 441 | 456 | condition = condition.orCondition(new MongoCondition[]{con1, con}); |
| 442 | 457 | } |
| 458 | + if (null != hcertificateNum) { | |
| 459 | + condition = condition.and("hcertificateNum", hcertificateNum, MongoOper.LIKE); | |
| 460 | + } | |
| 461 | + | |
| 443 | 462 | if (null != rLevel) { |
| 444 | 463 | condition = condition.and("riskLevelId", rLevel, MongoOper.IS); |
| 445 | 464 | } |
| ... | ... | @@ -509,6 +528,15 @@ |
| 509 | 528 | return new MongoCondition(c.andOperator(condition.getCriteria())).toMongoQuery(); |
| 510 | 529 | } |
| 511 | 530 | return condition.toMongoQuery(); |
| 531 | + } | |
| 532 | + | |
| 533 | + | |
| 534 | + public Date getBirth() { | |
| 535 | + return birth; | |
| 536 | + } | |
| 537 | + | |
| 538 | + public void setBirth(Date birth) { | |
| 539 | + this.birth = birth; | |
| 512 | 540 | } |
| 513 | 541 | |
| 514 | 542 | public String getId() { |
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java
View file @
b8e9d65
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | import com.lyms.platform.common.enums.*; |
| 5 | 5 | import com.lyms.platform.common.utils.DateUtil; |
| 6 | 6 | import com.lyms.platform.common.utils.JsonUtil; |
| 7 | +import com.lyms.platform.common.utils.Lunar; | |
| 7 | 8 | import com.lyms.platform.common.utils.StringUtils; |
| 8 | 9 | import com.lyms.platform.data.pojo.MessageContent; |
| 9 | 10 | import com.lyms.platform.data.pojo.MessageListRequest; |
| ... | ... | @@ -174,7 +175,6 @@ |
| 174 | 175 | highRiskSmsModel.setModified(new Date()); |
| 175 | 176 | highRiskService.addHighRiskSmsModel(highRiskSmsModel); |
| 176 | 177 | |
| 177 | - | |
| 178 | 178 | String name = String.valueOf(riskMap.get("id")); |
| 179 | 179 | List<MessageContent> messageContents = amsSmses.get(name); |
| 180 | 180 | if (CollectionUtils.isNotEmpty(messageContents)) |
| 181 | 181 | |
| 182 | 182 | |
| ... | ... | @@ -183,28 +183,10 @@ |
| 183 | 183 | { |
| 184 | 184 | String messageContent = "【"+messagePrefix+"】" + message.getContent(); |
| 185 | 185 | |
| 186 | - MessageRequest request = new MessageRequest(); | |
| 186 | + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), SmsServiceEnums.GWZD.getId(), | |
| 187 | + pat.getHospitalId(),message.getId(),pat.getId()); | |
| 187 | 188 | |
| 188 | - //平台ID TODO | |
| 189 | - request.setTypeId(1); | |
| 190 | - request.setContent(messageContent); | |
| 191 | - //服务对象 1孕妇 2儿童 3产妇 | |
| 192 | - request.setObjType(ServiceObjEnums.YUNOBJ.getId()); | |
| 193 | - request.setPhone(pat.getPhone()); | |
| 194 | - //计划发送时间 | |
| 195 | - request.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 196 | - //短信商 TODO | |
| 197 | - request.setServiceType(1); | |
| 198 | - request.setSubTypeId(SmsServiceEnums.GWZD.getId()); | |
| 199 | - | |
| 200 | - //医院ID ext1 | |
| 201 | - //模板ID ext2; | |
| 202 | - //患者ID ext3; | |
| 203 | - request.setExt1(String.valueOf(pat.getHospitalId())); | |
| 204 | - request.setExt2(message.getId()); | |
| 205 | - request.setExt3(pat.getId()); | |
| 206 | 189 | messages.add(request); |
| 207 | - | |
| 208 | 190 | isRisk = true; |
| 209 | 191 | break; |
| 210 | 192 | } |
| 211 | 193 | |
| 212 | 194 | |
| ... | ... | @@ -235,28 +217,10 @@ |
| 235 | 217 | } |
| 236 | 218 | |
| 237 | 219 | String messageContent = "【"+messagePrefix+"】" + message.getContent(); |
| 220 | + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), SmsServiceEnums.YBZD.getId(), | |
| 221 | + pat.getHospitalId(),message.getId(),pat.getId()); | |
| 238 | 222 | |
| 239 | - MessageRequest request = new MessageRequest(); | |
| 240 | 223 | |
| 241 | - //平台ID TODO | |
| 242 | - request.setTypeId(1); | |
| 243 | - request.setContent(messageContent); | |
| 244 | - //服务对象 1孕妇 2儿童 3产妇 | |
| 245 | - request.setObjType(ServiceObjEnums.YUNOBJ.getId()); | |
| 246 | - request.setPhone(pat.getPhone()); | |
| 247 | - //计划发送时间 | |
| 248 | - request.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 249 | - //短信商 TODO | |
| 250 | - request.setServiceType(1); | |
| 251 | - request.setSubTypeId(SmsServiceEnums.YBZD.getId()); | |
| 252 | - | |
| 253 | - //医院ID ext1 | |
| 254 | - //模板ID ext2; | |
| 255 | - //患者ID ext3; | |
| 256 | - request.setExt1(String.valueOf(pat.getHospitalId())); | |
| 257 | - request.setExt2(message.getId()); | |
| 258 | - request.setExt3(pat.getId()); | |
| 259 | - | |
| 260 | 224 | messages.add(request); |
| 261 | 225 | break; |
| 262 | 226 | } |
| 263 | 227 | |
| 264 | 228 | |
| ... | ... | @@ -378,30 +342,10 @@ |
| 378 | 342 | { |
| 379 | 343 | continue; |
| 380 | 344 | } |
| 381 | - | |
| 382 | 345 | String messageContent = "【"+messagePrefix+"】" + message.getContent(); |
| 346 | + MessageRequest request = getMessageRequest( messageContent,baby.getMphone(),ServiceObjEnums.BABYOBJ.getId(), SmsServiceEnums.YBZD.getId(), | |
| 347 | + baby.getHospitalId(),message.getId(),baby.getId()); | |
| 383 | 348 | |
| 384 | - MessageRequest request = new MessageRequest(); | |
| 385 | - | |
| 386 | - //平台ID TODO | |
| 387 | - request.setTypeId(1); | |
| 388 | - request.setContent(messageContent); | |
| 389 | - //服务对象 1孕妇 2儿童 3产妇 | |
| 390 | - request.setObjType(ServiceObjEnums.CHANOBJ.getId()); | |
| 391 | - request.setPhone(baby.getMphone()); | |
| 392 | - //计划发送时间 | |
| 393 | - request.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 394 | - //短信商 TODO | |
| 395 | - request.setServiceType(1); | |
| 396 | - request.setSubTypeId(SmsServiceEnums.YBZD.getId()); | |
| 397 | - | |
| 398 | - //医院ID ext1 | |
| 399 | - //模板ID ext2; | |
| 400 | - //患者ID ext3; | |
| 401 | - request.setExt1(String.valueOf(baby.getHospitalId())); | |
| 402 | - request.setExt2(message.getId()); | |
| 403 | - request.setExt3(baby.getId()); | |
| 404 | - | |
| 405 | 349 | messages.add(request); |
| 406 | 350 | break; |
| 407 | 351 | } |
| 408 | 352 | |
| 409 | 353 | |
| ... | ... | @@ -518,30 +462,11 @@ |
| 518 | 462 | { |
| 519 | 463 | continue; |
| 520 | 464 | } |
| 521 | - | |
| 522 | 465 | String messageContent = "【"+messagePrefix+"】" + message.getContent(); |
| 523 | 466 | |
| 524 | - MessageRequest request = new MessageRequest(); | |
| 467 | + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.CHANOBJ.getId(), SmsServiceEnums.YBZD.getId(), | |
| 468 | + pat.getHospitalId(),message.getId(),pat.getId()); | |
| 525 | 469 | |
| 526 | - //平台ID TODO | |
| 527 | - request.setTypeId(1); | |
| 528 | - request.setContent(messageContent); | |
| 529 | - //服务对象 1孕妇 2儿童 3产妇 | |
| 530 | - request.setObjType(ServiceObjEnums.CHANOBJ.getId()); | |
| 531 | - request.setPhone(pat.getPhone()); | |
| 532 | - //计划发送时间 | |
| 533 | - request.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 534 | - //短信商 TODO | |
| 535 | - request.setServiceType(1); | |
| 536 | - request.setSubTypeId(SmsServiceEnums.YBZD.getId()); | |
| 537 | - | |
| 538 | - //医院ID ext1 | |
| 539 | - //模板ID ext2; | |
| 540 | - //患者ID ext3; | |
| 541 | - request.setExt1(String.valueOf(pat.getHospitalId())); | |
| 542 | - request.setExt2(message.getId()); | |
| 543 | - request.setExt3(pat.getId()); | |
| 544 | - | |
| 545 | 470 | messages.add(request); |
| 546 | 471 | break; |
| 547 | 472 | } |
| ... | ... | @@ -559,7 +484,7 @@ |
| 559 | 484 | |
| 560 | 485 | |
| 561 | 486 | /** |
| 562 | - * 创建模板短信 | |
| 487 | + * 生成模板短信 | |
| 563 | 488 | */ |
| 564 | 489 | @Override |
| 565 | 490 | public void productTemplateSms() { |
| 566 | 491 | |
| 567 | 492 | |
| 568 | 493 | |
| 569 | 494 | |
| ... | ... | @@ -665,37 +590,21 @@ |
| 665 | 590 | } |
| 666 | 591 | } |
| 667 | 592 | |
| 593 | + //发送短信集合 | |
| 594 | + MessageListRequest list = new MessageListRequest(); | |
| 595 | + List<MessageRequest> messages = new ArrayList<>(); | |
| 596 | + | |
| 668 | 597 | //孕妇预约短信 |
| 669 | 598 | if (smsType == SmsServiceEnums.CJYYTX.getId()) |
| 670 | 599 | { |
| 671 | - | |
| 672 | - //发送短信集合 | |
| 673 | - MessageListRequest list = new MessageListRequest(); | |
| 674 | - List<MessageRequest> messages = new ArrayList<>(); | |
| 675 | - | |
| 676 | - Set<String> idset = new HashSet<>(); | |
| 677 | 600 | Date yuYueDate = DateUtil.addDay(new Date(),sendTimeType); |
| 601 | + Set<String> idset = getYuYuePatient(sendTimeType,tempHid); | |
| 678 | 602 | |
| 679 | - AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 680 | - antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 681 | - antExChuQuery.setNextCheckTime(yuYueDate); | |
| 682 | - List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
| 683 | - for (AntExChuModel chu : chus) | |
| 684 | - { | |
| 685 | - idset.add(chu.getParentId()); | |
| 686 | - } | |
| 687 | - List<AntenatalExaminationModel> fuzs = antenatalExaminationService.queryYuyueAntenatalExamination(yuYueDate,tempHid); | |
| 688 | - | |
| 689 | - for (AntenatalExaminationModel f : fuzs) | |
| 690 | - { | |
| 691 | - idset.add(f.getParentId()); | |
| 692 | - } | |
| 693 | - | |
| 694 | 603 | for (String pid : idset) |
| 695 | 604 | { |
| 696 | 605 | //查询符合条件的产妇 |
| 697 | 606 | patientsQuery.setId(pid); |
| 698 | - List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 607 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 699 | 608 | if (CollectionUtils.isNotEmpty(patients)) |
| 700 | 609 | { |
| 701 | 610 | for (Patients pat : patients) |
| 702 | 611 | |
| 703 | 612 | |
| 704 | 613 | |
| 705 | 614 | |
| ... | ... | @@ -706,40 +615,21 @@ |
| 706 | 615 | String messageContent = "【"+messagePrefix+"】"+template.getContent(); |
| 707 | 616 | messageContent = replaceEL(pat.getUsername(),yuYueDate,messageContent); |
| 708 | 617 | |
| 709 | - MessageRequest request = new MessageRequest(); | |
| 710 | - //平台ID TODO | |
| 711 | - request.setTypeId(1); | |
| 712 | - request.setContent(messageContent); | |
| 713 | - //服务对象 1孕妇 2儿童 3产妇 | |
| 714 | - request.setObjType(ServiceObjEnums.YUNOBJ.getId()); | |
| 715 | - request.setPhone(pat.getPhone()); | |
| 716 | - //计划发送时间 | |
| 717 | - request.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 718 | - //短信商 TODO | |
| 719 | - request.setServiceType(1); | |
| 720 | - request.setSubTypeId(SmsServiceEnums.YBZD.getId()); | |
| 618 | + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(), | |
| 619 | + pat.getHospitalId(),template.getId(),pat.getId()); | |
| 721 | 620 | |
| 722 | - //医院ID ext1 | |
| 723 | - //模板ID ext2; | |
| 724 | - //患者ID ext3; | |
| 725 | - request.setExt1(pat.getHospitalId()); | |
| 726 | - request.setExt2(template.getId()); | |
| 727 | - request.setExt3(pat.getId()); | |
| 728 | - | |
| 729 | 621 | messages.add(request); |
| 730 | 622 | } |
| 731 | 623 | } |
| 732 | 624 | } |
| 733 | - list.setMessages(messages); | |
| 734 | - sendSms(list); | |
| 625 | + | |
| 735 | 626 | } |
| 736 | 627 | else if (smsType == SmsServiceEnums.CJCXTX.getId()) |
| 737 | 628 | { |
| 738 | - | |
| 739 | 629 | //发送频次 |
| 740 | 630 | Integer sendFreq = template.getSendFrequency(); |
| 741 | 631 | |
| 742 | - if (sendFreq == SendFrequencyEnums.YEAR.getId()) | |
| 632 | + if (sendFreq == SendFrequencyEnums.ONCE.getId()) | |
| 743 | 633 | { |
| 744 | 634 | |
| 745 | 635 | //GL(0,"公历","0,1,2","0,1,2,3"),NL(1,"农历","0,1,2","0,1,2,3"),TSRQ(2,"特殊日期","0,2","1,2,3"),SLRQ(3,"生理日期","0","1,2,3"); |
| 746 | 636 | |
| 747 | 637 | |
| 748 | 638 | |
| 749 | 639 | |
| 750 | 640 | |
| 751 | 641 | |
| 752 | 642 | |
| 753 | 643 | |
| 754 | 644 | |
| 755 | 645 | |
| 756 | 646 | |
| 757 | 647 | |
| 758 | 648 | |
| 759 | 649 | |
| 760 | 650 | |
| 761 | 651 | |
| 762 | 652 | |
| ... | ... | @@ -756,65 +646,244 @@ |
| 756 | 646 | |
| 757 | 647 | if (start != null && end != null) |
| 758 | 648 | { |
| 759 | - | |
| 649 | + Date startDate = DateUtil.getNewDate(-end,"周",0); | |
| 650 | + Date endDate = DateUtil.getNewDate(-start,"周",0); | |
| 651 | + patientsQuery.setLastMensesStart(startDate); | |
| 652 | + patientsQuery.setLastMensesEnd(endDate); | |
| 760 | 653 | //查询符合条件的孕妇 |
| 761 | 654 | List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); |
| 762 | 655 | if (CollectionUtils.isNotEmpty(patients)) |
| 763 | 656 | { |
| 657 | + for (Patients pat : patients) | |
| 658 | + { | |
| 764 | 659 | |
| 660 | + //如果有有效的预约短信就发送 产检程序提醒 | |
| 661 | + boolean isOrder = queryYunIsOrder( sendTimeType, tempHid,pat.getId(),pat.getLastMenses(),start); | |
| 662 | + if (isOrder) | |
| 663 | + { | |
| 664 | + continue; | |
| 665 | + } | |
| 666 | + | |
| 667 | + //短信前缀 | |
| 668 | + String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor()); | |
| 669 | + String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 670 | + messageContent = replaceName(pat.getUsername(), messageContent); | |
| 671 | + | |
| 672 | + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(), | |
| 673 | + pat.getHospitalId(),template.getId(),pat.getId()); | |
| 674 | + messages.add(request); | |
| 675 | + } | |
| 765 | 676 | } |
| 766 | 677 | } |
| 767 | 678 | |
| 768 | 679 | } |
| 769 | 680 | } |
| 770 | - | |
| 771 | 681 | } |
| 772 | 682 | |
| 773 | - | |
| 774 | 683 | } |
| 684 | + else | |
| 685 | + { | |
| 686 | + //发送频次 | |
| 687 | + Integer sendFreq = template.getSendFrequency(); | |
| 688 | + if (sendFreq == SendFrequencyEnums.YEAR.getId()) | |
| 689 | + { | |
| 690 | + //GL(0,"公历","0,1,2","0,1,2,3"),NL(1,"农历","0,1,2","0,1,2,3"),TSRQ(2,"特殊日期","0,2","1,2,3"),SLRQ(3,"生理日期","0","1,2,3"); | |
| 691 | + Integer sendDateType = template.getSendDateType(); | |
| 692 | + if (sendDateType == SendDateEnums.TSRQ.getId()) { | |
| 693 | + //孕妇 下面的 孕妇生日 丈夫生日 | |
| 694 | + Integer specialDateType = template.getSpecialDateType(); | |
| 695 | + //丈夫生日 | |
| 696 | + if (specialDateType == SpecialDateEnums.ZFSR.getId()) | |
| 697 | + { | |
| 698 | + Date birthday = DateUtil.addDay(new Date(),sendTimeType); | |
| 699 | + //生成年月日时间去匹配丈夫身份证号 | |
| 700 | + String bstr = DateUtil.getYmd(birthday); | |
| 701 | + patientsQuery.setHcertificateNum(bstr); | |
| 775 | 702 | |
| 703 | + //查询符合条件丈夫信息 | |
| 704 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 705 | + if (CollectionUtils.isNotEmpty(patients)) | |
| 706 | + { | |
| 707 | + for (Patients pat : patients) | |
| 708 | + { | |
| 776 | 709 | |
| 710 | + //短信前缀 | |
| 711 | + String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor()); | |
| 712 | + String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 713 | + messageContent = replaceName(pat.getHusbandName(), messageContent); | |
| 714 | + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(), | |
| 715 | + pat.getHospitalId(),template.getId(),pat.getId()); | |
| 777 | 716 | |
| 717 | + messages.add(request); | |
| 718 | + } | |
| 719 | + } | |
| 720 | + } | |
| 721 | + else | |
| 722 | + { | |
| 723 | + if(specialDateType == SpecialDateEnums.MMSR.getId()) | |
| 724 | + { | |
| 725 | + Date birthday = DateUtil.addDay(new Date(), sendTimeType); | |
| 726 | + patientsQuery.setBirth(birthday); | |
| 727 | + | |
| 728 | + //查询符合条件的孕妇 | |
| 729 | + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery); | |
| 730 | + if (CollectionUtils.isNotEmpty(patients)) | |
| 731 | + { | |
| 732 | + for (Patients pat : patients) | |
| 733 | + { | |
| 734 | + | |
| 735 | + //短信前缀 | |
| 736 | + String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor()); | |
| 737 | + String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 738 | + messageContent = replaceName(pat.getHusbandName(), messageContent); | |
| 739 | + | |
| 740 | + | |
| 741 | + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(), | |
| 742 | + pat.getHospitalId(),template.getId(),pat.getId()); | |
| 743 | + | |
| 744 | + messages.add(request); | |
| 745 | + } | |
| 746 | + } | |
| 747 | + } | |
| 748 | + } | |
| 749 | + } | |
| 750 | + //特殊日期中的公历和农历 | |
| 751 | + else if (sendDateType == SendDateEnums.GL.getId() || sendDateType == SendDateEnums.NL.getId() ) | |
| 752 | + { | |
| 753 | + | |
| 754 | + //公历 | |
| 755 | + if (sendDateType == SendDateEnums.GL.getId()) | |
| 756 | + { | |
| 757 | + String currentDate = DateUtil.getyyyy_MM_dd(new Date()); | |
| 758 | + Date sendDate = template.getSendDate(); | |
| 759 | + if (sendDate != null) | |
| 760 | + { | |
| 761 | + Date planSendDate = DateUtil.addDay(sendDate,sendDateType); | |
| 762 | + String sendDateStr = DateUtil.getyyyy_MM_dd(planSendDate); | |
| 763 | + if (currentDate.equals(sendDateStr)) | |
| 764 | + { | |
| 765 | + | |
| 766 | + } | |
| 767 | + } | |
| 768 | + } | |
| 769 | + //农历 | |
| 770 | + else if (sendDateType == SendDateEnums.NL.getId()) | |
| 771 | + { | |
| 772 | + Calendar today = Calendar.getInstance(); | |
| 773 | + today.setTime(new Date()); | |
| 774 | + Lunar lunar = new Lunar(today); | |
| 775 | + //当前时间农历日期 | |
| 776 | + String currentDate = lunar.getString(); | |
| 777 | + } | |
| 778 | + | |
| 779 | + } | |
| 780 | + } | |
| 781 | + | |
| 782 | + } | |
| 783 | + | |
| 784 | + list.setMessages(messages); | |
| 785 | + sendSms(list); | |
| 778 | 786 | } |
| 787 | + } | |
| 788 | + } | |
| 779 | 789 | |
| 780 | 790 | |
| 791 | + /** | |
| 792 | + * 查询预约孕妇Id | |
| 793 | + * @param sendTimeType 发送时间 | |
| 794 | + * @param tempHid 模板医院ID | |
| 795 | + * @return | |
| 796 | + */ | |
| 797 | + private Set<String> getYuYuePatient(Integer sendTimeType,String tempHid) | |
| 798 | + { | |
| 799 | + Set<String> idset = new HashSet<>(); | |
| 800 | + Date yuYueDate = DateUtil.addDay(new Date(), sendTimeType); | |
| 801 | + | |
| 802 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 803 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 804 | + antExChuQuery.setNextCheckTime(yuYueDate); | |
| 805 | + List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
| 806 | + for (AntExChuModel chu : chus) | |
| 807 | + { | |
| 808 | + idset.add(chu.getParentId()); | |
| 781 | 809 | } |
| 810 | + List<AntenatalExaminationModel> fuzs = antenatalExaminationService.queryYuyueAntenatalExamination(yuYueDate, tempHid); | |
| 782 | 811 | |
| 812 | + for (AntenatalExaminationModel f : fuzs) | |
| 813 | + { | |
| 814 | + idset.add(f.getParentId()); | |
| 815 | + } | |
| 816 | + return idset; | |
| 783 | 817 | } |
| 784 | 818 | |
| 819 | + /** | |
| 820 | + * 判断当前孕妇是否有有效预约短信 | |
| 821 | + * @param sendTimeType | |
| 822 | + * @param tempHid | |
| 823 | + * @param pid 孕妇ID | |
| 824 | + * @return | |
| 825 | + */ | |
| 826 | + private boolean queryYunIsOrder(Integer sendTimeType,String tempHid,String pid,Date lastLmess,Integer start) | |
| 827 | + { | |
| 828 | + Set<String> idset = new HashSet<>(); | |
| 829 | + Date startDate = DateUtil.getRangeDate(lastLmess, -start, "周", 0); | |
| 785 | 830 | |
| 786 | -// private MessageRequest getMessageRequest(Patients pat,SmsConfigModel config,Integer obj,Integer subType,SmsTemplateModel template) | |
| 787 | -// { | |
| 788 | -// | |
| 789 | -// //短信前缀 | |
| 790 | -// String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor()); | |
| 791 | -// String messageContent = "【"+messagePrefix+"】"+template.getContent(); | |
| 792 | -// messageContent = replaceEL(pat.getUsername(),yuYueDate,messageContent); | |
| 793 | -// MessageRequest request = new MessageRequest(); | |
| 794 | -// | |
| 795 | -// //平台ID TODO | |
| 796 | -// request.setTypeId(1); | |
| 797 | -// request.setContent(messageContent); | |
| 798 | -// //服务对象 1孕妇 2儿童 3产妇 | |
| 799 | -// request.setObjType(ServiceObjEnums.YUNOBJ.getId()); | |
| 800 | -// request.setPhone(pat.getPhone()); | |
| 801 | -// //计划发送时间 | |
| 802 | -// request.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 803 | -// //短信商 TODO | |
| 804 | -// request.setServiceType(1); | |
| 805 | -// request.setSubTypeId(SmsServiceEnums.YBZD.getId()); | |
| 806 | -// | |
| 807 | -// //医院ID ext1 | |
| 808 | -// //模板ID ext2; | |
| 809 | -// //患者ID ext3; | |
| 810 | -// request.setExt1(pat.getHospitalId()); | |
| 811 | -// request.setExt2(template.getId()); | |
| 812 | -// request.setExt3(pat.getId()); | |
| 813 | -// | |
| 814 | -// } | |
| 831 | + AntExChuQuery antExChuQuery = new AntExChuQuery(); | |
| 832 | + antExChuQuery.setYn(YnEnums.YES.getId()); | |
| 833 | + antExChuQuery.setNextCheckTimeStart(startDate); | |
| 834 | + antExChuQuery.setParentId(pid); | |
| 835 | + List<AntExChuModel> chus = antenatalExaminationService.queryAntExChu(antExChuQuery); | |
| 836 | + for (AntExChuModel chu : chus) | |
| 837 | + { | |
| 838 | + idset.add(chu.getParentId()); | |
| 839 | + } | |
| 840 | + List<AntenatalExaminationModel> fuzs = antenatalExaminationService.queryYuyueAntenatalExamination(startDate,tempHid,pid); | |
| 815 | 841 | |
| 842 | + for (AntenatalExaminationModel f : fuzs) | |
| 843 | + { | |
| 844 | + idset.add(f.getParentId()); | |
| 845 | + } | |
| 846 | + return idset.size() > 0; | |
| 847 | + } | |
| 816 | 848 | |
| 849 | + | |
| 817 | 850 | /** |
| 851 | + * 封装发送短信对象 | |
| 852 | + * @param messageContent | |
| 853 | + * @param phone | |
| 854 | + * @param serviceObj | |
| 855 | + * @param smsType | |
| 856 | + * @param hospitalId | |
| 857 | + * @param tempId | |
| 858 | + * @param pid | |
| 859 | + * @return | |
| 860 | + */ | |
| 861 | + private MessageRequest getMessageRequest(String messageContent,String phone,Integer serviceObj,Integer smsType,String hospitalId,String tempId,String pid) | |
| 862 | + { | |
| 863 | + MessageRequest request = new MessageRequest(); | |
| 864 | + //平台ID TODO | |
| 865 | + request.setTypeId(1); | |
| 866 | + request.setContent(messageContent); | |
| 867 | + //服务对象 1孕妇 2儿童 3产妇 | |
| 868 | + request.setObjType(serviceObj); | |
| 869 | + request.setPhone(phone); | |
| 870 | + //计划发送时间 | |
| 871 | + request.setPlanTime(DateUtil.getyyyy_MM_dd_hms(new Date())); | |
| 872 | + //短信商 TODO | |
| 873 | + request.setServiceType(1); | |
| 874 | + request.setSubTypeId(smsType); | |
| 875 | + | |
| 876 | + //医院ID ext1 | |
| 877 | + //模板ID ext2; | |
| 878 | + //患者ID ext3; | |
| 879 | + request.setExt1(hospitalId); | |
| 880 | + request.setExt2(tempId); | |
| 881 | + request.setExt3(pid); | |
| 882 | + return request; | |
| 883 | + } | |
| 884 | + | |
| 885 | + | |
| 886 | + /** | |
| 818 | 887 | * 发送短信到短信中心 |
| 819 | 888 | * @param list |
| 820 | 889 | */ |
| ... | ... | @@ -838,6 +907,21 @@ |
| 838 | 907 | { |
| 839 | 908 | String date = DateUtil.getyyyy_MM_dd(checkDate); |
| 840 | 909 | return repalceStr.replace("{{姓名}}",name).replace("{{预约检查时间}}",date); |
| 910 | + } | |
| 911 | + return repalceStr; | |
| 912 | + } | |
| 913 | + | |
| 914 | + /** | |
| 915 | + * 替换名字 | |
| 916 | + * @param name | |
| 917 | + * @param repalceStr | |
| 918 | + * @return | |
| 919 | + */ | |
| 920 | + private String replaceName(String name,String repalceStr) | |
| 921 | + { | |
| 922 | + if (StringUtils.isNotEmpty(repalceStr)) | |
| 923 | + { | |
| 924 | + return repalceStr.replace("{{姓名}}",name); | |
| 841 | 925 | } |
| 842 | 926 | return repalceStr; |
| 843 | 927 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/BabyBookbuildingController.java
View file @
b8e9d65
| ... | ... | @@ -2,23 +2,26 @@ |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | import com.lyms.platform.biz.service.BabyBookbuildingService; |
| 5 | +import com.lyms.platform.biz.service.YunBookbuildingService; | |
| 5 | 6 | import com.lyms.platform.common.base.BaseController; |
| 6 | 7 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 7 | 8 | import com.lyms.platform.common.result.BaseListResponse; |
| 8 | 9 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 9 | 10 | import com.lyms.platform.common.result.BaseResponse; |
| 10 | 11 | import com.lyms.platform.common.utils.StringUtils; |
| 12 | +import com.lyms.platform.common.utils.SystemConfig; | |
| 11 | 13 | import com.lyms.platform.operate.web.facade.BabyBookbuildingFacade; |
| 12 | -import com.lyms.platform.operate.web.request.BabyBookbuildingAddRequest; | |
| 13 | -import com.lyms.platform.operate.web.request.BabyGuideSmsequest; | |
| 14 | -import com.lyms.platform.operate.web.request.BabyManageRequest; | |
| 15 | -import com.lyms.platform.operate.web.request.BookbuildingQueryRequest; | |
| 14 | +import com.lyms.platform.operate.web.facade.BookbuildingFacade; | |
| 15 | +import com.lyms.platform.operate.web.request.*; | |
| 16 | +import com.lyms.platform.operate.web.result.BasicConfigResult; | |
| 17 | +import com.lyms.platform.pojo.BabyModel; | |
| 16 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | 19 | import org.springframework.stereotype.Controller; |
| 18 | 20 | import org.springframework.web.bind.annotation.*; |
| 19 | 21 | |
| 20 | 22 | import javax.validation.Valid; |
| 21 | 23 | import java.io.UnsupportedEncodingException; |
| 24 | +import java.util.List; | |
| 22 | 25 | |
| 23 | 26 | |
| 24 | 27 | /* |
| 25 | 28 | |
| 26 | 29 | |
| 27 | 30 | |
| ... | ... | @@ -66,27 +69,25 @@ |
| 66 | 69 | |
| 67 | 70 | /** |
| 68 | 71 | * 查询儿童建档信息根据id查询 |
| 69 | - * | |
| 70 | 72 | * @param id |
| 71 | 73 | * @return |
| 72 | 74 | */ |
| 73 | 75 | @RequestMapping(value = "/queryBabyBuildById/{id}", method = RequestMethod.GET) |
| 74 | 76 | @ResponseBody |
| 75 | - public BaseObjectResponse queryBabyBuildById(@PathVariable("id") String id) { | |
| 76 | - return babyBookbuildingFacade.queryBabyBuildById(id); | |
| 77 | + public BaseObjectResponse queryBabyBuildById(@PathVariable("id")String id){ | |
| 78 | + return babyBookbuildingFacade.queryBabyBuildById(id); | |
| 77 | 79 | } |
| 78 | 80 | |
| 79 | 81 | |
| 80 | 82 | /** |
| 81 | - * 查询儿童建档就诊卡号,母亲身份证 | |
| 82 | - * | |
| 83 | + * 查询儿童建档就诊卡号,母亲身份证 | |
| 83 | 84 | * @param cardNo |
| 84 | 85 | * @param vcCardNo |
| 85 | 86 | * @return |
| 86 | 87 | */ |
| 87 | 88 | @RequestMapping(value = "/queryBabyBuild", method = RequestMethod.GET) |
| 88 | 89 | @ResponseBody |
| 89 | - public BaseObjectResponse queryBabyBuild(@RequestParam(required = false) String cardNo, @RequestParam(required = false) String vcCardNo) { | |
| 90 | + public BaseObjectResponse queryBabyBuild(@RequestParam(required = false)String cardNo,@RequestParam(required = false)String vcCardNo){ | |
| 90 | 91 | BookbuildingQueryRequest param = new BookbuildingQueryRequest(); |
| 91 | 92 | param.setCardNo(cardNo); |
| 92 | 93 | param.setVcCardNo(vcCardNo); |
| 93 | 94 | |
| 94 | 95 | |
| 95 | 96 | |
| ... | ... | @@ -94,19 +95,20 @@ |
| 94 | 95 | } |
| 95 | 96 | |
| 96 | 97 | |
| 98 | + | |
| 97 | 99 | /** |
| 98 | - * 查询儿童建档记录就诊卡号,母亲身份证 | |
| 99 | - * | |
| 100 | + * 查询儿童建档记录就诊卡号,母亲身份证 | |
| 100 | 101 | * @param cardNo |
| 101 | 102 | * @param vcCardNo |
| 102 | 103 | * @return |
| 103 | 104 | */ |
| 104 | 105 | @RequestMapping(value = "/queryBabyBuildRecord", method = RequestMethod.GET) |
| 105 | 106 | @ResponseBody |
| 106 | - public BaseObjectResponse queryBabyBuildRecord(@RequestParam(required = false) String cardNo, @RequestParam(required = false) String vcCardNo) { | |
| 107 | + public BaseObjectResponse queryBabyBuildRecord(@RequestParam(required = false)String cardNo,@RequestParam(required = false)String vcCardNo,@RequestParam(required = false)String hospitalId){ | |
| 107 | 108 | BookbuildingQueryRequest param = new BookbuildingQueryRequest(); |
| 108 | 109 | param.setCardNo(cardNo); |
| 109 | 110 | param.setVcCardNo(vcCardNo); |
| 111 | + param.setHospitalId(hospitalId); | |
| 110 | 112 | return babyBookbuildingFacade.queryBabyBuildRecord(param); |
| 111 | 113 | } |
| 112 | 114 | |
| 113 | 115 | |
| 114 | 116 | |
| 115 | 117 | |
| 116 | 118 | |
| ... | ... | @@ -130,33 +132,31 @@ |
| 130 | 132 | */ |
| 131 | 133 | @RequestMapping(value = "/queryDiagnose", method = RequestMethod.GET) |
| 132 | 134 | @ResponseBody |
| 133 | - public BaseObjectResponse queryDiagnose(@RequestParam(required = true) String keyword) throws UnsupportedEncodingException { | |
| 134 | - // keyword = new String(keyword.getBytes("ISO-8859-1"),"UTF-8"); | |
| 135 | + public BaseObjectResponse queryDiagnose(@RequestParam(required = true)String keyword) throws UnsupportedEncodingException { | |
| 136 | + // keyword = new String(keyword.getBytes("ISO-8859-1"),"UTF-8"); | |
| 135 | 137 | return babyBookbuildingFacade.queryDiagnose(keyword); |
| 136 | 138 | } |
| 137 | 139 | |
| 138 | 140 | /** |
| 139 | 141 | * 查询妈咪高危因素 |
| 140 | - * | |
| 141 | 142 | * @param cardNo |
| 142 | 143 | * @return |
| 143 | 144 | */ |
| 144 | 145 | |
| 145 | 146 | @RequestMapping(value = "/queryMommyRiskByCardNo", method = RequestMethod.GET) |
| 146 | 147 | @ResponseBody |
| 147 | - public BaseObjectResponse queryMommyRiskByCardNo(@RequestParam(required = true) String cardNo) { | |
| 148 | + public BaseObjectResponse queryMommyRiskByCardNo(@RequestParam(required = true)String cardNo){ | |
| 148 | 149 | return babyBookbuildingFacade.queryMommyRiskByCardNo(cardNo); |
| 149 | 150 | } |
| 150 | 151 | |
| 151 | 152 | |
| 152 | 153 | /** |
| 153 | 154 | * 查询儿童管理页面 |
| 154 | - * | |
| 155 | - * @param mcardNo 母亲身份证 | |
| 155 | + * @param mcardNo 母亲身份证 | |
| 156 | 156 | * @param page |
| 157 | 157 | * @param limit |
| 158 | - * @param name 儿童姓名 | |
| 159 | - * @param highRiskType 0 非高危 1 高危 2/空 全部 | |
| 158 | + * @param name 儿童姓名 | |
| 159 | + * @param highRiskType 0 非高危 1 高危 2/空 全部 | |
| 160 | 160 | * @return |
| 161 | 161 | */ |
| 162 | 162 | @RequestMapping(value = "/queryBabyList", method = RequestMethod.GET) |
| ... | ... | @@ -174,7 +174,7 @@ |
| 174 | 174 | @RequestParam(value = "highRiskType", required = false) Integer highRiskType, |
| 175 | 175 | @RequestParam(value = "diagnose", required = false) String diagnose, |
| 176 | 176 | @RequestParam("page") Integer page, |
| 177 | - @RequestParam("limit") Integer limit) { | |
| 177 | + @RequestParam("limit") Integer limit){ | |
| 178 | 178 | |
| 179 | 179 | BabyManageRequest request = new BabyManageRequest(); |
| 180 | 180 | request.setBcardNo(bcardNo); |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyBookbuildingFacade.java
View file @
b8e9d65
| ... | ... | @@ -575,7 +575,7 @@ |
| 575 | 575 | if (!StringUtils.isEmpty(param.getCardNo())) { |
| 576 | 576 | babyQuery.setCardId(param.getCardNo()); |
| 577 | 577 | models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); |
| 578 | - if (CollectionUtils.isNotEmpty(models)) { | |
| 578 | + if (!CollectionUtils.isNotEmpty(models)) { | |
| 579 | 579 | //通过查询孕妇 |
| 580 | 580 | PatientsQuery puerperaQuery = new PatientsQuery(); |
| 581 | 581 | puerperaQuery.setCardNo(param.getCardNo()); |
| ... | ... | @@ -587,7 +587,7 @@ |
| 587 | 587 | models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); |
| 588 | 588 | } |
| 589 | 589 | } |
| 590 | - } else if (!StringUtils.isEmpty(param.getVcCardNo()) && !StringUtils.isEmpty(String.valueOf(param.getHospitalId()))) { | |
| 590 | + } else if (param.getHospitalId() != null & !StringUtils.isEmpty(param.getVcCardNo())) { | |
| 591 | 591 | babyQuery.setHospitalId(param.getHospitalId()); |
| 592 | 592 | babyQuery.setVcCardNo(param.getVcCardNo()); |
| 593 | 593 | models = babyBookbuildingService.queryBabyBuildByCond(babyQuery); |
| ... | ... | @@ -596,8 +596,16 @@ |
| 596 | 596 | if (models != null && models.size() > 0) { |
| 597 | 597 | Set<String> uid = new HashSet<>(); |
| 598 | 598 | for (BabyModel model : models) { |
| 599 | - if (model != null && StringUtils.isNotEmpty(model.getCardId()) && StringUtils.isNotEmpty(model.getPhoneId())) { | |
| 600 | - uid.add(model.getCardNo()); | |
| 599 | + if (model != null) { | |
| 600 | + if (StringUtils.isNotEmpty(model.getCardId())) | |
| 601 | + { | |
| 602 | + uid.add(model.getCardId()); | |
| 603 | + } | |
| 604 | + else if (StringUtils.isNotEmpty(model.getPhoneId())) | |
| 605 | + { | |
| 606 | + uid.add(model.getPhoneId()); | |
| 607 | + } | |
| 608 | + | |
| 601 | 609 | } |
| 602 | 610 | |
| 603 | 611 | } |