Commit 64ece249 authored by zhangwanglin's avatar zhangwanglin

服务时长

parent 05056064
...@@ -24,6 +24,7 @@ import com.hungraim.ltc.pojo.vo.disable.PlaceOtherVO; ...@@ -24,6 +24,7 @@ import com.hungraim.ltc.pojo.vo.disable.PlaceOtherVO;
import com.hungraim.ltc.util.*; import com.hungraim.ltc.util.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -473,6 +474,16 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -473,6 +474,16 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
Page<NursingRecordsRespVO> nursingRecordsRespVOPage = null; Page<NursingRecordsRespVO> nursingRecordsRespVOPage = null;
if("上门".equals(modeName)){ if("上门".equals(modeName)){
nursingRecordsRespVOPage = chDisabAccountsDetailMapper.queryNursingRecordsGoDoor(new Page<>(nursingReqVO.getPageNum(), nursingReqVO.getPageSize()), nursingReqVO); nursingRecordsRespVOPage = chDisabAccountsDetailMapper.queryNursingRecordsGoDoor(new Page<>(nursingReqVO.getPageNum(), nursingReqVO.getPageSize()), nursingReqVO);
List<NursingRecordsRespVO> records = nursingRecordsRespVOPage.getRecords();
for (NursingRecordsRespVO record : records) {
String srvStartTime = record.getSrvStartTime();
String srvEndTime = record.getSrvEndTime();
if(StringUtils.isNotEmpty(srvStartTime) && StringUtils.isNotEmpty(srvEndTime)) {
String time = dateDiff(srvStartTime, srvEndTime, "yyyy-MM-dd HH:mm:ss", "min");
record.setIntervalTime(time);
}
}
}else { }else {
nursingReqVO.setModeId("医疗".equals(modeName) ? "1" : "2"); nursingReqVO.setModeId("医疗".equals(modeName) ? "1" : "2");
nursingRecordsRespVOPage = chDisabAccountsDetailMapper.queryNursingRecords(new Page<>(nursingReqVO.getPageNum(), nursingReqVO.getPageSize()), nursingReqVO); nursingRecordsRespVOPage = chDisabAccountsDetailMapper.queryNursingRecords(new Page<>(nursingReqVO.getPageNum(), nursingReqVO.getPageSize()), nursingReqVO);
...@@ -480,6 +491,51 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -480,6 +491,51 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
return nursingRecordsRespVOPage; return nursingRecordsRespVOPage;
} }
/**
* 计算2个时间相差的天数、小时、分钟、秒
* @param startTime 开始时间
* @param endTime 截止时间
* @param format 时间格式 yyyy-MM-dd HH:mm:ss
* @param str 返回的数据为:day-天、hour-小时、min-分钟、second-秒
* @return
*/
public static String dateDiff(String startTime, String endTime, String format, String str) {
// 按照传入的格式生成一个simpledateformate对象
SimpleDateFormat sd = new SimpleDateFormat(format);
long nd = 1000 * 24 * 60 * 60;// 一天的毫秒数
long nh = 1000 * 60 * 60;// 一小时的毫秒数
long nm = 1000 * 60;// 一分钟的毫秒数
long ns = 1000;// 一秒钟的毫秒数
long diff;
long day = 0;
long hour = 0;
long min = 0;
long second = 0;
// 获得两个时间的毫秒时间差异
try {
diff = sd.parse(endTime).getTime() - sd.parse(startTime).getTime();
// 计算差多少天
day = diff / nd;
// 计算差多少小时
hour = diff / nh ;
// 计算差多少分钟
min = diff / nm ;
// 计算差多少秒
second = diff / ns;
// 输出结果
System.out.println("时间相差:" + day + "天" +
(hour - day * 24) + "小时"
+ (min - day * 24 * 60) + "分钟" +
second + "秒。");
/*System.out.println("hour=" + hour + ",min=" + min);*/
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String time = min+"分钟"+ (second - min*60) + "秒";
return time;
}
@Override @Override
public OverallEduceDecreaseCostRespVO queryOverallCostRecords(OverallCostReqVO req) { public OverallEduceDecreaseCostRespVO queryOverallCostRecords(OverallCostReqVO req) {
return chDisabAccountsDetailMapper.queryOverallCostRecords(req); return chDisabAccountsDetailMapper.queryOverallCostRecords(req);
......
...@@ -41,5 +41,8 @@ public class NursingRecordsRespVO { ...@@ -41,5 +41,8 @@ public class NursingRecordsRespVO {
private String realName; private String realName;
private String intervalTime;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment