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

120 lines
3.8 KiB
Java
Raw Normal View History

2025-03-24 22:12:01 +08:00
package com.dpkj.modules.chs.controller;
2025-05-22 18:36:38 +08:00
import cn.hutool.core.util.StrUtil;
2025-03-24 22:12:01 +08:00
import com.alibaba.fastjson.JSONObject;
import com.dpkj.common.vo.Result;
import com.dpkj.modules.chs.service.IHispayService;
2025-05-29 17:41:06 +08:00
import com.dpkj.modules.chs.vo.OutpatientBudgetModel;
2025-03-24 22:12:01 +08:00
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
2025-05-29 17:41:06 +08:00
import org.springframework.validation.annotation.Validated;
2025-05-22 18:36:38 +08:00
import org.springframework.web.bind.annotation.PostMapping;
2025-03-24 22:12:01 +08:00
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 {
2025-05-20 18:03:31 +08:00
private final IHispayService iHispayService;
2025-03-24 22:12:01 +08:00
2025-05-22 18:36:38 +08:00
/**
* 通过医保卡或医保电子凭证读卡
*
* @return com.dpkj.common.vo.Result<?>
* @author 萧道子 2025/5/20
*/
2025-05-29 17:41:06 +08:00
@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
*/
2025-05-22 18:36:38 +08:00
@PostMapping("findReadCard")
public Result<?> findReadCard(@RequestBody JSONObject data) {
2025-05-29 17:41:06 +08:00
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) {
2025-03-24 22:12:01 +08:00
try {
2025-05-22 18:36:38 +08:00
String type = data.getString("type");
if (StrUtil.isEmpty(type)) {
throw new RuntimeException("参数缺失");
}
2025-05-29 17:41:06 +08:00
log.info("[HispayController][doRegistrationPayment][挂号-结算] 参数:{}", data);
return Result.ok("成功", null);
2025-03-24 22:12:01 +08:00
} catch (Exception e) {
e.printStackTrace();
2025-05-29 17:41:06 +08:00
log.info("[HispayController][doRegistrationPayment][挂号-结算] 失败:{}", e.getMessage());
2025-05-22 18:36:38 +08:00
return Result.error(e.getMessage());
2025-03-24 22:12:01 +08:00
}
}
}