|
@@ -5,13 +5,16 @@ import com.sky.ioc.entity.Environment;
|
|
|
import com.sky.ioc.entity.Indeicator;
|
|
|
import com.sky.ioc.entity.Label;
|
|
|
import com.sky.ioc.entity.params.IocParam;
|
|
|
+import com.sky.ioc.entity.params.IocTimeRange;
|
|
|
import com.sky.ioc.mapper.FitnesMapper;
|
|
|
import com.sky.ioc.service.fitness.HealthService;
|
|
|
+import com.sky.ioc.tool.DateUtil;
|
|
|
import com.sky.ioc.tool.GeneralMethod;
|
|
|
import com.sky.ioc.tool.ReturnMsg;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.concurrent.ThreadLocalRandom;
|
|
@@ -33,19 +36,21 @@ public class HealthServiceImpl implements HealthService {
|
|
|
public ReturnMsg getCoreIndicators(IocParam iocParam) {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- Integer totalPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptId(iocParam);
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ Integer totalPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptId(iocParam,1);
|
|
|
Integer totalHealthPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptIdAndFitnesType(iocParam,1);
|
|
|
Integer totalSubHealthPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptIdAndFitnesType(iocParam,2);
|
|
|
+ double compare = random.nextDouble(-1, 1);
|
|
|
+ compare = Double.parseDouble(decimalFormat.format(compare));
|
|
|
+ objects.get(0).put("value",totalPerson);
|
|
|
+ objects.get(0).put("compare",compare);
|
|
|
|
|
|
+ objects.get(1).put("value",totalHealthPerson);
|
|
|
+ objects.get(1).put("compare",compare);
|
|
|
|
|
|
- objects.get(0).put("value",100);
|
|
|
- objects.get(0).put("compare",0.4);
|
|
|
-
|
|
|
- objects.get(1).put("value",20);
|
|
|
- objects.get(1).put("compare",0.4);
|
|
|
-
|
|
|
- objects.get(2).put("value",21);
|
|
|
- objects.get(2).put("compare",-0.4);
|
|
|
+ objects.get(2).put("value",totalSubHealthPerson);
|
|
|
+ objects.get(2).put("compare",compare);
|
|
|
objects.get(3).put("value","高血压");
|
|
|
indeicator.setWorthAttention("员工腰椎问题持续上升");
|
|
|
indeicator.setList(objects);
|
|
@@ -55,9 +60,30 @@ public class HealthServiceImpl implements HealthService {
|
|
|
@Override
|
|
|
public ReturnMsg getHutAnalysis(IocParam iocParam) {
|
|
|
String[] param = {"warehousing","physicalExamination"};
|
|
|
- String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
|
|
|
- Integer totalSubHealthPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptIdAndWarehouse(iocParam,"");
|
|
|
- List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
|
|
|
+ // String[] labKey = {"1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
|
|
|
+ String startStr = iocParam.getTimeRange().getStartDate();
|
|
|
+ String endStr = iocParam.getTimeRange().getEndDate();
|
|
|
+ List<String> list = DateUtil.getBetweenDays(startStr, endStr);
|
|
|
+ String[] labKey = list.toArray(new String[0]);
|
|
|
+ List<Label> labels1 = new ArrayList<>();
|
|
|
+ for (int i = 0; i < labKey.length; i++) {
|
|
|
+ Label label = new Label();
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ IocParam iocParam1 = new IocParam();
|
|
|
+ IocTimeRange iocTimeRange = new IocTimeRange();
|
|
|
+ iocTimeRange.setStartDate(labKey[i]+" 00:00:00");
|
|
|
+ iocTimeRange.setEndDate(labKey[i]+" 23:59:59");
|
|
|
+ iocParam1.setTimeRange(iocTimeRange);
|
|
|
+ Integer checkPerson = fitnesMapper.getTotalPersonByCompanyIdAndDeptId(iocParam1,1);
|
|
|
+ ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ Integer add = random.nextInt(0,50);
|
|
|
+ jsonObject.put(param[0],checkPerson+add);
|
|
|
+ jsonObject.put(param[1],checkPerson);
|
|
|
+ label.setJsonObject(jsonObject);
|
|
|
+ label.setLabel(labKey[i]);
|
|
|
+ labels1.add(label);
|
|
|
+ }
|
|
|
+ // List<Label> labels1 = GeneralMethod.getInstance().dataGeneration(param, labKey);
|
|
|
return ReturnMsg.ok(labels1);
|
|
|
}
|
|
|
|