|
@@ -398,52 +398,40 @@ public class PersonDeviceLogApiController {
|
|
|
@ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
|
|
|
})
|
|
|
public MessageResult<List<Map>> temperaturePieChart(
|
|
|
- String startTime,String endTime,
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime,
|
|
|
String token, @RequestAttribute String subject){
|
|
|
MessageResult<List<Map>> msgResult = new MessageResult<>();
|
|
|
List<Map> listMap = new ArrayList<>();
|
|
|
try{
|
|
|
- String startDate = "";
|
|
|
- String endDate = "";
|
|
|
- //37度以上为异常体温
|
|
|
- BigDecimal bd = new BigDecimal(37);
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(personInfo.getCompanyId());
|
|
|
|
|
|
- if(StringUtil.isNotEmpty(startTime)&&StringUtil.isNotEmpty(endTime)) {
|
|
|
- startDate = startTime;
|
|
|
- endDate = endTime;
|
|
|
+ if (startTime==null){
|
|
|
+ startTime = DateTime.now().plusDays(-14).toDate();
|
|
|
}
|
|
|
- else{
|
|
|
- Date now = new Date();
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
-
|
|
|
- Calendar rightNow = Calendar.getInstance();
|
|
|
- rightNow.setTime(now);
|
|
|
- rightNow.add(Calendar.DATE, -14);
|
|
|
-
|
|
|
- Calendar now1 = Calendar.getInstance();
|
|
|
- now1.setTime(now);
|
|
|
- now1.add(Calendar.DATE, 1);
|
|
|
|
|
|
- Date dt1 = rightNow.getTime();
|
|
|
- Date dt2 = now1.getTime();
|
|
|
- startDate = sdf.format(dt1);
|
|
|
- endDate = sdf.format(dt2);
|
|
|
+ if (endTime==null){
|
|
|
+ endTime = DateTime.now().plusDays(1).toDate();
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ endTime = new DateTime(endTime).plusDays(1).toDate();
|
|
|
}
|
|
|
|
|
|
- List<PersonDeviceFilterLog> normalPersonDeviceFilterLogList = personDeviceFilterLogService.temperatureNormalStatistics(bd,startDate,endDate);
|
|
|
- List<PersonDeviceFilterLog> unusualPersonDeviceFilterLogList = personDeviceFilterLogService.temperatureUnusualStatistics(bd,startDate,endDate);
|
|
|
+ long normalCount = personDeviceFilterLogService.countByTimeRangeAndCompanyCode(companyInfo.getCode() + "%",1,startTime,endTime);
|
|
|
+ long abnormalCount = personDeviceFilterLogService.countByTimeRangeAndCompanyCode(companyInfo.getCode() + "%",-1,startTime,endTime);
|
|
|
|
|
|
Map<String,Object> map1 = new HashMap();
|
|
|
|
|
|
map1.put("name","体温正常");
|
|
|
- map1.put("value",normalPersonDeviceFilterLogList.size());
|
|
|
+ map1.put("value",normalCount);
|
|
|
|
|
|
listMap.add(map1);
|
|
|
|
|
|
Map<String,Object> map2 = new HashMap();
|
|
|
|
|
|
map2.put("name","体温异常");
|
|
|
- map2.put("value",unusualPersonDeviceFilterLogList.size());
|
|
|
+ map2.put("value",abnormalCount);
|
|
|
|
|
|
listMap.add(map2);
|
|
|
|
|
@@ -462,25 +450,44 @@ public class PersonDeviceLogApiController {
|
|
|
@ApiOperation(value="体温台账统计")
|
|
|
@RequestMapping(value = "temperatureStatistics",method = RequestMethod.POST)
|
|
|
@ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name="startTime",value = "开始时间(格式:yyyy-MM-dd)",paramType = "form"),
|
|
|
+ @ApiImplicitParam(name="endTime",value = "截止时间(格式:yyyy-MM-dd)",paramType = "form"),
|
|
|
@ApiImplicitParam(name="token",value = "令牌",required = true,paramType = "form"),
|
|
|
@ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
|
|
|
})
|
|
|
public MessageResult<List<Map>> temperatureStatistics(
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime,
|
|
|
String token, @RequestAttribute String subject){
|
|
|
MessageResult<List<Map>> msgResult = new MessageResult<>();
|
|
|
List<Map> listMap = new ArrayList<>();
|
|
|
|
|
|
try{
|
|
|
- List<PersonDeviceFilterLog> personDeviceFilterLogList = personDeviceFilterLogService.list();
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(personInfo.getCompanyId());
|
|
|
+
|
|
|
+ if (startTime==null){
|
|
|
+ startTime = DateTime.now().plusDays(-14).toDate();
|
|
|
+ }
|
|
|
+
|
|
|
+ if (endTime==null){
|
|
|
+ endTime = DateTime.now().plusDays(1).toDate();
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ endTime = new DateTime(endTime).plusDays(1).toDate();
|
|
|
+ }
|
|
|
+
|
|
|
+ long detected = personDeviceFilterLogService.countByTimeRangeAndCompanyCode(companyInfo.getCode() + "%",0,startTime,endTime);
|
|
|
+
|
|
|
Map map = new HashMap();
|
|
|
- map.put("detected",personDeviceFilterLogList.size());
|
|
|
- List<CompanyInfo> companyList = companyInfoService.list();
|
|
|
+ map.put("detected",detected);
|
|
|
|
|
|
- map.put("companyCount",companyList.size());
|
|
|
+ long companyCount = companyInfoService.countByCompanyCode(companyInfo.getCode() + "%");
|
|
|
+ map.put("companyCount",companyCount);
|
|
|
|
|
|
- List<PersonInfo> personInfo = personInfoService.list();
|
|
|
+ long personCount = personInfoService.countByCompanyCode(companyInfo.getCode() + "%");
|
|
|
+ map.put("personCount",personCount);
|
|
|
|
|
|
- map.put("personCount",personInfo.size());
|
|
|
listMap.add(map);
|
|
|
|
|
|
msgResult.setResult(true);
|
|
@@ -505,41 +512,35 @@ public class PersonDeviceLogApiController {
|
|
|
@ApiImplicitParam(name="subject",value = "目标(不传)",paramType = "form")
|
|
|
})
|
|
|
public MessageResult<Map<String, Object>> unusualStatistics(
|
|
|
- String startTime,String endTime,
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date startTime,
|
|
|
+ @DateTimeFormat(pattern = "yyyy-MM-dd") Date endTime,
|
|
|
String token, @RequestAttribute String subject) {
|
|
|
MessageResult<Map<String, Object>> msgResult = new MessageResult<>();
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
try{
|
|
|
+ PersonInfo personInfo = personInfoService.get(Long.valueOf(subject));
|
|
|
+ CompanyInfo companyInfo = companyInfoService.get(personInfo.getCompanyId());
|
|
|
+
|
|
|
String startDate = "";
|
|
|
String endDate = "";
|
|
|
+
|
|
|
//37度以上为异常体温
|
|
|
- BigDecimal bd = new BigDecimal(37);
|
|
|
+ BigDecimal standard = new BigDecimal(37);
|
|
|
|
|
|
- if(StringUtil.isNotEmpty(startTime)&&StringUtil.isNotEmpty(endTime)) {
|
|
|
- startDate = startTime;
|
|
|
- endDate = endTime;
|
|
|
+ if (startTime==null){
|
|
|
+ startTime = DateTime.now().plusDays(-14).toDate();
|
|
|
}
|
|
|
- else{
|
|
|
- Date now = new Date();
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
-
|
|
|
- Calendar rightNow = Calendar.getInstance();
|
|
|
- rightNow.setTime(now);
|
|
|
- rightNow.add(Calendar.DATE, -14);
|
|
|
|
|
|
- Calendar now1 = Calendar.getInstance();
|
|
|
- now1.setTime(now);
|
|
|
- now1.add(Calendar.DATE, 1);
|
|
|
-
|
|
|
- Date dt1 = rightNow.getTime();
|
|
|
- Date dt2 = now1.getTime();
|
|
|
- startDate = sdf.format(dt1);
|
|
|
- endDate = sdf.format(dt2);
|
|
|
+ if (endTime==null){
|
|
|
+ endTime = DateTime.now().plusDays(1).toDate();
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ endTime = new DateTime(endTime).plusDays(1).toDate();
|
|
|
}
|
|
|
|
|
|
- List<Map<String, Object>> mapList = personDeviceFilterLogService.unusualStatistics(bd,startDate,endDate);
|
|
|
+ List<Map<String, Object>> mapList = personDeviceFilterLogService.unusualStatistics(companyInfo.getCode() + "%",standard,startTime,endTime);
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
|
|
|
int companyTotalCount = 0;
|
|
@@ -549,6 +550,7 @@ public class PersonDeviceLogApiController {
|
|
|
if(curMap.get("name")!=null){
|
|
|
list.add(curMap);
|
|
|
companyTotalCount++;
|
|
|
+
|
|
|
if(curMap.get("personCount")!=null){
|
|
|
String personCountStr = curMap.get("personCount").toString();
|
|
|
if(StringUtil.isNotEmpty(personCountStr)){
|