增加中心ORR统计
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
df8292b2a5
commit
834f6be548
|
|
@ -137,7 +137,23 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public int SubjectCount => SubjectCodeList.Count();
|
||||
|
||||
public List<string> SubjectCodeList { get; set; }
|
||||
public List<EfficacyEvaluationSubjectInfo> SubjectCodeList { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class EfficacyEvaluationSubjectInfo
|
||||
{
|
||||
public string TrialSiteCode { get; set; }
|
||||
|
||||
public string SubjectCode { get; set; }
|
||||
}
|
||||
|
||||
public class TrialSiteOrrStat
|
||||
{
|
||||
public string TrialSiteCode { get; set; }
|
||||
public int SiteSubjectCount { get; set; }
|
||||
public int SiteCrPrSubjectCount { get; set; }
|
||||
public string OrrPercent { get; set; }
|
||||
}
|
||||
|
||||
public class EfficacyEvaluationExport
|
||||
|
|
@ -152,6 +168,8 @@ namespace IRaCIS.Core.Application.ViewModel
|
|||
|
||||
public Guid SubjectId { get; set; }
|
||||
|
||||
public string TrialSiteCode { get; set; }
|
||||
|
||||
public string SubjectCode { get; set; } = String.Empty;
|
||||
|
||||
public decimal VisitTaskNum { get; set; }
|
||||
|
|
|
|||
|
|
@ -162,6 +162,7 @@ public class TrialStatService(
|
|||
{
|
||||
Id = t.Id,
|
||||
SubjectId = t.SubjectId,
|
||||
TrialSiteCode=t.Subject.TrialSite.TrialSiteCode,
|
||||
SubjectCode = t.Subject.Code,
|
||||
VisitTaskNum = t.VisitTaskNum,
|
||||
TaskName = t.TaskName,
|
||||
|
|
@ -236,7 +237,7 @@ public class TrialStatService(
|
|||
DictionaryCode = g.FirstOrDefault()?.DictionaryCode,
|
||||
OverallTumorEvaluation = g.Key,
|
||||
Code = g.Key,
|
||||
SubjectCodeList = g.Select(t => t.SubjectCode).Distinct().ToList()
|
||||
SubjectCodeList = g.Select(t => new EfficacyEvaluationSubjectInfo { SubjectCode= t.SubjectCode, TrialSiteCode=t.TrialSiteCode }).Distinct().ToList()
|
||||
}).ToList();
|
||||
|
||||
|
||||
|
|
@ -260,22 +261,15 @@ public class TrialStatService(
|
|||
DictionaryCode = dicName,
|
||||
Code = t.Code, //方便找到首次PD的日期
|
||||
OverallTumorEvaluation = t.Value,//翻译后的值
|
||||
SubjectCodeList = resultDict.ContainsKey(t.Code) ? resultDict[t.Code] : new List<string>()
|
||||
SubjectCodeList = resultDict.ContainsKey(t.Code) ? resultDict[t.Code] : new List<EfficacyEvaluationSubjectInfo>()
|
||||
})
|
||||
.ToList();
|
||||
|
||||
// (cr +pr) /总人数
|
||||
|
||||
var crAddPr = translateList.Where(t => t.OverallTumorEvaluation == "PR" || t.OverallTumorEvaluation == "CR").Sum(t => t.SubjectCount);
|
||||
|
||||
var orrPercent = totalSubjectCount > 0
|
||||
? ((decimal)crAddPr / totalSubjectCount * 100).ToString("0.00") + "%"
|
||||
: "0.00%";
|
||||
|
||||
var pdInfo = translateList
|
||||
.WhereIf(criterion.CriterionType == CriterionType.IRECIST1Point1, t => t.OverallTumorEvaluation == "iCPD")
|
||||
.WhereIf(criterion.CriterionType == CriterionType.Lugano2014, t => t.OverallTumorEvaluation == "PMD/PD")
|
||||
.WhereIf(criterion.CriterionType != CriterionType.IRECIST1Point1 && criterion.CriterionType != CriterionType.IRECIST1Point1, t => t.OverallTumorEvaluation == "PD")
|
||||
.WhereIf(criterion.CriterionType != CriterionType.IRECIST1Point1 && criterion.CriterionType != CriterionType.Lugano2014, t => t.OverallTumorEvaluation == "PD")
|
||||
.FirstOrDefault();
|
||||
|
||||
var firstPdList = new List<FirstPdInfo>();
|
||||
|
|
@ -300,8 +294,47 @@ public class TrialStatService(
|
|||
|
||||
}
|
||||
|
||||
// (cr +pr) /总人数
|
||||
|
||||
return ResponseOutput.Ok(translateList, new { PDList = firstPdList, ORR = orrPercent });
|
||||
var crAddPr = translateList.Where(t => t.OverallTumorEvaluation == "PR" || t.OverallTumorEvaluation == "CR").Sum(t => t.SubjectCount);
|
||||
|
||||
var orrPercent = totalSubjectCount > 0
|
||||
? ((decimal)crAddPr / totalSubjectCount * 100).ToString("0.00") + "%"
|
||||
: "0.00%";
|
||||
|
||||
|
||||
var centerOrrList = translateList
|
||||
// 先把 Subject 拆平
|
||||
.SelectMany(t => t.SubjectCodeList.Select(s => new
|
||||
{
|
||||
s.TrialSiteCode,
|
||||
s.SubjectCode,
|
||||
t.OverallTumorEvaluation
|
||||
}))
|
||||
// 按中心分组
|
||||
.GroupBy(x => x.TrialSiteCode)
|
||||
.Select(g =>
|
||||
{
|
||||
var total = g.Count();
|
||||
|
||||
var crPr = g.Count(x =>
|
||||
x.OverallTumorEvaluation == "CR" ||
|
||||
x.OverallTumorEvaluation == "PR");
|
||||
|
||||
return new TrialSiteOrrStat
|
||||
{
|
||||
TrialSiteCode = g.Key,
|
||||
SiteSubjectCount = total,
|
||||
SiteCrPrSubjectCount = crPr,
|
||||
OrrPercent = total > 0
|
||||
? ((decimal)crPr / total * 100).ToString("0.00") + "%"
|
||||
: "0.00%"
|
||||
};
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
||||
return ResponseOutput.Ok(translateList, new { PDList = firstPdList, ORR = orrPercent,SiteORRList= centerOrrList });
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue