Commit 665ca917 authored by 董天德's avatar 董天德

Merge branch 'dev_nursing_records_20230214' into uat_ch_master

parents 0a495066 6b264abb
......@@ -24,6 +24,7 @@ import com.hungraim.ltc.pojo.vo.disable.PlaceOtherVO;
import com.hungraim.ltc.util.*;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
......@@ -473,6 +474,16 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
Page<NursingRecordsRespVO> nursingRecordsRespVOPage = null;
if("上门".equals(modeName)){
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 {
nursingReqVO.setModeId("医疗".equals(modeName) ? "1" : "2");
nursingRecordsRespVOPage = chDisabAccountsDetailMapper.queryNursingRecords(new Page<>(nursingReqVO.getPageNum(), nursingReqVO.getPageSize()), nursingReqVO);
......@@ -480,6 +491,51 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
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
public OverallEduceDecreaseCostRespVO queryOverallCostRecords(OverallCostReqVO req) {
return chDisabAccountsDetailMapper.queryOverallCostRecords(req);
......@@ -518,6 +574,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setDeductionAmount(deductionAmount.add(amountOfMoney));
deductionAmountTotal = deductionAmountTotal.add(amountOfMoney);
}
chDisabDetailAccounts.setLcd(new Date());
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
chDisabAccounts.setReissueAmountTotal(reissueAmountTotal);
chDisabAccounts.setDeductionAmountTotal(deductionAmountTotal);
......@@ -685,6 +742,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccountsDTO.setAccountsAllCost(accountsAllCost.add(limit));
chDisabDetailAccountsDTO.setAccountsOverallCost(accountsOverallCost.add(overallCost));
chDisabDetailAccountsDTO.setAccountsPersonalCost(accountsPersonalCost.add(personalCost));
chDisabDetailAccountsDTO.setLcd(new Date());
chDisabAccountsDetailMapper.updateById(chDisabDetailAccountsDTO);
}
......@@ -744,6 +802,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccountsDTO.setDeductionAmount(subtract);
}
disabAccountsMapper.updateById(chDisabAccountDTO);
chDisabDetailAccountsDTO.setLcd(new Date());
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccountsDTO);
chDisabFreeRdInfoMapper.deleteById(freeRdId);
return result;
......@@ -778,6 +837,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setAccountsDetailId(accountsDetailId);
chDisabDetailAccounts.setStatus(((short)1));
chDisabDetailAccounts.setDeclarationTime(new Date());
chDisabDetailAccounts.setLcd(new Date());
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
return result;
}
......@@ -887,6 +947,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setAccountsDetailId(accountsDetailId);
chDisabDetailAccounts.setStatus(status);
chDisabDetailAccounts.setAccountsId(accountsId);
chDisabDetailAccounts.setLcd(new Date());
int result = chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
return result;
}
......@@ -969,6 +1030,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccountsDTO.setAccountsAllCost(accountsAllCost.add(limit));
chDisabDetailAccountsDTO.setAccountsOverallCost(accountsOverallCost.add(limit));
chDisabDetailAccountsDTO.setAccountsPersonalCost(zero);
chDisabDetailAccountsDTO.setLcd(new Date());
chDisabAccountsDetailMapper.updateById(chDisabDetailAccountsDTO);
}
return Result.success();
......@@ -1063,6 +1125,7 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setAccountsAllCost(allCostSubtract);
chDisabDetailAccounts.setAccountsOverallCost(overCostSubtract);
chDisabDetailAccounts.setAccountsPersonalCost(personCostSubtract);
chDisabDetailAccounts.setLcd(new Date());
chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
}
......
......@@ -234,7 +234,6 @@ and organ.SRV_ORGAN_ID = #{req.srvOrganId} order by detail.SRV_DATE desc
to_char(d.ACCOUNTS_START_TIME,'yyyy-MM-dd') accountsStartTime,
to_char(d.ACCOUNTS_END_TIME,'yyyy-MM-dd') accountsEndTime,
to_char(d.ACCOUNTS_TIME,'yyyy-MM') accountsTime,
emp.EMP_NAME empName,
d.ACCOUNTS_ALL_COST accountsAllCost,
d.ACCOUNTS_OVERALL_COST accountsOverallCost,
d.ACCOUNTS_PERSONAL_COST accountsPersonalCost,
......@@ -250,7 +249,6 @@ and organ.SRV_ORGAN_ID = #{req.srvOrganId} order by detail.SRV_DATE desc
left join CH_DISABLE_APPLY apply on info.APPLY_ID=apply.APPLY_ID
left join CH_SRV_ORGAN o on d.SRV_ORGAN_ID = o.SRV_ORGAN_ID
LEFT JOIN CH_FND_ORGAN t3 ON o.ORGAN_ID = t3.ORGAN_ID
left join ch_srv_organ_emp emp on d.emp_id = emp.emp_id
<where>
1=1
<if test="accountsId != null and accountsId != ''">
......@@ -312,7 +310,8 @@ and organ.SRV_ORGAN_ID = #{req.srvOrganId} order by detail.SRV_DATE desc
<if test="accountsStatus == 0">
d.status = #{accountsStatus},
d.REISSUE_AMOUNT = 0,
d.DEDUCTION_AMOUNT = 0
d.DEDUCTION_AMOUNT = 0,
d.lcd = sysdate
</if>
</set>
......
......@@ -531,14 +531,7 @@ public class DisableController {
if (disableExitVO.getDisableInfoId() == null|| disableExitVO.getExitReasonId() == null||disableExitVO.getApplyId() == null) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
int i = disableService.disableInfoExit(disableExitVO);
if (i > 0) {
return Result.success();
} else {
return Result.failed();
}
return disableService.disableInfoExit(disableExitVO);
}
......
......@@ -185,7 +185,7 @@ public interface DisableService {
Integer applyMethod);
int disableInfoExit(DisableExitVO disableExitVO);
Result disableInfoExit(DisableExitVO disableExitVO);
void disableExitHanlder(Integer exitReasonId, Integer srvOrganId, Integer disableInfoId, Date date);
......
......@@ -637,7 +637,7 @@ public class DisableServiceImpl implements DisableService {
@Override
@Transactional(rollbackFor = Exception.class)
public int disableInfoExit(DisableExitVO disableExitVO) {
public Result disableInfoExit(DisableExitVO disableExitVO) {
String exitTime = disableExitVO.getExitTime();
Integer applyId = disableExitVO.getApplyId();
Integer exitReasonId = disableExitVO.getExitReasonId();
......@@ -663,9 +663,21 @@ public class DisableServiceImpl implements DisableService {
boolean now = DateUtils.isNow(date);
if (now) {
disableExitHanlder(exitReasonId, srvOrganId, disableInfoId, date);
} else {
// 插入历史记录
ChDisableExit chDisableExit = new ChDisableExit();
chDisableExit.setDisabInfoId(disableInfoId);
chDisableExit.setExitReasonId(exitReasonId);
chDisableExit.setExitTime(date);
chDisableExit.setSrvOrganId(srvOrganId);
disableExitMapper.insert(chDisableExit);
return Result.failed("操作成功,退出状态及服务方案和计划将在"+exitTime+"日自动终止");
}
return result;
if (result > 0) {
return Result.success();
} else {
return Result.failed();
}
}
/**
......@@ -687,6 +699,7 @@ public class DisableServiceImpl implements DisableService {
UpdateWrapper updateWrapper2 = new UpdateWrapper();
updateWrapper2.eq("DISAB_INFO_ID", Long.valueOf(disableInfoId));
updateWrapper2.notIn("status",2);
updateWrapper2.set("status", 2);
updateWrapper2.set("LCD", new DATE());
updateWrapper2.set("end_reason", "失能人员退出,计划终止");
......@@ -708,13 +721,16 @@ public class DisableServiceImpl implements DisableService {
chSrvSend1.setStatus((short)0);
chSrvSendInfoMapper.insert(chSrvSend1);
}
// 插入历史记录
ChDisableExit chDisableExit = new ChDisableExit();
chDisableExit.setDisabInfoId(disableInfoId);
chDisableExit.setExitReasonId(exitReasonId);
chDisableExit.setExitTime(date);
chDisableExit.setSrvOrganId(srvOrganId);
disableExitMapper.insert(chDisableExit);
if(srvOrganId != null) {
// 插入历史记录
ChDisableExit chDisableExit = new ChDisableExit();
chDisableExit.setDisabInfoId(disableInfoId);
chDisableExit.setExitReasonId(exitReasonId);
chDisableExit.setExitTime(date);
chDisableExit.setSrvOrganId(srvOrganId);
disableExitMapper.insert(chDisableExit);
}
}
@Override
......@@ -745,7 +761,7 @@ public class DisableServiceImpl implements DisableService {
Long disabInfoId = disableInfoListVo.getDisabInfoId();
String exitTime = disableInfoListVo.getExitTime();
Date date = DateUtils.strToDate(exitTime);
disableExitHanlder(exitReasonId,srvOrganId.intValue(),disabInfoId.intValue(),date);
disableExitHanlder(exitReasonId,null,disabInfoId.intValue(),date);
}
}
......
......@@ -127,7 +127,7 @@ WHERE TASK_DETAIL_ID = #{taskDetailId}
<update id = "updateChDisabDetailAccounts">
UPDATE CH_DISAB_ACCOUNTS_DETAIL d SET d.ACCOUNTS_ALL_COST = #{accountsAllCostsub}, d.ACCOUNTS_OVERALL_COST = #{accountsOverallCostsub},
d.ACCOUNTS_PERSONAL_COST = #{accountsPersonalCostsub}
d.ACCOUNTS_PERSONAL_COST = #{accountsPersonalCostsub},d.lcd = sysdate
WHERE d.ACCOUNTS_DETAIL_ID = #{accountsDetailId}
</update>
......
......@@ -2,12 +2,12 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hungraim.ltc.dao.DisableInfoMapper">
<select id="getDisableInfoList" resultType="com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo">
with bb as (
SELECT T2.DISAB_INFO_ID disabInfoId,
max(T6.SRV_ORGAN_ID) srvOrganId,
SELECT max(T6.SRV_SEND_ID) srvSendId,
T2.DISAB_INFO_ID disabInfoId,
T2.REAL_NAME realName,
DECODE(max(T2.SRV_MODE_ID), '1','医疗','2', '养老','3','上门', '4', '异地') svrModelName,
max(T5.SRV_ORGAN_NAME) svrOrganName,
to_char(max(e.EXIT_TIME),'yyyy-MM-dd') exitTime,
max(T2.CERTI_CODE) CERTI_CODE,
max(e.EXIT_REASON_ID) exitReasonId,
......@@ -16,16 +16,17 @@
max(apply.apply_id) applyId
FROM CH_SRV_SEND T6
LEFT join CH_DISABLE_INFO T2 on T6.DISAB_INFO_ID = T2.DISAB_INFO_ID
LEFT JOIN CH_SRV_ORGAN T5 ON T6.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
left join CH_DISABLE_APPLY apply on apply.APPLY_ID = T2.APPLY_ID
left join CH_DISABLE_EXIT
e on e.DISAB_INFO_ID = T2.DISAB_INFO_ID
group by T2.DISAB_INFO_ID,T2.REAL_NAME)
select t.*, ( case when t.exitReasonId is null then null else 1 end ) exitFlag from bb t
select t.*,o.SRV_ORGAN_ID srvOrganId,o.SRV_ORGAN_NAME svrOrganName, ( case when t.exitReasonId is null then null else 1 end ) exitFlag from bb t
left join CH_SRV_SEND s on t.srvSendId = s.SRV_SEND_ID
LEFT JOIN CH_SRV_ORGAN o ON o.SRV_ORGAN_ID = s.SRV_ORGAN_ID
<where>
1=1
<if test="srvOrganId != null and srvOrganId != '' and srvOrganId!=0">
and t.srvOrganId = #{srvOrganId}
and o.SRV_ORGAN_ID = #{srvOrganId}
</if>
<if test="certiCode != null and certiCode != ''">
and t.CERTI_CODE = #{certiCode}
......@@ -44,32 +45,15 @@
<select id="getDisableExitList" resultType="com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo">
SELECT distinct T2.DISAB_INFO_ID disabInfoId,
T1.PROGRAM_ID programId,
T6.SRV_ORGAN_ID srvOrganId,
T5.DISTRICT_PROVINCIAL districtProvincial,
T5.DISTRICT_CITY districtCity,
T2.REAL_NAME realName,
T7.MODE_NAME svrModelName,
T5.SRV_ORGAN_NAME svrOrganName,
T1.PROG_STATUS progStatus,
T1.EFF_TIME effTime,
T2.CERTI_CODE certiCode,
T2.APPLY_ID applyId,
to_char(T2.EXIT_TIME,'yyyy-MM-dd') exitTime,
--服务方案起始日
--服务方案终止日
to_char(T1.PROGRAM_DATE,'yyyy-MM-dd HH24:mi:ss') programDate,
to_char(T1.PROGRAM_EDN_DATE,'yyyy-MM-dd HH24:mi:ss') programEdnDate,
T2.EXIT_FLAG exitFlag,
T2.EXIT_REASON_ID exitReasonId
FROM CH_DISABLE_INFO T2
inner join (select * from CH_SRV_SEND where STATUS in(1,3)) T6 on T6.DISAB_INFO_ID = T2.DISAB_INFO_ID
LEFT JOIN CH_SRV_PROGRAM T1 ON T1.DISAB_INFO_ID = T2.DISAB_INFO_ID
LEFT JOIN CH_CFG_SRV_MODE T7 ON T2.SRV_MODE_ID = T7.MODE_ID
LEFT JOIN CH_SRV_ORGAN T5 ON T6.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
where T2.EXIT_TIME is not null
and T2.EXIT_TIME = to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd')
SELECT distinct T2.DISAB_INFO_ID disabInfoId,
T2.CERTI_CODE certiCode,
T2.APPLY_ID applyId,
to_char(T2.EXIT_TIME,'yyyy-MM-dd') exitTime,
T2.EXIT_FLAG exitFlag,
T2.EXIT_REASON_ID exitReasonId
FROM CH_DISABLE_INFO T2
where T2.EXIT_TIME is not null
and T2.EXIT_TIME = to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd')
</select>
......@@ -85,6 +69,7 @@
<update id="updateSrvProgramById" parameterType="com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram">
update CH_SRV_PROGRAM g set g.PROG_STATUS ='2',g.END_REASON = #{endReason} where
g.DISAB_INFO_ID =#{disabInfoId} and g.PROGRAM_DATE <![CDATA[ < ]]> sysdate
and g.PROG_STATUS <![CDATA[ <> ]]>'2'
</update>
<update id="updateSrvSendById" parameterType="com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend">
......
......@@ -117,6 +117,8 @@ public class ChDisabDetailAccounts implements Serializable {
private Date declarationTime;
private Date lcd;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -41,5 +41,8 @@ public class NursingRecordsRespVO {
private String realName;
private String intervalTime;
}
......@@ -25,8 +25,8 @@ public class AccountExportDetailListResp {
@Excel(name = "失能人员",width = 20)
private String realName;
@Excel(name = "护理人员",width = 20)
private String empName;
/* @Excel(name = "护理人员",width = 20)
private String empName;*/
/**
* 结算月份
*/
......
......@@ -84,7 +84,7 @@ public class SrvProgramController {
* @return 返回个人照护方案列表
*/
@RequestMapping("/programSetList")
public Result getProgramSetList(Integer pageNum, Integer pageSize, Long disabInfoId, Long srvOrganId,String status) {
public Result getProgramSetList(Integer pageNum, Integer pageSize, Long disabInfoId, Long srvOrganId,Long srvSendId,String status) {
if (pageNum == null || pageNum < 1 || disabInfoId == null || disabInfoId == 0 || srvOrganId == null || srvOrganId == 0) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
......@@ -92,7 +92,7 @@ public class SrvProgramController {
pageSize = 10;
}
Page<ProgramListVo> page = new Page<>(pageNum, pageSize);
page = srvProgramService.getProgramSetList(page, disabInfoId, srvOrganId, status);
page = srvProgramService.getProgramSetList(page, disabInfoId, srvOrganId,srvSendId, status);
List<ProgramListVo> records = page.getRecords();
records =records.stream().collect(
Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparingLong(ProgramListVo::getProgramId))), ArrayList::new));
......
......@@ -25,7 +25,7 @@ public interface ChSrvProgramMapper extends BaseMapper<ChSrvProgram> {
* @param programStatus 服务方案状态 0:未生效、1:已生效、2:已终止
* @return 返回个人照护方案列表
*/
Page<ProgramListVo> getProgramList(Page<ProgramListVo> page, @Param("disabInfoId") Long disabInfoId, @Param("srvOrganId") Long srvOrganId, @Param("programStatus") String programStatus);
Page<ProgramListVo> getProgramList(Page<ProgramListVo> page, @Param("disabInfoId") Long disabInfoId, @Param("srvOrganId") Long srvOrganId, @Param("srvSendId")Long srvSendId ,@Param("programStatus") String programStatus);
/**
* 查看服务方案详情
......
......@@ -32,7 +32,7 @@ public interface SrvProgramService {
* @param programStatus 服务方案状态 0:未生效、1:已生效、2:已终止
* @return 返回个人照护方案列表
*/
Page<ProgramListVo> getProgramSetList(Page<ProgramListVo> page, Long disabInfoId, Long srvOrganId, String programStatus);
Page<ProgramListVo> getProgramSetList(Page<ProgramListVo> page, Long disabInfoId, Long srvOrganId,Long srvSendId, String programStatus);
/**
* 个人照护方案记录条数,查询对应方案状态的记录条数
......
......@@ -55,8 +55,8 @@ public class SrvProgramServiceImpl implements SrvProgramService {
}
@Override
public Page<ProgramListVo> getProgramSetList(Page<ProgramListVo> page, Long disabInfoId, Long srvOrganId, String programStatus) {
return chSrvProgramMapper.getProgramList(page, disabInfoId, srvOrganId, programStatus);
public Page<ProgramListVo> getProgramSetList(Page<ProgramListVo> page, Long disabInfoId, Long srvOrganId,Long srvSendId, String programStatus) {
return chSrvProgramMapper.getProgramList(page, disabInfoId, srvOrganId, srvSendId,programStatus);
}
@Override
......
......@@ -140,6 +140,9 @@
LEFT JOIN CH_SRV_ORGAN T5 ON T1.SRV_ORGAN_ID = T5.SRV_ORGAN_ID
WHERE T1.DISAB_INFO_ID = #{disabInfoId}
AND T1.SRV_ORGAN_ID = #{srvOrganId}
<if test="srvSendId != null and srvSendId != ''">
AND T1.SRV_SEND_ID = #{srvSendId}
</if>
<!--
<if test="programStatus != null and programStatus != ''">
AND T1.PROG_STATUS = #{programStatus}
......
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