parent
dff91fe82f
commit
7ffb2286a6
20 changed files with 553 additions and 18 deletions
@ -0,0 +1,284 @@ |
|||||||
|
package org.springblade.lims.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.joda.time.DateTime; |
||||||
|
import org.springblade.core.boot.ctrl.BladeController; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.lims.entry.Entrust; |
||||||
|
import org.springblade.lims.entry.Instrument; |
||||||
|
import org.springblade.lims.entry.InstrumentUseLog; |
||||||
|
import org.springblade.lims.entry.RepairApplication; |
||||||
|
import org.springblade.lims.service.IEntrtrustService; |
||||||
|
import org.springblade.lims.service.IInstrumentService; |
||||||
|
import org.springblade.lims.service.IInstrumentUseLogService; |
||||||
|
import org.springblade.lims.service.IRepairApplicationService; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.text.ParseException; |
||||||
|
import java.text.SimpleDateFormat; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author swj |
||||||
|
* @since 2022年6月1日19:49:10 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/largeScreen") |
||||||
|
@Api(value = "", tags = "") |
||||||
|
public class LargeScreenController extends BladeController { |
||||||
|
|
||||||
|
private final IEntrtrustService entrtrustService; |
||||||
|
|
||||||
|
private final IRepairApplicationService repairApplicationService; |
||||||
|
|
||||||
|
private final IInstrumentService instrumentService; |
||||||
|
|
||||||
|
private final IInstrumentUseLogService instrumentUseLogService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 本年度委托单完成情况 |
||||||
|
*/ |
||||||
|
@GetMapping("/entrustYear") |
||||||
|
public R<Map<String, Object>> entrustYear() throws ParseException { |
||||||
|
//获取今年第一天
|
||||||
|
DateTime date = new DateTime(); |
||||||
|
int year = date.getYear(); |
||||||
|
String str = year + "-01-01 00:00:00"; |
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
||||||
|
Date parse = sdf.parse(str); |
||||||
|
// 本年度委托单完成数量
|
||||||
|
LambdaQueryWrapper<Entrust> wrapper = new LambdaQueryWrapper<>(); |
||||||
|
wrapper.eq(Entrust::getStatus, 6); |
||||||
|
wrapper.ge(Entrust::getCreateTime, parse); |
||||||
|
int count = entrtrustService.count(wrapper); |
||||||
|
// 年度计划数量
|
||||||
|
double plan = 0.00; |
||||||
|
double actual = 0.00; |
||||||
|
actual += count; |
||||||
|
// 完成率
|
||||||
|
double rate = actual / plan * 100; |
||||||
|
// 委托
|
||||||
|
wrapper.clear(); |
||||||
|
wrapper.eq(Entrust::getStatus, 6); |
||||||
|
wrapper.ge(Entrust::getCreateTime, parse); |
||||||
|
wrapper.eq(Entrust::getInvestigativeType, "1"); |
||||||
|
int wt = entrtrustService.count(wrapper); |
||||||
|
double wt1 = 0.00; |
||||||
|
wt1 += wt; |
||||||
|
double rate1 = wt1 / wt * 100; |
||||||
|
// 监督
|
||||||
|
wrapper.clear(); |
||||||
|
wrapper.eq(Entrust::getStatus, 6); |
||||||
|
wrapper.ge(Entrust::getCreateTime, parse); |
||||||
|
wrapper.eq(Entrust::getInvestigativeType, "2"); |
||||||
|
int jd = entrtrustService.count(wrapper); |
||||||
|
double jd1 = 0.00; |
||||||
|
jd1 += jd; |
||||||
|
double rate2 = jd1 / jd * 100; |
||||||
|
// 仲裁
|
||||||
|
wrapper.clear(); |
||||||
|
wrapper.eq(Entrust::getStatus, 6); |
||||||
|
wrapper.ge(Entrust::getCreateTime, parse); |
||||||
|
wrapper.eq(Entrust::getInvestigativeType, "3"); |
||||||
|
int zc = entrtrustService.count(wrapper); |
||||||
|
double zc1 = 0.00; |
||||||
|
zc1 += zc; |
||||||
|
double rate3 = zc1 / zc * 100; |
||||||
|
// 门诊
|
||||||
|
wrapper.clear(); |
||||||
|
wrapper.eq(Entrust::getStatus, 6); |
||||||
|
wrapper.ge(Entrust::getCreateTime, parse); |
||||||
|
wrapper.eq(Entrust::getInvestigativeType, "4"); |
||||||
|
int mz = entrtrustService.count(wrapper); |
||||||
|
double mz1 = 0.00; |
||||||
|
mz1 += mz; |
||||||
|
double rate4 = mz1 / mz * 100; |
||||||
|
Map<String, Object> map = new HashMap<>(); |
||||||
|
map.put("entrustCount", count); |
||||||
|
map.put("wt", rate1); |
||||||
|
map.put("jd", rate2); |
||||||
|
map.put("zc", rate3); |
||||||
|
map.put("mz", rate4); |
||||||
|
return R.data(map); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 今日委托单完成情况 |
||||||
|
*/ |
||||||
|
@GetMapping("/entrustDay") |
||||||
|
public R<Map<String, Object>> entrustDay() throws ParseException { |
||||||
|
Map<String, Object> map = new HashMap<>(); |
||||||
|
//获取今年第一天
|
||||||
|
DateTime date = new DateTime(); |
||||||
|
int year = date.getYear(); |
||||||
|
int month = date.getMonthOfYear(); |
||||||
|
int day = date.getDayOfMonth(); |
||||||
|
String str1 = year + month + day + "00:00:00"; |
||||||
|
String str2 = year + month + day + "23:59:59"; |
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
||||||
|
Date parse1 = sdf.parse(str1); |
||||||
|
Date parse2 = sdf.parse(str2); |
||||||
|
// 今日委托单数量
|
||||||
|
LambdaQueryWrapper<Entrust> wrapper = new LambdaQueryWrapper<>(); |
||||||
|
// wrapper.ge(Entrust::getCreateTime, parse1).lt(Entrust::getCreateTime, parse2);
|
||||||
|
wrapper.between(Entrust::getCreateTime, parse1, parse2); |
||||||
|
int count = entrtrustService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 今日进行中
|
||||||
|
wrapper.between(Entrust::getCreateTime, parse1, parse2); |
||||||
|
wrapper.ne(Entrust::getStatus, 6); |
||||||
|
int count1 = entrtrustService.count(wrapper); |
||||||
|
// 今日完成
|
||||||
|
wrapper.between(Entrust::getCreateTime, parse1, parse2); |
||||||
|
wrapper.eq(Entrust::getStatus, 6); |
||||||
|
int count2 = entrtrustService.count(wrapper); |
||||||
|
map.put("count", count); |
||||||
|
map.put("jxz", count1); |
||||||
|
map.put("wc", count2); |
||||||
|
return R.data(map); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 各实验室检测数量统计 |
||||||
|
*/ |
||||||
|
@GetMapping("/examine") |
||||||
|
public void examine() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 仪器设备维修数统计 |
||||||
|
*/ |
||||||
|
@GetMapping("/repair") |
||||||
|
public R<Map<String, Object>> repair() throws ParseException { |
||||||
|
Map<String, Object> map = new HashMap<>(); |
||||||
|
//获取今年第一天
|
||||||
|
DateTime date = new DateTime(); |
||||||
|
int year = date.getYear(); |
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
||||||
|
Date parse1 = sdf.parse(year + "-01-01 00:00:00"); |
||||||
|
Date parse2 = sdf.parse(year + "-02-01 00:00:00"); |
||||||
|
Date parse3 = sdf.parse(year + "-03-01 00:00:00"); |
||||||
|
Date parse4 = sdf.parse(year + "-04-01 00:00:00"); |
||||||
|
Date parse5 = sdf.parse(year + "-05-01 00:00:00"); |
||||||
|
Date parse6 = sdf.parse(year + "-06-01 00:00:00"); |
||||||
|
Date parse7 = sdf.parse(year + "-07-01 00:00:00"); |
||||||
|
Date parse8 = sdf.parse(year + "-08-01 00:00:00"); |
||||||
|
Date parse9 = sdf.parse(year + "-09-01 00:00:00"); |
||||||
|
Date parse10 = sdf.parse(year + "-10-01 00:00:00"); |
||||||
|
Date parse11 = sdf.parse(year + "-11-01 00:00:00"); |
||||||
|
Date parse12 = sdf.parse(year + "-12-01 00:00:00"); |
||||||
|
LambdaQueryWrapper<RepairApplication> wrapper = new LambdaQueryWrapper<>(); |
||||||
|
// 1月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse1).lt(RepairApplication::getCreateTime, parse2); |
||||||
|
int count1 = repairApplicationService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 2月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse2).lt(RepairApplication::getCreateTime, parse3); |
||||||
|
int count2 = repairApplicationService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 3月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse3).lt(RepairApplication::getCreateTime, parse4); |
||||||
|
int count3 = repairApplicationService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 4月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse4).lt(RepairApplication::getCreateTime, parse5); |
||||||
|
int count4 = repairApplicationService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 5月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse5).lt(RepairApplication::getCreateTime, parse6); |
||||||
|
int count5 = repairApplicationService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 6月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse6).lt(RepairApplication::getCreateTime, parse7); |
||||||
|
int count6 = repairApplicationService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 7月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse7).lt(RepairApplication::getCreateTime, parse8); |
||||||
|
int count7 = repairApplicationService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 8月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse8).lt(RepairApplication::getCreateTime, parse9); |
||||||
|
int count8 = repairApplicationService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 9月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse9).lt(RepairApplication::getCreateTime, parse10); |
||||||
|
int count9 = repairApplicationService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 10月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse10).lt(RepairApplication::getCreateTime, parse11); |
||||||
|
int count10 = repairApplicationService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 11月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse11).lt(RepairApplication::getCreateTime, parse12); |
||||||
|
int count11 = repairApplicationService.count(wrapper); |
||||||
|
wrapper.clear(); |
||||||
|
// 12月报修数量
|
||||||
|
wrapper.ge(RepairApplication::getCreateTime, parse12); |
||||||
|
int count12 = repairApplicationService.count(wrapper); |
||||||
|
map.put("count1", count1); |
||||||
|
map.put("count2", count2); |
||||||
|
map.put("count3", count3); |
||||||
|
map.put("count4", count4); |
||||||
|
map.put("count5", count5); |
||||||
|
map.put("count6", count6); |
||||||
|
map.put("count7", count7); |
||||||
|
map.put("count8", count8); |
||||||
|
map.put("count9", count9); |
||||||
|
map.put("count10", count10); |
||||||
|
map.put("count11", count11); |
||||||
|
map.put("count12", count12); |
||||||
|
return R.data(map); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 仪器使用次数统计 |
||||||
|
*/ |
||||||
|
@GetMapping("/instrument") |
||||||
|
public R<Map<String, Object>> instrument() { |
||||||
|
Map<String, Object> map = new HashMap<>(); |
||||||
|
// 仪器设备运行中数量
|
||||||
|
LambdaQueryWrapper<Instrument> wrapper = new LambdaQueryWrapper<>(); |
||||||
|
wrapper.eq(Instrument::getIsDeleted, 0); |
||||||
|
wrapper.eq(Instrument::getStatus, 1); |
||||||
|
int count1 = instrumentService.count(wrapper); |
||||||
|
// 仪器设备关机数量
|
||||||
|
wrapper.clear(); |
||||||
|
wrapper.eq(Instrument::getIsDeleted, 0); |
||||||
|
wrapper.eq(Instrument::getStatus, 0); |
||||||
|
int count2 = instrumentService.count(wrapper); |
||||||
|
// 仪器设备维修中数量
|
||||||
|
wrapper.clear(); |
||||||
|
wrapper.eq(Instrument::getIsDeleted, 0); |
||||||
|
wrapper.eq(Instrument::getStatus, 2); |
||||||
|
int count3 = instrumentService.count(wrapper); |
||||||
|
map.put("functionCount", count1); |
||||||
|
map.put("closeCount", count2); |
||||||
|
map.put("repairCount", count3); |
||||||
|
// 仪器设备使用记录
|
||||||
|
LambdaQueryWrapper<InstrumentUseLog> queryWrapper = new LambdaQueryWrapper<>(); |
||||||
|
queryWrapper.orderByDesc(InstrumentUseLog::getCreateTime); |
||||||
|
List<InstrumentUseLog> useLogs = instrumentUseLogService.list(queryWrapper); |
||||||
|
map.put("useLogs", useLogs); |
||||||
|
return R.data(map); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 定时往前端选择性推送 |
||||||
|
*/ |
||||||
|
@GetMapping("/message") |
||||||
|
public void message() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
|
||||||
|
package org.springblade.lims.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.springblade.lims.entry.ExamineWay; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* |
||||||
|
* @author swj |
||||||
|
* @since 2022年6月2日15:47:39 |
||||||
|
*/ |
||||||
|
public interface LargeScreenMapper extends BaseMapper { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
|
||||||
|
package org.springblade.lims.service; |
||||||
|
|
||||||
|
import org.springblade.core.mp.base.BaseService; |
||||||
|
import org.springblade.lims.entry.ExamineWay; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author swj |
||||||
|
* @since 2022年6月1日19:50:34 |
||||||
|
*/ |
||||||
|
public interface ILargeScreenService extends BaseService { |
||||||
|
} |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
|
||||||
|
package org.springblade.lims.service.impl; |
||||||
|
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.lims.entry.ExamineItem; |
||||||
|
import org.springblade.lims.mapper.ExamineItemMapper; |
||||||
|
import org.springblade.lims.mapper.LargeScreenMapper; |
||||||
|
import org.springblade.lims.service.IExamineItemService; |
||||||
|
import org.springblade.lims.service.ILargeScreenService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author swj |
||||||
|
* @since 2022年6月2日15:53:01 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
@AllArgsConstructor |
||||||
|
public class LargeScreenServiceImpl extends BaseServiceImpl implements ILargeScreenService { |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue