1、增加长者审核历史查询接口
This commit is contained in:
parent
e2dc42a337
commit
642089888f
|
|
@ -375,4 +375,16 @@ public class ElderApi {
|
|||
rabbitMQUtil.sendToExchange("hldy.elder", elderInfoEntity.getOrgCode() + ".elder.updateelder", mqdto);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询长者/监护人变更审批记录
|
||||
*
|
||||
* @param openId
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryElderHisAudit")
|
||||
public Result<List<ElderInfoEntity>> queryElderHisAudit(@RequestParam("openId") String openId) {
|
||||
return Result.ok(elderInfoApi.queryElderHisAudit(openId));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,6 +243,18 @@ public class ElderInfoEntity implements Serializable {
|
|||
* 机构名称
|
||||
*/
|
||||
private String departName;
|
||||
/**
|
||||
* 机构地址
|
||||
*/
|
||||
private String departAddress;
|
||||
/**
|
||||
* 机构负责人
|
||||
*/
|
||||
private String departFzr;
|
||||
/**
|
||||
* 机构负责人电话
|
||||
*/
|
||||
private String departPhone;
|
||||
/**
|
||||
* 监护人信息变更状态 1修改申请中 2通过 3驳回
|
||||
*/
|
||||
|
|
@ -295,4 +307,7 @@ public class ElderInfoEntity implements Serializable {
|
|||
* 缴费状态中文名
|
||||
*/
|
||||
private String jfztName;
|
||||
private String modifyStatus;
|
||||
private String auditContent;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,4 +13,6 @@ public interface IElderInfoApi {
|
|||
void addElder(ElderInfoEntity elderInfoEn);
|
||||
|
||||
boolean validateChanged(String orgCode, ElderInfoEntity elderInfoEntity);
|
||||
|
||||
List<ElderInfoEntity> queryElderHisAudit(String openId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,27 @@
|
|||
package com.nu.modules.elderinfo.mapper;
|
||||
|
||||
import com.nu.entity.ElderInfoEntity;
|
||||
import com.nu.modules.elderinfo.entity.ElderInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 长者信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2025-04-11
|
||||
* @Date: 2025-04-11
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ElderInfoMapper extends BaseMapper<ElderInfo> {
|
||||
|
||||
List<ElderInfo> selectLists(@Param("openId") String openId,@Param("elderId") String elderId);
|
||||
List<ElderInfo> selectLists(@Param("openId") String openId, @Param("elderId") String elderId);
|
||||
|
||||
/**
|
||||
* sql拼接的机构只有一条数据 不存在笛卡尔积
|
||||
* @param openId
|
||||
* @return
|
||||
*/
|
||||
List<ElderInfoEntity> selectModifyHisByOpenId(@Param("openId") String openId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,28 +4,35 @@
|
|||
|
||||
<select id="selectLists" resultType="com.nu.modules.elderinfo.entity.ElderInfo">
|
||||
select elder.*,
|
||||
yblxDictItem.item_text as yblxName,
|
||||
sndjDictItem.item_text as sndjName,
|
||||
jfztDictItem.item_text as jfztName
|
||||
yblxDictItem.item_text as yblxName,
|
||||
sndjDictItem.item_text as sndjName,
|
||||
jfztDictItem.item_text as jfztName
|
||||
from nu_biz_elder_info elder
|
||||
LEFT JOIN sys_dict yblxDict on yblxDict.dict_code = 'medical_insurance_type'
|
||||
LEFT JOIN sys_dict_item yblxDictItem on yblxDictItem.dict_id = yblxDict.id and
|
||||
yblxDictItem.item_value = elder.medical_type
|
||||
LEFT JOIN sys_dict sndjDict on sndjDict.dict_code = (case elder.medical_type
|
||||
when 'syb' then 'syb_reimbursement_type'
|
||||
when ' zgyb' then 'zgyb_reimbursement_type'
|
||||
when 'jmyb' then 'jmyb_reimbursement_type'
|
||||
else '' end)
|
||||
LEFT JOIN sys_dict_item sndjDictItem on sndjDictItem.dict_id = sndjDict.id and
|
||||
sndjDictItem.item_value = elder.disability_reimbursement_type
|
||||
LEFT JOIN sys_dict jfztDict on jfztDict.dict_code = 'elder_payment_status'
|
||||
LEFT JOIN sys_dict_item jfztDictItem on jfztDictItem.dict_id = jfztDict.id and
|
||||
jfztDictItem.item_value = elder.payment_status
|
||||
LEFT JOIN sys_dict yblxDict on yblxDict.dict_code = 'medical_insurance_type'
|
||||
LEFT JOIN sys_dict_item yblxDictItem on yblxDictItem.dict_id = yblxDict.id and
|
||||
yblxDictItem.item_value = elder.medical_type
|
||||
LEFT JOIN sys_dict sndjDict on sndjDict.dict_code = (case elder.medical_type
|
||||
when 'syb' then 'syb_reimbursement_type'
|
||||
when ' zgyb' then 'zgyb_reimbursement_type'
|
||||
when 'jmyb' then 'jmyb_reimbursement_type'
|
||||
else '' end)
|
||||
LEFT JOIN sys_dict_item sndjDictItem on sndjDictItem.dict_id = sndjDict.id and
|
||||
sndjDictItem.item_value = elder.disability_reimbursement_type
|
||||
LEFT JOIN sys_dict jfztDict on jfztDict.dict_code = 'elder_payment_status'
|
||||
LEFT JOIN sys_dict_item jfztDictItem on jfztDictItem.dict_id = jfztDict.id and
|
||||
jfztDictItem.item_value = elder.payment_status
|
||||
<where>
|
||||
elder.guardian_open_id = #{openId}
|
||||
<if test="elderId != null and elderId != ''">
|
||||
and elder.id = #{elderId}
|
||||
and elder.id = #{elderId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectModifyHisByOpenId" resultType="com.nu.entity.ElderInfoEntity">
|
||||
select mi.*,sd.depart_name as departName,sd.address as departAddress
|
||||
from nu_biz_elder_modify_info mi
|
||||
left join sys_depart sd on 1=1
|
||||
where mi.guardian_open_id = #{openId}
|
||||
and mi.modify_status != '0'
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nu.modules.elderinfo.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.dto.ElderInfoMQDto;
|
||||
|
|
@ -13,13 +14,19 @@ import com.nu.modules.elderinfo.entity.ElderInfo;
|
|||
import com.nu.modules.elderinfo.mapper.ElderInfoMapper;
|
||||
import com.nu.modules.elderinfo.service.IElderInfoService;
|
||||
import com.nu.modules.employees.entity.NuEmployeesAdvisoryInfo;
|
||||
import com.nu.modules.nubaseelder.entity.NuBaseElder;
|
||||
import com.nu.modules.nubaseelder.service.INuBaseElderService;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 长者信息
|
||||
|
|
@ -31,6 +38,8 @@ import java.util.Objects;
|
|||
public class ElderInfoServiceImpl extends ServiceImpl<ElderInfoMapper, ElderInfo> implements IElderInfoService, IElderInfoApi {
|
||||
@Autowired
|
||||
private INuBaseInfoApi nuBaseInfoApi;
|
||||
@Autowired
|
||||
private INuBaseElderService baseElderService;
|
||||
|
||||
@Override
|
||||
public List<ElderInfoEntity> queryByElderIds(String[] ids) {
|
||||
|
|
@ -109,4 +118,43 @@ public class ElderInfoServiceImpl extends ServiceImpl<ElderInfoMapper, ElderInfo
|
|||
// }
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ElderInfoEntity> queryElderHisAudit(String openId) {
|
||||
//先查询家属微信openid 都绑定了哪些机构
|
||||
QueryWrapper<NuBaseElder> baseElderQW = new QueryWrapper<>();
|
||||
baseElderQW.eq("open_id", openId);
|
||||
List<NuBaseElder> baseElderList = baseElderService.list(baseElderQW);
|
||||
if (CollectionUtils.isEmpty(baseElderList)) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
//去对应机构的modify表把所有变更的信息都取出来
|
||||
List<String> orgCodes = baseElderList.stream()
|
||||
.map(NuBaseElder::getOrgCode)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<ElderInfoEntity> his = Lists.newArrayList();
|
||||
for (String orgCode : orgCodes) {
|
||||
if (StringUtils.isNotBlank(orgCode)) {
|
||||
try {
|
||||
DynamicDataSourceContextHolder.push(orgCode);
|
||||
his.addAll(baseMapper.selectModifyHisByOpenId(openId));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
DynamicDataSourceContextHolder.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//按照审批时间排序重新组合
|
||||
if(!CollectionUtils.isEmpty(his)){
|
||||
his = his.stream()
|
||||
.sorted(Comparator.comparing(ElderInfoEntity::getUpdateTime, Comparator.nullsLast(Comparator.reverseOrder())))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
return his;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue