You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.4 KiB

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json.Linq;
using ReZero.DependencyInjection;
using ReZero.SuperAPI;
using System;
using System.Threading.Tasks;
using medical.transfomer.business;
namespace medical.insu.transfomer.Controllers
{
[Api(200100, GroupName = "分组0")]
public class MedCommonController
{
[DI]
public TransformerFactory? transformerFactory { get; set; }
//执行国家医保接口
[HttpPost]
public async Task<object> execPublic(JObject value)
{
try
{
if (transformerFactory == null)
{
return new { code = -1, msg = "医保转换服务未初始化" };
}
string action = value["action"]?.ToString();
if (string.IsNullOrEmpty(action))
{
return new { code = -1, msg = "缺少action参数" };
}
// 获取数据部分
JObject data = value["data"] as JObject ?? new JObject();
// 使用转换工厂处理医保交易
return await transformerFactory.ExecuteMethod(action, data);
}
catch (Exception ex)
{
return new { code = -1, msg = $"处理请求发生异常: {ex.Message}" };
}
}
}
}