Commit 3f0149a0 by 刘军

报告完成

parent 3dc49591
using G.Buss.BaseInfo.Services.ChemotherapySVC; using G.Buss.BaseInfo.Services.ChemotherapySVC;
using G.MES.API.App_Start;
using G.MES.DataModel; using G.MES.DataModel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Web; using System.Web;
using System.Web.Http;
namespace G.MES.API.Controllers namespace G.MES.API.Controllers
{ {
...@@ -16,9 +18,30 @@ namespace G.MES.API.Controllers ...@@ -16,9 +18,30 @@ namespace G.MES.API.Controllers
/// <summary> /// <summary>
/// 获取化药结果 /// 获取化药结果
/// </summary> /// </summary>
[HttpGet]
[NoAuthAttribute]
public List<Chemotherapy> GetChemotherapy() public List<Chemotherapy> GetChemotherapy()
{ {
return svc.GetChemotherapy(); return svc.GetChemotherapy();
} }
/// <summary>
/// 导入化疗结果
/// </summary>
/// <returns></returns>
[HttpPost]
[NoAuthAttribute]
public bool ImportChemotherapy()
{
try
{
HttpPostedFile file = HttpContext.Current.Request.Files["Excel"];
return svc.ImportChemotherapy(file);
}
catch (Exception e)
{
throw new Exception("表格导入错误" + e.Message);
}
}
} }
} }
\ No newline at end of file
...@@ -10,6 +10,10 @@ CREATE TABLE [dbo].[Chemotherapy]( ...@@ -10,6 +10,10 @@ CREATE TABLE [dbo].[Chemotherapy](
[Genotype] [VARCHAR](50) NULL, [Genotype] [VARCHAR](50) NULL,
[MedicationPrompts] [TEXT] NULL, [MedicationPrompts] [TEXT] NULL,
[Levels] [VARCHAR](50) NULL, [Levels] [VARCHAR](50) NULL,
[CurrentIndex] [INT] NULL,
[Sys_Create] [DATETIME] NULL,
[ParentOID] [UNIQUEIDENTIFIER] NULL,
[SampleNumber] [INT] NULL,
CONSTRAINT [PK_Chemotherapy] PRIMARY KEY CLUSTERED CONSTRAINT [PK_Chemotherapy] PRIMARY KEY CLUSTERED
( (
[ChemotherapyOID] ASC [ChemotherapyOID] ASC
......
using Chloe.SqlServer; using Chloe.SqlServer;
using G.Buss.BaseInfo.Services.SummarySVC;
using G.MES.DataModel; using G.MES.DataModel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web;
namespace G.Buss.BaseInfo.Services.ChemotherapySVC namespace G.Buss.BaseInfo.Services.ChemotherapySVC
{ {
...@@ -22,5 +25,74 @@ namespace G.Buss.BaseInfo.Services.ChemotherapySVC ...@@ -22,5 +25,74 @@ namespace G.Buss.BaseInfo.Services.ChemotherapySVC
return chemotherapies; return chemotherapies;
} }
} }
public bool ImportChemotherapy(HttpPostedFile file)
{
try
{
DataTable table = SummarySvc.RenderDataTableFromExcel(file.InputStream, 0, 0);
List<Chemotherapy> chemotherapys = new List<Chemotherapy>();
List<string> SampleNumber = new List<string>();
Guid PreOID = Guid.Empty;
for (int i = 0; i < table.Rows.Count; i++)
{
Chemotherapy chemotherapy = new Chemotherapy();
Guid OID = Guid.NewGuid();
if (string.IsNullOrEmpty(table.Rows[i]["药物"].ToString()))
{
if (PreOID == Guid.Empty)
{
throw new Exception("excel第一行数据不能为空");
}
chemotherapy.ParentOID = PreOID;
chemotherapy.ChemotherapyOID = OID;
chemotherapy.DrugPlan = table.Rows[i]["药物"].ToString();
chemotherapy.Gene = table.Rows[i]["基因"].ToString();
chemotherapy.TestSite = table.Rows[i]["检测位点"].ToString();
chemotherapy.Genotype = table.Rows[i]["基因型"].ToString();
chemotherapy.MedicationPrompts = table.Rows[i]["用药提示"].ToString();
chemotherapy.Levels = table.Rows[i]["级别"].ToString();
//summary.Sys_CreateBy = user.Sys_UserOID;
chemotherapy.Sys_Create = DateTime.Now;
chemotherapy.CurrentIndex = i;
}
else
{
chemotherapy.ParentOID = Guid.Empty;
chemotherapy.ChemotherapyOID = OID;
chemotherapy.DrugPlan = table.Rows[i]["药物"].ToString();
chemotherapy.Gene = table.Rows[i]["基因"].ToString();
chemotherapy.TestSite = table.Rows[i]["检测位点"].ToString();
chemotherapy.Genotype = table.Rows[i]["基因型"].ToString();
chemotherapy.MedicationPrompts = table.Rows[i]["用药提示"].ToString();
chemotherapy.Levels = table.Rows[i]["级别"].ToString();
chemotherapy.SampleNumber = table.Rows[i]["受试者ID"].ToString();
chemotherapy.Sys_Create = DateTime.Now;
chemotherapy.CurrentIndex = i;
PreOID = OID;
SampleNumber.Add(chemotherapy.SampleNumber);
}
chemotherapys.Add(chemotherapy);
}
using (var context = new MsSqlContext(sqlConn))
{
List<Chemotherapy> summarie = context.Query<Chemotherapy>().Where(n => SampleNumber.Contains(n.SampleNumber)).ToList();
List<Guid> guids = summarie.Select(n => n.ChemotherapyOID).ToList();
List<string> numbers = summarie.Select(n => n.SampleNumber).ToList();
//删除已存在的数据再重新插入
if (summarie.Any())
{
context.Delete<Chemotherapy>(m => numbers.Contains(m.SampleNumber) || guids.Contains(m.ParentOID));
}
context.InsertRange(chemotherapys);
}
return true;
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
} }
} }
...@@ -105,13 +105,10 @@ namespace G.Buss.BaseInfo.Services.ExportWordSVC ...@@ -105,13 +105,10 @@ namespace G.Buss.BaseInfo.Services.ExportWordSVC
/// <summary> /// <summary>
/// 获取化疗药物 /// 获取化疗药物
/// </summary> /// </summary>
public List<Chemotherapy> GetChemotherapyDrugs() public DataTable GetChemotherapyDrugs()
{ {
using (var context = new MsSqlContext(sqlConn)) SqlHelper context = new SqlHelper();
{ return context.ExcuteDatatable("SELECT * FROM dbo.Chemotherapy ORDER BY CurrentIndex ASC", null);
List<Chemotherapy> chemotherapies = context.Query<Chemotherapy>().ToList();
return chemotherapies;
}
} }
/// <summary> /// <summary>
/// 获取遗传风险 /// 获取遗传风险
......
...@@ -94,7 +94,7 @@ namespace G.Buss.BaseInfo.Services.SummarySVC ...@@ -94,7 +94,7 @@ namespace G.Buss.BaseInfo.Services.SummarySVC
} }
} }
private static DataTable RenderDataTableFromExcel(Stream ExcelFileStream, int SheetIndex, int HeaderRowIndex) public static DataTable RenderDataTableFromExcel(Stream ExcelFileStream, int SheetIndex, int HeaderRowIndex)
{ {
XSSFWorkbook workbook = new XSSFWorkbook(ExcelFileStream); XSSFWorkbook workbook = new XSSFWorkbook(ExcelFileStream);
ISheet sheet = workbook.GetSheetAt(SheetIndex); ISheet sheet = workbook.GetSheetAt(SheetIndex);
......
...@@ -33,5 +33,13 @@ namespace G.MES.DataModel ...@@ -33,5 +33,13 @@ namespace G.MES.DataModel
public virtual string MedicationPrompts { get;set; } public virtual string MedicationPrompts { get;set; }
///<summary><summary> ///<summary><summary>
public virtual string Levels { get;set; } public virtual string Levels { get;set; }
///<summary><summary>
public virtual Nullable<int> CurrentIndex { get;set; }
///<summary><summary>
public virtual Nullable<System.DateTime> Sys_Create { get;set; }
///<summary><summary>
public virtual System.Guid ParentOID { get;set; }
///<summary><summary>
public virtual string SampleNumber { get;set; }
} }
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
</defaultConnectionFactory> </defaultConnectionFactory>
</entityFramework> </entityFramework>
<connectionStrings> <connectionStrings>
<add name="DbModelEntities" connectionString="metadata=res://*/DbModel.csdl|res://*/DbModel.ssdl|res://*/DbModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=SYSMANAGE;persist security info=True;user id=sa;password=123456;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" /> <add name="DbModelEntities" connectionString="metadata=res://*/DbModel.csdl|res://*/DbModel.ssdl|res://*/DbModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=47.96.124.15;initial catalog=JCBB_MB;persist security info=True;user id=sa;password=valtai;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings> </connectionStrings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" /></startup>
<runtime> <runtime>
......
...@@ -61,8 +61,9 @@ namespace G.MES.DataAdapter ...@@ -61,8 +61,9 @@ namespace G.MES.DataAdapter
public DbSet<CodeClassify> CodeClassify { get; set; } public DbSet<CodeClassify> CodeClassify { get; set; }
public DbSet<CodeValue> CodeValue { get; set; } public DbSet<CodeValue> CodeValue { get; set; }
public DbSet<Gene> Gene { get; set; } public DbSet<Gene> Gene { get; set; }
public DbSet<Chemotherapy> Chemotherapy { get; set; }
public DbSet<GeneCorrelation> GeneCorrelation { get; set; } public DbSet<GeneCorrelation> GeneCorrelation { get; set; }
public DbSet<Summary> Summary { get; set; }
public DbSet<ClientInfo> ClientInfo { get; set; } public DbSet<ClientInfo> ClientInfo { get; set; }
public DbSet<Chemotherapy> Chemotherapy { get; set; }
} }
} }
// 为模型“D:\Project\NEWAPI\3.SourceCode\NEWJCBGAPI\G.MES.DbAdapter\DbModel.edmx”启用了 T4 代码生成。 // 为模型“F:\Work\Project\报告系统\Git\ReportingSystemAPI\G.MES.DbAdapter\DbModel.edmx”启用了 T4 代码生成。
// 要启用旧代码生成功能,请将“代码生成策略”设计器属性的值 // 要启用旧代码生成功能,请将“代码生成策略”设计器属性的值
// 更改为“旧的 ObjectContext”。当在设计器中打开该模型时,此属性会出现在 // 更改为“旧的 ObjectContext”。当在设计器中打开该模型时,此属性会出现在
// “属性”窗口中。 // “属性”窗口中。
......
...@@ -28,6 +28,22 @@ ...@@ -28,6 +28,22 @@
<Property Name="SYS_ORG" Type="uniqueidentifier" /> <Property Name="SYS_ORG" Type="uniqueidentifier" />
<Property Name="SYS_LAST_UPD_BY" Type="uniqueidentifier" /> <Property Name="SYS_LAST_UPD_BY" Type="uniqueidentifier" />
</EntityType> </EntityType>
<EntityType Name="Chemotherapy">
<Key>
<PropertyRef Name="ChemotherapyOID" />
</Key>
<Property Name="ChemotherapyOID" Type="uniqueidentifier" Nullable="false" />
<Property Name="DrugPlan" Type="varchar" MaxLength="50" />
<Property Name="Gene" Type="varchar" MaxLength="50" />
<Property Name="TestSite" Type="varchar" MaxLength="50" />
<Property Name="Genotype" Type="varchar" MaxLength="50" />
<Property Name="MedicationPrompts" Type="text" />
<Property Name="Levels" Type="varchar" MaxLength="50" />
<Property Name="CurrentIndex" Type="int" />
<Property Name="Sys_Create" Type="datetime" />
<Property Name="ParentOID" Type="uniqueidentifier" Nullable="false" />
<Property Name="SampleNumber" Type="varchar" MaxLength="50" />
</EntityType>
<EntityType Name="ClientInfo"> <EntityType Name="ClientInfo">
<Key> <Key>
<PropertyRef Name="ClientInfoOID" /> <PropertyRef Name="ClientInfoOID" />
...@@ -151,7 +167,7 @@ ...@@ -151,7 +167,7 @@
<Property Name="GeneCorrelationOID" Type="uniqueidentifier" Nullable="false" /> <Property Name="GeneCorrelationOID" Type="uniqueidentifier" Nullable="false" />
<Property Name="GeneName" Type="varchar" MaxLength="50" /> <Property Name="GeneName" Type="varchar" MaxLength="50" />
<Property Name="SortNo" Type="int" /> <Property Name="SortNo" Type="int" />
<Property Name="Type" Type="int" /> <Property Name="Type" Type="varchar" MaxLength="50" />
<Property Name="SYS_Created" Type="datetime" /> <Property Name="SYS_Created" Type="datetime" />
<Property Name="SYS_LAST_UPD" Type="datetime" /> <Property Name="SYS_LAST_UPD" Type="datetime" />
<Property Name="SYS_CreatedBy" Type="uniqueidentifier" /> <Property Name="SYS_CreatedBy" Type="uniqueidentifier" />
...@@ -319,6 +335,22 @@ ...@@ -319,6 +335,22 @@
<Property Name="SYS_ORG" Type="uniqueidentifier" /> <Property Name="SYS_ORG" Type="uniqueidentifier" />
<Property Name="SYS_LAST_UPD_BY" Type="uniqueidentifier" /> <Property Name="SYS_LAST_UPD_BY" Type="uniqueidentifier" />
</EntityType> </EntityType>
<EntityType Name="Summary">
<Key>
<PropertyRef Name="SummaryOID" />
</Key>
<Property Name="SummaryOID" Type="uniqueidentifier" Nullable="false" />
<Property Name="Gene" Type="varchar" MaxLength="50" />
<Property Name="Position" Type="varchar" MaxLength="50" />
<Property Name="Annotation" Type="text" />
<Property Name="Abundance" Type="varchar" MaxLength="50" />
<Property Name="Mutations" Type="varchar" MaxLength="50" />
<Property Name="ParentOID" Type="uniqueidentifier" Nullable="false" />
<Property Name="SampleNumber" Type="varchar" MaxLength="50" />
<Property Name="Sys_CreateBy" Type="uniqueidentifier" />
<Property Name="Sys_Create" Type="datetime" />
<Property Name="CurrentIndex" Type="int" />
</EntityType>
<EntityType Name="Sys_AuditLogDetailed"> <EntityType Name="Sys_AuditLogDetailed">
<Key> <Key>
<PropertyRef Name="AuditOID" /> <PropertyRef Name="AuditOID" />
...@@ -590,6 +622,7 @@ ...@@ -590,6 +622,7 @@
<EntityContainer Name="DbModelStoreContainer"> <EntityContainer Name="DbModelStoreContainer">
<EntitySet Name="AutoIncReccord" EntityType="Self.AutoIncReccord" Schema="dbo" store:Type="Tables" /> <EntitySet Name="AutoIncReccord" EntityType="Self.AutoIncReccord" Schema="dbo" store:Type="Tables" />
<EntitySet Name="ChemicalDrugReferences" EntityType="Self.ChemicalDrugReferences" Schema="dbo" store:Type="Tables" /> <EntitySet Name="ChemicalDrugReferences" EntityType="Self.ChemicalDrugReferences" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Chemotherapy" EntityType="Self.Chemotherapy" Schema="dbo" store:Type="Tables" />
<EntitySet Name="ClientInfo" EntityType="Self.ClientInfo" Schema="dbo" store:Type="Tables" /> <EntitySet Name="ClientInfo" EntityType="Self.ClientInfo" Schema="dbo" store:Type="Tables" />
<EntitySet Name="CodeClassify" EntityType="Self.CodeClassify" Schema="dbo" store:Type="Tables" /> <EntitySet Name="CodeClassify" EntityType="Self.CodeClassify" Schema="dbo" store:Type="Tables" />
<EntitySet Name="CodeValue" EntityType="Self.CodeValue" Schema="dbo" store:Type="Tables" /> <EntitySet Name="CodeValue" EntityType="Self.CodeValue" Schema="dbo" store:Type="Tables" />
...@@ -604,6 +637,7 @@ ...@@ -604,6 +637,7 @@
<EntitySet Name="PMID" EntityType="Self.PMID" Schema="dbo" store:Type="Tables" /> <EntitySet Name="PMID" EntityType="Self.PMID" Schema="dbo" store:Type="Tables" />
<EntitySet Name="SampleControl" EntityType="Self.SampleControl" Schema="dbo" store:Type="Tables" /> <EntitySet Name="SampleControl" EntityType="Self.SampleControl" Schema="dbo" store:Type="Tables" />
<EntitySet Name="SampleType" EntityType="Self.SampleType" Schema="dbo" store:Type="Tables" /> <EntitySet Name="SampleType" EntityType="Self.SampleType" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Summary" EntityType="Self.Summary" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Sys_AuditLogDetailed" EntityType="Self.Sys_AuditLogDetailed" Schema="dbo" store:Type="Tables" /> <EntitySet Name="Sys_AuditLogDetailed" EntityType="Self.Sys_AuditLogDetailed" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Sys_BusiPortalMenu" EntityType="Self.Sys_BusiPortalMenu" Schema="dbo" store:Type="Tables" /> <EntitySet Name="Sys_BusiPortalMenu" EntityType="Self.Sys_BusiPortalMenu" Schema="dbo" store:Type="Tables" />
<EntitySet Name="Sys_CONTACT" EntityType="Self.Sys_CONTACT" Schema="dbo" store:Type="Tables" /> <EntitySet Name="Sys_CONTACT" EntityType="Self.Sys_CONTACT" Schema="dbo" store:Type="Tables" />
...@@ -695,9 +729,10 @@ ...@@ -695,9 +729,10 @@
<EntitySet Name="CodeClassify" EntityType="DbModel.CodeClassify" /> <EntitySet Name="CodeClassify" EntityType="DbModel.CodeClassify" />
<EntitySet Name="CodeValue" EntityType="DbModel.CodeValue" /> <EntitySet Name="CodeValue" EntityType="DbModel.CodeValue" />
<EntitySet Name="Gene" EntityType="DbModel.Gene" /> <EntitySet Name="Gene" EntityType="DbModel.Gene" />
<EntitySet Name="Chemotherapy" EntityType="DbModel.Chemotherapy" />
<EntitySet Name="GeneCorrelation" EntityType="DbModel.GeneCorrelation" /> <EntitySet Name="GeneCorrelation" EntityType="DbModel.GeneCorrelation" />
<EntitySet Name="Summary" EntityType="DbModel.Summary" />
<EntitySet Name="ClientInfo" EntityType="DbModel.ClientInfo" /> <EntitySet Name="ClientInfo" EntityType="DbModel.ClientInfo" />
<EntitySet Name="Chemotherapy" EntityType="DbModel.Chemotherapy" />
</EntityContainer> </EntityContainer>
<EntityType Name="Sys_BusiPortalMenu"> <EntityType Name="Sys_BusiPortalMenu">
...@@ -1240,18 +1275,6 @@ ...@@ -1240,18 +1275,6 @@
<Property Name="SYS_ORG" Type="Guid" /> <Property Name="SYS_ORG" Type="Guid" />
<Property Name="SYS_LAST_UPD_BY" Type="Guid" /> <Property Name="SYS_LAST_UPD_BY" Type="Guid" />
</EntityType> </EntityType>
<EntityType Name="Chemotherapy">
<Key>
<PropertyRef Name="ChemotherapyOID" />
</Key>
<Property Name="ChemotherapyOID" Type="Guid" Nullable="false" />
<Property Name="DrugPlan" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="Gene" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="TestSite" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="Genotype" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="MedicationPrompts" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
<Property Name="Levels" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
</EntityType>
<EntityType Name="GeneCorrelation"> <EntityType Name="GeneCorrelation">
<Key> <Key>
<PropertyRef Name="GeneCorrelationOID" /> <PropertyRef Name="GeneCorrelationOID" />
...@@ -1259,7 +1282,7 @@ ...@@ -1259,7 +1282,7 @@
<Property Name="GeneCorrelationOID" Type="Guid" Nullable="false" /> <Property Name="GeneCorrelationOID" Type="Guid" Nullable="false" />
<Property Name="GeneName" Type="String" MaxLength="50" FixedLength="false" Unicode="false" /> <Property Name="GeneName" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="SortNo" Type="Int32" /> <Property Name="SortNo" Type="Int32" />
<Property Name="Type" Type="String" /> <Property Name="Type" Type="String" MaxLength="50" Unicode="false" FixedLength="false" />
<Property Name="SYS_Created" Type="DateTime" Precision="3" /> <Property Name="SYS_Created" Type="DateTime" Precision="3" />
<Property Name="SYS_LAST_UPD" Type="DateTime" Precision="3" /> <Property Name="SYS_LAST_UPD" Type="DateTime" Precision="3" />
<Property Name="SYS_CreatedBy" Type="Guid" /> <Property Name="SYS_CreatedBy" Type="Guid" />
...@@ -1269,6 +1292,22 @@ ...@@ -1269,6 +1292,22 @@
<Property Name="SYS_ORG" Type="Guid" /> <Property Name="SYS_ORG" Type="Guid" />
<Property Name="SYS_LAST_UPD_BY" Type="Guid" /> <Property Name="SYS_LAST_UPD_BY" Type="Guid" />
</EntityType> </EntityType>
<EntityType Name="Summary">
<Key>
<PropertyRef Name="SummaryOID" />
</Key>
<Property Name="SummaryOID" Type="Guid" Nullable="false" />
<Property Name="Gene" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="Position" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="Annotation" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
<Property Name="Abundance" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="Mutations" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="ParentOID" Type="Guid" Nullable="false" />
<Property Name="SampleNumber" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="Sys_CreateBy" Type="Guid" />
<Property Name="Sys_Create" Type="DateTime" Precision="3" />
<Property Name="CurrentIndex" Type="Int32" />
</EntityType>
<EntityType Name="ClientInfo"> <EntityType Name="ClientInfo">
<Key> <Key>
<PropertyRef Name="ClientInfoOID" /> <PropertyRef Name="ClientInfoOID" />
...@@ -1331,6 +1370,22 @@ ...@@ -1331,6 +1370,22 @@
<Property Name="ProjectNumber" Type="String" MaxLength="50" FixedLength="false" Unicode="false" /> <Property Name="ProjectNumber" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="DetectingPlatform" Type="String" MaxLength="50" FixedLength="false" Unicode="false" /> <Property Name="DetectingPlatform" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
</EntityType> </EntityType>
<EntityType Name="Chemotherapy">
<Key>
<PropertyRef Name="ChemotherapyOID" />
</Key>
<Property Name="ChemotherapyOID" Type="Guid" Nullable="false" />
<Property Name="DrugPlan" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="Gene" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="TestSite" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="Genotype" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="MedicationPrompts" Type="String" MaxLength="Max" FixedLength="false" Unicode="false" />
<Property Name="Levels" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
<Property Name="CurrentIndex" Type="Int32" />
<Property Name="Sys_Create" Type="DateTime" Precision="3" />
<Property Name="ParentOID" Type="Guid" Nullable="false" />
<Property Name="SampleNumber" Type="String" MaxLength="50" FixedLength="false" Unicode="false" />
</EntityType>
</Schema> </Schema>
</edmx:ConceptualModels> </edmx:ConceptualModels>
...@@ -1840,6 +1895,23 @@ ...@@ -1840,6 +1895,23 @@
</MappingFragment> </MappingFragment>
</EntityTypeMapping> </EntityTypeMapping>
</EntitySetMapping> </EntitySetMapping>
<EntitySetMapping Name="Summary">
<EntityTypeMapping TypeName="DbModel.Summary">
<MappingFragment StoreEntitySet="Summary">
<ScalarProperty Name="CurrentIndex" ColumnName="CurrentIndex" />
<ScalarProperty Name="Sys_Create" ColumnName="Sys_Create" />
<ScalarProperty Name="Sys_CreateBy" ColumnName="Sys_CreateBy" />
<ScalarProperty Name="SampleNumber" ColumnName="SampleNumber" />
<ScalarProperty Name="ParentOID" ColumnName="ParentOID" />
<ScalarProperty Name="Mutations" ColumnName="Mutations" />
<ScalarProperty Name="Abundance" ColumnName="Abundance" />
<ScalarProperty Name="Annotation" ColumnName="Annotation" />
<ScalarProperty Name="Position" ColumnName="Position" />
<ScalarProperty Name="Gene" ColumnName="Gene" />
<ScalarProperty Name="SummaryOID" ColumnName="SummaryOID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
<EntitySetMapping Name="ClientInfo"> <EntitySetMapping Name="ClientInfo">
<EntityTypeMapping TypeName="DbModel.ClientInfo"> <EntityTypeMapping TypeName="DbModel.ClientInfo">
<MappingFragment StoreEntitySet="ClientInfo"> <MappingFragment StoreEntitySet="ClientInfo">
...@@ -1903,6 +1975,23 @@ ...@@ -1903,6 +1975,23 @@
</MappingFragment> </MappingFragment>
</EntityTypeMapping> </EntityTypeMapping>
</EntitySetMapping> </EntitySetMapping>
<EntitySetMapping Name="Chemotherapy">
<EntityTypeMapping TypeName="DbModel.Chemotherapy">
<MappingFragment StoreEntitySet="Chemotherapy">
<ScalarProperty Name="SampleNumber" ColumnName="SampleNumber" />
<ScalarProperty Name="ParentOID" ColumnName="ParentOID" />
<ScalarProperty Name="Sys_Create" ColumnName="Sys_Create" />
<ScalarProperty Name="CurrentIndex" ColumnName="CurrentIndex" />
<ScalarProperty Name="Levels" ColumnName="Levels" />
<ScalarProperty Name="MedicationPrompts" ColumnName="MedicationPrompts" />
<ScalarProperty Name="Genotype" ColumnName="Genotype" />
<ScalarProperty Name="TestSite" ColumnName="TestSite" />
<ScalarProperty Name="Gene" ColumnName="Gene" />
<ScalarProperty Name="DrugPlan" ColumnName="DrugPlan" />
<ScalarProperty Name="ChemotherapyOID" ColumnName="ChemotherapyOID" />
</MappingFragment>
</EntityTypeMapping>
</EntitySetMapping>
</EntityContainerMapping> </EntityContainerMapping>
</Mapping></edmx:Mappings> </Mapping></edmx:Mappings>
</edmx:Runtime> </edmx:Runtime>
......
...@@ -41,9 +41,10 @@ ...@@ -41,9 +41,10 @@
<EntityTypeShape EntityType="DbModel.CodeClassify" Width="1.5" PointX="9.375" PointY="9.75" /> <EntityTypeShape EntityType="DbModel.CodeClassify" Width="1.5" PointX="9.375" PointY="9.75" />
<EntityTypeShape EntityType="DbModel.CodeValue" Width="1.5" PointX="11.375" PointY="4.75" /> <EntityTypeShape EntityType="DbModel.CodeValue" Width="1.5" PointX="11.375" PointY="4.75" />
<EntityTypeShape EntityType="DbModel.Gene" Width="1.5" PointX="11.375" PointY="9.75" /> <EntityTypeShape EntityType="DbModel.Gene" Width="1.5" PointX="11.375" PointY="9.75" />
<EntityTypeShape EntityType="DbModel.Chemotherapy" Width="1.5" PointX="0.75" PointY="13.75" />
<EntityTypeShape EntityType="DbModel.GeneCorrelation" Width="1.5" PointX="3.375" PointY="13.75" /> <EntityTypeShape EntityType="DbModel.GeneCorrelation" Width="1.5" PointX="3.375" PointY="13.75" />
<EntityTypeShape EntityType="DbModel.Summary" Width="1.5" PointX="9.375" PointY="14.75" />
<EntityTypeShape EntityType="DbModel.ClientInfo" Width="1.5" PointX="13.375" PointY="0.75" /> <EntityTypeShape EntityType="DbModel.ClientInfo" Width="1.5" PointX="13.375" PointY="0.75" />
<EntityTypeShape EntityType="DbModel.Chemotherapy" Width="1.5" PointX="0.75" PointY="13.75" />
</Diagram> </Diagram>
</edmx:Diagrams> </edmx:Diagrams>
......
...@@ -18,7 +18,7 @@ namespace WordByDocx.Word ...@@ -18,7 +18,7 @@ namespace WordByDocx.Word
{ {
Spire.Doc.Document document = new Spire.Doc.Document(); Spire.Doc.Document document = new Spire.Doc.Document();
document.LoadFromFile(BaseDic); document.LoadFromFile(BaseDic);
Guid guids = new Guid("7AFD11CC-259F-438B-B5DC-3469C891C5F0"); Guid guids = new Guid("09B141B3-2E2A-4DF7-A9B9-B281B7AC0DAE");
ReplaceText replaceText = new ReplaceText(document); ReplaceText replaceText = new ReplaceText(document);
replaceText.ReplaceUserInfo(guids); replaceText.ReplaceUserInfo(guids);
replaceText.ReplaceTMBTable(); replaceText.ReplaceTMBTable();
...@@ -27,6 +27,7 @@ namespace WordByDocx.Word ...@@ -27,6 +27,7 @@ namespace WordByDocx.Word
replaceText.ReplaceChemicalMedicineReferences(); replaceText.ReplaceChemicalMedicineReferences();
replaceText.ReplaceGeneList(); replaceText.ReplaceGeneList();
replaceText.ReplaceSummary(); replaceText.ReplaceSummary();
replaceText.ReplaceChemotherapy();
document.SaveToFile(OutDic + "out.docx"); document.SaveToFile(OutDic + "out.docx");
using (var documentDocx = DocX.Load(OutDic + "out.docx")) using (var documentDocx = DocX.Load(OutDic + "out.docx"))
{ {
......
...@@ -44,6 +44,15 @@ namespace WordByDocx.Word ...@@ -44,6 +44,15 @@ namespace WordByDocx.Word
} }
/// <summary> /// <summary>
/// 获取化疗结果
/// </summary>
/// <returns></returns>
public static DataTable GetChemotherapy()
{
return svc.GetChemotherapyDrugs();
}
/// <summary>
/// 获取TMB表格(这里不考虑线程的问题) /// 获取TMB表格(这里不考虑线程的问题)
/// </summary> /// </summary>
public static List<TMBTable> GetTMBTable() public static List<TMBTable> GetTMBTable()
......
...@@ -80,7 +80,7 @@ namespace WordByDocx.Word ...@@ -80,7 +80,7 @@ namespace WordByDocx.Word
p3.AppendText(heards[i]); p3.AppendText(heards[i]);
} }
bool mergeFlag = false; bool mergeFlag = false;
Guid preOID = Guid.Empty; string preOID = string.Empty;
for (int r = 0; r < summaries.Rows.Count; r++) for (int r = 0; r < summaries.Rows.Count; r++)
{ {
TableRow dataRow = table.Rows[r + 1]; TableRow dataRow = table.Rows[r + 1];
...@@ -90,14 +90,77 @@ namespace WordByDocx.Word ...@@ -90,14 +90,77 @@ namespace WordByDocx.Word
dataRow.Cells[i].CellFormat.VerticalAlignment = Spire.Doc.Documents.VerticalAlignment.Middle; dataRow.Cells[i].CellFormat.VerticalAlignment = Spire.Doc.Documents.VerticalAlignment.Middle;
Paragraph p = dataRow.Cells[i].AddParagraph(); Paragraph p = dataRow.Cells[i].AddParagraph();
p.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center; p.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center;
p.AppendText(summaries.Rows[r][tableHeards[i]].ToString()); string val = summaries.Rows[r][tableHeards[i]].ToString();
p.AppendText(val);
if (string.IsNullOrEmpty(val))
{
table.ApplyVerticalMerge(i, r, r + 1);
}
//else
//{
// preOID = summaries.Rows[r]["SummaryOID"].ToString();
//}
} }
} }
body.ChildObjects.Remove(paragraph); body.ChildObjects.Remove(paragraph);
body.ChildObjects.Insert(index, table); body.ChildObjects.Insert(index, table);
} }
/// <summary>
/// 替换化疗结果
/// </summary>
public void ReplaceChemotherapy()
{
DataTable summaries = GetData.GetChemotherapy();
string[] heards = new string[] { "药物", "基因", "检测位点", "基因型", "用药提示", "级别" };
string[] tableHeards = new string[] { "DrugPlan", "Gene", "TestSite", "Genotype", "MedicationPrompts", "Levels" };
Section section = document.Sections[0];
TextSelection selection = document.FindString("#{Chemotherapy}", true, true);
TextRange range = selection.GetAsOneRange();
Paragraph paragraph = range.OwnerParagraph;
Body body = paragraph.OwnerTextBody;
int index = body.ChildObjects.IndexOf(paragraph);
Table table = section.AddTable(true);
table.ResetCells(summaries.Rows.Count + 1, heards.Length);
//填充数据与样式
for (int i = 0; i < heards.Length; i++)
{
TableRow Frow = table.Rows[0];
Frow.IsHeader = true;
Frow.Height = 30;
Frow.HeightType = TableRowHeightType.Exactly;
Frow.RowFormat.BackColor = Color.LightGoldenrodYellow;
Frow.Cells[i].CellFormat.VerticalAlignment = Spire.Doc.Documents.VerticalAlignment.Middle;
Paragraph p3 = Frow.Cells[i].AddParagraph();
p3.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center;
p3.AppendText(heards[i]);
}
bool mergeFlag = false;
string preOID = string.Empty;
for (int r = 0; r < summaries.Rows.Count; r++)
{
TableRow dataRow = table.Rows[r + 1];
dataRow.Height = 25;
for (int i = 0; i < tableHeards.Length; i++)
{
dataRow.Cells[i].CellFormat.VerticalAlignment = Spire.Doc.Documents.VerticalAlignment.Middle;
Paragraph p = dataRow.Cells[i].AddParagraph();
p.Format.HorizontalAlignment = Spire.Doc.Documents.HorizontalAlignment.Center;
string val = summaries.Rows[r][tableHeards[i]].ToString();
p.AppendText(val);
if (string.IsNullOrEmpty(val))
{
table.ApplyVerticalMerge(i, r, r + 1);
}
//else
//{
// preOID = summaries.Rows[r]["SummaryOID"].ToString();
//}
}
}
body.ChildObjects.Remove(paragraph);
body.ChildObjects.Insert(index, table);
}
/// <summary> /// <summary>
/// 替换TMB表格 /// 替换TMB表格
/// </summary> /// </summary>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论