Falcon.ModelSP/README.MD
吴长征 bad9973d3c 书写使用说明
增加readme.md使用说明
2019-12-13 14:16:20 +08:00

129 lines
3.5 KiB
Markdown
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.

模型化执行存储过程组件。
首先需要使用POCO类型定义存储过程参数和返回值类型。如
```
/// <summary>
/// 医疗救助结算费用明细表
/// </summary>
public class Pro_JSFYMXB
{
/// <summary>
/// 开始时间
/// </summary>
public DateTime Sd { get; set; }
/// <summary>
/// 解释时间
/// </summary>
public DateTime Ed { get; set; }
/// <summary>
/// 机构代码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 查询标志 1门急诊 2住院 4实时 8事后
/// </summary>
public int Flags { get; set; }
}
/// <summary>
/// 医疗救助结算费用明细表 结果
/// </summary>
public class Pro_JSFYMXB_Result
{
/// <summary>
/// 序号
/// </summary>
public long Xh { get; set; }
/// <summary>
/// 社保卡号
/// </summary>
public string Sbkh { get; set; }
/// <summary>
/// 救助对象所在村居委
/// </summary>
public string Cjw { get; set; }
/// <summary>
/// 姓名
/// </summary>
public string Xm { get; set; }
/// <summary>
/// 身份证
/// </summary>
public string Sfz { get; set; }
/// <summary>
/// 性别
/// </summary>
public string Xb { get; set; }
/// <summary>
/// 救助类型
/// </summary>
public string Jzlx { get; set; }
/// <summary>
/// 就诊疾病
/// </summary>
public string Jzjb { get; set; }
/// <summary>
/// 收款人姓名
/// </summary>
public string Skrxm { get; set; }
/// <summary>
/// 银行卡号
/// </summary>
public string Yhkh { get; set; }
/// <summary>
/// 开户银行
/// </summary>
public string Khyh { get; set; }
/// <summary>
/// 总费用
/// </summary>
public decimal Zfy { get; set; }
/// <summary>
/// 医保统筹费用
/// </summary>
public decimal Ybtcfy { get; set; }
/// <summary>
/// 自费费用
/// </summary>
public decimal Zfeify { get; set; }
/// <summary>
/// 自负费用
/// </summary>
public decimal Zfufy { get; set; }
/// <summary>
/// 医保救助费用
/// </summary>
public decimal Ybjzfy { get; set; }
}
```
然后可以通过以下两种方法执行存储过程:
1. 通过`IServiceCollection.UseFalconSP()`注册`IFalconSPRuner`接口。 然后通过RunSP方法执行存储过程。
2. 通过扩展Dbcontext
已下扩展了自定义数据上下文`MzbkDbContext`并且实现了`Pro_JSFYMXB`方法执行存储过程。
```
/// <summary>
/// 数据库存储过程定义
/// </summary>
public static class MzbkDbSpExtend
{
/// <summary>
/// 医疗救助结算费用明细表 存储过程
/// </summary>
public static IEnumerable<Pro_JSFYMXB_Result> Pro_JSFYMXB(this MzbkDbContext db,Pro_JSFYMXB pram) {
return db.RunProcuder<Pro_JSFYMXB,Pro_JSFYMXB_Result>(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,
});
}
```