Commit 08a083cb authored by zhangwanglin's avatar zhangwanglin

服务方式新增

parent 089f0e4d
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
@Repository @Repository
public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAccounts> { public interface ChDisabAccountsDetailMapper extends BaseMapper<ChDisabDetailAccounts> {
List<OrganAccountsVO> getOrganAccountsList(@Param("taskDetailIds") List<String> taskDetailIds, String status); List<OrganAccountsVO> getOrganAccountsList(String taskDetailId);
Page<SrvOrganAccountListResp> searchSrvOrganAccountList(Page page, List<Long> organIds, SrvOrganListReq req); Page<SrvOrganAccountListResp> searchSrvOrganAccountList(Page page, List<Long> organIds, SrvOrganListReq req);
......
...@@ -35,7 +35,6 @@ import java.text.ParseException; ...@@ -35,7 +35,6 @@ import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
...@@ -475,33 +474,50 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -475,33 +474,50 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
@Override @Override
public void organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS) { public void organAccountTaskExecute(List<AccountTaskExecuteReqVO> accountTaskExecuteReqVOS) {
List<String> taskDetailIdList = accountTaskExecuteReqVOS.stream().map(AccountTaskExecuteReqVO::getTaskDetailId).collect(Collectors.toList()); if (CollectionUtil.isEmpty(accountTaskExecuteReqVOS)) {
// 已完成 return;
}
List<String> taskDetailIds = accountTaskExecuteReqVOS.stream().map(AccountTaskExecuteReqVO::getTaskDetailId).distinct().collect(Collectors.toList());
// 根据任务id查找结算详情,还没有对应的任务数据说明还未发生过结算,进行插入详情表和结算表
List<ChDisabDetailAccounts> chDisabDetailList = chDisabAccountsDetailMapper.queryAccountByCondition(taskDetailIds);
// 根据任务id分组,一个任务下会有多个项目,任务id相同
Map<String, List<AccountTaskExecuteReqVO>> accountTaskMap = accountTaskExecuteReqVOS.stream().collect(Collectors.groupingBy(AccountTaskExecuteReqVO::getTaskDetailId));
for(Map.Entry<String, List<AccountTaskExecuteReqVO>> entry:accountTaskMap.entrySet()) {
String taskDetailId = entry.getKey();
// 已完成的任务,一个任务下有服务完成就产生结算,多个服务完成算一条服务的结算(实际上结算详情有一条记录就产生结算费用)
List<ChSrvTaskFinishItem> chSrvTaskFinishItems = chSrvTaskFinishItemMapper.selectList(new LambdaQueryWrapper<ChSrvTaskFinishItem>() List<ChSrvTaskFinishItem> chSrvTaskFinishItems = chSrvTaskFinishItemMapper.selectList(new LambdaQueryWrapper<ChSrvTaskFinishItem>()
.in(ChSrvTaskFinishItem::getTaskDetailId, taskDetailIdList)); .eq(ChSrvTaskFinishItem::getTaskDetailId, taskDetailId));
for (AccountTaskExecuteReqVO accountTaskExecuteReqVO : accountTaskExecuteReqVOS) { List<AccountTaskExecuteReqVO> accountTaskList = entry.getValue();
// 一个任务下只要有一条服务完成就产生结算,多个服务完成算一条服务的结算(实际上结算详情有一条记录就产生结算费用) // 处理具体的服务项目
List<ChSrvTaskFinishItem> chSrvTaskFinishItemStream = chSrvTaskFinishItems.stream().filter(s -> s.getItemId().equals(Long.valueOf(accountTaskExecuteReqVO.getItemId()))).collect(Collectors.toList()); for (AccountTaskExecuteReqVO accountTaskExecuteReqVO : accountTaskList) {
// 已完成的任务更新ch_srv_plan状态
String planId = accountTaskExecuteReqVO.getPlanId(); String planId = accountTaskExecuteReqVO.getPlanId();
Integer integer = chSrvTaskDetailMapper.updateSrvPlanById(planId); Integer integer = chSrvTaskDetailMapper.updateSrvPlanById(planId);
if (CollectionUtil.isNotEmpty(chSrvTaskFinishItems)) {
List<ChSrvTaskFinishItem> chSrvTaskFinishItemStream = chSrvTaskFinishItems.stream()
.filter(s -> s.getItemId().equals(Long.valueOf(accountTaskExecuteReqVO.getItemId()))).collect(Collectors.toList());
// 如果存在就不插入了
if (CollectionUtil.isNotEmpty(chSrvTaskFinishItemStream)) { if (CollectionUtil.isNotEmpty(chSrvTaskFinishItemStream)) {
return; return;
} }
}
ChSrvTaskFinishItem chSrvTaskFinishItem = new ChSrvTaskFinishItem(); ChSrvTaskFinishItem chSrvTaskFinishItem = new ChSrvTaskFinishItem();
chSrvTaskFinishItem.setTaskDetailId(Long.valueOf(accountTaskExecuteReqVO.getTaskDetailId())); chSrvTaskFinishItem.setTaskDetailId(Long.valueOf(accountTaskExecuteReqVO.getTaskDetailId()));
chSrvTaskFinishItem.setItemId(Long.valueOf(accountTaskExecuteReqVO.getItemId())); chSrvTaskFinishItem.setItemId(Long.valueOf(accountTaskExecuteReqVO.getItemId()));
chSrvTaskFinishItemMapper.insert(chSrvTaskFinishItem); chSrvTaskFinishItemMapper.insert(chSrvTaskFinishItem);
ChSrvTaskDetail ca = new ChSrvTaskDetail(); ChSrvTaskDetail ca = new ChSrvTaskDetail();
ca.setStatus((short)4); ca.setStatus((short) 4);
ca.setTaskDetailId(Long.valueOf(accountTaskExecuteReqVO.getTaskDetailId())); ca.setTaskDetailId(Long.valueOf(accountTaskExecuteReqVO.getTaskDetailId()));
chSrvTaskDetailMapper.updateById(ca); chSrvTaskDetailMapper.updateById(ca);
} }
List<String> taskDetailIds = accountTaskExecuteReqVOS.stream().map(AccountTaskExecuteReqVO::getTaskDetailId).collect(Collectors.toList()); accountSave( taskDetailId, chDisabDetailList);
List<OrganAccountsVO> accountsList = chDisabAccountsDetailMapper.getOrganAccountsList(taskDetailIds,"4"); }
// 根据机构,服务方式和时间查找结算表是否有数据,有数据进行累加 }
List<ChDisabDetailAccounts> chDisabDetailList = chDisabAccountsDetailMapper.queryAccountByCondition(taskDetailIds);
// 详情表还没有对应的任务数据说明还未发生过结算,进行插入详情表和结算表 private void accountSave(String taskDetailId, List<ChDisabDetailAccounts> chDisabDetailList) {
if(CollectionUtil.isEmpty(chDisabDetailList)){ if (CollectionUtil.isEmpty(chDisabDetailList)) {
List<OrganAccountsVO> accountsList = chDisabAccountsDetailMapper.getOrganAccountsList(taskDetailId);
for (OrganAccountsVO accountsVO : accountsList) { for (OrganAccountsVO accountsVO : accountsList) {
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts(); ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
chDisabDetailAccounts.setSrvOrganId(accountsVO.getSrvOrganId()); chDisabDetailAccounts.setSrvOrganId(accountsVO.getSrvOrganId());
...@@ -513,12 +529,13 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -513,12 +529,13 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
if ("养老".equals(accountsVO.getSrvModeName())) { if ("养老".equals(accountsVO.getSrvModeName())) {
limit = BigDecimal.valueOf(50); limit = BigDecimal.valueOf(50);
// 医疗机构护理,原则上收治医疗护理需求为主的重度失能人员一级及以下医疗机构其限额为 80 元/人/天,由长期护理保险基金支付 70%,个人支付 30%; // 医疗机构护理,原则上收治医疗护理需求为主的重度失能人员一级及以下医疗机构其限额为 80 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
}else if("医疗".equals(accountsVO.getSrvModeName())&& "1".equals(accountsVO.getLevelCode()) && accountsVO.getDisableLevelName().contains("重度")){ // && accountsVO.getDisableLevelName().contains("重度")
} else if ("医疗".equals(accountsVO.getSrvModeName()) && "1".equals(accountsVO.getLevelCode())) {
limit = BigDecimal.valueOf(80); limit = BigDecimal.valueOf(80);
// 二级及以上医疗机构其限额为 100 元/人/天,由长期护理保险基金支付 70%,个人支付 30%; // 二级及以上医疗机构其限额为 100 元/人/天,由长期护理保险基金支付 70%,个人支付 30%;
}else if("医疗".equals(accountsVO.getSrvModeName())&& (!"1".equals(accountsVO.getLevelCode())) && accountsVO.getDisableLevelName().contains("重度")){ } else if ("医疗".equals(accountsVO.getSrvModeName()) && (!"1".equals(accountsVO.getLevelCode()))) {
limit = BigDecimal.valueOf(100); limit = BigDecimal.valueOf(100);
}else { } else {
return; return;
} }
chDisabDetailAccounts.setAccountsAllCost(limit); chDisabDetailAccounts.setAccountsAllCost(limit);
...@@ -528,10 +545,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -528,10 +545,10 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setAccountsPersonalCost(personalCost); chDisabDetailAccounts.setAccountsPersonalCost(personalCost);
chDisabDetailAccounts.setModeName(accountsVO.getSrvModeName()); chDisabDetailAccounts.setModeName(accountsVO.getSrvModeName());
chDisabDetailAccounts.setCreationTime(new Date()); chDisabDetailAccounts.setCreationTime(new Date());
//结算时间为任务时间 // 结算时间为任务时间
chDisabDetailAccounts.setAccountsTime(DateUtils.strToTime(accountsVO.getSrvDate())); chDisabDetailAccounts.setAccountsTime(DateUtils.strToTime(accountsVO.getSrvDate()));
chDisabDetailAccounts.setAccountsStartTime(DateUtils.strToTime(accountsVO.getSrvStartTime())); //chDisabDetailAccounts.setAccountsStartTime(DateUtils.strToTime(accountsVO.getSrvStartTime()));
chDisabDetailAccounts.setAccountsEndTime(DateUtils.strToTime(accountsVO.getSrvEndTime())); //chDisabDetailAccounts.setAccountsEndTime(DateUtils.strToTime(accountsVO.getSrvEndTime()));
chDisabDetailAccounts.setTaskDetailId(accountsVO.getTaskDetailId()); chDisabDetailAccounts.setTaskDetailId(accountsVO.getTaskDetailId());
chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea()); chDisabDetailAccounts.setMedicalArea(accountsVO.getMedicalArea());
chDisabDetailAccounts.setItemIds(accountsVO.getItemId()); chDisabDetailAccounts.setItemIds(accountsVO.getItemId());
...@@ -540,13 +557,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis ...@@ -540,13 +557,6 @@ public class AccountServiceImpl extends ServiceImpl<ChDisabAccountsMapper, ChDis
chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId()); chDisabDetailAccounts.setAccountsId(chDisabAccounts.getAccountsId());
chDisabAccountsDetailMapper.insert(chDisabDetailAccounts); chDisabAccountsDetailMapper.insert(chDisabDetailAccounts);
} }
}else {
ChDisabDetailAccounts chDisabDetailAccounts = new ChDisabDetailAccounts();
Long accountsDetailId = chDisabDetailList.get(0).getAccountsDetailId();
chDisabDetailAccounts.setAccountsDetailId(accountsDetailId);
String itemIds = chDisabDetailAccounts.getItemIds();
chDisabDetailAccounts.setItemIds(itemIds+","+accountTaskExecuteReqVOS.get(0).getItemId());
chDisabAccountsDetailMapper.updateById(chDisabDetailAccounts);
} }
} }
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
disable.CERTI_CODE certiCode, disable.CERTI_CODE certiCode,
--所在省市 --所在省市
apply.MEDICAL_AREA medicalArea, apply.MEDICAL_AREA medicalArea,
mode1.MODE_ID modeId, program.SRV_MODE_ID modeId,
--服务方式 --服务方式
mode1.mode_name srvModeName, DECODE(program.SRV_MODE_ID, '1','医疗','2', '养老','3','上门', '4', '异地') srvModeName,
--护理机构名称 --护理机构名称
organ.srv_organ_id srvOrganId, organ.srv_organ_id srvOrganId,
--护理机构名称 --护理机构名称
...@@ -23,41 +23,21 @@ ...@@ -23,41 +23,21 @@
emp.emp_name empName, emp.emp_name empName,
--任务时间 --任务时间
detail.SRV_DATE srvDate, detail.SRV_DATE srvDate,
detail.SRV_START_TIME srvStartTime,
detail.SRV_END_TIME srvEndTime,
-- 机构等级 -- 机构等级
organ.LEVEL_CODE levelCode, organ.LEVEL_CODE levelCode,
-- 失能等级
level1.DISABLE_LEVEL_NAME disableLevelName,
d.service_type_detailed_name itemName
,d.PARA_ID,
CSOP.ITEM_TIMES,
CSOP.ITEM_TIMES_TYPE,
CSTFI.ITEM_ID itemId CSTFI.ITEM_ID itemId
from ch_srv_task_detail detail--服务计划 from ch_srv_task_detail detail--服务计划
left join ch_srv_task task on task.srv_task_id = detail.srv_task_id--服务计划详情 left join ch_srv_task task on task.srv_task_id = detail.srv_task_id--服务计划详情
left join ch_disable_info disable on task.disab_info_id = disable.disab_info_id--失能人员 left join ch_disable_info disable on task.disab_info_id = disable.disab_info_id--失能人员
left join CH_DEV.CH_DISABLE_APPLY apply on apply.apply_id = disable.apply_id left join CH_DEV.CH_DISABLE_APPLY apply on apply.apply_id = disable.apply_id
left join ch_apr_task aprtask on disable.last_task_id = aprtask.task_id--评定任务 left join ch_srv_organ_emp emp on task.srv_emp_id = emp.emp_id--护理人员
left join ch_apr_report report on aprtask.task_id = report.task_id--评定报告
left join ch_srv_program program on task.program_id = program.program_id--服务方案 left join ch_srv_program program on task.program_id = program.program_id--服务方案
left join ch_srv_organ organ on program.srv_organ_id = organ.srv_organ_id--服务机构 left join ch_srv_organ organ on program.srv_organ_id = organ.srv_organ_id--服务机构
left join ch_cfg_srv_mode mode1 on program.srv_mode_id = mode1.mode_id--服务方式
left join ch_srv_organ_emp emp on task.srv_emp_id = emp.emp_id--护理人员
-- 失能等级
left join ch_cfg_srv_disable_level level1 on report.disable_level_id = level1.disable_level_id
LEFT JOIN CH_SRV_TASK_FINISH_ITEM CSTFI ON detail.TASK_DETAIL_ID = CSTFI.TASK_DETAIL_ID LEFT JOIN CH_SRV_TASK_FINISH_ITEM CSTFI ON detail.TASK_DETAIL_ID = CSTFI.TASK_DETAIL_ID
LEFT JOIN CH_SRV_ORGAN_PROJECT CSOP ON CSOP.PROJECT_ID = CSTFI.ITEM_ID
LEFT JOIN CH_SERVICE_TYPE_detailed d on d.service_type_detailed_id = CSOP.item_name
<where> <where>
<if test="status != null and status != ''"> detail.STATUS = '4'
AND detail.STATUS = #{status} <if test="taskDetailId != null and taskDetailId != ''">
</if> AND detail.TASK_DETAIL_ID = #{taskDetailId}
<if test="taskDetailIds != null and taskDetailIds.size() > 0">
AND detail.TASK_DETAIL_ID IN
<foreach collection="taskDetailIds" separator="," open="(" close=")" item="taskDetailId">
#{taskDetailId}
</foreach>
</if> </if>
</where> </where>
</select> </select>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
plan.TASK_DETAIL_ID taskDetailId, plan.TASK_DETAIL_ID taskDetailId,
plan.ITEM_NAME itemName, plan.ITEM_NAME itemName,
emp.emp_name empName, emp.emp_name empName,
DECODE(plan.MODE_ID, '1','医疗','2', '养老','3','上门', '4', '异地') srvModeName,
to_char(plan.SRV_PLAN_TIME,'yyyy-MM-dd') srvDate, to_char(plan.SRV_PLAN_TIME,'yyyy-MM-dd') srvDate,
plan.IS_STATUS status plan.IS_STATUS status
from ch_srv_plan plan from ch_srv_plan plan
......
...@@ -32,6 +32,6 @@ public class SrvTaskRespVO { ...@@ -32,6 +32,6 @@ public class SrvTaskRespVO {
private Long status; private Long status;
private String srvModeName;
} }
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