Commit 85ba2939 authored by zhangwanglin's avatar zhangwanglin

异地费用

parent 2abf5d7b
......@@ -27,4 +27,7 @@ public interface ChSrvTaskDetailMapper extends BaseMapper<ChSrvTaskDetail> {
Page<PlaceOtherVO> placeOtherQuery(Page page, String name, String certiCode);
List<PlaceOtherVO> placeOtherTaskQuery();
}
\ No newline at end of file
......@@ -66,4 +66,5 @@ public interface AccountService extends IService<ChDisabAccounts> {
Page<PlaceOtherVO> placeOtherQuery(Page page, String name, String certiCode);
void placeOtherTaskQuery();
}
......@@ -697,31 +697,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override
public void otherPlaceHandler(String programId){
/* List<OrganAccountsVO> accountsList = chDisabAccountsDetailMapper.getOtherPlaceList(programId);
for (OrganAccountsVO accountsVO : accountsList) {
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setSrvOrganId(accountsVO.getSrvOrganId());
// 异地
BigDecimal limit = BigDecimal.valueOf(20);
BigDecimal zero = BigDecimal.valueOf(0);
chDisabDetailAccounts.setAccountsAllCost(limit);
chDisabDetailAccounts.setAccountsPersonalCost(zero);
chDisabDetailAccounts.setAccountsOverallCost(zero);
chDisabDetailAccounts.setReissueAmount(zero);
chDisabDetailAccounts.setDeductionAmount(zero);
chDisabDetailAccounts.setStatus((short)0);
chDisabDetailAccounts.setModeName(accountsVO.getSrvModeName());
chDisabDetailAccounts.setCreationTime(new Date());
chDisabDetailAccounts.setAccountsTime(DateUtils.strToDate(accountsVO.getSrvDate()));
chDisabDetailAccounts.setAccountsStartTime(DateUtils.getFirstDayOfMonth(DateUtils.strToDate(accountsVO.getSrvDate())));
chDisabDetailAccounts.setAccountsEndTime(DateUtils.getlastDayOfMonth(DateUtils.strToDate(accountsVO.getSrvDate())));
chDisabDetailAccounts.setTaskDetailId(accountsVO.getTaskDetailId());
chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea());
chDisabDetailAccounts.setDisabInfoId(accountsVO.getDisabInfoId());
ChDisabAccounts chDisabAccounts = getChDisabAccounts1(accountsVO);
chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId());
chDisabAccountsDetailMapper.insert(chDisabDetailAccounts);
}*/
}
@Override
......@@ -901,10 +876,20 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override
public int placeOtherApply(Integer disabInfoId, String otherApplyTime) {
int result = taskDetailMapper.placeOtherApply(disabInfoId,otherApplyTime);
Date date = DateUtils.strToDate(otherApplyTime);
boolean now = DateUtils.isNow(date);
if (now) {
placeFreeHandler(disabInfoId, otherApplyTime);
}
return result;
}
private void placeFreeHandler(Integer disabInfoId, String otherApplyTime) {
BigDecimal limit = BigDecimal.valueOf(20);
BigDecimal zero = BigDecimal.valueOf(0);
ChDisabDetailAccounts chDisabDetailAccountsDTO = chDisabAccountsDetailMapper.queryDisabDetailAccounts("471", otherApplyTime, String.valueOf(disabInfoId), "异地");
if(Objects.isNull(chDisabDetailAccountsDTO)) {
if (Objects.isNull(chDisabDetailAccountsDTO)) {
// 异地
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setAccountsAllCost(limit);
......@@ -914,7 +899,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setSrvOrganId("471");
chDisabDetailAccounts.setCreationTime(new Date());
chDisabDetailAccounts.setAccountsTime(DateUtils.strToDate(otherApplyTime));
// chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea());
chDisabDetailAccounts.setDisabInfoId(String.valueOf(disabInfoId));
chDisabDetailAccounts.setStatus((short) 1);
chDisabDetailAccounts.setReissueAmount(BigDecimal.valueOf(0));
......@@ -933,10 +917,21 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabAccounts.setReissueAmountTotal(zero);
chDisabAccounts.setDeductionAmountTotal(zero);
disabAccountsMapper.insert(chDisabAccounts);
}else {
BigDecimal allCost1 = chDisabAccounts.getAllCost();
BigDecimal overallCost1 = chDisabAccounts.getOverallCost();
allCost1 = allCost1.add(chDisabDetailAccountsDTO.getAccountsAllCost());
overallCost1 = overallCost1.add(chDisabDetailAccountsDTO.getAccountsAllCost());
ChDisabAccounts chDisabAccount = new ChDisabAccounts();
chDisabAccount.setAllCost(allCost1);
chDisabAccount.setOverallCost(overallCost1);
Long accountsId = chDisabAccounts.getAccountsId();
chDisabAccount.setAccountsId(accountsId);
disabAccountsMapper.updateById(chDisabAccount);
}
chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId());
chDisabAccountsDetailMapper.insert(chDisabDetailAccounts);
}else {
} else {
BigDecimal accountsAllCost = chDisabDetailAccountsDTO.getAccountsAllCost();
BigDecimal accountsOverallCost = chDisabDetailAccountsDTO.getAccountsOverallCost();
chDisabDetailAccountsDTO.setAccountsAllCost(accountsAllCost.add(limit));
......@@ -944,7 +939,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccountsDTO.setAccountsPersonalCost(zero);
chDisabAccountsDetailMapper.updateById(chDisabDetailAccountsDTO);
}
return result;
}
@Override
......@@ -953,4 +947,16 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
return placeOtherVOPage;
}
@Override
public void placeOtherTaskQuery(){
List<PlaceOtherVO> placeOtherVOS = taskDetailMapper.placeOtherTaskQuery();
for (PlaceOtherVO placeOtherVO : placeOtherVOS) {
Integer disabInfoId = placeOtherVO.getDisabInfoId();
String otherApplyTime = placeOtherVO.getOtherApplyTime();
placeFreeHandler(disabInfoId,otherApplyTime);
}
}
}
......@@ -78,6 +78,34 @@
</if>
</select>
<select id="placeOtherTaskQuery" resultType="com.hungraim.ltc.pojo.vo.disable.PlaceOtherVO">
SELECT distinct info.DISAB_INFO_ID disabInfoId,
report.evaluate_time evaluateTime,
task.ORGAN_ID organId,
report.disable_level_id disableLevelId,
info.REAL_NAME realName,
info.CERTI_CODE certiCode,
(SELECT DISE_TYPE_CODE FROM CH_FND_DISEASE_TYPE WHERE info.DISE_TYPE_S = DISE_TYPE_ID) diseTypeS,
info.disease_desc diseaseDesc,
lev.DISABLE_LEVEL_NAME riskLevel,
report.PUBLICITY_START_TIME publicityStartTime,
report.PUBLICITY_END_TIME publicityEndTime,
report.PUBLICITY_TIME publicityTime,
to_char(info.OTHER_APPLY_TIME,'yyyy-MM-dd') otherApplyTime
FROM CH_DISABLE_INFO info
LEFT JOIN CH_APR_TASK task ON info.DISAB_INFO_ID = task.DISABLE_INFO_ID
LEFT JOIN ch_apr_report report ON report.TASK_ID = task.TASK_ID
left join ch_apr_organ aprOrgan on task.apr_organ_id = aprOrgan.apr_organ_id
LEFT JOIN CH_CFG_SRV_DISABLE_LEVEL lev ON report.DISABLE_LEVEL_ID = lev.DISABLE_LEVEL_ID
where info.SRV_MODE_ID ='4' and sysdate <![CDATA[ > ]]> report.PUBLICITY_END_TIME
and info.OTHER_APPLY_TIME is not null
and info.OTHER_APPLY_TIME = to_date(to_char(sysdate,'yyyy-MM-dd'),'yyyy-MM-dd')
</select>
<update id="placeOtherApply">
update CH_DISABLE_INFO set OTHER_APPLY_TIME = TO_DATE ( #{otherApplyTime}, 'yyyy-MM-dd') where DISAB_INFO_ID = #{disabInfoId}
......
......@@ -569,4 +569,10 @@ public class DisableController {
return Result.success(1);
}
@GetMapping("/disableExitTask")
public Result disableExitTask(){
disableService.disableExitTask();
return Result.success();
}
}
......@@ -6,7 +6,6 @@ import com.hungraim.ltc.pojo.entity.disable.ChDisableInfo;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.vo.disable.DisableInfoListVo;
import com.hungraim.ltc.pojo.vo.governance.ProgramListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
......@@ -31,7 +30,9 @@ public interface DisableInfoMapper extends BaseMapper<ChDisableInfo> {
*/
Page<DisableInfoListVo> getDisableInfoList(Page<DisableInfoListVo> page, @Param("srvOrganId") Long srvOrganId,String certiCode,String realName,String svrModelId);
int deleteSrvSend(Integer disableInfoId,String exitTime);
List<DisableInfoListVo> getDisableExitList();
int updateSrvProgramById(ChSrvProgram chSrvProgram);
......
......@@ -187,4 +187,6 @@ public interface DisableService {
List<ChDisableExit> getDisableExitHis(Integer disableInfoId);
Integer selectByCertiCode(String certiCode);
void disableExitTask();
}
......@@ -16,13 +16,10 @@ import com.hungraim.ltc.pojo.entity.assessment.ChAprTask;
import com.hungraim.ltc.pojo.entity.assessment.ChDisableInfoHis;
import com.hungraim.ltc.pojo.entity.disable.*;
import com.hungraim.ltc.pojo.entity.riskLevel.ChDisableRiskLevel;
import com.hungraim.ltc.pojo.entity.riskLevel.ChSrvorganRiskLevel;
import com.hungraim.ltc.pojo.entity.serviceManage.ChCfgPara;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvSend;
import com.hungraim.ltc.pojo.entity.serviceManage.ChSrvTaskDetail;
import com.hungraim.ltc.pojo.vo.disable.*;
import com.hungraim.ltc.pojo.vo.governance.ProgramListVo;
import com.hungraim.ltc.pojo.vo.system.AttachUpdateVo;
import com.hungraim.ltc.service.DisableService;
import com.hungraim.ltc.service.OrganService;
......@@ -39,7 +36,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.awt.print.Book;
import java.util.*;
@Service
......@@ -643,8 +639,23 @@ public class DisableServiceImpl implements DisableService {
int result = disableInfoMapper.updateById(chDisableInfo);
boolean now = DateUtils.isNow(date);
if (now) {
disableExitHanlder(exitReasonId, srvOrganId, disableInfoId, date);
}
return result;
}
/**
* 失能人员退出处理
*@param exitReasonId 失能退出原因
* @param srvOrganId 失能退出前所在护理机构
* @param disableInfoId 失能人员
* @param date 退出时间
*@return void
**/
private void disableExitHanlder(Integer exitReasonId, Integer srvOrganId, Integer disableInfoId, Date date) {
// 更新方案为已终止
ChSrvProgram chSrvProgram = new ChSrvProgram();
chSrvProgram.setProgramId(chSrvProgram.getProgramId());
chSrvProgram.setDisabInfoId(Long.valueOf(disableInfoId));
chSrvProgram.setProgStatus(2);
chSrvProgram.setEndReason("失能人员退出,终止方案");
......@@ -659,6 +670,7 @@ public class DisableServiceImpl implements DisableService {
// disableInfoMapper.updateSrvSendById(chSrvSend);
// 1, 死亡
}else if (exitReasonId == 1){
// 更新已分配为已退出
chSrvSend.setStatus((short)3);
disableInfoMapper.updateSrvSendById(chSrvSend);
}else {
......@@ -672,20 +684,13 @@ public class DisableServiceImpl implements DisableService {
chSrvSend1.setStatus((short)0);
chSrvSendInfoMapper.insert(chSrvSend1);
}
}
// 解除护理机构分配
// delete from CH_SRV_SEND where DISAB_INFO_ID = '327'
// disableInfoMapper.deleteSrvSend(disableInfoId,exitTime);
// }
// 插入历史记录
ChDisableExit chDisableExit = new ChDisableExit();
chDisableExit.setDisabInfoId(disableInfoId);
chDisableExit.setExitReasonId(exitReasonId);
chDisableExit.setExitTime(date);
chDisableExit.setSrvOrganId(srvOrganId);
disableExitMapper.insert(chDisableExit);
return result;
}
@Override
......@@ -703,6 +708,23 @@ public class DisableServiceImpl implements DisableService {
}
/**
* @desc 定时执行失能退出退出时间不是当天的
* @return void
**/
@Override
public void disableExitTask(){
List<DisableInfoListVo> disableExitList = disableInfoMapper.getDisableExitList();
for (DisableInfoListVo disableInfoListVo : disableExitList) {
Integer exitReasonId = disableInfoListVo.getExitReasonId();
Long srvOrganId = disableInfoListVo.getSrvOrganId();
Long disabInfoId = disableInfoListVo.getDisabInfoId();
String exitTime = disableInfoListVo.getExitTime();
Date date = DateUtils.strToDate(exitTime);
disableExitHanlder(exitReasonId,srvOrganId.intValue(),disabInfoId.intValue(),date);
}
}
}
......@@ -48,19 +48,50 @@
<if test="svrModelId != null and svrModelId != ''">
and T7.MODE_ID = #{svrModelId}
</if>
</where>
</select>
<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>
<update id="updateChSrvProgram">
update CH_SRV_PROGRAM t set t.PROG_STATUS ='2' ,t.END_TIME =sysdate
where t.PROGRAM_ID =#{programId}
</update>
<delete id="deleteSrvSend">
delete from CH_SRV_SEND where DISAB_INFO_ID = #{disableInfoId}
</delete>
<update id="updateSrvProgramById" parameterType="com.hungraim.ltc.pojo.entity.serviceManage.ChSrvProgram">
......
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