String[] weekDays = { "周日", "周一", "周二", "周三", "周四", "周五", "周六" };
Calendar cal = Calendar.getInstance(); // 获得一个日历
try {
SimpleDateFormat adf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = adf.parse(re.getTextTrim()); // 时间字符串
cal.setTime(date);
int w = cal.get(Calendar.DAY_OF_WEEK) - 1; // 指示一个星期中的某天。
if (w < 0){
w = 0;
}
SimpleDateFormat f = new SimpleDateFormat("HH");
String sTime = f.format(date); // 获取小时
int hour = Integer.parseInt(sTime);
if(hour>6&&hour<=12) { // 上午
System.out.println(weekDays[w]+"上午");
}
if(hour>12&&hour<=18) { // 下午
System.out.println(weekDays[w]+"下午");
}
} catch (Exception e) {
e.printStackTrace();
}
// 分组合并整理
Map<String, List> skuIdMap = new HashMap<>();
for (VisitInfo skuVo : listAll) {
List tempList = skuIdMap.get(skuVo.getDoctorCode());
/如果取不到数据,那么直接new一个空的ArrayList*/
if (tempList == null) {
tempList = new ArrayList<>();
tempList.add(skuVo);
skuIdMap.put(skuVo.getDoctorCode(), tempList);
} else {
/某个sku之前已经存放过了,则直接追加数据到原来的List里*/
tempList.add(skuVo);
}
}
Map<String, Object> map = new HashMap();
for(String sku: skuIdMap.keySet()){
List l = skuIdMap.get(sku);
String proied = “”;
for(VisitInfo vis: l) {
proied += vis.getPeriod()+"、";
}
map.put(sku, proied.substring(0, proied.length()-1));
}
return map;

3037

被折叠的 条评论
为什么被折叠?



