| 
					
					
						
							
						
					
					
				 | 
				@ -143,7 +143,6 @@ namespace Shentun.Peis.PhoneFollowUps | 
			
		
		
	
		
			
				 | 
				 | 
				        } | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				        /// <summary>
 | 
				 | 
				 | 
				        /// <summary>
 | 
			
		
		
	
		
			
				 | 
				 | 
				        /// 获取所有危急值列表
 | 
				 | 
				 | 
				        /// 获取所有危急值列表
 | 
			
		
		
	
		
			
				 | 
				 | 
				        /// </summary>
 | 
				 | 
				 | 
				        /// </summary>
 | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -363,17 +362,11 @@ namespace Shentun.Peis.PhoneFollowUps | 
			
		
		
	
		
			
				 | 
				 | 
				        [HttpPost("api/app/PhoneFollowUp/AutoCreate")] | 
				 | 
				 | 
				        [HttpPost("api/app/PhoneFollowUp/AutoCreate")] | 
			
		
		
	
		
			
				 | 
				 | 
				        public async Task AutoCreateAsync(AutoCreatePhoneFollowUpDto input) | 
				 | 
				 | 
				        public async Task AutoCreateAsync(AutoCreatePhoneFollowUpDto input) | 
			
		
		
	
		
			
				 | 
				 | 
				        { | 
				 | 
				 | 
				        { | 
			
		
		
	
		
			
				 | 
				 | 
				            if (string.IsNullOrWhiteSpace(input.ModeValue)) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                throw new UserFriendlyException("计划周期不能为空"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				            } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				            if (input.FollowUpMode == FollowUpModeFlag.Corn && string.IsNullOrWhiteSpace(input.EndDate)) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (string.IsNullOrWhiteSpace(input.StartDate)) | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				                throw new UserFriendlyException("采用corn表达式时需要截止日期"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                throw new UserFriendlyException("开始时间不能为空"); | 
			
		
		
	
		
			
				 | 
				 | 
				            } | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				            var isPhoneFollowUp = await _phoneFollowUpRepository.CountAsync(c => c.FollowUpId == input.FollowUpId); | 
				 | 
				 | 
				            var isPhoneFollowUp = await _phoneFollowUpRepository.CountAsync(c => c.FollowUpId == input.FollowUpId); | 
			
		
		
	
		
			
				 | 
				 | 
				            if (isPhoneFollowUp > 0) | 
				 | 
				 | 
				            if (isPhoneFollowUp > 0) | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				            { | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -389,82 +382,26 @@ namespace Shentun.Peis.PhoneFollowUps | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				            List<PhoneFollowUp> phoneFollowUpList = new List<PhoneFollowUp>(); | 
				 | 
				 | 
				            List<PhoneFollowUp> phoneFollowUpList = new List<PhoneFollowUp>(); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				            if (input.FollowUpMode == FollowUpModeFlag.Corn) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                //corn表达式
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                #region 解析Cron表达式
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                try | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var schedule = CronExpression.Parse(input.ModeValue, CronFormat.IncludeSeconds); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var occurrences = schedule.GetOccurrences(DateTime.UtcNow, Convert.ToDateTime(input.EndDate).ToUniversalTime());  //获取截止时间前所有的计划时间
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                    foreach (var occurrence in occurrences) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        var phoneFollowUpEntity = new PhoneFollowUp(GuidGenerator.Create()) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            FollowUpContent = input.FollowUpContent, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            FollowUpId = input.FollowUpId, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            ReplyContent = input.ReplyContent, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            PlanFollowDate = occurrence, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            IsComplete = 'N' | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        }; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                        phoneFollowUpList.Add(phoneFollowUpEntity); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                catch (Exception ex) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            for (int i = 0; i < input.GenerateCount; i++) | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				                    throw new UserFriendlyException("Corn表达式不正确"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                DateTime planFollowDate = Convert.ToDateTime(input.StartDate); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                #endregion
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				            } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				            else | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                //其他模式
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                int planCount = 0; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                try | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    planCount = Convert.ToInt32(input.ModeValue); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                catch (Exception ex) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    throw new UserFriendlyException("Corn表达式不正确"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                for (int i = 0; i < planCount; i++) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    DateTime planFollowDate = DateTime.Now; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (input.FollowUpMode == FollowUpModeFlag.Day) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        planFollowDate = planFollowDate.AddDays(i); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    else if (input.FollowUpMode == FollowUpModeFlag.Week) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        planFollowDate = planFollowDate.AddDays(7 * i); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    else if (input.FollowUpMode == FollowUpModeFlag.Month) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        planFollowDate = planFollowDate.AddMonths(i); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    else if (input.FollowUpMode == FollowUpModeFlag.Year) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        planFollowDate = planFollowDate.AddYears(i); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                planFollowDate = planFollowDate.AddDays(i * input.IntervalDays); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                var phoneFollowUpEntity = new PhoneFollowUp(GuidGenerator.Create()) | 
				 | 
				 | 
				                var phoneFollowUpEntity = new PhoneFollowUp(GuidGenerator.Create()) | 
			
		
		
	
		
			
				 | 
				 | 
				                { | 
				 | 
				 | 
				                { | 
			
		
		
	
		
			
				 | 
				 | 
				                    FollowUpContent = input.FollowUpContent, | 
				 | 
				 | 
				                    FollowUpContent = input.FollowUpContent, | 
			
		
		
	
		
			
				 | 
				 | 
				                    FollowUpId = input.FollowUpId, | 
				 | 
				 | 
				                    FollowUpId = input.FollowUpId, | 
			
		
		
	
		
			
				 | 
				 | 
				                        ReplyContent = input.ReplyContent, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    PlanFollowDate = planFollowDate, | 
				 | 
				 | 
				                    PlanFollowDate = planFollowDate, | 
			
		
		
	
		
			
				 | 
				 | 
				                    IsComplete = 'N' | 
				 | 
				 | 
				                    IsComplete = 'N' | 
			
		
		
	
		
			
				 | 
				 | 
				                }; | 
				 | 
				 | 
				                }; | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                phoneFollowUpList.Add(phoneFollowUpEntity); | 
				 | 
				 | 
				                phoneFollowUpList.Add(phoneFollowUpEntity); | 
			
		
		
	
		
			
				 | 
				 | 
				            } | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				            } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				            if (phoneFollowUpList.Any()) | 
				 | 
				 | 
				            if (phoneFollowUpList.Any()) | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				            { | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -474,8 +411,8 @@ namespace Shentun.Peis.PhoneFollowUps | 
			
		
		
	
		
			
				 | 
				 | 
				                await _followUpRepository.UpdateAsync(followUpEnt); | 
				 | 
				 | 
				                await _followUpRepository.UpdateAsync(followUpEnt); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				            } | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				        } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				        /// <summary>
 | 
				 | 
				 | 
				        /// <summary>
 | 
			
		
		
	
		
			
				 | 
				 | 
				        /// 新增电话随访记录
 | 
				 | 
				 | 
				        /// 新增电话随访记录
 | 
			
		
		
	
		
			
				 | 
				 | 
				        /// </summary>
 | 
				 | 
				 | 
				        /// </summary>
 | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -500,7 +437,6 @@ namespace Shentun.Peis.PhoneFollowUps | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				                FollowUpContent = input.FollowUpContent, | 
				 | 
				 | 
				                FollowUpContent = input.FollowUpContent, | 
			
		
		
	
		
			
				 | 
				 | 
				                FollowUpId = input.FollowUpId, | 
				 | 
				 | 
				                FollowUpId = input.FollowUpId, | 
			
		
		
	
		
			
				 | 
				 | 
				                ReplyContent = input.ReplyContent, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                PlanFollowDate = Convert.ToDateTime(input.PlanFollowDate), | 
				 | 
				 | 
				                PlanFollowDate = Convert.ToDateTime(input.PlanFollowDate), | 
			
		
		
	
		
			
				 | 
				 | 
				                IsComplete = 'N' | 
				 | 
				 | 
				                IsComplete = 'N' | 
			
		
		
	
		
			
				 | 
				 | 
				            }; | 
				 | 
				 | 
				            }; | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -556,5 +492,6 @@ namespace Shentun.Peis.PhoneFollowUps | 
			
		
		
	
		
			
				 | 
				 | 
				            await _phoneFollowUpRepository.DeleteAsync(input.PhoneFollowUpId); | 
				 | 
				 | 
				            await _phoneFollowUpRepository.DeleteAsync(input.PhoneFollowUpId); | 
			
		
		
	
		
			
				 | 
				 | 
				        } | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				    } | 
				 | 
				 | 
				    } | 
			
		
		
	
		
			
				 | 
				 | 
				} | 
				 | 
				 | 
				} |