石首问题修改 ,时区问题处理
This commit is contained in:
parent
67d8c0d3f7
commit
92fe9ab7c8
@ -10,6 +10,7 @@ import org.springframework.context.annotation.ComponentScan;
|
||||
public class TransitPlatFormApplication {
|
||||
public static void main(String[] args) {
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
System.setProperty("user.timezone", "Etc/GMT-8");
|
||||
SpringApplication.run(TransitPlatFormApplication.class, args);
|
||||
System.out.println("项目启动成功!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.transitPlatForm.transitPF.controller;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.transitPlatForm.common.annotation.Anonymous;
|
||||
import com.transitPlatForm.common.core.domain.Result;
|
||||
import com.transitPlatForm.common.utils.DateUtils;
|
||||
@ -45,11 +47,18 @@ public class RegStatController {
|
||||
String currentDateTime1 = currentDateTime.substring(0, 4) + "-" + monthStr + "-01 00:00:00";
|
||||
Date et = DateUtils.parseDate(currentDateTime1);
|
||||
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Map<String, Object> regStatAll = regStatMapper.selectRegStatAll();
|
||||
//概况
|
||||
map.put("regStatAll", regStatAll);
|
||||
//当月累计
|
||||
Map<String, Object> regStatAllMonth = regStatMapper.selectRegStatAll(st,et);
|
||||
map.put("regStatAllMonth", regStatAllMonth);
|
||||
//当年累计
|
||||
Map<String, Object> stringObjectMap = transFormat(currentDateTime);
|
||||
Date yearStart = DateUtil.parse(stringObjectMap.get("yearStart").toString(),"yyyy-MM-dd HH:mm:ss");
|
||||
Date yearEnd = DateUtil.parse(stringObjectMap.get("yearEnd").toString(),"yyyy-MM-dd HH:mm:ss");
|
||||
Map<String, Object> regStatAllYear = regStatMapper.selectRegStatAll(yearStart,yearEnd);
|
||||
map.put("regStatAllYear", regStatAllYear);
|
||||
|
||||
List<Map<String, Object>> regStatMonth = regStatMapper.selectRegStatMonth(st, et);
|
||||
List<Map<String, Object>> regStatMonth0 = regStatMonth.stream()
|
||||
.sorted(Comparator.comparingInt(o -> (Integer) o.get("daynum"))).collect(Collectors.toList());
|
||||
@ -62,17 +71,28 @@ public class RegStatController {
|
||||
List<Map<String, Object>> regStatHospMonth1 = setmapgroup(regStatHospMonth0);
|
||||
List<Map<String, Object>> regStatHospMonth2 = regStatHospMonth1.stream()
|
||||
.sorted(Comparator.comparingInt((Map<String, Object> o) -> (Integer) o.get("groupsum")).reversed()).collect(Collectors.toList());
|
||||
|
||||
map.put("regStatHospMonth", regStatHospMonth2);
|
||||
}
|
||||
List<Map<String, Object>> regStatStatus = regStatMapper.selectRegStatStatus(st, et);
|
||||
//送检样本状态占比
|
||||
long totalSl = regStatStatus.stream()
|
||||
.filter(statusMap -> statusMap.get("sl") != null)
|
||||
.mapToLong(statusMap -> Long.parseLong(statusMap.get("sl").toString()))
|
||||
.sum();
|
||||
System.out.println("totalSl:"+totalSl);
|
||||
DecimalFormat df = new DecimalFormat("0.00%");
|
||||
df.setRoundingMode(RoundingMode.HALF_UP);
|
||||
for (Map<String, Object> objectMap : regStatStatus) {
|
||||
int sl = (int) objectMap.get("sl");
|
||||
System.out.println("sl:"+sl);
|
||||
objectMap.put("percent",df.format((double)sl / (double)totalSl) ); //百分比
|
||||
}
|
||||
List<Map<String, Object>> regStatStatus0 = regStatStatus.stream()
|
||||
.sorted((o1, o2) -> {
|
||||
int val1 = (Integer) o1.get("sl");
|
||||
int val2 = (Integer) o2.get("sl");
|
||||
return Integer.compare(val2, val1);
|
||||
}).collect(Collectors.toList());
|
||||
//送检样本状态占比
|
||||
map.put("regStatStatus", regStatStatus0);
|
||||
List<Map<String, Object>> regStatSample = regStatMapper.selectRegStatSample(st, et);
|
||||
List<Map<String, Object>> regStatSample0 = regStatSample.stream()
|
||||
@ -154,4 +174,24 @@ public class RegStatController {
|
||||
}
|
||||
return mapref;
|
||||
}
|
||||
|
||||
public Map<String,Object> transFormat(String currentDateTime){
|
||||
Date now = DateUtil.parse(currentDateTime, "yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
// 2. 当年第一天 00:00:00(Hutool 直接提供 beginOfYear 方法)
|
||||
java.util.Date firstDayOfYear = DateUtil.beginOfYear(now);
|
||||
|
||||
// 3. 下一年第一天 00:00:00(在当年第一天基础上加 1 年,再取年初)
|
||||
java.util.Date firstDayOfNextYear = DateUtil.beginOfYear(
|
||||
DateUtil.offset(firstDayOfYear, DateField.YEAR, 1)
|
||||
);
|
||||
|
||||
// 4. 转回你需要的字符串格式
|
||||
String yearStart = DateUtil.format(firstDayOfYear, "yyyy-MM-dd HH:mm:ss");
|
||||
String yearEnd = DateUtil.format(firstDayOfNextYear, "yyyy-MM-dd HH:mm:ss");
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("yearStart",yearStart);
|
||||
map.put("yearEnd",yearEnd);
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface RegStatMapper {
|
||||
Map<String,Object> selectRegStatAll();
|
||||
Map<String,Object> selectRegStatAll(@Param("st") Date st, @Param("et")Date et);
|
||||
List<Map<String,Object>> selectRegStatMonth(@Param("st") Date st, @Param("et")Date et);
|
||||
List<Map<String,Object>> selectRegStatHospMonth(@Param("st") Date st, @Param("et")Date et);
|
||||
List<Map<String,Object>> selectRegStatStatus(@Param("st") Date st, @Param("et")Date et);
|
||||
|
||||
@ -5,58 +5,63 @@
|
||||
<mapper namespace="com.transitPlatForm.transitPF.mapper.RegStatMapper">
|
||||
|
||||
<select id="selectRegStatAll" resultType="map">
|
||||
SELECT * FROM v_reg_statall
|
||||
select count(distinct SrcHospCode) as jgs, --机构数
|
||||
count(distinct isnull(PatIdentity,patid)) as rs, --检验人数
|
||||
<![CDATA[(SELECT count(1) FROM reg_TransitSample a WHERE a.Status >= '30' AND a.Status <> '90') as gs,]]>--检验管数
|
||||
(SELECT count(1) FROM reg_TransitSample a WHERE a.Status = '70') as bgs, --检验报告数
|
||||
(select count(1) from reg_TransitSample_detail b,reg_TransitSample c WHERE b.Barcode = c.barcode AND c.Status = '70') as xms -- 检验项目数
|
||||
from reg_TransitSample
|
||||
<![CDATA[WHERE status <> '90']]>
|
||||
<if test="st != null"><![CDATA[and ordertime >= #{st}]]></if>
|
||||
<if test="et != null"><![CDATA[and ordertime <= #{et}]]></if>
|
||||
|
||||
</select>
|
||||
<select id="selectRegStatMonth" resultType="map">
|
||||
select day(OrderTime) as daynum,count(1) sl
|
||||
from reg_TransitSample
|
||||
<where>
|
||||
<![CDATA[where Status <> '90' ]]>
|
||||
<if test="st != null ">
|
||||
and OrderTime >= #{st}
|
||||
</if>
|
||||
<if test="et != null ">
|
||||
and #{et} > OrderTime
|
||||
</if>
|
||||
</where>
|
||||
group by day(OrderTime)
|
||||
</select>
|
||||
<select id="selectRegStatHospMonth" resultType="map">
|
||||
select SrcHospName,day(OrderTime) as daynum,count(1) sl
|
||||
from reg_TransitSample
|
||||
<where>
|
||||
<![CDATA[where Status <> '90' ]]>
|
||||
<if test="st != null ">
|
||||
and OrderTime >= #{st}
|
||||
</if>
|
||||
<if test="et != null ">
|
||||
and #{et} > OrderTime
|
||||
</if>
|
||||
</where>
|
||||
group by SrcHospName,day(OrderTime)
|
||||
</select>
|
||||
<select id="selectRegStatStatus" resultType="map">
|
||||
select b.dict_name,count(1) sl
|
||||
from reg_TransitSample a join reg_dict b on b.dict_type='ZT' and a.Status=b.dict_code
|
||||
<where>
|
||||
from reg_TransitSample a join reg_dict b on (b.dict_type='ZT' and a.Status=b.dict_code)
|
||||
<![CDATA[where a.Status <> '90' ]]>
|
||||
<if test="st != null ">
|
||||
and a.OrderTime >= #{st}
|
||||
</if>
|
||||
<if test="et != null ">
|
||||
and #{et} > a.OrderTime
|
||||
</if>
|
||||
</where>
|
||||
group by b.dict_name
|
||||
</select>
|
||||
<select id="selectRegStatSample" resultType="map">
|
||||
select SampleTypeName,count(1) sl
|
||||
from reg_TransitSample
|
||||
<where>
|
||||
<![CDATA[where Status <> '90' ]]>
|
||||
<if test="st != null ">
|
||||
and OrderTime >= #{st}
|
||||
</if>
|
||||
<if test="et != null ">
|
||||
and #{et} > OrderTime
|
||||
</if>
|
||||
</where>
|
||||
group by SampleTypeName
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user