yinyitong-zhongyuyuan-dll-s.../src/main/java/com/dpkj/modules/chs/controller/HispayController.java

120 lines
3.8 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.dpkj.modules.chs.controller;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.dpkj.common.vo.Result;
import com.dpkj.modules.chs.service.IHispayService;
import com.dpkj.modules.chs.vo.OutpatientBudgetModel;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @Auther: 萧道子
* @Date: 2025/3/22 16:25
* @Description: 医保模块-HIS医保
*/
@Slf4j
@AllArgsConstructor
@RestController
@RequestMapping("/chs/hispay")
public class HispayController {
private final IHispayService iHispayService;
/**
* 通过医保卡或医保电子凭证读卡
*
* @return com.dpkj.common.vo.Result<?>
* @author 萧道子 2025/5/20
*/
@PostMapping("findReadCode")
public Result<?> findReadCode() {
try {
JSONObject res = iHispayService.readCode();
return Result.ok("成功", res);
} catch (Exception e) {
e.printStackTrace();
log.error("[HispayController][getPatientInfo][按医保电子凭证读卡] ERR{}", e.getMessage());
return Result.error(e.getMessage());
}
}
/**
* 通过医保卡获取患者信息
*
* @param data :
* @return com.dpkj.common.vo.Result<?>
* @author 萧道子 2025/5/28
*/
@PostMapping("findReadCard")
public Result<?> findReadCard(@RequestBody JSONObject data) {
try {
String password = data.getString("password");
if (StrUtil.isEmpty(password)) {
throw new RuntimeException("密码不可为空");
}
JSONObject res = iHispayService.readCard(password);
return Result.ok("成功", res);
} catch (Exception e) {
e.printStackTrace();
log.error("[HispayController][readCardByCard][按医保卡读卡] ERR{}", e.getMessage());
return Result.error(e.getMessage());
}
}
/**
* 门诊缴费-预算
*
* @param data :
* @return com.dpkj.common.vo.Result<?>
* @author 萧道子 2025/5/27
*/
@PostMapping("outpatientBudgetByCode")
public Result<?> outpatientBudgetByCode(@RequestBody @Validated OutpatientBudgetModel data) {
try {
log.info("[HispayController][outpatientBudgetByCode][门诊缴费-预算-电子医保凭证] 参数:{}", data);
JSONObject res = iHispayService.outpatientBudgetByCode(data);
return Result.ok("成功", res);
} catch (Exception e) {
e.printStackTrace();
log.info("[HispayController][outpatientBudgetByCode][门诊缴费-预算-电子医保凭证] 失败:{}", e.getMessage());
return Result.error(e.getMessage());
}
}
/**
* 门诊缴费-结算
*
* @param data :
* @return com.dpkj.common.vo.Result<?>
* @author 萧道子 2025/5/27
*/
@PostMapping("doOutpatientPayment")
public Result<?> doRegistrationPayment(@RequestBody JSONObject data) {
try {
String type = data.getString("type");
if (StrUtil.isEmpty(type)) {
throw new RuntimeException("参数缺失");
}
log.info("[HispayController][doRegistrationPayment][挂号-结算] 参数:{}", data);
return Result.ok("成功", null);
} catch (Exception e) {
e.printStackTrace();
log.info("[HispayController][doRegistrationPayment][挂号-结算] 失败:{}", e.getMessage());
return Result.error(e.getMessage());
}
}
}