22 changed files with 1113 additions and 0 deletions
-
12Shentun.PeisReport.Api/.config/dotnet-tools.json
-
31Shentun.PeisReport.Api/Configs/NLog.config
-
228Shentun.PeisReport.Api/Controllers/PeisController.cs
-
351Shentun.PeisReport.Api/Controllers/ReportController.cs
-
33Shentun.PeisReport.Api/Controllers/WeatherForecastController.cs
-
7Shentun.PeisReport.Api/Dto/BarCodeNoInputDto.cs
-
22Shentun.PeisReport.Api/Dto/DeleteReportInputDto.cs
-
10Shentun.PeisReport.Api/Dto/IdNoInputDto.cs
-
7Shentun.PeisReport.Api/Dto/PatientRegisterIdInputDto.cs
-
51Shentun.PeisReport.Api/Dto/PatientRegisterListDto.cs
-
12Shentun.PeisReport.Api/Dto/PeisReportUrlByPatientRegisterIdDto.cs
-
9Shentun.PeisReport.Api/Dto/PublicResultDto.cs
-
25Shentun.PeisReport.Api/Dto/QueueRegisterByBarCodeNoDto.cs
-
6Shentun.PeisReport.Api/Dto/UploadReportDto.cs
-
132Shentun.PeisReport.Api/Dto/UploadReportInputDto.cs
-
62Shentun.PeisReport.Api/Program.cs
-
31Shentun.PeisReport.Api/Properties/launchSettings.json
-
16Shentun.PeisReport.Api/Shentun.PeisReport.Api.csproj
-
13Shentun.PeisReport.Api/WeatherForecast.cs
-
8Shentun.PeisReport.Api/appsettings.Development.json
-
22Shentun.PeisReport.Api/appsettings.json
-
25Shentun.PeisReport.sln
@ -0,0 +1,12 @@ |
|||
{ |
|||
"version": 1, |
|||
"isRoot": true, |
|||
"tools": { |
|||
"dotnet-ef": { |
|||
"version": "9.0.3", |
|||
"commands": [ |
|||
"dotnet-ef" |
|||
] |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" |
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd" |
|||
autoReload="true" |
|||
throwExceptions="false" |
|||
internalLogLevel="Off" internalLogFile="NLog\all_log.log"> |
|||
|
|||
<targets> |
|||
<!--文件日志,archive相关参数:文件拆分,每100M拆分一个新文件--> |
|||
<target xsi:type="File" |
|||
name="all_log" |
|||
fileName="NLog\${shortdate}\${uppercase:${level}}.log" |
|||
layout="${longdate}|${logger}|${uppercase:${level}}|${message} ${exception}" |
|||
archiveFileName="NLog\${shortdate}\${uppercase:${level}}${shortdate}.{####}.log" |
|||
archiveNumbering="Rolling" |
|||
archiveAboveSize="10485760" |
|||
concurrentwrites="true" |
|||
maxArchiveFiles="100" |
|||
/> |
|||
|
|||
</targets> |
|||
|
|||
|
|||
<rules> |
|||
<!-- add your logging rules here --> |
|||
<!--路由顺序会对日志打印产生影响。路由匹配逻辑为顺序匹配。--> |
|||
<Logger name="Micrisoft.*" minlevel="Trace" final="true" /> |
|||
<logger name="*" minlevel="Trace" writeTo="all_log" /> |
|||
</rules> |
|||
</nlog> |
|||
@ -0,0 +1,228 @@ |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Configuration.UserSecrets; |
|||
using Newtonsoft.Json; |
|||
using Shentun.PeisReport.Api.Dto; |
|||
using SqlSugar; |
|||
using System.Data; |
|||
|
|||
namespace Shentun.PeisReport.Api.Controllers |
|||
{ |
|||
[Route("api/[controller]/[action]")]
|
|||
[ApiController] |
|||
public class PeisController : ControllerBase |
|||
{ |
|||
private readonly SqlSugarClient _peisDb; |
|||
private readonly IConfiguration _configuration; |
|||
private readonly ILogger<PeisController> _logger; |
|||
public PeisController( |
|||
IConfiguration configuration, |
|||
ILogger<PeisController> logger) |
|||
{ |
|||
_configuration = configuration; |
|||
_logger = logger; |
|||
_peisDb = new SqlSugarClient(new ConnectionConfig() |
|||
{ |
|||
ConnectionString = _configuration.GetSection("ConnectionStrings:Default").Value, |
|||
DbType = SqlSugar.DbType.SqlServer, |
|||
IsAutoCloseConnection = true |
|||
}); |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 根据身份证号码获取体检列表
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<PatientRegisterListDto> GetPatientRegisterListAsync(IdNoInputDto input) |
|||
{ |
|||
|
|||
var result = new PatientRegisterListDto |
|||
{ |
|||
Code = 100, |
|||
Message = "请求失败" |
|||
}; |
|||
|
|||
|
|||
if (string.IsNullOrWhiteSpace(input.IdNo)) |
|||
{ |
|||
result.Message = "身份证不能为空"; |
|||
|
|||
return result; |
|||
} |
|||
|
|||
try |
|||
{ |
|||
|
|||
var query = await _peisDb.Ado.GetDataTableAsync($"select b.sex_name,a.patient_register_id,a.age,a.barcode_no,a.medical_times," + |
|||
$"a.medical_start_date,a.mobile_telephone,a.name as patient_name" + |
|||
$" from patient_register as a left join sex as b " + |
|||
$" on a.sex_id=b.sex_id where id_card_no='{input.IdNo}' and audit_flag='Y' "); |
|||
if (query.Rows.Count > 0) |
|||
{ |
|||
List<PatientRegisterListResultDataDto> patientRegisterList = new List<PatientRegisterListResultDataDto>(); |
|||
|
|||
foreach (DataRow row in query.Rows) |
|||
{ |
|||
patientRegisterList.Add(new PatientRegisterListResultDataDto |
|||
{ |
|||
age = row["age"].ToString(), |
|||
barcode_no = row["barcode_no"].ToString(), |
|||
medical_date = Convert.ToDateTime(row["medical_start_date"].ToString()).ToString("yyyy-MM-dd"), |
|||
medical_time = row["medical_times"].ToString(), |
|||
mobile_telephone = row["mobile_telephone"].ToString(), |
|||
name = row["patient_name"].ToString(), |
|||
patient_register_id = row["patient_register_id"].ToString(), |
|||
sex = row["sex_name"].ToString() |
|||
}); |
|||
} |
|||
|
|||
result.Message = "请求成功"; |
|||
result.Data = patientRegisterList; |
|||
result.Code = 200; |
|||
|
|||
} |
|||
else |
|||
{ |
|||
result.Code = 100; |
|||
result.Message = "身份证号未查到体检数据"; |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
result.Message = ex.Message; |
|||
_logger.LogError($"访问GetPatientRegisterListAsync异常,异常信息:{ex.Message}"); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 根据人员id获取体检报告地址
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<PeisReportUrlByPatientRegisterIdDto> GetPeisReportUrlByPatientRegisterIdAsync(PatientRegisterIdInputDto input) |
|||
{ |
|||
|
|||
var result = new PeisReportUrlByPatientRegisterIdDto |
|||
{ |
|||
Code = 100, |
|||
Message = "请求失败" |
|||
}; |
|||
|
|||
|
|||
if (string.IsNullOrWhiteSpace(input.PatientRegisterId)) |
|||
{ |
|||
result.Message = "人员Id不能为空"; |
|||
|
|||
return result; |
|||
} |
|||
|
|||
try |
|||
{ |
|||
|
|||
|
|||
var query = await _peisDb.Ado.GetDataTableAsync($"select name as patient_name from patient_register where patient_register_id='{input.PatientRegisterId}' and create_pdf_flag='1'"); |
|||
if (query.Rows.Count > 0) |
|||
{ |
|||
|
|||
string patientName = query.Rows[0]["patient_name"].ToString(); |
|||
string directoryDate = input.PatientRegisterId.Substring(0, 6); |
|||
string hostAddress = _configuration.GetSection("HostAddress").Value; |
|||
string reportVirtual = _configuration.GetSection("ReportVirtualPath:RequestPath").Value; |
|||
string reportUrl = $"{hostAddress + reportVirtual}/{directoryDate}/{input.PatientRegisterId}({patientName}).pdf"; |
|||
|
|||
result.Message = "请求成功"; |
|||
result.Data = new PeisReportUrlByPatientRegisterIdResultDataDto { peis_report_url = reportUrl }; |
|||
result.Code = 200; |
|||
|
|||
} |
|||
else |
|||
{ |
|||
result.Code = 100; |
|||
result.Message = "未上传报告"; |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
result.Message = ex.Message; |
|||
_logger.LogError($"访问GetPeisReportUrlByPatientRegisterIdAsync异常,异常信息:{ex.Message}"); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 获取当前人员的排队情况
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<QueueRegisterByBarCodeNoDto> GetQueueRegisterByBarCodeNoAsync(BarCodeNoInputDto input) |
|||
{ |
|||
|
|||
var result = new QueueRegisterByBarCodeNoDto |
|||
{ |
|||
Code = 100, |
|||
Message = "请求失败" |
|||
}; |
|||
|
|||
|
|||
if (string.IsNullOrWhiteSpace(input.BarCodeNo)) |
|||
{ |
|||
result.Message = "条码不能为空"; |
|||
|
|||
return result; |
|||
} |
|||
|
|||
try |
|||
{ |
|||
|
|||
|
|||
var query = await _peisDb.Ado.GetDataTableAsync($" select a.queue_register_id,a.room_id,c.room_name,b.name as patient_name from queue_register as a " + |
|||
$" left join patient_register as b on a.patient_register_id=b.patient_register_id " + |
|||
$" left join room as c on a.room_id=c.room_id " + |
|||
$" where b.barcode_no='{input.BarCodeNo}' and a.complete_flag='0' and created_date >= convert(varchar(10),getdate(),121)"); |
|||
if (query.Rows.Count > 0) |
|||
{ |
|||
|
|||
string patientName = query.Rows[0]["patient_name"].ToString(); |
|||
string roomId = query.Rows[0]["room_id"].ToString(); |
|||
string roomName = query.Rows[0]["room_name"].ToString(); |
|||
string queueRegisterId = query.Rows[0]["queue_register_id"].ToString(); |
|||
|
|||
|
|||
var queueCount = _peisDb.Ado.SqlQuerySingle<int>($" select count(queue_register_id) as pdcount from queue_register " + |
|||
$" where room_id='{roomId}' and complete_flag = '0' and queue_register_id<'{queueRegisterId}' and created_date >= convert(varchar(10),getdate(),121)"); |
|||
|
|||
result.Message = "请求成功"; |
|||
result.Data = new QueueRegisterByBarCodeNoResultDataDto |
|||
{ |
|||
patient_name = patientName, |
|||
queue_count = queueCount, |
|||
room_name = roomName |
|||
}; |
|||
result.Code = 200; |
|||
|
|||
} |
|||
else |
|||
{ |
|||
result.Code = 100; |
|||
result.Message = "当前无排队信息"; |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
result.Message = ex.Message; |
|||
_logger.LogError($"访问GetQueueRegisterByBarCodeNoAsync异常,异常信息:{ex.Message}"); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,351 @@ |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.Extensions.Configuration.UserSecrets; |
|||
using Newtonsoft.Json; |
|||
using Shentun.PeisReport.Api.Dto; |
|||
using SqlSugar; |
|||
using System.Data; |
|||
using static Dm.net.buffer.ByteArrayBuffer; |
|||
|
|||
namespace Shentun.PeisReport.Api.Controllers |
|||
{ |
|||
/// <summary>
|
|||
/// 上传
|
|||
/// </summary>
|
|||
[Route("api/[controller]/[action]")]
|
|||
[ApiController] |
|||
public class ReportController : ControllerBase |
|||
{ |
|||
private readonly SqlSugarClient _peisDb; |
|||
private readonly SqlSugarClient _reportDb; |
|||
private readonly IConfiguration _configuration; |
|||
private readonly ILogger<ReportController> _logger; |
|||
|
|||
|
|||
public ReportController( |
|||
IConfiguration configuration, |
|||
ILogger<ReportController> logger) |
|||
{ |
|||
_configuration = configuration; |
|||
_logger = logger; |
|||
_reportDb = new SqlSugarClient(new ConnectionConfig() |
|||
{ |
|||
ConnectionString = _configuration.GetSection("ConnectionStrings:Report").Value, |
|||
DbType = SqlSugar.DbType.Oracle, |
|||
IsAutoCloseConnection = true |
|||
}); |
|||
|
|||
//_reportDb.Aop.OnLogExecuting = (sql, pars) =>
|
|||
//{
|
|||
// _logger.LogError(sql);
|
|||
// _logger.LogError("参数:" + string.Join(",", pars.Select(p => $"{p.ParameterName}={p.Value}")));
|
|||
//};
|
|||
|
|||
_peisDb = new SqlSugarClient(new ConnectionConfig() |
|||
{ |
|||
ConnectionString = _configuration.GetSection("ConnectionStrings:Default").Value, |
|||
DbType = SqlSugar.DbType.SqlServer, |
|||
IsAutoCloseConnection = true |
|||
}); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 上传体检数据
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<UploadReportDto> UploadReportAsync(UploadReportInputDto input) |
|||
{ |
|||
|
|||
var result = new UploadReportDto |
|||
{ |
|||
Code = 100, |
|||
Message = "请求失败" |
|||
}; |
|||
|
|||
try |
|||
{ |
|||
|
|||
var peisQuery = await _peisDb.Ado.GetDataTableAsync($"select name as patient_name from patient_register where patient_register_id='{input.PatientRegisterId}' and create_pdf_flag='1'"); |
|||
if (peisQuery.Rows.Count > 0) |
|||
{ |
|||
|
|||
string patientName = peisQuery.Rows[0]["patient_name"].ToString(); |
|||
string directoryDate = input.PatientRegisterId.Substring(0, 6); |
|||
string zWHostAddress = _configuration.GetSection("ZWHostAddress").Value; |
|||
string reportVirtual = _configuration.GetSection("ReportVirtualPath:RequestPath").Value; |
|||
string reportUrl = $"{zWHostAddress + reportVirtual}/{directoryDate}/{input.PatientRegisterId}({patientName}).pdf"; |
|||
|
|||
input.bgdz = reportUrl; |
|||
} |
|||
|
|||
|
|||
var query = await _reportDb.Ado.GetDataTableAsync($"select * from TJDJ_00.tj_jbxxb where examRequestCode='{input.examRequestCode}' " + |
|||
$" and yljgdm='{input.yljgdm}' and yljgmc='{input.yljgmc}' "); |
|||
if (query.Rows.Count > 0) |
|||
{ |
|||
////修改
|
|||
//var exeCount = await _reportDb.Ado.ExecuteCommandAsync("update TJDJ_00.tj_jbxxb set name=@name,iDCard=@iDCard,identityType=@identityType,birthDate=@birthDate,xb=@xb,age=@age," +
|
|||
// "telephone=@telephone,mz=@mz,kh=@kh,klx=@klx,gzdw=@gzdw,xjzdz=@xjzdz,regCode=@regCode,scheduleDate=@scheduleDate,iTypeName=@iTypeName," +
|
|||
// "groupName=@groupName,tjzje=@tjzje,bgdz=@bgdz,scheduleStatus=@scheduleStatus,xgbz=@xgbz,scsj=@scsj,yljgdm=@yljgdm,yljgmc=@yljgmc where examRequestCode=@examRequestCode",
|
|||
// new List<SugarParameter>() {
|
|||
// new SugarParameter("name",input.name),
|
|||
// new SugarParameter("iDCard",input.iDCard),
|
|||
// new SugarParameter("identityType",input.identityType),
|
|||
// new SugarParameter("birthDate",input.birthDate),
|
|||
// new SugarParameter("xb",input.xb),
|
|||
// new SugarParameter("age",input.age),
|
|||
// new SugarParameter("telephone",input.telephone),
|
|||
// new SugarParameter("mz",input.mz),
|
|||
// new SugarParameter("kh",input.kh),
|
|||
// new SugarParameter("klx",input.klx),
|
|||
// new SugarParameter("gzdw",input.gzdw),
|
|||
// new SugarParameter("xjzdz",input.xjzdz),
|
|||
// new SugarParameter("examRequestCode",input.examRequestCode),
|
|||
// new SugarParameter("scheduleDate",input.scheduleDate),
|
|||
// new SugarParameter("iTypeName",input.iTypeName),
|
|||
// new SugarParameter("groupName",input.groupName),
|
|||
// new SugarParameter("regCode",input.regCode),
|
|||
// new SugarParameter("tjzje",input.tjzje),
|
|||
// new SugarParameter("bgdz",input.bgdz),
|
|||
// new SugarParameter("scheduleStatus",input.scheduleStatus),
|
|||
// new SugarParameter("xgbz","2"),
|
|||
// new SugarParameter("scsj",input.scsj),
|
|||
// new SugarParameter("yljgdm",input.yljgdm),
|
|||
// new SugarParameter("yljgmc",input.yljgmc)
|
|||
// });
|
|||
|
|||
//修改
|
|||
var exeCount = await _reportDb.Ado.ExecuteCommandAsync($"update TJDJ_00.tj_jbxxb set name='{input.name}',iDCard='{input.iDCard}',identityType='{input.identityType}'," + |
|||
$"birthDate='{input.birthDate}',xb='{input.xb}',age='{input.age}',telephone='{input.telephone}',mz='{input.mz}',kh='{input.kh}',klx='{input.klx}',gzdw='{input.gzdw}'," + |
|||
$"xjzdz='{input.xjzdz}',regCode='{input.regCode}',scheduleDate='{input.scheduleDate}',iTypeName='{input.iTypeName}',groupName='{input.groupName}',tjzje='{input.tjzje}'," + |
|||
$"bgdz='{input.bgdz}',scheduleStatus='{input.scheduleStatus}',xgbz='{input.xgbz}',scsj='{input.scsj}' " + |
|||
$" where examRequestCode='{input.examRequestCode}' and yljgdm='{input.yljgdm}' and yljgmc='{input.yljgmc}' "); |
|||
|
|||
|
|||
if (exeCount == 0) |
|||
{ |
|||
_logger.LogError($"接口UploadReportAsync异常,更新失败:{JsonConvert.SerializeObject(input)}"); |
|||
result = new UploadReportDto |
|||
{ |
|||
Code = 100, |
|||
Message = "更新失败" |
|||
}; |
|||
} |
|||
else |
|||
{ |
|||
result = new UploadReportDto |
|||
{ |
|||
Code = 200, |
|||
Message = "更新成功" |
|||
}; |
|||
} |
|||
|
|||
} |
|||
else |
|||
{ |
|||
////新增
|
|||
//var exeCount = await _reportDb.Ado.ExecuteCommandAsync("INSERT INTO TJDJ_00.tj_jbxxb(name,iDCard,identityType,birthDate,xb,age,telephone,mz,kh,klx,gzdw,xjzdz,examRequestCode,scheduleDate,iTypeName," +
|
|||
// "groupName,regCode,tjzje,bgdz,scheduleStatus,xgbz,scsj,yljgdm,yljgmc) VALUES (@name,@iDCard,@identityType,@birthDate,@xb,@age,@telephone,@mz,@kh,@klx,@gzdw,@xjzdz,@examRequestCode," +
|
|||
// "@scheduleDate,@iTypeName,@groupName,@regCode,@tjzje,@bgdz,@scheduleStatus,@xgbz,@scsj,@yljgdm,@yljgmc);",
|
|||
// new List<SugarParameter>() {
|
|||
// new SugarParameter("name",input.name),
|
|||
// new SugarParameter("iDCard",input.iDCard),
|
|||
// new SugarParameter("identityType",input.identityType),
|
|||
// new SugarParameter("birthDate",input.birthDate),
|
|||
// new SugarParameter("xb",input.xb),
|
|||
// new SugarParameter("age",input.age),
|
|||
// new SugarParameter("telephone",input.telephone),
|
|||
// new SugarParameter("mz",input.mz),
|
|||
// new SugarParameter("kh",input.kh),
|
|||
// new SugarParameter("klx",input.klx),
|
|||
// new SugarParameter("gzdw",input.gzdw),
|
|||
// new SugarParameter("xjzdz",input.xjzdz),
|
|||
// new SugarParameter("examRequestCode",input.examRequestCode),
|
|||
// new SugarParameter("scheduleDate",input.scheduleDate),
|
|||
// new SugarParameter("iTypeName",input.iTypeName),
|
|||
// new SugarParameter("groupName",input.groupName),
|
|||
// new SugarParameter("regCode",input.regCode),
|
|||
// new SugarParameter("tjzje",input.tjzje),
|
|||
// new SugarParameter("bgdz",input.bgdz),
|
|||
// new SugarParameter("scheduleStatus",input.scheduleStatus),
|
|||
// new SugarParameter("xgbz","1"),
|
|||
// new SugarParameter("scsj",input.scsj),
|
|||
// new SugarParameter("yljgdm",input.yljgdm),
|
|||
// new SugarParameter("yljgmc",input.yljgmc)
|
|||
// });
|
|||
|
|||
|
|||
//新增
|
|||
var exeCount = await _reportDb.Ado.ExecuteCommandAsync($"INSERT INTO TJDJ_00.tj_jbxxb(name,iDCard,identityType,birthDate,xb,age,telephone,mz,kh,klx,gzdw,xjzdz,examRequestCode,scheduleDate,iTypeName," + |
|||
$"groupName,regCode,tjzje,bgdz,scheduleStatus,xgbz,scsj,yljgdm,yljgmc) VALUES ('{input.name}','{input.iDCard}','{input.identityType}','{input.birthDate}','{input.xb}','{input.age}'," + |
|||
$"'{input.telephone}','{input.mz}','{input.kh}','{input.klx}','{input.gzdw}','{input.xjzdz}','{input.examRequestCode}'," + |
|||
$"'{input.scheduleDate}','{input.iTypeName}','{input.groupName}','{input.regCode}','{input.tjzje}','{input.bgdz}','{input.scheduleStatus}','1','{input.scsj}','{input.yljgdm}','{input.yljgmc}');"); |
|||
|
|||
|
|||
|
|||
if (exeCount == 0) |
|||
{ |
|||
_logger.LogError($"接口UploadReportAsync异常,上传失败:{JsonConvert.SerializeObject(input)}"); |
|||
result = new UploadReportDto |
|||
{ |
|||
Code = 100, |
|||
Message = "上传失败" |
|||
}; |
|||
} |
|||
else |
|||
{ |
|||
result = new UploadReportDto |
|||
{ |
|||
Code = 200, |
|||
Message = "上传成功" |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
result.Message = ex.Message; |
|||
_logger.LogError($"接口UploadReportAsync异常,上传失败:{JsonConvert.SerializeObject(input)},异常信息:{ex.ToString()}"); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 撤销上传的数据
|
|||
/// </summary>
|
|||
/// <param name="input"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<UploadReportDto> DeleteReportAsync(DeleteReportInputDto input) |
|||
{ |
|||
|
|||
var result = new UploadReportDto |
|||
{ |
|||
Code = 100, |
|||
Message = "请求失败" |
|||
}; |
|||
|
|||
try |
|||
{ |
|||
|
|||
|
|||
var query = await _reportDb.Ado.GetDataTableAsync($"select * from TJDJ_00.tj_jbxxb where examRequestCode='{input.examRequestCode}' and yljgdm='{input.yljgdm}' and yljgmc='{input.yljgmc}' "); |
|||
if (query.Rows.Count > 0) |
|||
{ |
|||
//修改
|
|||
var exeCount = await _reportDb.Ado.ExecuteCommandAsync($"update TJDJ_00.tj_jbxxb set xgbz='3' where examRequestCode='{input.examRequestCode}' " + |
|||
" and yljgdm='{input.yljgdm}' and yljgmc='{input.yljgmc}' "); |
|||
|
|||
if (exeCount == 0) |
|||
{ |
|||
_logger.LogError($"接口DeleteReportAsync异常,更新失败:{JsonConvert.SerializeObject(input)}"); |
|||
result = new UploadReportDto |
|||
{ |
|||
Code = 100, |
|||
Message = "更新失败" |
|||
}; |
|||
} |
|||
else |
|||
{ |
|||
result = new UploadReportDto |
|||
{ |
|||
Code = 200, |
|||
Message = "更新成功" |
|||
}; |
|||
} |
|||
|
|||
} |
|||
else |
|||
{ |
|||
result = new UploadReportDto |
|||
{ |
|||
Code = 100, |
|||
Message = "数据不存在" |
|||
}; |
|||
} |
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
result.Message = ex.Message; |
|||
_logger.LogError($"接口DeleteReportAsync异常,上传失败:{JsonConvert.SerializeObject(input)},异常信息:{ex.ToString()}"); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
/// <summary>
|
|||
/// 查询测试
|
|||
/// </summary>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public async Task<PublicResultDto> TestSqlAsync() |
|||
{ |
|||
|
|||
var result = new PublicResultDto |
|||
{ |
|||
Code = 100, |
|||
Message = "请求失败" |
|||
}; |
|||
|
|||
try |
|||
{ |
|||
var query = _reportDb.Ado.GetScalar("select count(*) from TJDJ_00.tj_jbxxb"); |
|||
result = new PublicResultDto |
|||
{ |
|||
Code = 200, |
|||
Message = query.ToString() |
|||
}; |
|||
|
|||
} |
|||
catch (Exception ex) |
|||
{ |
|||
result.Message = ex.Message; |
|||
_logger.LogError($"接口TestSqlAsync异常,上传失败:{ex.Message}"); |
|||
} |
|||
return result; |
|||
} |
|||
|
|||
///// <summary>
|
|||
///// 删除测试
|
|||
///// </summary>
|
|||
///// <returns></returns>
|
|||
//[HttpPost]
|
|||
//public async Task<PublicResultDto> TestDeleteSqlAsync(string examRequestCode)
|
|||
//{
|
|||
|
|||
// var result = new PublicResultDto
|
|||
// {
|
|||
// Code = 100,
|
|||
// Message = "请求失败"
|
|||
// };
|
|||
|
|||
// try
|
|||
// {
|
|||
// var query = _reportDb.Ado.ExecuteCommand("delete from TJDJ_00.tj_jbxxb where examRequestCode='{examRequestCode}' ");
|
|||
// result = new PublicResultDto
|
|||
// {
|
|||
// Code = 200,
|
|||
// Message = query.ToString()
|
|||
// };
|
|||
|
|||
// }
|
|||
// catch (Exception ex)
|
|||
// {
|
|||
// result.Message = ex.Message;
|
|||
// _logger.LogError($"接口TestDeleteSqlAsync异常,失败:{ex.Message}");
|
|||
// }
|
|||
// return result;
|
|||
//}
|
|||
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace Shentun.PeisReport.Api.Controllers |
|||
{ |
|||
[ApiController] |
|||
[Route("[controller]")]
|
|||
public class WeatherForecastController : ControllerBase |
|||
{ |
|||
private static readonly string[] Summaries = new[] |
|||
{ |
|||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" |
|||
}; |
|||
|
|||
private readonly ILogger<WeatherForecastController> _logger; |
|||
|
|||
public WeatherForecastController(ILogger<WeatherForecastController> logger) |
|||
{ |
|||
_logger = logger; |
|||
} |
|||
|
|||
[HttpGet(Name = "GetWeatherForecast")] |
|||
public IEnumerable<WeatherForecast> Get() |
|||
{ |
|||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast |
|||
{ |
|||
Date = DateTime.Now.AddDays(index), |
|||
TemperatureC = Random.Shared.Next(-20, 55), |
|||
Summary = Summaries[Random.Shared.Next(Summaries.Length)] |
|||
}) |
|||
.ToArray(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace Shentun.PeisReport.Api.Dto |
|||
{ |
|||
public class BarCodeNoInputDto |
|||
{ |
|||
public string BarCodeNo { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
namespace Shentun.PeisReport.Api.Dto |
|||
{ |
|||
public class DeleteReportInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 预约编码
|
|||
/// </summary>
|
|||
public string examRequestCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 医疗机构代码
|
|||
/// </summary>
|
|||
public string yljgdm { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 医疗机构名称
|
|||
/// </summary>
|
|||
public string yljgmc { get; set; } |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
namespace Shentun.PeisReport.Api.Dto |
|||
{ |
|||
public class IdNoInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 身份证号码
|
|||
/// </summary>
|
|||
public string IdNo { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
namespace Shentun.PeisReport.Api.Dto |
|||
{ |
|||
public class PatientRegisterIdInputDto |
|||
{ |
|||
public string PatientRegisterId { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,51 @@ |
|||
namespace Shentun.PeisReport.Api.Dto |
|||
{ |
|||
public class PatientRegisterListDto : PublicResultDto |
|||
{ |
|||
public List<PatientRegisterListResultDataDto> Data { get; set; } = new List<PatientRegisterListResultDataDto>(); |
|||
} |
|||
|
|||
public class PatientRegisterListResultDataDto |
|||
{ |
|||
/// <summary>
|
|||
/// 人员id
|
|||
/// </summary>
|
|||
public string patient_register_id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 条码号
|
|||
/// </summary>
|
|||
public string barcode_no { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 姓名
|
|||
/// </summary>
|
|||
public string name { get; set; } |
|||
|
|||
|
|||
/// <summary>
|
|||
/// 性别
|
|||
/// </summary>
|
|||
public string sex { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 年龄
|
|||
/// </summary>
|
|||
public string age { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 手机号
|
|||
/// </summary>
|
|||
public string mobile_telephone { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 体检次数
|
|||
/// </summary>
|
|||
public string medical_time { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 体检日期 格式(2024-02-20)
|
|||
/// </summary>
|
|||
public string medical_date { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
namespace Shentun.PeisReport.Api.Dto |
|||
{ |
|||
public class PeisReportUrlByPatientRegisterIdDto : PublicResultDto |
|||
{ |
|||
public PeisReportUrlByPatientRegisterIdResultDataDto Data { get; set; } = new PeisReportUrlByPatientRegisterIdResultDataDto(); |
|||
} |
|||
|
|||
public class PeisReportUrlByPatientRegisterIdResultDataDto |
|||
{ |
|||
public string peis_report_url { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
namespace Shentun.PeisReport.Api.Dto |
|||
{ |
|||
public class PublicResultDto |
|||
{ |
|||
public int Code { get;set; } |
|||
|
|||
public string Message { get;set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
namespace Shentun.PeisReport.Api.Dto |
|||
{ |
|||
public class QueueRegisterByBarCodeNoDto : PublicResultDto |
|||
{ |
|||
public QueueRegisterByBarCodeNoResultDataDto Data { get; set; } = new QueueRegisterByBarCodeNoResultDataDto(); |
|||
} |
|||
|
|||
public class QueueRegisterByBarCodeNoResultDataDto |
|||
{ |
|||
/// <summary>
|
|||
/// 姓名
|
|||
/// </summary>
|
|||
public string patient_name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 房间名称
|
|||
/// </summary>
|
|||
public string room_name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 排队人数
|
|||
/// </summary>
|
|||
public int queue_count { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
namespace Shentun.PeisReport.Api.Dto |
|||
{ |
|||
public class UploadReportDto : PublicResultDto |
|||
{ |
|||
} |
|||
} |
|||
@ -0,0 +1,132 @@ |
|||
namespace Shentun.PeisReport.Api.Dto |
|||
{ |
|||
public class UploadReportInputDto |
|||
{ |
|||
/// <summary>
|
|||
/// 人员id
|
|||
/// </summary>
|
|||
public string PatientRegisterId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 姓名
|
|||
/// </summary>
|
|||
public string name { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 证件号码
|
|||
/// </summary>
|
|||
public string iDCard { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 证件类别
|
|||
/// </summary>
|
|||
public string identityType { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 出生年月 YYYY-MM-DD
|
|||
/// </summary>
|
|||
public string birthDate { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 性别
|
|||
/// </summary>
|
|||
public string xb { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 年龄
|
|||
/// </summary>
|
|||
public string age { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 联系电话
|
|||
/// </summary>
|
|||
public string telephone { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 民族
|
|||
/// </summary>
|
|||
public string mz { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 卡号
|
|||
/// </summary>
|
|||
public string kh { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 卡类型
|
|||
/// </summary>
|
|||
public string klx { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 工作单位
|
|||
/// </summary>
|
|||
public string gzdw { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 现居住地址
|
|||
/// </summary>
|
|||
public string xjzdz { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 预约编码
|
|||
/// </summary>
|
|||
public string examRequestCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 预约时间
|
|||
/// </summary>
|
|||
public string scheduleDate { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 体检业务名称
|
|||
/// </summary>
|
|||
public string iTypeName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 体检套餐名称
|
|||
/// </summary>
|
|||
public string groupName { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 体检号
|
|||
/// </summary>
|
|||
public string regCode { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 体检总金额
|
|||
/// </summary>
|
|||
public string tjzje { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// PDF报告地址
|
|||
/// </summary>
|
|||
public string bgdz { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 状态
|
|||
/// </summary>
|
|||
public string scheduleStatus { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 修改标志
|
|||
/// </summary>
|
|||
public string xgbz { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 上传时间
|
|||
/// </summary>
|
|||
public string scsj { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 医疗机构代码
|
|||
/// </summary>
|
|||
public string yljgdm { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 医疗机构名称
|
|||
/// </summary>
|
|||
public string yljgmc { get; set; } |
|||
|
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,62 @@ |
|||
using Microsoft.Extensions.FileProviders; |
|||
using Microsoft.Extensions.Options; |
|||
using NLog.Web; |
|||
|
|||
var builder = WebApplication.CreateBuilder(args); |
|||
|
|||
var configuration = builder.Configuration; |
|||
|
|||
// Add services to the container.
|
|||
|
|||
//nlog
|
|||
builder.Logging.AddNLog("Configs/NLog.config"); |
|||
|
|||
builder.Services.AddControllers(); |
|||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|||
builder.Services.AddEndpointsApiExplorer(); |
|||
builder.Services.AddSwaggerGen(opt => |
|||
{ |
|||
var baseDirectory = AppContext.BaseDirectory; |
|||
|
|||
var commentsFile = Path.Combine(baseDirectory, "Shentun.PeisReport.Api.xml"); |
|||
opt.IncludeXmlComments(commentsFile, true); |
|||
|
|||
}); |
|||
|
|||
builder.Services.AddCors(options => |
|||
{ |
|||
options.AddPolicy("AllowAll", |
|||
builder => builder |
|||
.AllowAnyOrigin() |
|||
.AllowAnyMethod() |
|||
.AllowAnyHeader()); |
|||
}); |
|||
|
|||
var app = builder.Build(); |
|||
|
|||
|
|||
|
|||
var isSwagger = Convert.ToBoolean(configuration["Swagger:IsEnabled"]); |
|||
if (isSwagger) |
|||
{ |
|||
app.UseSwagger(); |
|||
app.UseSwaggerUI(); |
|||
} |
|||
|
|||
|
|||
|
|||
//ÐéÄâĿ¼
|
|||
app.UseStaticFiles(new StaticFileOptions |
|||
{ |
|||
FileProvider = new PhysicalFileProvider(configuration["ReportVirtualPath:RealPath"]), |
|||
RequestPath = configuration["ReportVirtualPath:RequestPath"] |
|||
}); |
|||
|
|||
|
|||
app.UseCors("AllowAll"); |
|||
|
|||
app.UseAuthorization(); |
|||
|
|||
app.MapControllers(); |
|||
|
|||
app.Run(); |
|||
@ -0,0 +1,31 @@ |
|||
{ |
|||
"$schema": "https://json.schemastore.org/launchsettings.json", |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:50516", |
|||
"sslPort": 44309 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"Shentun.PeisReport.Api": { |
|||
"commandName": "Project", |
|||
"dotnetRunMessages": true, |
|||
"launchBrowser": true, |
|||
"launchUrl": "swagger", |
|||
"applicationUrl": "https://localhost:7005;http://localhost:5116", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"launchUrl": "swagger", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>net6.0</TargetFramework> |
|||
<Nullable>enable</Nullable> |
|||
<ImplicitUsings>enable</ImplicitUsings> |
|||
<GenerateDocumentationFile>True</GenerateDocumentationFile> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.14" /> |
|||
<PackageReference Include="SqlSugarCore" Version="5.1.4.169" /> |
|||
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,13 @@ |
|||
namespace Shentun.PeisReport.Api |
|||
{ |
|||
public class WeatherForecast |
|||
{ |
|||
public DateTime Date { get; set; } |
|||
|
|||
public int TemperatureC { get; set; } |
|||
|
|||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); |
|||
|
|||
public string? Summary { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft.AspNetCore": "Warning" |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft.AspNetCore": "Warning" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*", |
|||
"ConnectionStrings": { |
|||
"Default": "server=140.143.162.39;uid=sa;pwd=shentun;database=mypeis;Encrypt=false;", |
|||
"Report": "User Id=tjdj_08;Password=Tfdj_yixm7u8X;Data Source=TJDJ;Unicode=True" |
|||
}, |
|||
"HostAddress": "https://localhost:7005", |
|||
"ZWHostAddress": "https://localhost:7005", |
|||
"ReportVirtualPath": { |
|||
"RealPath": "E:\\peis_pdf", |
|||
"RequestPath": "/Pdf" |
|||
}, |
|||
"Swagger": { |
|||
"IsEnabled": true |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|||
# Visual Studio Version 17 |
|||
VisualStudioVersion = 17.9.34902.65 |
|||
MinimumVisualStudioVersion = 10.0.40219.1 |
|||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shentun.PeisReport.Api", "Shentun.PeisReport.Api\Shentun.PeisReport.Api.csproj", "{D264FFC0-0B67-48B7-9630-100D7921A36D}" |
|||
EndProject |
|||
Global |
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|||
Debug|Any CPU = Debug|Any CPU |
|||
Release|Any CPU = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|||
{D264FFC0-0B67-48B7-9630-100D7921A36D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|||
{D264FFC0-0B67-48B7-9630-100D7921A36D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|||
{D264FFC0-0B67-48B7-9630-100D7921A36D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|||
{D264FFC0-0B67-48B7-9630-100D7921A36D}.Release|Any CPU.Build.0 = Release|Any CPU |
|||
EndGlobalSection |
|||
GlobalSection(SolutionProperties) = preSolution |
|||
HideSolutionNode = FALSE |
|||
EndGlobalSection |
|||
GlobalSection(ExtensibilityGlobals) = postSolution |
|||
SolutionGuid = {9452ACF7-4F6C-4F2C-AA4B-7588550B23D3} |
|||
EndGlobalSection |
|||
EndGlobal |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue