|
@@ -108,7 +108,7 @@ public class MuseumInfoController {
|
|
|
// TODO 1.2.3.代表哪种标本类型
|
|
|
// 返回某种标本类型的List数组
|
|
|
// Integer
|
|
|
-//
|
|
|
+
|
|
|
@GetMapping("/sampleTypeCount")
|
|
|
@Operation(summary = "标本类型计数")
|
|
|
public CommonResult<Map<String,Integer>> getMap() {
|
|
@@ -152,7 +152,6 @@ public class MuseumInfoController {
|
|
|
public CommonResult<List<MuseuminfoMonthSaveVO>> getOutSave() {
|
|
|
LocalDate date = LocalDate.now();
|
|
|
int currentYear =date.getYear();
|
|
|
-
|
|
|
List<MuseuminfoMonthSaveVO> result = new ArrayList<>();
|
|
|
for (int month = 1 ; month <= 12 ; month++) {
|
|
|
int sample_number =0;
|
|
@@ -164,10 +163,8 @@ public class MuseumInfoController {
|
|
|
re.setCount(0);
|
|
|
}else {
|
|
|
for (String numberStr : number) {
|
|
|
- // 去除方括号
|
|
|
- String processedStr = numberStr.replaceAll("\\[|\\]","");
|
|
|
- // 按逗号分割元素
|
|
|
- String[] groupElements = processedStr.split(",");
|
|
|
+
|
|
|
+ String[] groupElements = numberStr.split(",");
|
|
|
// 累加元素数量(每个元素为一组)
|
|
|
sample_number += groupElements.length;
|
|
|
}
|
|
@@ -178,6 +175,69 @@ public class MuseumInfoController {
|
|
|
return CommonResult.success(result);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/backSaveCount")
|
|
|
+ @Operation(summary = "标本出入库状态计数(每月)(回库)")
|
|
|
+ public CommonResult<List<MuseuminfoMonthSaveVO>> getBackSave() {
|
|
|
+ LocalDate date = LocalDate.now();
|
|
|
+ int currentYear =date.getYear();
|
|
|
+
|
|
|
+ List<MuseuminfoMonthSaveVO> result = new ArrayList<>();
|
|
|
+ for (int month = 1 ; month <= 12 ; month++) {
|
|
|
+ int sample_number = countSampleNumbers(museumInfoService.MuseumInfoBySaveBack(month,currentYear));
|
|
|
+ MuseuminfoMonthSaveVO re = new MuseuminfoMonthSaveVO();
|
|
|
+ re.setMonth(month);
|
|
|
+ re.setCount(sample_number);
|
|
|
+ result.add(re);
|
|
|
+ }
|
|
|
+ return CommonResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/yearCount")
|
|
|
+ @Operation(summary = "历年标本数量统计")
|
|
|
+ public CommonResult<List<Map<Integer,Object>>> getYearSampleCount() {
|
|
|
+ List<Map<Integer, Object>> result = new ArrayList<>();
|
|
|
+ LocalDate date = LocalDate.now();
|
|
|
+ int currentYear = date.getYear();
|
|
|
+ int year1 = currentYear - 2;
|
|
|
+ for (int year = currentYear; year >= year1; year--) {
|
|
|
+
|
|
|
+ Integer number1 = museumInfoService.MuseumInfoYearJoin(year);
|
|
|
+ int sample_number2 = countSampleNumbers(museumInfoService.MuseumInfoYearOutBack(1, year));
|
|
|
+ int sample_number3 = countSampleNumbers(museumInfoService.MuseumInfoYearOutBack(0, year));
|
|
|
+ Map<Integer,Object> map = new HashMap<>();
|
|
|
+ Map<String, Integer> innerMap = new HashMap<>();
|
|
|
+ innerMap.put("入库", number1);
|
|
|
+ innerMap.put("回库", sample_number2);
|
|
|
+ innerMap.put("出库", sample_number3);
|
|
|
+ map.put(year,innerMap);
|
|
|
+ result.add(map);
|
|
|
+ }
|
|
|
+ return CommonResult.success(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 统计样本数量
|
|
|
+ * @param number 包含样本信息的列表
|
|
|
+ * @return 样本数量
|
|
|
+ */
|
|
|
+ private int countSampleNumbers(List<String> number) {
|
|
|
+ if (number == null) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ int count = 0;
|
|
|
+ for (String numberStr : number) {
|
|
|
+
|
|
|
+ String processedStr = numberStr.replaceAll("\\[|\\]","");
|
|
|
+ // 按逗号分割元素
|
|
|
+ String[] groupElements = processedStr.split(",");
|
|
|
+
|
|
|
+ count += groupElements.length;
|
|
|
+ }
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("/originCount")
|
|
|
@Operation(summary = "标本来源计数")
|
|
|
public CommonResult<List<Map<Integer,Object>>> getOrigin(){
|