Commit b2b24fd0e822bb7cf103fe26aa1ecb74ed79f253

Authored by jiangjiazhi

Merge remote-tracking branch 'origin/master'

Showing 4 changed files

platform-common/src/main/java/com/lyms/platform/common/utils/DateUtil.java View file @ b2b24fd
... ... @@ -9,8 +9,10 @@
9 9  
10 10 public class DateUtil {
11 11  
  12 + public static SimpleDateFormat dd = new SimpleDateFormat("dd");
12 13 public static SimpleDateFormat ymd = new SimpleDateFormat("yyyyMMdd");
13 14 public static SimpleDateFormat y_m_d = new SimpleDateFormat("yyyy-MM-dd");
  15 + public static SimpleDateFormat md = new SimpleDateFormat("MM-dd");
14 16 public static SimpleDateFormat m_d = new SimpleDateFormat("MM/dd");
15 17 public static SimpleDateFormat y_m_d_h_m_s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
16 18 public static SimpleDateFormat y_m_d_h_m = new SimpleDateFormat("yyyyMMddHHmm");
17 19  
... ... @@ -181,12 +183,34 @@
181 183 }
182 184 }
183 185  
  186 + public static String getMMdd(Date d) {
  187 + if (d == null) {
  188 + return null;
  189 + }
  190 + try {
  191 + return md.format(d);
  192 + } catch (Exception e) {
  193 + return null;
  194 + }
  195 + }
  196 +
184 197 public static String getMM_dd(Date d) {
185 198 if (d == null) {
186 199 return null;
187 200 }
188 201 try {
189 202 return m_d.format(d);
  203 + } catch (Exception e) {
  204 + return null;
  205 + }
  206 + }
  207 +
  208 + public static String getDD(Date d) {
  209 + if (d == null) {
  210 + return null;
  211 + }
  212 + try {
  213 + return dd.format(d);
190 214 } catch (Exception e) {
191 215 return null;
192 216 }
platform-common/src/main/java/com/lyms/platform/common/utils/Lunar.java View file @ b2b24fd
... ... @@ -173,7 +173,7 @@
173 173 return chineseTen[day / 10] + chineseNumber[n];
174 174 }
175 175  
176   - public String getString() {
  176 + public String getYMD() {
177 177  
178 178 String m = "";
179 179 if (month < 10 )
180 180  
... ... @@ -194,14 +194,42 @@
194 194 d = day+"";
195 195 }
196 196 return year +"-"+ m +"-" + d;
197   - }
198   -
  197 + }
  198 +
  199 + public String getMD() {
  200 +
  201 + String m = "";
  202 + if (month < 10) {
  203 + m = "0" + month;
  204 + } else {
  205 + m = month + "";
  206 + }
  207 + String d = "";
  208 + if (day < 10) {
  209 + d = "0" + day;
  210 + } else {
  211 + d = day + "";
  212 + }
  213 + return m + "-" + d;
  214 +
  215 + }
  216 +
  217 + public String getD() {
  218 + String d = "";
  219 + if (day < 10) {
  220 + d = "0" + day;
  221 + } else {
  222 + d = day + "";
  223 + }
  224 + return d;
  225 +
  226 + }
199 227 public static void main(String[] args) throws ParseException {
200 228 Calendar today = Calendar.getInstance();
201 229 today.setTime(chineseDateFormat.parse("2011-07-14"));
202 230 Lunar lunar = new Lunar(today);
203 231  
204   - System.out.println(lunar.getString());
  232 + System.out.println(lunar.getMD());
205 233 }
206 234 }
platform-data-api/src/main/java/com/lyms/platform/data/service/impl/SmsServiceImpl.java View file @ b2b24fd
... ... @@ -754,15 +754,33 @@
754 754 //公历
755 755 if (sendDateType == SendDateEnums.GL.getId())
756 756 {
757   - String currentDate = DateUtil.getyyyy_MM_dd(new Date());
  757 + String currentDate = DateUtil.getMM_dd(new Date());
758 758 Date sendDate = template.getSendDate();
759 759 if (sendDate != null)
760 760 {
761   - Date planSendDate = DateUtil.addDay(sendDate,sendDateType);
762   - String sendDateStr = DateUtil.getyyyy_MM_dd(planSendDate);
  761 + Date actualSendDate = DateUtil.addDay(sendDate,sendTimeType);
  762 + String sendDateStr = DateUtil.getMM_dd(actualSendDate);
763 763 if (currentDate.equals(sendDateStr))
764 764 {
  765 + //查询符合条件的孕妇
  766 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  767 + if (CollectionUtils.isNotEmpty(patients))
  768 + {
  769 + for (Patients pat : patients)
  770 + {
765 771  
  772 + //短信前缀
  773 + String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor());
  774 + String messageContent = "【"+messagePrefix+"】"+template.getContent();
  775 + messageContent = replaceName(pat.getUsername(), messageContent);
  776 +
  777 +
  778 + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(),
  779 + pat.getHospitalId(),template.getId(),pat.getId());
  780 +
  781 + messages.add(request);
  782 + }
  783 + }
766 784 }
767 785 }
768 786 }
769 787  
770 788  
771 789  
... ... @@ -773,10 +791,245 @@
773 791 today.setTime(new Date());
774 792 Lunar lunar = new Lunar(today);
775 793 //当前时间农历日期
776   - String currentDate = lunar.getString();
  794 + String currentDate = lunar.getMD();
  795 + Date sendDate = template.getSendDate();
  796 + if (sendDate != null)
  797 + {
  798 + Date actualSendDate = DateUtil.addDay(sendDate,sendTimeType);
  799 + String sendDateStr = DateUtil.getMM_dd(actualSendDate);
  800 + if (currentDate.equals(sendDateStr))
  801 + {
  802 + //查询符合条件的孕妇
  803 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  804 + if (CollectionUtils.isNotEmpty(patients))
  805 + {
  806 + for (Patients pat : patients)
  807 + {
  808 +
  809 + //短信前缀
  810 + String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor());
  811 + String messageContent = "【"+messagePrefix+"】"+template.getContent();
  812 + messageContent = replaceName(pat.getUsername(), messageContent);
  813 +
  814 +
  815 + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(),
  816 + pat.getHospitalId(),template.getId(),pat.getId());
  817 +
  818 + messages.add(request);
  819 + }
  820 + }
  821 + }
  822 + }
777 823 }
  824 + }
  825 + }
  826 + else if (sendFreq == SendFrequencyEnums.MONTH.getId())
  827 + {
  828 + Integer sendDateType = template.getSendDateType();
778 829  
  830 + //公历
  831 + if (sendDateType == SendDateEnums.GL.getId())
  832 + {
  833 + String currentDate = DateUtil.getDD(new Date());
  834 + Date sendDate = template.getSendDate();
  835 + if (sendDate != null)
  836 + {
  837 + Date actualSendDate = DateUtil.addDay(sendDate,sendTimeType);
  838 + String sendDateStr = DateUtil.getDD(actualSendDate);
  839 + if (currentDate.equals(sendDateStr))
  840 + {
  841 + //查询符合条件的孕妇
  842 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  843 + if (CollectionUtils.isNotEmpty(patients))
  844 + {
  845 + for (Patients pat : patients)
  846 + {
  847 +
  848 + //短信前缀
  849 + String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor());
  850 + String messageContent = "【"+messagePrefix+"】"+template.getContent();
  851 + messageContent = replaceName(pat.getUsername(), messageContent);
  852 +
  853 +
  854 + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(),
  855 + pat.getHospitalId(),template.getId(),pat.getId());
  856 +
  857 + messages.add(request);
  858 + }
  859 + }
  860 + }
779 861 }
  862 + }
  863 + //农历
  864 + else if (sendDateType == SendDateEnums.NL.getId())
  865 + {
  866 + Calendar today = Calendar.getInstance();
  867 + today.setTime(new Date());
  868 + Lunar lunar = new Lunar(today);
  869 + //当前时间农历日期
  870 + String currentDate = lunar.getD();
  871 + Date sendDate = template.getSendDate();
  872 + if (sendDate != null)
  873 + {
  874 + Date actualSendDate = DateUtil.addDay(sendDate,sendTimeType);
  875 + String sendDateStr = DateUtil.getDD(actualSendDate);
  876 + if (currentDate.equals(sendDateStr))
  877 + {
  878 + //查询符合条件的孕妇
  879 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  880 + if (CollectionUtils.isNotEmpty(patients))
  881 + {
  882 + for (Patients pat : patients)
  883 + {
  884 +
  885 + //短信前缀
  886 + String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor());
  887 + String messageContent = "【"+messagePrefix+"】"+template.getContent();
  888 + messageContent = replaceName(pat.getUsername(), messageContent);
  889 +
  890 +
  891 + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(),
  892 + pat.getHospitalId(),template.getId(),pat.getId());
  893 +
  894 + messages.add(request);
  895 + }
  896 + }
  897 + }
  898 + }
  899 + }
  900 + }
  901 + else if (sendFreq == SendFrequencyEnums.ONCE.getId())
  902 + {
  903 + //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");
  904 + Integer sendDateType = template.getSendDateType();
  905 + if (sendDateType == SendDateEnums.TSRQ.getId()) {
  906 + //孕妇 下面的 建档 服务结束
  907 + Integer specialDateType = template.getSpecialDateType();
  908 + //服务结束
  909 + if (specialDateType == SpecialDateEnums.FWJS.getId())
  910 + {
  911 +
  912 + }
  913 + //孕妇建档在 孕妇建档生成
  914 + else if (specialDateType == SpecialDateEnums.JD.getId())
  915 + {
  916 +
  917 +
  918 + }
  919 + }
  920 + //特殊日期中的公历和农历
  921 + else if (sendDateType == SendDateEnums.GL.getId() || sendDateType == SendDateEnums.NL.getId() )
  922 + {
  923 +
  924 + //公历
  925 + if (sendDateType == SendDateEnums.GL.getId())
  926 + {
  927 + String currentDate = DateUtil.getyyyy_MM_dd(new Date());
  928 + Date sendDate = template.getSendDate();
  929 + if (sendDate != null)
  930 + {
  931 + Date actualSendDate = DateUtil.addDay(sendDate,sendTimeType);
  932 + String sendDateStr = DateUtil.getyyyy_MM_dd(actualSendDate);
  933 + if (currentDate.equals(sendDateStr))
  934 + {
  935 + //查询符合条件的孕妇
  936 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  937 + if (CollectionUtils.isNotEmpty(patients))
  938 + {
  939 + for (Patients pat : patients)
  940 + {
  941 +
  942 + //短信前缀
  943 + String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor());
  944 + String messageContent = "【"+messagePrefix+"】"+template.getContent();
  945 + messageContent = replaceName(pat.getUsername(), messageContent);
  946 +
  947 +
  948 + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(),
  949 + pat.getHospitalId(),template.getId(),pat.getId());
  950 +
  951 + messages.add(request);
  952 + }
  953 + }
  954 + }
  955 + }
  956 + }
  957 + //农历
  958 + else if (sendDateType == SendDateEnums.NL.getId())
  959 + {
  960 + Calendar today = Calendar.getInstance();
  961 + today.setTime(new Date());
  962 + Lunar lunar = new Lunar(today);
  963 + //当前时间农历日期
  964 + String currentDate = lunar.getYMD();
  965 + Date sendDate = template.getSendDate();
  966 + if (sendDate != null)
  967 + {
  968 + Date actualSendDate = DateUtil.addDay(sendDate,sendTimeType);
  969 + String sendDateStr = DateUtil.getyyyy_MM_dd(actualSendDate);
  970 + if (currentDate.equals(sendDateStr))
  971 + {
  972 + //查询符合条件的孕妇
  973 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  974 + if (CollectionUtils.isNotEmpty(patients))
  975 + {
  976 + for (Patients pat : patients)
  977 + {
  978 +
  979 + //短信前缀
  980 + String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor());
  981 + String messageContent = "【"+messagePrefix+"】"+template.getContent();
  982 + messageContent = replaceName(pat.getUsername(), messageContent);
  983 +
  984 +
  985 + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(),
  986 + pat.getHospitalId(),template.getId(),pat.getId());
  987 +
  988 + messages.add(request);
  989 + }
  990 + }
  991 + }
  992 + }
  993 + }
  994 + }
  995 + else if (sendDateType == SendDateEnums.SLRQ.getId())
  996 + {
  997 + //孕妇特殊日期 孕周
  998 + Integer specialDateType = template.getSpecialDateType();
  999 + if (specialDateType == SpecialDateEnums.YZ.getId())
  1000 + {
  1001 + Integer start = template.getStart();
  1002 + Integer end = template.getEnd();
  1003 + if (end != null && start != null)
  1004 + {
  1005 +
  1006 + Date startDate = DateUtil.getNewDate(-end,"周",sendTimeType);
  1007 + Date endDate = DateUtil.getNewDate(-start,"周",sendTimeType);
  1008 + patientsQuery.setLastMensesStart(startDate);
  1009 + patientsQuery.setLastMensesEnd(endDate);
  1010 +
  1011 + //查询符合条件的孕妇
  1012 + List<Patients> patients = yunBookbuildingService.queryPregnantWithQuery(patientsQuery);
  1013 + if (CollectionUtils.isNotEmpty(patients))
  1014 + {
  1015 + for (Patients pat : patients)
  1016 + {
  1017 +
  1018 + //短信前缀
  1019 + String messagePrefix = getSmsPrefix(config,pat.getBookbuildingDoctor());
  1020 + String messageContent = "【"+messagePrefix+"】"+template.getContent();
  1021 + messageContent = replaceName(pat.getUsername(), messageContent);
  1022 +
  1023 +
  1024 + MessageRequest request = getMessageRequest( messageContent,pat.getPhone(),ServiceObjEnums.YUNOBJ.getId(), template.getSmsType(),
  1025 + pat.getHospitalId(),template.getId(),pat.getId());
  1026 +
  1027 + messages.add(request);
  1028 + }
  1029 + }
  1030 + }
  1031 + }
  1032 + }
780 1033 }
781 1034  
782 1035 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/BabyCheckRequest.java View file @ b2b24fd
... ... @@ -218,6 +218,15 @@
218 218  
219 219 private String checkDate;
220 220  
  221 + private String monthAge;
  222 +
  223 + public String getMonthAge() {
  224 + return monthAge;
  225 + }
  226 +
  227 + public void setMonthAge(String monthAge) {
  228 + this.monthAge = monthAge;
  229 + }
221 230  
222 231 public String getCheckDate() {
223 232 return checkDate;