From 0b29c45845e0e82de205ca033c2ff0600350a122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E9=95=BF=E5=BE=81?= Date: Fri, 13 Dec 2019 14:10:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=A6=E5=86=99=E4=BD=BF=E7=94=A8=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.MD | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 1 deletion(-) diff --git a/README.MD b/README.MD index 4f72a2d..0c3e769 100644 --- a/README.MD +++ b/README.MD @@ -1 +1,129 @@ -模型化执行存储过程组件 \ No newline at end of file +模型化执行存储过程组件。 + +首先需要使用POCO类型定义存储过程参数和返回值类型。如: +``` + /// + /// 医疗救助结算费用明细表 + /// + public class Pro_JSFYMXB + { + /// + /// 开始时间 + /// + public DateTime Sd { get; set; } + /// + /// 解释时间 + /// + public DateTime Ed { get; set; } + /// + /// 机构代码 + /// + public string Code { get; set; } + /// + /// 查询标志 1门急诊 2住院 4实时 8事后 + /// + public int Flags { get; set; } + } + /// + /// 医疗救助结算费用明细表 结果 + /// + public class Pro_JSFYMXB_Result + { + /// + /// 序号 + /// + public long Xh { get; set; } + /// + /// 社保卡号 + /// + public string Sbkh { get; set; } + /// + /// 救助对象所在村居委 + /// + public string Cjw { get; set; } + /// + /// 姓名 + /// + public string Xm { get; set; } + /// + /// 身份证 + /// + public string Sfz { get; set; } + /// + /// 性别 + /// + public string Xb { get; set; } + /// + /// 救助类型 + /// + public string Jzlx { get; set; } + /// + /// 就诊疾病 + /// + public string Jzjb { get; set; } + /// + /// 收款人姓名 + /// + public string Skrxm { get; set; } + /// + /// 银行卡号 + /// + public string Yhkh { get; set; } + /// + /// 开户银行 + /// + public string Khyh { get; set; } + /// + /// 总费用 + /// + public decimal Zfy { get; set; } + /// + /// 医保统筹费用 + /// + public decimal Ybtcfy { get; set; } + /// + /// 自费费用 + /// + public decimal Zfeify { get; set; } + /// + /// 自负费用 + /// + public decimal Zfufy { get; set; } + /// + /// 医保救助费用 + /// + public decimal Ybjzfy { get; set; } + } + +``` +然后又两种方法执行以上定义的存储过程: +1. 通过`IServiceCollection.UseFalconSP()`注册`IFalconSPRuner`接口。 然后通过RunSP方法执行存储过程。 +2. 通过扩展Dbcontext: + +已下扩展了自定义数据上下文`MzbkDbContext`并且实现了`Pro_JSFYMXB`方法执行存储过程。 +``` +/// +/// 数据库存储过程定义 +/// +public static class MzbkDbSpExtend +{ + /// + /// 医疗救助结算费用明细表 存储过程 + /// + public static IEnumerable Pro_JSFYMXB(this MzbkDbContext db,Pro_JSFYMXB pram) { + return db.RunProcuder(pram); + } +} + +``` +然后在程序中可以如下执行存储过程: +``` +using(var db = new MzbkDbContext(this.Config)) { + var list = db.Pro_JSFYMXB(new Pro_JSFYMXB { + Code = code, + Ed = ed.Value, + Sd = sd.Value, + Flags = flags.Value, + }); +} +``` \ No newline at end of file