完成HIS调用webservice
This commit is contained in:
parent
7c5e81c1af
commit
8730d5366d
|
@ -153,6 +153,8 @@
|
||||||
<Compile Include="App_Start\BundleConfig.cs" />
|
<Compile Include="App_Start\BundleConfig.cs" />
|
||||||
<Compile Include="App_Start\FilterConfig.cs" />
|
<Compile Include="App_Start\FilterConfig.cs" />
|
||||||
<Compile Include="App_Start\RouteConfig.cs" />
|
<Compile Include="App_Start\RouteConfig.cs" />
|
||||||
|
<Compile Include="Dal\Wappers\HisDrugInfoWapper.cs" />
|
||||||
|
<Compile Include="Dal\Wappers\HisPrescriptyInfoWapper.cs" />
|
||||||
<Compile Include="Controllers\HomeController.cs" />
|
<Compile Include="Controllers\HomeController.cs" />
|
||||||
<Compile Include="Controllers\TestController.cs" />
|
<Compile Include="Controllers\TestController.cs" />
|
||||||
<Compile Include="Dal\DjyDbContext.cs" />
|
<Compile Include="Dal\DjyDbContext.cs" />
|
||||||
|
@ -211,6 +213,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="App_Data\" />
|
<Folder Include="App_Data\" />
|
||||||
|
<Folder Include="Bll\" />
|
||||||
<Folder Include="Models\" />
|
<Folder Include="Models\" />
|
||||||
<Folder Include="Views\Test\" />
|
<Folder Include="Views\Test\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace Cmdjy.Dal
|
||||||
public partial class DjyDbContext:DbContext
|
public partial class DjyDbContext:DbContext
|
||||||
{
|
{
|
||||||
public DjyDbContext() : base("DjyDbContext") {
|
public DjyDbContext() : base("DjyDbContext") {
|
||||||
Database.SetInitializer<DjyDbContext>(null);
|
//Database.SetInitializer<DjyDbContext>(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
18
WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisDrugInfoWapper.cs
Normal file
18
WebSiteCode/Cmdjy/Cmdjy/Dal/Wappers/HisDrugInfoWapper.cs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
namespace Cmdjy.Dal.Wappers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 药品信息墙纸
|
||||||
|
/// </summary>
|
||||||
|
public class HisDrugInfoWapper:Dal.Tables.HisDrugInfo
|
||||||
|
{
|
||||||
|
public HisDrugInfoWapper(ws.HisDrugInfo s) {
|
||||||
|
if(s == null) return;
|
||||||
|
foreach(var p in s.GetType().GetProperties()) {
|
||||||
|
var tp = this.GetType().GetProperty(p.Name);
|
||||||
|
if(tp != null && tp.CanWrite && p.CanRead) {
|
||||||
|
tp.SetValue(this,p.GetValue(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
namespace Cmdjy.Dal.Wappers
|
||||||
|
{
|
||||||
|
public class HisPrescriptyInfoWapper:Dal.Tables.HisPrescriptionInfo
|
||||||
|
{
|
||||||
|
public HisPrescriptyInfoWapper(ws.HisPrescriptionInfo s) {
|
||||||
|
if(s == null) return;
|
||||||
|
foreach(var p in s.GetType().GetProperties()) {
|
||||||
|
var tp = this.GetType().GetProperty(p.Name);
|
||||||
|
if(tp != null && tp.CanWrite && p.CanRead) {
|
||||||
|
tp.SetValue(this,p.GetValue(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,9 @@ using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Services;
|
using System.Web.Services;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Cmdjy.Dal;
|
||||||
|
using Cmdjy.Dal.Wappers;
|
||||||
|
using System.Data.Entity;
|
||||||
|
|
||||||
namespace Cmdjy.ws
|
namespace Cmdjy.ws
|
||||||
{
|
{
|
||||||
|
@ -20,21 +23,51 @@ namespace Cmdjy.ws
|
||||||
|
|
||||||
[WebMethod(Description = "医疗机构上传处方信息")]
|
[WebMethod(Description = "医疗机构上传处方信息")]
|
||||||
public string PostPrescriptionInfo(HisPrescriptionInfo info) {
|
public string PostPrescriptionInfo(HisPrescriptionInfo info) {
|
||||||
var json = JsonConvert.SerializeObject(info);
|
HisPrescriptionResult result = null;
|
||||||
var result = new HisPrescriptionResult {
|
using(var db = new DjyDbContext()) {
|
||||||
Code = ResultCode.Success,PrescriptionId = "1",
|
var en = new HisPrescriptyInfoWapper(info) as Dal.Tables.HisPrescriptionInfo;
|
||||||
Msg = json,
|
en.RawAddress = this.Context.Request.UserHostAddress;
|
||||||
};
|
en.CreateDatetime = DateTime.Now;
|
||||||
|
db.Entry(en).State = EntityState.Added;
|
||||||
|
try {
|
||||||
|
db.SaveChanges();
|
||||||
|
result = new HisPrescriptionResult {
|
||||||
|
Code = ResultCode.Success,PrescriptionId = en.Id.ToString(),
|
||||||
|
Msg = "保存成功",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch(Exception ex) {
|
||||||
|
result = new HisPrescriptionResult {
|
||||||
|
Code = ResultCode.Exception,PrescriptionId = "0",
|
||||||
|
Msg = ex.ToString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
return JsonConvert.SerializeObject(result);
|
return JsonConvert.SerializeObject(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
[WebMethod(Description = "医疗机构上传药品信息")]
|
[WebMethod(Description = "医疗机构上传药品信息")]
|
||||||
public string PostDrugInfo(HisDrugInfo info) {
|
public string PostDrugInfo(HisDrugInfo info) {
|
||||||
var json = JsonConvert.SerializeObject(info);
|
HisDrugResult result = null;
|
||||||
var result = new HisDrugResult {
|
using(var db = new DjyDbContext()) {
|
||||||
Code = ResultCode.Success,DrugId = "1",
|
var en = new HisDrugInfoWapper(info) as Dal.Tables.HisDrugInfo;
|
||||||
Msg = json,
|
en.RawAddress = this.Context.Request.UserHostAddress;
|
||||||
};
|
en.CreateDatetime = DateTime.Now;
|
||||||
|
db.Entry(en).State = EntityState.Added;
|
||||||
|
try {
|
||||||
|
db.SaveChanges();
|
||||||
|
result = new HisDrugResult {
|
||||||
|
Code = ResultCode.Success,DrugId = en.Id.ToString(),
|
||||||
|
Msg = "保存成功",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
catch(Exception ex) {
|
||||||
|
result = new HisDrugResult {
|
||||||
|
Code = ResultCode.Exception,DrugId = "0",
|
||||||
|
Msg = ex.ToString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
return JsonConvert.SerializeObject(result);
|
return JsonConvert.SerializeObject(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user