Ver Fonte

feat: 财务复核功能-复核详情查询TODO

lixuesong há 1 ano atrás
pai
commit
41ae415c7c

+ 44 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/controller/WmPayOffController.java

@@ -50,6 +50,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.RandomStringUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.data.redis.core.script.DefaultRedisScript;
 import org.springframework.security.access.AccessDeniedException;
@@ -347,6 +348,49 @@ public class WmPayOffController {
 		return R.ok(voList);
 	}
 
+	/**
+	 * 查询财务结算复核汇总数据
+	 *
+	 * @param page 分页参数
+	 * @param userId 用户id
+	 * @param subjectLocation 结算渠道
+	 * @return {@link R}<{@link ?}> 结果
+	 */
+	@GetMapping("/page-financial-review-detail")
+	public R<IPage<WmScorePackageSettleOutput>> pageFinancialReviewDetail(Page<WmScorePackageSettleOutput> page,
+																	@Param("userId") Integer userId,
+																	SubjectLocation subjectLocation,
+																	Boolean reviewFlag) {
+		Integer deptId = SecurityUtils.getUser().getDeptId();
+
+		SettleFinancialReviewVO query = new SettleFinancialReviewVO();
+		query.setSubjectLocation(subjectLocation);
+		query.setReviewFlag(reviewFlag);
+		query.setDeptId(deptId);
+		query.setUserId(userId);
+		IPage<WmScorePackageSettleOutput> detailPage = wmScorePackageService.pageFinancialReviewDetail(page, query);
+
+		return R.ok(detailPage);
+	}
+
+	public R<List<WmScorePackageSettleOutput>> listFinancialReviewDetail(String[] settleNoteIds) {
+		List<WmScorePackageSettleNote> settleNotes = wmScorePackageSettleNoteService.listByIds(Arrays.asList(settleNoteIds));
+
+		List<SysUser> sysUsers = sysUserService.listByIds(settleNotes.stream().map(WmScorePackageSettleNote::getUserId).collect(Collectors.toSet()));
+
+		List<WmScorePackageSettleOutput> outputList = new ArrayList<>();
+		settleNotes.forEach(settleNote -> {
+			WmScorePackageSettleOutput output = new WmScorePackageSettleOutput();
+			output.setSettleAmount(settleNote.getSettleAmount());
+			output.setActualAmount(settleNote.getActualAmount());
+//			output.setUserNames(settleNote.getUserNames());
+		});
+
+		// TODO
+
+		return null;
+	}
+
 	/**
 	 * 结算包结算导出
 	 *

+ 5 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/entity/vo/SettleFinancialReviewVO.java

@@ -66,4 +66,9 @@ public class SettleFinancialReviewVO implements Serializable {
 	 * 复核标记
 	 */
 	private Boolean reviewFlag;
+
+	/**
+	 * 结算表id
+	 */
+	private String[] settleNoteIds;
 }

+ 9 - 1
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/mapper/WmScorePackageMapper.java

@@ -181,10 +181,18 @@ public interface WmScorePackageMapper extends DataScopeMapper<WmScorePackage> {
 										  @Param("toApproval") Boolean toApproval);
 
 	/**
-	 * 查询财务结算复核数据
+	 * 查询财务结算复核汇总
 	 *
 	 * @param query 查询条件
 	 * @return 结果
 	 */
 	List<SettleFinancialReviewVO> listFinancialReview(@Param("query") SettleFinancialReviewVO query);
+
+	/**
+	 * 查询财务结算复核数据详情
+	 *
+	 * @param query 查询条件
+	 * @return 结果
+	 */
+	IPage<WmScorePackageSettleOutput> pageFinancialReviewDetail(Page<WmScorePackageSettleOutput> page, @Param("query") SettleFinancialReviewVO query);
 }

+ 10 - 0
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/WmScorePackageService.java

@@ -31,6 +31,7 @@ import com.qunzhixinxi.hnqz.admin.entity.dto.UnpackDTO;
 import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageApiOutput;
 import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageSettleInput;
 import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageSettleOutput;
+import com.qunzhixinxi.hnqz.admin.entity.vo.SettleFinancialReviewVO;
 import com.qunzhixinxi.hnqz.common.core.util.R;
 
 import java.time.LocalDate;
@@ -236,4 +237,13 @@ public interface WmScorePackageService extends IService<WmScorePackage> {
 	 * @return 结果
 	 */
 	List<WmScorePackage> getScorePackagekfpjf(Integer superDeptId, Integer deptId, String[] typeIds, String[] packageIds);
+
+
+	/**
+	 * 查询财务结算复核数据详情
+	 *
+	 * @param query 查询条件
+	 * @return 结果
+	 */
+	IPage<WmScorePackageSettleOutput> pageFinancialReviewDetail(Page<WmScorePackageSettleOutput> page, SettleFinancialReviewVO query);
 }

+ 82 - 56
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/service/impl/WmScorePackageServiceImpl.java

@@ -32,6 +32,7 @@ import com.qunzhixinxi.hnqz.admin.entity.dto.UnpackDTO;
 import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageApiOutput;
 import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageSettleInput;
 import com.qunzhixinxi.hnqz.admin.entity.input.WmScorePackageSettleOutput;
+import com.qunzhixinxi.hnqz.admin.entity.vo.SettleFinancialReviewVO;
 import com.qunzhixinxi.hnqz.admin.enums.DelEnum;
 import com.qunzhixinxi.hnqz.admin.enums.EnableEnum;
 import com.qunzhixinxi.hnqz.admin.enums.PackageFinishStatusEnum;
@@ -1847,62 +1848,7 @@ public class WmScorePackageServiceImpl extends ServiceImpl<WmScorePackageMapper,
 		Page<WmScorePackageSettleOutput> settleListPage = wmScorePackageMapper.listPackageSettleList(page, input);
 
 		List<WmScorePackageSettleOutput> settleList = settleListPage.getRecords();
-		for (WmScorePackageSettleOutput ouPut : settleList) {
-			WmScorePackageStatus statusQuery = new WmScorePackageStatus();
-			statusQuery.setPackageId(ouPut.getId());
-			statusQuery.setStatus("2");
-			List<WmScorePackageStatus> statusList = wmScorePackageStatusService.getByPackageId(statusQuery);
-			String userNames = statusList.stream()
-					.map(WmScorePackageStatus::getUserId)
-					.collect(Collectors.joining(","));
-			ouPut.setUserNames(userNames);
-
-			Set<String> userIds = statusList.stream().map(WmScorePackageStatus::getTaskUserId).collect(Collectors.toSet());
-			if (CollUtil.isNotEmpty(userIds)) {
-				List<SysUser> users = sysUserMapper.selectList(Wrappers.<SysUser>lambdaQuery().in(SysUser::getUserId, userIds));
-				String userPhones = users.stream().map(SysUser::getUsername).collect(Collectors.joining(","));
-				ouPut.setUserPhones(userPhones);
-				// 脱敏的身份证号
-				String idCardNums = users.stream().map(user -> DesensitizedUtil.idCardNum(user.getIdCardNumber(), 5, 4)).collect(Collectors.joining(","));
-				ouPut.setIdCardNums(idCardNums);
-			}
-			// 查询结算成功时间
-			List<WmScorePackageSettleNote> packageSettleNoteList = settleNoteMapper.selectList(Wrappers.<WmScorePackageSettleNote>lambdaQuery()
-					.eq(WmScorePackageSettleNote::getPackageId, ouPut.getId()));
-			if (CollectionUtil.isNotEmpty(packageSettleNoteList)) {
-				WmScorePackageSettleNote settleNote = packageSettleNoteList.get(0);
-				LocalDateTime notifyTime = settleNote.getNotifyTime();
-				if (notifyTime != null) {
-					ouPut.setBelongDate(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(notifyTime));
-				}
-				if (ouPut.getInvoiceCategory() == null) {
-					ouPut.setInvoiceCategory(settleNote.getInvoiceType());
-				}
-
-				if (ouPut.getSettleAmount() == null) {
-					BigDecimal tmp = new BigDecimal("0");
-					for (WmScorePackageSettleNote note : packageSettleNoteList) {
-						if (null != note.getSettleAmount()) {
-							tmp = tmp.add(note.getSettleAmount());
-						}
-					}
-					ouPut.setSettleAmount(tmp);
-				}
-				if (StringUtils.isBlank(ouPut.getSettleStatus())) {
-					ouPut.setSettleStatus(String.valueOf(settleNote.getSettleNoteStatus()));
-				}
-				ouPut.setSubjectLocation(settleNote.getSubjectLocation());
-				ouPut.setSubToGigTime(settleNote.getSubToGigTime());
-				ouPut.setActualAmount(settleNote.getActualAmount());
-			}
-			if (PackageTypeEnum.TYPE1_HCP_PACKAGE.val().equals(ouPut.getPackageType1())) {
-				// 如果是患者教育,则转换积分值 '分'->'元'
-				WmScorePackage scorePackage = this.getById(ouPut.getId());
-				if (scorePackage != null && StringUtils.isNumeric(scorePackage.getUserScore())) {
-					ouPut.setScore(String.format("%.2f", Integer.parseInt(scorePackage.getUserScore()) / 100.0));
-				}
-			}
-		}
+		this.settleDetail(settleList);
 		return settleListPage;
 	}
 
@@ -3482,4 +3428,84 @@ public class WmScorePackageServiceImpl extends ServiceImpl<WmScorePackageMapper,
 
 		return packages;
 	}
+
+	/**
+	 * 查询财务结算复核数据详情
+	 *
+	 * @param query 查询条件
+	 * @return 结果
+	 */
+	@Override
+	public IPage<WmScorePackageSettleOutput> pageFinancialReviewDetail(Page<WmScorePackageSettleOutput> page, SettleFinancialReviewVO query) {
+		IPage<WmScorePackageSettleOutput> detailPage = wmScorePackageMapper.pageFinancialReviewDetail(page, query);
+
+		List<WmScorePackageSettleOutput> settleList = detailPage.getRecords();
+		this.settleDetail(settleList);
+
+		return detailPage;
+	}
+
+	/**
+	 * 结算数据字段拼接转换
+	 *
+	 * @param settleList 数据列表
+	 */
+	private void settleDetail(List<WmScorePackageSettleOutput> settleList) {
+		for (WmScorePackageSettleOutput ouPut : settleList) {
+			WmScorePackageStatus statusQuery = new WmScorePackageStatus();
+			statusQuery.setPackageId(ouPut.getId());
+			statusQuery.setStatus("2");
+			List<WmScorePackageStatus> statusList = wmScorePackageStatusService.getByPackageId(statusQuery);
+			String userNames = statusList.stream()
+					.map(WmScorePackageStatus::getUserId)
+					.collect(Collectors.joining(","));
+			ouPut.setUserNames(userNames);
+
+			Set<String> userIds = statusList.stream().map(WmScorePackageStatus::getTaskUserId).collect(Collectors.toSet());
+			if (CollUtil.isNotEmpty(userIds)) {
+				List<SysUser> users = sysUserMapper.selectList(Wrappers.<SysUser>lambdaQuery().in(SysUser::getUserId, userIds));
+				String userPhones = users.stream().map(SysUser::getUsername).collect(Collectors.joining(","));
+				ouPut.setUserPhones(userPhones);
+				// 脱敏的身份证号
+				String idCardNums = users.stream().map(user -> DesensitizedUtil.idCardNum(user.getIdCardNumber(), 5, 4)).collect(Collectors.joining(","));
+				ouPut.setIdCardNums(idCardNums);
+			}
+			// 查询结算成功时间
+			List<WmScorePackageSettleNote> packageSettleNoteList = settleNoteMapper.selectList(Wrappers.<WmScorePackageSettleNote>lambdaQuery()
+					.eq(WmScorePackageSettleNote::getPackageId, ouPut.getId()));
+			if (CollectionUtil.isNotEmpty(packageSettleNoteList)) {
+				WmScorePackageSettleNote settleNote = packageSettleNoteList.get(0);
+				LocalDateTime notifyTime = settleNote.getNotifyTime();
+				if (notifyTime != null) {
+					ouPut.setBelongDate(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(notifyTime));
+				}
+				if (ouPut.getInvoiceCategory() == null) {
+					ouPut.setInvoiceCategory(settleNote.getInvoiceType());
+				}
+
+				if (ouPut.getSettleAmount() == null) {
+					BigDecimal tmp = new BigDecimal("0");
+					for (WmScorePackageSettleNote note : packageSettleNoteList) {
+						if (null != note.getSettleAmount()) {
+							tmp = tmp.add(note.getSettleAmount());
+						}
+					}
+					ouPut.setSettleAmount(tmp);
+				}
+				if (StringUtils.isBlank(ouPut.getSettleStatus())) {
+					ouPut.setSettleStatus(String.valueOf(settleNote.getSettleNoteStatus()));
+				}
+				ouPut.setSubjectLocation(settleNote.getSubjectLocation());
+				ouPut.setSubToGigTime(settleNote.getSubToGigTime());
+				ouPut.setActualAmount(settleNote.getActualAmount());
+			}
+			if (PackageTypeEnum.TYPE1_HCP_PACKAGE.val().equals(ouPut.getPackageType1())) {
+				// 如果是患者教育,则转换积分值 '分'->'元'
+				WmScorePackage scorePackage = this.getById(ouPut.getId());
+				if (scorePackage != null && StringUtils.isNumeric(scorePackage.getUserScore())) {
+					ouPut.setScore(String.format("%.2f", Integer.parseInt(scorePackage.getUserScore()) / 100.0));
+				}
+			}
+		}
+	}
 }

+ 45 - 1
hnqz-upms/hnqz-upms-biz/src/main/resources/mapper/WmScorePackageMapper.xml

@@ -1734,7 +1734,8 @@
 			   n.subject_location,
 			   sum(n.settle_amount) AS settle_amount,
 			   sum(n.actual_amount) AS actual_amount,
-			   count(p.id)          AS package_count
+			   count(p.id)          AS package_count,
+			   group_concat(n.id) AS settle_note_ids
 		FROM wm_score_package_settle_note n
 		LEFT JOIN wm_score_package p ON n.package_id = p.id
 				 LEFT JOIN sys_user u ON u.user_id = n.user_id
@@ -1758,4 +1759,47 @@
 		</if>
 		GROUP BY n.user_id
 	</select>
+
+	<!-- 结算复核-查看 -->
+	<select id="pageFinancialReviewDetail" resultMap="packageSettleMap">
+		SELECT
+			   p.id,
+			   p.pkg_sn,
+			   p.score_package_name,
+			   p.send_package_dept_id,
+			   p.create_time,
+			   u.realname,
+			   u.id_card_number,
+			   u.username,
+			   u.dept_id,
+			   n.user_id,
+			   n.subject_location,
+			   n.settle_note_status as settle_status,
+			   n.invoice_type       as invoice_category,
+			   n.settle_amount,
+			   n.actual_amount,
+			   p.settlement_date,
+			   n.sub_time,
+			   n.sub_to_gig_time,
+			   n.notify_time
+		FROM wm_score_package_settle_note n
+				 LEFT JOIN wm_score_package p ON n.package_id = p.id
+				 LEFT JOIN sys_user u ON u.user_id = n.user_id
+		WHERE (
+					p.send_package_dept_id = #{query.deptId} OR
+					p.mah_settle_dept_id = #{query.deptId} AND p.mah_settle_step = 'FINANCE')
+		  AND p.package_finish_status = 1
+		  AND p.typeid IN (4, 5)
+		  AND p.settle_flag = 1
+		  AND u.user_id = #{query.userId}
+		<if test="query.subjectLocation != null">
+			AND n.subject_location = #{query.subjectLocation}
+		</if>
+		<if test="query.reviewFlag != null and query.reviewFlag == true">
+			AND n.review_status in ('PASSED', 'REJECTED')
+		</if>
+		<if test="query.reviewFlag == null or query.reviewFlag == false">
+			AND n.review_status is null
+		</if>
+	</select>
 </mapper>