From cde81f353ee63e4d708e24503c96d8ceb3713663 Mon Sep 17 00:00:00 2001
From: wxd <123@qq.com>
Date: Wed, 21 May 2025 14:44:46 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE=E6=96=87?=
=?UTF-8?q?=E4=BB=B6=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../.config/dotnet-tools.json | 12 +
Shentun.PeisReport.Api/Configs/NLog.config | 31 ++
.../Controllers/PeisController.cs | 228 ++++++++++++
.../Controllers/ReportController.cs | 351 ++++++++++++++++++
.../Controllers/WeatherForecastController.cs | 33 ++
.../Dto/BarCodeNoInputDto.cs | 7 +
.../Dto/DeleteReportInputDto.cs | 22 ++
Shentun.PeisReport.Api/Dto/IdNoInputDto.cs | 10 +
.../Dto/PatientRegisterIdInputDto.cs | 7 +
.../Dto/PatientRegisterListDto.cs | 51 +++
.../PeisReportUrlByPatientRegisterIdDto.cs | 12 +
Shentun.PeisReport.Api/Dto/PublicResultDto.cs | 9 +
.../Dto/QueueRegisterByBarCodeNoDto.cs | 25 ++
Shentun.PeisReport.Api/Dto/UploadReportDto.cs | 6 +
.../Dto/UploadReportInputDto.cs | 132 +++++++
Shentun.PeisReport.Api/Program.cs | 62 ++++
.../Properties/launchSettings.json | 31 ++
.../Shentun.PeisReport.Api.csproj | 16 +
Shentun.PeisReport.Api/WeatherForecast.cs | 13 +
.../appsettings.Development.json | 8 +
Shentun.PeisReport.Api/appsettings.json | 22 ++
Shentun.PeisReport.sln | 25 ++
22 files changed, 1113 insertions(+)
create mode 100644 Shentun.PeisReport.Api/.config/dotnet-tools.json
create mode 100644 Shentun.PeisReport.Api/Configs/NLog.config
create mode 100644 Shentun.PeisReport.Api/Controllers/PeisController.cs
create mode 100644 Shentun.PeisReport.Api/Controllers/ReportController.cs
create mode 100644 Shentun.PeisReport.Api/Controllers/WeatherForecastController.cs
create mode 100644 Shentun.PeisReport.Api/Dto/BarCodeNoInputDto.cs
create mode 100644 Shentun.PeisReport.Api/Dto/DeleteReportInputDto.cs
create mode 100644 Shentun.PeisReport.Api/Dto/IdNoInputDto.cs
create mode 100644 Shentun.PeisReport.Api/Dto/PatientRegisterIdInputDto.cs
create mode 100644 Shentun.PeisReport.Api/Dto/PatientRegisterListDto.cs
create mode 100644 Shentun.PeisReport.Api/Dto/PeisReportUrlByPatientRegisterIdDto.cs
create mode 100644 Shentun.PeisReport.Api/Dto/PublicResultDto.cs
create mode 100644 Shentun.PeisReport.Api/Dto/QueueRegisterByBarCodeNoDto.cs
create mode 100644 Shentun.PeisReport.Api/Dto/UploadReportDto.cs
create mode 100644 Shentun.PeisReport.Api/Dto/UploadReportInputDto.cs
create mode 100644 Shentun.PeisReport.Api/Program.cs
create mode 100644 Shentun.PeisReport.Api/Properties/launchSettings.json
create mode 100644 Shentun.PeisReport.Api/Shentun.PeisReport.Api.csproj
create mode 100644 Shentun.PeisReport.Api/WeatherForecast.cs
create mode 100644 Shentun.PeisReport.Api/appsettings.Development.json
create mode 100644 Shentun.PeisReport.Api/appsettings.json
create mode 100644 Shentun.PeisReport.sln
diff --git a/Shentun.PeisReport.Api/.config/dotnet-tools.json b/Shentun.PeisReport.Api/.config/dotnet-tools.json
new file mode 100644
index 0000000..4633692
--- /dev/null
+++ b/Shentun.PeisReport.Api/.config/dotnet-tools.json
@@ -0,0 +1,12 @@
+{
+ "version": 1,
+ "isRoot": true,
+ "tools": {
+ "dotnet-ef": {
+ "version": "9.0.3",
+ "commands": [
+ "dotnet-ef"
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/Shentun.PeisReport.Api/Configs/NLog.config b/Shentun.PeisReport.Api/Configs/NLog.config
new file mode 100644
index 0000000..6d71117
--- /dev/null
+++ b/Shentun.PeisReport.Api/Configs/NLog.config
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Shentun.PeisReport.Api/Controllers/PeisController.cs b/Shentun.PeisReport.Api/Controllers/PeisController.cs
new file mode 100644
index 0000000..73aef6d
--- /dev/null
+++ b/Shentun.PeisReport.Api/Controllers/PeisController.cs
@@ -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 _logger;
+ public PeisController(
+ IConfiguration configuration,
+ ILogger logger)
+ {
+ _configuration = configuration;
+ _logger = logger;
+ _peisDb = new SqlSugarClient(new ConnectionConfig()
+ {
+ ConnectionString = _configuration.GetSection("ConnectionStrings:Default").Value,
+ DbType = SqlSugar.DbType.SqlServer,
+ IsAutoCloseConnection = true
+ });
+ }
+
+
+ ///
+ /// 根据身份证号码获取体检列表
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task 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 patientRegisterList = new List();
+
+ 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;
+ }
+
+
+ ///
+ /// 根据人员id获取体检报告地址
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task 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;
+ }
+
+
+ ///
+ /// 获取当前人员的排队情况
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task 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($" 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;
+ }
+
+
+ }
+}
diff --git a/Shentun.PeisReport.Api/Controllers/ReportController.cs b/Shentun.PeisReport.Api/Controllers/ReportController.cs
new file mode 100644
index 0000000..aa39441
--- /dev/null
+++ b/Shentun.PeisReport.Api/Controllers/ReportController.cs
@@ -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
+{
+ ///
+ /// 上传
+ ///
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ public class ReportController : ControllerBase
+ {
+ private readonly SqlSugarClient _peisDb;
+ private readonly SqlSugarClient _reportDb;
+ private readonly IConfiguration _configuration;
+ private readonly ILogger _logger;
+
+
+ public ReportController(
+ IConfiguration configuration,
+ ILogger 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
+ });
+ }
+
+
+
+
+ ///
+ /// 上传体检数据
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task 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() {
+ // 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() {
+ // 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;
+ }
+
+
+
+ ///
+ /// 撤销上传的数据
+ ///
+ ///
+ ///
+ [HttpPost]
+ public async Task 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;
+ }
+
+
+
+
+ ///
+ /// 查询测试
+ ///
+ ///
+ [HttpPost]
+ public async Task 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;
+ }
+
+ /////
+ ///// 删除测试
+ /////
+ /////
+ //[HttpPost]
+ //public async Task 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;
+ //}
+
+
+ }
+}
diff --git a/Shentun.PeisReport.Api/Controllers/WeatherForecastController.cs b/Shentun.PeisReport.Api/Controllers/WeatherForecastController.cs
new file mode 100644
index 0000000..48384e9
--- /dev/null
+++ b/Shentun.PeisReport.Api/Controllers/WeatherForecastController.cs
@@ -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 _logger;
+
+ public WeatherForecastController(ILogger logger)
+ {
+ _logger = logger;
+ }
+
+ [HttpGet(Name = "GetWeatherForecast")]
+ public IEnumerable 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();
+ }
+ }
+}
diff --git a/Shentun.PeisReport.Api/Dto/BarCodeNoInputDto.cs b/Shentun.PeisReport.Api/Dto/BarCodeNoInputDto.cs
new file mode 100644
index 0000000..df6391a
--- /dev/null
+++ b/Shentun.PeisReport.Api/Dto/BarCodeNoInputDto.cs
@@ -0,0 +1,7 @@
+namespace Shentun.PeisReport.Api.Dto
+{
+ public class BarCodeNoInputDto
+ {
+ public string BarCodeNo { get; set; }
+ }
+}
diff --git a/Shentun.PeisReport.Api/Dto/DeleteReportInputDto.cs b/Shentun.PeisReport.Api/Dto/DeleteReportInputDto.cs
new file mode 100644
index 0000000..c471581
--- /dev/null
+++ b/Shentun.PeisReport.Api/Dto/DeleteReportInputDto.cs
@@ -0,0 +1,22 @@
+namespace Shentun.PeisReport.Api.Dto
+{
+ public class DeleteReportInputDto
+ {
+ ///
+ /// 预约编码
+ ///
+ public string examRequestCode { get; set; }
+
+ ///
+ /// 医疗机构代码
+ ///
+ public string yljgdm { get; set; }
+
+ ///
+ /// 医疗机构名称
+ ///
+ public string yljgmc { get; set; }
+ }
+
+
+}
diff --git a/Shentun.PeisReport.Api/Dto/IdNoInputDto.cs b/Shentun.PeisReport.Api/Dto/IdNoInputDto.cs
new file mode 100644
index 0000000..60e1b6a
--- /dev/null
+++ b/Shentun.PeisReport.Api/Dto/IdNoInputDto.cs
@@ -0,0 +1,10 @@
+namespace Shentun.PeisReport.Api.Dto
+{
+ public class IdNoInputDto
+ {
+ ///
+ /// 身份证号码
+ ///
+ public string IdNo { get; set; }
+ }
+}
diff --git a/Shentun.PeisReport.Api/Dto/PatientRegisterIdInputDto.cs b/Shentun.PeisReport.Api/Dto/PatientRegisterIdInputDto.cs
new file mode 100644
index 0000000..3a00ff6
--- /dev/null
+++ b/Shentun.PeisReport.Api/Dto/PatientRegisterIdInputDto.cs
@@ -0,0 +1,7 @@
+namespace Shentun.PeisReport.Api.Dto
+{
+ public class PatientRegisterIdInputDto
+ {
+ public string PatientRegisterId { get; set; }
+ }
+}
diff --git a/Shentun.PeisReport.Api/Dto/PatientRegisterListDto.cs b/Shentun.PeisReport.Api/Dto/PatientRegisterListDto.cs
new file mode 100644
index 0000000..d0b81a1
--- /dev/null
+++ b/Shentun.PeisReport.Api/Dto/PatientRegisterListDto.cs
@@ -0,0 +1,51 @@
+namespace Shentun.PeisReport.Api.Dto
+{
+ public class PatientRegisterListDto : PublicResultDto
+ {
+ public List Data { get; set; } = new List();
+ }
+
+ public class PatientRegisterListResultDataDto
+ {
+ ///
+ /// 人员id
+ ///
+ public string patient_register_id { get; set; }
+
+ ///
+ /// 条码号
+ ///
+ public string barcode_no { get; set; }
+
+ ///
+ /// 姓名
+ ///
+ public string name { get; set; }
+
+
+ ///
+ /// 性别
+ ///
+ public string sex { get; set; }
+
+ ///
+ /// 年龄
+ ///
+ public string age { get; set; }
+
+ ///
+ /// 手机号
+ ///
+ public string mobile_telephone { get; set; }
+
+ ///
+ /// 体检次数
+ ///
+ public string medical_time { get; set; }
+
+ ///
+ /// 体检日期 格式(2024-02-20)
+ ///
+ public string medical_date { get; set; }
+ }
+}
diff --git a/Shentun.PeisReport.Api/Dto/PeisReportUrlByPatientRegisterIdDto.cs b/Shentun.PeisReport.Api/Dto/PeisReportUrlByPatientRegisterIdDto.cs
new file mode 100644
index 0000000..716bbe4
--- /dev/null
+++ b/Shentun.PeisReport.Api/Dto/PeisReportUrlByPatientRegisterIdDto.cs
@@ -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; }
+ }
+}
diff --git a/Shentun.PeisReport.Api/Dto/PublicResultDto.cs b/Shentun.PeisReport.Api/Dto/PublicResultDto.cs
new file mode 100644
index 0000000..96135e8
--- /dev/null
+++ b/Shentun.PeisReport.Api/Dto/PublicResultDto.cs
@@ -0,0 +1,9 @@
+namespace Shentun.PeisReport.Api.Dto
+{
+ public class PublicResultDto
+ {
+ public int Code { get;set; }
+
+ public string Message { get;set; }
+ }
+}
diff --git a/Shentun.PeisReport.Api/Dto/QueueRegisterByBarCodeNoDto.cs b/Shentun.PeisReport.Api/Dto/QueueRegisterByBarCodeNoDto.cs
new file mode 100644
index 0000000..8c14e07
--- /dev/null
+++ b/Shentun.PeisReport.Api/Dto/QueueRegisterByBarCodeNoDto.cs
@@ -0,0 +1,25 @@
+namespace Shentun.PeisReport.Api.Dto
+{
+ public class QueueRegisterByBarCodeNoDto : PublicResultDto
+ {
+ public QueueRegisterByBarCodeNoResultDataDto Data { get; set; } = new QueueRegisterByBarCodeNoResultDataDto();
+ }
+
+ public class QueueRegisterByBarCodeNoResultDataDto
+ {
+ ///
+ /// 姓名
+ ///
+ public string patient_name { get; set; }
+
+ ///
+ /// 房间名称
+ ///
+ public string room_name { get; set; }
+
+ ///
+ /// 排队人数
+ ///
+ public int queue_count { get; set; }
+ }
+}
diff --git a/Shentun.PeisReport.Api/Dto/UploadReportDto.cs b/Shentun.PeisReport.Api/Dto/UploadReportDto.cs
new file mode 100644
index 0000000..3f86ba2
--- /dev/null
+++ b/Shentun.PeisReport.Api/Dto/UploadReportDto.cs
@@ -0,0 +1,6 @@
+namespace Shentun.PeisReport.Api.Dto
+{
+ public class UploadReportDto : PublicResultDto
+ {
+ }
+}
diff --git a/Shentun.PeisReport.Api/Dto/UploadReportInputDto.cs b/Shentun.PeisReport.Api/Dto/UploadReportInputDto.cs
new file mode 100644
index 0000000..7cee07e
--- /dev/null
+++ b/Shentun.PeisReport.Api/Dto/UploadReportInputDto.cs
@@ -0,0 +1,132 @@
+namespace Shentun.PeisReport.Api.Dto
+{
+ public class UploadReportInputDto
+ {
+ ///
+ /// 人员id
+ ///
+ public string PatientRegisterId { get; set; }
+
+ ///
+ /// 姓名
+ ///
+ public string name { get; set; }
+
+ ///
+ /// 证件号码
+ ///
+ public string iDCard { get; set; }
+
+ ///
+ /// 证件类别
+ ///
+ public string identityType { get; set; }
+
+ ///
+ /// 出生年月 YYYY-MM-DD
+ ///
+ public string birthDate { get; set; }
+
+ ///
+ /// 性别
+ ///
+ public string xb { get; set; }
+
+ ///
+ /// 年龄
+ ///
+ public string age { get; set; }
+
+ ///
+ /// 联系电话
+ ///
+ public string telephone { get; set; }
+
+ ///
+ /// 民族
+ ///
+ public string mz { get; set; }
+
+ ///
+ /// 卡号
+ ///
+ public string kh { get; set; }
+
+ ///
+ /// 卡类型
+ ///
+ public string klx { get; set; }
+
+ ///
+ /// 工作单位
+ ///
+ public string gzdw { get; set; }
+
+ ///
+ /// 现居住地址
+ ///
+ public string xjzdz { get; set; }
+
+ ///
+ /// 预约编码
+ ///
+ public string examRequestCode { get; set; }
+
+ ///
+ /// 预约时间
+ ///
+ public string scheduleDate { get; set; }
+
+ ///
+ /// 体检业务名称
+ ///
+ public string iTypeName { get; set; }
+
+ ///
+ /// 体检套餐名称
+ ///
+ public string groupName { get; set; }
+
+ ///
+ /// 体检号
+ ///
+ public string regCode { get; set; }
+
+ ///
+ /// 体检总金额
+ ///
+ public string tjzje { get; set; }
+
+ ///
+ /// PDF报告地址
+ ///
+ public string bgdz { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public string scheduleStatus { get; set; }
+
+ ///
+ /// 修改标志
+ ///
+ public string xgbz { get; set; }
+
+ ///
+ /// 上传时间
+ ///
+ public string scsj { get; set; }
+
+ ///
+ /// 医疗机构代码
+ ///
+ public string yljgdm { get; set; }
+
+ ///
+ /// 医疗机构名称
+ ///
+ public string yljgmc { get; set; }
+
+
+ }
+}
diff --git a/Shentun.PeisReport.Api/Program.cs b/Shentun.PeisReport.Api/Program.cs
new file mode 100644
index 0000000..b7ff7e3
--- /dev/null
+++ b/Shentun.PeisReport.Api/Program.cs
@@ -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();
diff --git a/Shentun.PeisReport.Api/Properties/launchSettings.json b/Shentun.PeisReport.Api/Properties/launchSettings.json
new file mode 100644
index 0000000..e9af9df
--- /dev/null
+++ b/Shentun.PeisReport.Api/Properties/launchSettings.json
@@ -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"
+ }
+ }
+ }
+}
diff --git a/Shentun.PeisReport.Api/Shentun.PeisReport.Api.csproj b/Shentun.PeisReport.Api/Shentun.PeisReport.Api.csproj
new file mode 100644
index 0000000..a18c59c
--- /dev/null
+++ b/Shentun.PeisReport.Api/Shentun.PeisReport.Api.csproj
@@ -0,0 +1,16 @@
+
+
+
+ net6.0
+ enable
+ enable
+ True
+
+
+
+
+
+
+
+
+
diff --git a/Shentun.PeisReport.Api/WeatherForecast.cs b/Shentun.PeisReport.Api/WeatherForecast.cs
new file mode 100644
index 0000000..86fa5fe
--- /dev/null
+++ b/Shentun.PeisReport.Api/WeatherForecast.cs
@@ -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; }
+ }
+}
diff --git a/Shentun.PeisReport.Api/appsettings.Development.json b/Shentun.PeisReport.Api/appsettings.Development.json
new file mode 100644
index 0000000..0c208ae
--- /dev/null
+++ b/Shentun.PeisReport.Api/appsettings.Development.json
@@ -0,0 +1,8 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ }
+}
diff --git a/Shentun.PeisReport.Api/appsettings.json b/Shentun.PeisReport.Api/appsettings.json
new file mode 100644
index 0000000..e76d62c
--- /dev/null
+++ b/Shentun.PeisReport.Api/appsettings.json
@@ -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
+ }
+}
diff --git a/Shentun.PeisReport.sln b/Shentun.PeisReport.sln
new file mode 100644
index 0000000..823831b
--- /dev/null
+++ b/Shentun.PeisReport.sln
@@ -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