|
@ -369,11 +369,13 @@ public class KitService extends BaseService {
|
|
* 本月用药情况
|
|
* 本月用药情况
|
|
* @param useDrugStatus (1、按时,2、超时,3、漏用)
|
|
* @param useDrugStatus (1、按时,2、超时,3、漏用)
|
|
*/
|
|
*/
|
|
public Map<String,Object> currentMonthDrugUse(String patientCode,Integer useDrugStatus,String deviceSn) throws Exception{
|
|
|
|
|
|
public Map<String,Object> currentMonthDrugUse(String patientCode,Integer useDrugStatus,String deviceSn,String month) throws Exception{
|
|
|
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
Date monthStart = DateUtil.strToDate(DateUtil.getFristDayOfMonthThisDate(new Date()));
|
|
|
|
Date monthEnd = new Date();
|
|
|
|
|
|
// Date monthStart = DateUtil.strToDate(DateUtil.getFristDayOfMonthThisDate(new Date()));
|
|
|
|
// Date monthEnd = new Date();
|
|
|
|
Date monthStart = DateUtil.strToDate(month,"yyyy-MM");
|
|
|
|
Date monthEnd = DateUtil.strToDate(DateUtil.getLastDayOfMonthThisDate(monthStart)+" 23:59:59");
|
|
Integer onTimeCount = kitDrugUseRecordDao.findStatisticsCount(patientCode,1,deviceSn,monthStart,monthEnd);//按时次数
|
|
Integer onTimeCount = kitDrugUseRecordDao.findStatisticsCount(patientCode,1,deviceSn,monthStart,monthEnd);//按时次数
|
|
Integer overTimeCount = kitDrugUseRecordDao.findStatisticsCount(patientCode,2,deviceSn,monthStart,monthEnd);//超时次数
|
|
Integer overTimeCount = kitDrugUseRecordDao.findStatisticsCount(patientCode,2,deviceSn,monthStart,monthEnd);//超时次数
|
|
Integer leakageCount = kitDrugUseRecordDao.findStatisticsCount(patientCode,3,deviceSn,monthStart,monthEnd);//漏用次数
|
|
Integer leakageCount = kitDrugUseRecordDao.findStatisticsCount(patientCode,3,deviceSn,monthStart,monthEnd);//漏用次数
|
|
@ -404,7 +406,7 @@ public class KitService extends BaseService {
|
|
Map<String,Map<String,Object>> map = new LinkedHashMap<>();
|
|
Map<String,Map<String,Object>> map = new LinkedHashMap<>();
|
|
|
|
|
|
for(KitDrugUseRecord one:list){
|
|
for(KitDrugUseRecord one:list){
|
|
String dateStr = DateUtil.dateToStr(one.getUseTime(),"MM-dd");
|
|
|
|
|
|
String dateStr = DateUtil.dateToStr(one.getUseTime(),"yyyy-MM-dd");
|
|
Map<String,Object> oneMap = null;
|
|
Map<String,Object> oneMap = null;
|
|
if(map.containsKey(dateStr)){
|
|
if(map.containsKey(dateStr)){
|
|
oneMap = map.get(dateStr);
|
|
oneMap = map.get(dateStr);
|
|
@ -437,8 +439,8 @@ public class KitService extends BaseService {
|
|
Collections.sort(resultList, new Comparator<Map<String,Object>>() {
|
|
Collections.sort(resultList, new Comparator<Map<String,Object>>() {
|
|
@Override
|
|
@Override
|
|
public int compare(Map<String,Object> o1, Map<String,Object> o2) {
|
|
public int compare(Map<String,Object> o1, Map<String,Object> o2) {
|
|
Long day1 = DateUtil.strToDate(o1.get("day").toString(), "MM-dd").getTime();
|
|
|
|
Long day2 = DateUtil.strToDate(o2.get("day").toString(), "MM-dd").getTime();
|
|
|
|
|
|
Long day1 = DateUtil.strToDate(o1.get("day").toString(), "yyyy-MM-dd").getTime();
|
|
|
|
Long day2 = DateUtil.strToDate(o2.get("day").toString(), "yyyy-MM-dd").getTime();
|
|
if(day1-day2>0){
|
|
if(day1-day2>0){
|
|
return -1;
|
|
return -1;
|
|
}else if(day1-day2<0){
|
|
}else if(day1-day2<0){
|
|
@ -489,6 +491,7 @@ public class KitService extends BaseService {
|
|
Map<String,Object> temp = new HashMap<>();
|
|
Map<String,Object> temp = new HashMap<>();
|
|
temp.put("useTime",DateUtil.dateToStr(one.getUseTime(),"HH:mm"));
|
|
temp.put("useTime",DateUtil.dateToStr(one.getUseTime(),"HH:mm"));
|
|
temp.put("drugDetail",JSONArray.fromObject(one.getDrugDetail()));
|
|
temp.put("drugDetail",JSONArray.fromObject(one.getDrugDetail()));
|
|
|
|
temp.put("useDrugStatus",one.getUseDrugStatus());
|
|
resultList.add(temp);
|
|
resultList.add(temp);
|
|
}
|
|
}
|
|
return resultList;
|
|
return resultList;
|