17 changed files with 436 additions and 48 deletions
-
173ThirdPlugIns/Shentun.Peis.PlugIns.Gem/ChargeRequestPlugInsGem.cs
-
6ThirdPlugIns/Shentun.Peis.PlugIns.Gem/LisRequestPlugInsGem.cs
-
6ThirdPlugIns/Shentun.Peis.PlugIns.Gem/PatientRegisterPluginsGemHis.cs
-
2ThirdPlugIns/Shentun.Peis.PlugIns.Gem/test/Shentun.Peis.PlugIns.Gem.Test/LisRequestPlugInsGemTest.cs
-
16src/Shentun.ColumnReferencePlugIns/ChargeRequestAsbitemForPlugIns.cs
-
31src/Shentun.ColumnReferencePlugIns/ChargeRequestForPlugIns.cs
-
97src/Shentun.ColumnReferencePlugIns/ChargeRequestPlugInsBase.cs
-
7src/Shentun.ColumnReferencePlugIns/ColumnReferencePlugInsBase.cs
-
12src/Shentun.ColumnReferencePlugIns/LisRequestPlugInsBase.cs
-
9src/Shentun.ColumnReferencePlugIns/PlugInsBase.cs
-
2src/Shentun.ColumnReferencePlugIns/ThirdPlugInsBase.cs
-
26src/Shentun.Peis.Application/ChargeRequests/ChargeRequestAppService.cs
-
4src/Shentun.Peis.Application/RegisterCheckAsbitems/RegisterCheckAsbitemAppService.cs
-
14src/Shentun.Peis.Domain/ChargeRequestAsbitems/ChargeRequestAsbitemManager.cs
-
59src/Shentun.Peis.Domain/ChargeRequests/ChargeRequestManager.cs
-
10src/Shentun.Peis.Domain/LisRequests/LisRequestManager.cs
-
6test/Shentun.Peis.Application.Tests/ChargeRequestAppServiceTest.cs
@ -0,0 +1,173 @@ |
|||||
|
using Dapper; |
||||
|
using Npgsql; |
||||
|
using ServiceReferenceHzcyHis; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Data.Common; |
||||
|
using System.Linq; |
||||
|
using System.ServiceModel; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using static ServiceReferenceHzcyHis.bstjPortTypeClient; |
||||
|
|
||||
|
namespace Shentun.Peis.PlugIns.Gem |
||||
|
{ |
||||
|
public class ChargeRequestPlugInsGem : ChargeRequestPlugInsBase |
||||
|
{ |
||||
|
private string _endpointAddress = ""; |
||||
|
public ChargeRequestPlugInsGem(string parmValue) : base(parmValue) |
||||
|
{ |
||||
|
_endpointAddress = InterfaceConfig.GetSection("Interface").GetSection("EndpointAddress").Value; |
||||
|
} |
||||
|
public override async Task<ChargeRequestPlugInsOut> SendRequest(ChargeRequestPlugInsInput input) |
||||
|
{ |
||||
|
//建立人员档案
|
||||
|
var patientRegisterForPlugIns = await GetPatientRegisterForPlugInsAsync(input.ChargeRequestId); |
||||
|
var chargeRequestForPlugIns = await GeChargeRequestForPlugInsAsync(input.ChargeRequestId); |
||||
|
if(chargeRequestForPlugIns == null) |
||||
|
{ |
||||
|
throw new Exception("没有申请单信息"); |
||||
|
} |
||||
|
if (!chargeRequestForPlugIns.Asbitems.Any()) |
||||
|
{ |
||||
|
throw new Exception("申请单没有组合项目信息"); |
||||
|
} |
||||
|
if (patientRegisterForPlugIns.BirthDate == null) |
||||
|
{ |
||||
|
throw new Exception("出生日期不能为空"); |
||||
|
} |
||||
|
var hisPatientQueryInput = new HisPatientQueryInput() |
||||
|
{ |
||||
|
Data = new HisPatientQueryDataInput() |
||||
|
{ |
||||
|
MsgHeader = new HisMsgHeaderInput() |
||||
|
{ |
||||
|
Sender = "PEIS", |
||||
|
MsgType = "SVR_ODS_1101", |
||||
|
MsgVersion = "3.1", |
||||
|
}, |
||||
|
Patient = new HisPatientQueryPatientInput() |
||||
|
{ |
||||
|
IdCard = patientRegisterForPlugIns.IdNo, |
||||
|
IdCardCode = "01", |
||||
|
Name = patientRegisterForPlugIns.PatientName, |
||||
|
Sex = "1", |
||||
|
BirthDate = ((DateTime)patientRegisterForPlugIns.BirthDate).ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo), |
||||
|
PatientPhone = patientRegisterForPlugIns.MobileTelephone, |
||||
|
EthnicGroupCode = "01", |
||||
|
WorkUnit = patientRegisterForPlugIns.CustomerOrgName, |
||||
|
Address = patientRegisterForPlugIns.Address, |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
var result = await PatientQuery(hisPatientQueryInput); |
||||
|
|
||||
|
if (result.MsgHeader.Status != "true") |
||||
|
{ |
||||
|
throw new Exception("建立HIS档案失败"+ result.MsgHeader.Detail); |
||||
|
|
||||
|
} |
||||
|
//更新人员登记信息
|
||||
|
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr)) |
||||
|
{ |
||||
|
conn.Execute(@"update patient_register set his_patient_id = @HisPatientId
|
||||
|
where id = @PatientRegisterId",
|
||||
|
new { HisPatientId = result.Patient.PatientId, |
||||
|
PatientRegisterId = patientRegisterForPlugIns.PatientRegisterId |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
//发送项目
|
||||
|
var hisInput = new HisMecSaveInput() |
||||
|
{ |
||||
|
Data = new HisMecSaveDataInput() |
||||
|
{ |
||||
|
MsgHeader = new HisMsgHeaderInput() |
||||
|
{ |
||||
|
Sender = "PEIS", |
||||
|
MsgType = "SVR_ODS_6101", |
||||
|
MsgVersion = "3.1", |
||||
|
}, |
||||
|
Items = new List<HisMecSaveDataItemInput>() |
||||
|
{ |
||||
|
new HisMecSaveDataItemInput() |
||||
|
{ |
||||
|
ExamRequestNo =chargeRequestForPlugIns.ChargeRequestNo, |
||||
|
FeeType = "1", |
||||
|
EmpId = result.Patient.PatientId, |
||||
|
DeptId = "", |
||||
|
DoctId = "", |
||||
|
ExeDeptId = "", |
||||
|
Tjunit = patientRegisterForPlugIns.CustomerOrgName, |
||||
|
Tjfee = chargeRequestForPlugIns.Asbitems.Sum(o=>o.Charges).ToString(), |
||||
|
Ztxm = "", |
||||
|
Remark = "体检科" |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
var mecSaveResult = await MecSave(hisInput); |
||||
|
if (mecSaveResult.MsgHeader.Status != "true") |
||||
|
{ |
||||
|
throw new Exception("建立HIS档案失败" + mecSaveResult.MsgHeader.Detail); |
||||
|
} |
||||
|
//更新申请单信息
|
||||
|
using (DbConnection conn = new NpgsqlConnection(AppConnctionStr)) |
||||
|
{ |
||||
|
conn.Execute(@"update charge_request set his_charge_no = @HisChargeNo
|
||||
|
where id = @ChargeRequestId",
|
||||
|
new |
||||
|
{ |
||||
|
HisChargeNo = mecSaveResult.MsgHeader.Yjxh, |
||||
|
ChargeRequestId = input.ChargeRequestId |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
return new ChargeRequestPlugInsOut(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
public async Task<HisPatientQueryOut> PatientQuery(HisPatientQueryInput input) |
||||
|
{ |
||||
|
using (var client = CreateClient()) |
||||
|
{ |
||||
|
input.SeviceBaseArg.Service = "patientQuery"; |
||||
|
var data = XmlHelper.SerializeToXml(input.Data); |
||||
|
|
||||
|
var resultStr = (await client.invokeAsync(input.SeviceBaseArg.Service, |
||||
|
input.SeviceBaseArg.Urid, |
||||
|
input.SeviceBaseArg.Pwd, |
||||
|
data)).@return; |
||||
|
var result = XmlHelper.DeserializeXml<HisPatientQueryOut>(resultStr); |
||||
|
return result; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public async Task<HisMecSaveOut> MecSave(HisMecSaveInput input) |
||||
|
{ |
||||
|
using (var client = CreateClient()) |
||||
|
{ |
||||
|
input.SeviceBaseArg.Service = "mecSave"; |
||||
|
var data = XmlHelper.SerializeToXml(input.Data); |
||||
|
|
||||
|
var resultStr = (await client.invokeAsync(input.SeviceBaseArg.Service, |
||||
|
input.SeviceBaseArg.Urid, |
||||
|
input.SeviceBaseArg.Pwd, |
||||
|
data)).@return; |
||||
|
var result = XmlHelper.DeserializeXml<HisMecSaveOut>(resultStr); |
||||
|
return result; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private bstjPortTypeClient CreateClient() |
||||
|
{ |
||||
|
return new bstjPortTypeClient(EndpointConfiguration.bstjHttpSoap11Endpoint, |
||||
|
_endpointAddress); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,16 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.Peis.PlugIns |
||||
|
{ |
||||
|
public class ChargeRequestAsbitemForPlugIns |
||||
|
{ |
||||
|
public Guid AsbitemId { get; set; } |
||||
|
public string AsbitemName { get; set; } = string.Empty; |
||||
|
public string ThirdAsbitemCode { get; set; } = string.Empty; |
||||
|
public decimal Charges { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.ComponentModel.DataAnnotations.Schema; |
||||
|
using System.ComponentModel.DataAnnotations; |
||||
|
using System.Linq; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace Shentun.Peis.PlugIns |
||||
|
{ |
||||
|
public class ChargeRequestForPlugIns |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 收费申请单号
|
||||
|
/// </summary>
|
||||
|
|
||||
|
public string ChargeRequestNo { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// HIS收费单号
|
||||
|
/// </summary>
|
||||
|
public string HisChargeNo { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 0、申请 1-收费,2-退费
|
||||
|
/// </summary>
|
||||
|
public char ChargeRequestFlag { get; set; } |
||||
|
|
||||
|
public List<ChargeRequestAsbitemForPlugIns> Asbitems = new List<ChargeRequestAsbitemForPlugIns> (); |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue