8 changed files with 141 additions and 113 deletions
			
			
		@ -1,48 +0,0 @@
					 | 
				
			||||
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}" }; | 
				
			||||
            } | 
				
			||||
        } | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
 | 
				
			||||
					Loading…
					
					
				
		Reference in new issue