Browse Source

重点人群续约率

jeremy 11 months ago
parent
commit
721cf4527c

+ 5 - 0
src/VitalMixtureService/DBService/Entities/CountyHealthPlatformStatisticsEntity.cs

@@ -204,6 +204,11 @@ namespace VitalService.Entities
         /// <value></value>
         public int KeyPeopleSignNum { get; set; }
         /// <summary>
+        /// 重点人群续约人数
+        /// </summary>
+        /// <value></value>
+        public int KeyPeopleRenewalsNum { get; set; }
+        /// <summary>
         /// 重点人群数量
         /// </summary>
         /// <value></value>

+ 6 - 0
src/VitalMixtureService/DBService/Entities/DoctorStatisticsEntity.cs

@@ -69,6 +69,12 @@ namespace VitalService.Entities
         /// <value></value>
         public int KeyPeopleSignNum { get; set; }
 
+        /// <summary>
+        /// 重点人群续约人数
+        /// </summary>
+        /// <value></value>
+        public int KeyPeopleRenewalsNum { get; set; }
+
         /// <summary>
         /// 重点人群数量
         /// </summary>

+ 6 - 0
src/VitalMixtureService/DBService/Entities/TownHealthPlatformStatisticsEntity.cs

@@ -127,6 +127,12 @@ namespace VitalService.Entities
         /// <value></value>
         public double SignedResidentRenewalRate { get; set; }
 
+        /// <summary>
+        /// 重点人群续约率
+        /// </summary>
+        /// <value></value>
+        public double KeepPeopleRenewalRate { get; set; }
+
         /// <summary>
         /// 签约居民首诊率
         /// </summary>

+ 6 - 0
src/VitalMixtureService/DBService/Service/DoctorStatisticsDBService.cs

@@ -121,6 +121,7 @@ namespace VitalService.Service
                                 statisticsDetail.SignQualifiedArchivesNum = 0;
                             }
                             statisticsDetail.RenewalsNum = 0;// 续约人数
+                            statisticsDetail.KeyPeopleRenewalsNum = 0;// 重点人群续约人数
                             var contractedPatients = contractRecords.Where(x => x.ServiceStartDate <= DateTime.Now && x.ServiceEndDate > DateTime.Now).GroupBy(x => x.ContractedPatient);
                             if (contractedPatients != null && contractedPatients.Count() > 0)
                             {
@@ -133,6 +134,10 @@ namespace VitalService.Service
                                         if (count > 1)
                                         {
                                             statisticsDetail.RenewalsNum++;
+                                            if (userKeyPatients.Any(x => x.Code == item.Key))
+                                            {
+                                                statisticsDetail.KeyPeopleRenewalsNum++;
+                                            }
                                         }
                                     }
                                 }
@@ -239,6 +244,7 @@ namespace VitalService.Service
                                     .Set(x => x.SignQualifiedArchivesNum, statisticsDetail.SignQualifiedArchivesNum)
                                     .Set(x => x.SignNum, statisticsDetail.SignNum)
                                     .Set(x => x.RenewalsNum, statisticsDetail.RenewalsNum)
+                                    .Set(x => x.KeyPeopleRenewalsNum, statisticsDetail.KeyPeopleRenewalsNum)
                                     .Set(x => x.KeyPeopleSignNum, statisticsDetail.KeyPeopleSignNum)
                                     .Set(x => x.KeyPeopleNum, statisticsDetail.KeyPeopleNum)
                                     .Set(x => x.ThatDayArchivesNum, statisticsDetail.ThatDayArchivesNum)

+ 6 - 0
src/VitalMixtureService/DBService/Service/VitalHealthStatisticDBService.DoctorChanged.cs

@@ -115,6 +115,7 @@ namespace VitalService.Service
                             QualifiedArchivesNum = doctorStatisticEntities.Sum(x => x.QualifiedArchivesNum),
                             SignQualifiedArchivesNum = doctorStatisticEntities.Sum(x => x.SignQualifiedArchivesNum),
                             RenewalsNum = doctorStatisticEntities.Sum(x => x.RenewalsNum),
+                            KeyPeopleRenewalsNum = doctorStatisticEntities.Sum(x => x.KeyPeopleRenewalsNum),
                             KeyPeopleSignNum = doctorStatisticEntities.Sum(x => x.KeyPeopleSignNum),
                             KeyPeopleNum = doctorStatisticEntities.Sum(x => x.KeyPeopleNum),
                             ThatDay = currentDay,
@@ -153,6 +154,7 @@ namespace VitalService.Service
                         {
                             InternetPlusSignRate = MathRoundPercentage(signTotalCount, archivesTotalCount),
                             SignedResidentRenewalRate = MathRoundPercentage(doctorStatisticEntities.Sum(x => x.RenewalsNum), signTotalCount),
+                            KeepPeopleRenewalRate = MathRoundPercentage(doctorStatisticEntities.Sum(x => x.KeyPeopleRenewalsNum), doctorStatisticEntities.Sum(x => x.KeyPeopleSignNum)),
                             SignedResidentFirstConsultationRate = 0,// TODO
                             SignedResidentEffectiveReferralRate = 0,// TODO
                         };
@@ -260,6 +262,7 @@ namespace VitalService.Service
                             QualifiedArchivesNum = villageStatisticEntities.Sum(x => x.ArchivesStatisticsData.QualifiedArchivesNum),
                             SignQualifiedArchivesNum = villageStatisticEntities.Sum(x => x.ArchivesStatisticsData.SignQualifiedArchivesNum),
                             RenewalsNum = villageStatisticEntities.Sum(x => x.ArchivesStatisticsData.RenewalsNum),
+                            KeyPeopleRenewalsNum = villageStatisticEntities.Sum(x => x.ArchivesStatisticsData.KeyPeopleRenewalsNum),
                             KeyPeopleSignNum = villageStatisticEntities.Sum(x => x.ArchivesStatisticsData.KeyPeopleSignNum),
                             KeyPeopleNum = villageStatisticEntities.Sum(x => x.ArchivesStatisticsData.KeyPeopleNum),
                             ThatDay = currentDay,
@@ -298,6 +301,7 @@ namespace VitalService.Service
                         {
                             InternetPlusSignRate = MathRoundPercentage(signTotalCount, archivesTotalCount),
                             SignedResidentRenewalRate = MathRoundPercentage(villageStatisticEntities.Sum(x => x.ArchivesStatisticsData.RenewalsNum), signTotalCount),
+                            KeepPeopleRenewalRate = MathRoundPercentage(villageStatisticEntities.Sum(x => x.ArchivesStatisticsData.KeyPeopleRenewalsNum), villageStatisticEntities.Sum(x => x.ArchivesStatisticsData.KeyPeopleSignNum)),
                             SignedResidentFirstConsultationRate = 0,// TODO
                             SignedResidentEffectiveReferralRate = 0,// TODO
                         };
@@ -403,6 +407,7 @@ namespace VitalService.Service
                             QualifiedArchivesNum = townStatisticEntities.Sum(x => x.VillageArchivesStatisticsData.QualifiedArchivesNum),
                             SignQualifiedArchivesNum = townStatisticEntities.Sum(x => x.VillageArchivesStatisticsData.SignQualifiedArchivesNum),
                             RenewalsNum = townStatisticEntities.Sum(x => x.VillageArchivesStatisticsData.RenewalsNum),
+                            KeyPeopleRenewalsNum = townStatisticEntities.Sum(x => x.VillageArchivesStatisticsData.KeyPeopleRenewalsNum),
                             KeyPeopleSignNum = townStatisticEntities.Sum(x => x.VillageArchivesStatisticsData.KeyPeopleSignNum),
                             KeyPeopleNum = townStatisticEntities.Sum(x => x.VillageArchivesStatisticsData.KeyPeopleNum),
                             ThatDay = currentDay,
@@ -451,6 +456,7 @@ namespace VitalService.Service
                         {
                             InternetPlusSignRate = MathRoundPercentage(signTotalCount, archivesTotalCount),
                             SignedResidentRenewalRate = MathRoundPercentage(townStatisticEntities.Sum(x => x.VillageArchivesStatisticsData.RenewalsNum), signTotalCount),
+                            KeepPeopleRenewalRate = MathRoundPercentage(townStatisticEntities.Sum(x => x.VillageArchivesStatisticsData.KeyPeopleRenewalsNum), townStatisticEntities.Sum(x => x.VillageArchivesStatisticsData.KeyPeopleSignNum)),
                             SignedResidentFirstConsultationRate = 0,// TODO
                             SignedResidentEffectiveReferralRate = 0,// TODO
                         };