You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							671 lines
						
					
					
						
							25 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							671 lines
						
					
					
						
							25 KiB
						
					
					
				
								using NPOI.POIFS.Properties;
							 | 
						|
								using Shentun.Peis.CustomerOrgs;
							 | 
						|
								using Shentun.Peis.DiagnosisFunctions;
							 | 
						|
								using Shentun.Peis.Models;
							 | 
						|
								using System;
							 | 
						|
								using System.Collections.Generic;
							 | 
						|
								using System.Linq;
							 | 
						|
								using System.Runtime.ConstrainedExecution;
							 | 
						|
								using System.Text;
							 | 
						|
								using System.Threading.Tasks;
							 | 
						|
								using TencentCloud.Ame.V20190916.Models;
							 | 
						|
								using Volo.Abp.Domain.Repositories;
							 | 
						|
								using Volo.Abp.Uow;
							 | 
						|
								using Xunit;
							 | 
						|
								using Xunit.Abstractions;
							 | 
						|
								
							 | 
						|
								namespace Shentun.Peis
							 | 
						|
								{
							 | 
						|
								    public class DiagnosisFunctionAppServiceTest : PeisApplicationTestBase
							 | 
						|
								    {
							 | 
						|
								        private readonly IRepository<CustomerOrg, Guid> _repository;
							 | 
						|
								        private readonly DiagnosisFunctionAppService _appService;
							 | 
						|
								        private readonly ITestOutputHelper _output;
							 | 
						|
								        private readonly IUnitOfWorkManager _unitOfWorkManager;
							 | 
						|
								        public DiagnosisFunctionAppServiceTest(ITestOutputHelper testOutputHelper)
							 | 
						|
								        {
							 | 
						|
								            _output = testOutputHelper;
							 | 
						|
								            _unitOfWorkManager = GetRequiredService<IUnitOfWorkManager>();
							 | 
						|
								            _repository = GetRequiredService<IRepository<CustomerOrg, Guid>>();
							 | 
						|
								            _appService = GetRequiredService<DiagnosisFunctionAppService>();
							 | 
						|
								        }
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task GetDiagnosisResultAsync2()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var getDiagnosisResultRequestDto = new GetDiagnosisResultRequestDto()
							 | 
						|
								                {
							 | 
						|
								                    RegisterCheckId = new Guid("3a11eeb9-81e2-44bc-fd9d-72ca7d3ef9a6"),
							 | 
						|
								                    Items = new List<GetDiagnosisResultRequest_Item>
							 | 
						|
								                    {
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a11eeb8-716b-6103-9e89-dbd9df85227f"),
							 | 
						|
								                            Result = "180/110"
							 | 
						|
								                        },
							 | 
						|
								
							 | 
						|
								                           new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0c5186-2920-6492-c8bf-5908fe6bda56"),
							 | 
						|
								                            Result = "肥胖;其它病"
							 | 
						|
								                        }
							 | 
						|
								                    }
							 | 
						|
								                };
							 | 
						|
								                var result = await _appService.GetDoctorCheckDiagnosisResultAsync(getDiagnosisResultRequestDto);
							 | 
						|
								                foreach (var item in result.DiagnosisResultDetails)
							 | 
						|
								                {
							 | 
						|
								                    _output.WriteLine(item.DiagnosisResult);
							 | 
						|
								                }
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task GetDiagnosisResultAsync3()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var getDiagnosisResultRequestDto = new GetDiagnosisResultRequestDto()
							 | 
						|
								                {
							 | 
						|
								                    RegisterCheckId = new Guid("3a11ee70-0351-8970-5bc5-dc0f72e62339"),
							 | 
						|
								                    Items = new List<GetDiagnosisResultRequest_Item>
							 | 
						|
								                    {
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0c6555-0dad-55b4-b59f-b11e8074cfdd"),
							 | 
						|
								                            Result = "阳性"
							 | 
						|
								                        },
							 | 
						|
								
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0c6558-e2a6-4aab-e6e9-d34957a7c3ed"),
							 | 
						|
								                            Result = "阴性"
							 | 
						|
								                        },
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0c655a-1fdc-2447-6dc9-d8ec8e110d2e"),
							 | 
						|
								                            Result = "阳性"
							 | 
						|
								                        },
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0c655c-1c9f-c8c5-150a-59b3cc351472"),
							 | 
						|
								                            Result = "阴性"
							 | 
						|
								                        },
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0c655d-6ab7-ca7e-3920-3b493ec83192"),
							 | 
						|
								                            Result = "阳性"
							 | 
						|
								                        },
							 | 
						|
								                    }
							 | 
						|
								                };
							 | 
						|
								                var result = await _appService.GetDoctorCheckDiagnosisResultAsync(getDiagnosisResultRequestDto);
							 | 
						|
								                foreach (var item in result.DiagnosisResultDetails)
							 | 
						|
								                {
							 | 
						|
								                    _output.WriteLine(item.DiagnosisResult);
							 | 
						|
								                }
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task GetDiagnosisResultAsync4()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var getDiagnosisResultRequestDto = new GetDiagnosisResultRequestDto()
							 | 
						|
								                {
							 | 
						|
								                    RegisterCheckId = new Guid("3a11ee70-034c-1ce6-40f9-7eabb02830a9"),
							 | 
						|
								                    Items = new List<GetDiagnosisResultRequest_Item>
							 | 
						|
								                    {
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0d2916-3706-a22a-69dd-bd80be509d07"),
							 | 
						|
								                            Result = "30.5"
							 | 
						|
								                        },
							 | 
						|
								
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0d2919-49d5-30d3-4373-b3dc1e806732"),
							 | 
						|
								                            Result = "9"
							 | 
						|
								                        },
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0d2917-40e2-2f81-ebfc-267a9a98b02e"),
							 | 
						|
								                            Result = "91.3"
							 | 
						|
								                        },
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0d291a-6ab5-8642-9cd3-30353ecb5d15"),
							 | 
						|
								                            Result = "90"
							 | 
						|
								                        },
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0d2918-344b-0373-a53c-b4888bd6b9a6"),
							 | 
						|
								                            Result = "13"
							 | 
						|
								                        },
							 | 
						|
								                    }
							 | 
						|
								                };
							 | 
						|
								                var result = await _appService.GetDoctorCheckDiagnosisResultAsync(getDiagnosisResultRequestDto);
							 | 
						|
								                foreach (var item in result.DiagnosisResultDetails)
							 | 
						|
								                {
							 | 
						|
								                    _output.WriteLine(item.DiagnosisResult);
							 | 
						|
								                }
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task GetDiagnosisResultAsync5()
							 | 
						|
								        {
							 | 
						|
								            using (var unitOfWork = _unitOfWorkManager.Begin(isTransactional: true))
							 | 
						|
								            {
							 | 
						|
								                var getDiagnosisResultRequestDto = new GetDiagnosisResultRequestDto()
							 | 
						|
								                {
							 | 
						|
								                    RegisterCheckId = new Guid("3a11ee70-034c-1ce6-40f9-7eabb02830a9"),
							 | 
						|
								                    Items = new List<GetDiagnosisResultRequest_Item>
							 | 
						|
								                    {
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0d2916-3706-a22a-69dd-bd80be509d07"),
							 | 
						|
								                            Result = "30.5"
							 | 
						|
								                        },
							 | 
						|
								
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0d2919-49d5-30d3-4373-b3dc1e806732"),
							 | 
						|
								                            Result = "9"
							 | 
						|
								                        },
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0d2917-40e2-2f81-ebfc-267a9a98b02e"),
							 | 
						|
								                            Result = "91.3"
							 | 
						|
								                        },
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0d291a-6ab5-8642-9cd3-30353ecb5d15"),
							 | 
						|
								                            Result = "90"
							 | 
						|
								                        },
							 | 
						|
								                        new GetDiagnosisResultRequest_Item()
							 | 
						|
								                        {
							 | 
						|
								                            ItemId = new Guid("3a0d2918-344b-0373-a53c-b4888bd6b9a6"),
							 | 
						|
								                            Result = "13"
							 | 
						|
								                        },
							 | 
						|
								                    }
							 | 
						|
								                };
							 | 
						|
								                var result = await _appService.GetDoctorCheckDiagnosisResultAsync(getDiagnosisResultRequestDto);
							 | 
						|
								                foreach (var item in result.DiagnosisResultDetails)
							 | 
						|
								                {
							 | 
						|
								                    _output.WriteLine(item.DiagnosisResult);
							 | 
						|
								                }
							 | 
						|
								            }
							 | 
						|
								        }
							 | 
						|
								        /// <summary>
							 | 
						|
								        /// 体重指数测试结果
							 | 
						|
								        /// </summary>
							 | 
						|
								        [Fact]
							 | 
						|
								        public void GetItemCalculateResultTzzsTest()
							 | 
						|
								        {
							 | 
						|
								            PatientItemCalculateInput patient = new PatientItemCalculateInput();
							 | 
						|
								            patient.SexName = "男";
							 | 
						|
								            patient.Age = 30;
							 | 
						|
								            patient.Items = new List<ItemResultInput>()
							 | 
						|
								            {
							 | 
						|
								                new ItemResultInput()
							 | 
						|
								                {
							 | 
						|
								                    ItemId = Guid.NewGuid(),
							 | 
						|
								                    ItemName = "身高",
							 | 
						|
								                    Result = "122"
							 | 
						|
								                },
							 | 
						|
								                 new ItemResultInput()
							 | 
						|
								                {
							 | 
						|
								                    ItemId = Guid.NewGuid(),
							 | 
						|
								                    ItemName = "体重",
							 | 
						|
								                    Result = "221"
							 | 
						|
								                },
							 | 
						|
								                  new ItemResultInput()
							 | 
						|
								                {
							 | 
						|
								                    ItemId = Guid.NewGuid(),
							 | 
						|
								                    ItemName = "体重指数",
							 | 
						|
								                }
							 | 
						|
								            };
							 | 
						|
								            var result = GetItemCalculateResultTzzs(patient);
							 | 
						|
								            _output.WriteLine("结果:" + result);
							 | 
						|
								            string code = @"
							 | 
						|
								                      string result = """";
							 | 
						|
								            decimal sg = 0;
							 | 
						|
								            decimal tz = 0;
							 | 
						|
								            foreach (var item in patient.Items)
							 | 
						|
								            {
							 | 
						|
								                if (item.ItemName == ""身高"")
							 | 
						|
								                          {
							 | 
						|
								                    if (decimal.TryParse(item.Result, out sg))
							 | 
						|
								                    {
							 | 
						|
								                        if (sg == 0)
							 | 
						|
								                        {
							 | 
						|
								                            return null;
							 | 
						|
								                        }
							 | 
						|
								                    }
							 | 
						|
								                    else
							 | 
						|
								                    {
							 | 
						|
								                        return null;
							 | 
						|
								                    }
							 | 
						|
								
							 | 
						|
								                }
							 | 
						|
								                if (item.ItemName == ""体重"")
							 | 
						|
								                          {
							 | 
						|
								                    if (decimal.TryParse(item.Result, out tz))
							 | 
						|
								                    {
							 | 
						|
								                        if (tz == 0)
							 | 
						|
								                        {
							 | 
						|
								                            return null;
							 | 
						|
								                        }
							 | 
						|
								                    }
							 | 
						|
								                    else
							 | 
						|
								                    {
							 | 
						|
								                        return null;
							 | 
						|
								                    }
							 | 
						|
								
							 | 
						|
								                }
							 | 
						|
								            }
							 | 
						|
								            result = (tz /((sg/100) * (sg / 100))).ToString(""0.00"");
							 | 
						|
								            return result;
							 | 
						|
								                      ";
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								            DiagnosisBuilder diagnosisBuilder = new DiagnosisBuilder();
							 | 
						|
								            result = diagnosisBuilder.GetItemCalculateResult(patient, code);
							 | 
						|
								            _output.WriteLine("动态结果:" + result);
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        /// <summary>
							 | 
						|
								        /// 体重指数
							 | 
						|
								        /// </summary>
							 | 
						|
								        /// <param name="patient"></param>
							 | 
						|
								        /// <returns></returns>
							 | 
						|
								        public string GetItemCalculateResultTzzs(PatientItemCalculateInput patient)
							 | 
						|
								        {
							 | 
						|
								            string result = "";
							 | 
						|
								            decimal sg = 0;
							 | 
						|
								            decimal tz = 0;
							 | 
						|
								
							 | 
						|
								            foreach (var item in patient.Items)
							 | 
						|
								            {
							 | 
						|
								                if (item.ItemName == "身高")
							 | 
						|
								                {
							 | 
						|
								                    if (decimal.TryParse(item.Result, out sg))
							 | 
						|
								                    {
							 | 
						|
								                        if (sg == 0)
							 | 
						|
								                        {
							 | 
						|
								                            return null;
							 | 
						|
								                        }
							 | 
						|
								                    }
							 | 
						|
								                    else
							 | 
						|
								                    {
							 | 
						|
								                        return null;
							 | 
						|
								                    }
							 | 
						|
								
							 | 
						|
								                }
							 | 
						|
								                if (item.ItemName == "体重")
							 | 
						|
								                {
							 | 
						|
								                    if (decimal.TryParse(item.Result, out tz))
							 | 
						|
								                    {
							 | 
						|
								                        if (tz == 0)
							 | 
						|
								                        {
							 | 
						|
								                            return null;
							 | 
						|
								                        }
							 | 
						|
								                    }
							 | 
						|
								                    else
							 | 
						|
								                    {
							 | 
						|
								                        return null;
							 | 
						|
								                    }
							 | 
						|
								
							 | 
						|
								                }
							 | 
						|
								            }
							 | 
						|
								            result = (tz / ((sg / 100) * (sg / 100))).ToString("0.00");
							 | 
						|
								            return result;
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public void GetItemDiagnosisResultXYTest()
							 | 
						|
								        {
							 | 
						|
								            PatientItemDiagnosisInput patient = new PatientItemDiagnosisInput();
							 | 
						|
								            patient.SexName = "男";
							 | 
						|
								            patient.Age = 30;
							 | 
						|
								            patient.Item = new ItemResultInput()
							 | 
						|
								            {
							 | 
						|
								                ItemId = Guid.NewGuid(),
							 | 
						|
								                ItemName = "血压",
							 | 
						|
								                Result = "180/110"
							 | 
						|
								            };
							 | 
						|
								            var result = GetItemDiagnosisResultXY(patient);
							 | 
						|
								            _output.WriteLine("结果:" + result);
							 | 
						|
								            string code = @"
							 | 
						|
								                      string result = """";
							 | 
						|
								            decimal szyDecimal = 0;
							 | 
						|
								            decimal ssyDecimal = 0;
							 | 
						|
								            var itemResult = patient.Item.Result;
							 | 
						|
								            if (string.IsNullOrWhiteSpace(itemResult))
							 | 
						|
								            {
							 | 
						|
								                return null;
							 | 
						|
								            }
							 | 
						|
								            if (itemResult == ""/"")
							 | 
						|
								                return null;
							 | 
						|
								            var pos = itemResult.IndexOf(""/"");
							 | 
						|
								            var szy = itemResult.Substring(0, pos);
							 | 
						|
								            var ssy = itemResult.Substring(pos + 1);
							 | 
						|
								            if (!decimal.TryParse(szy, out szyDecimal))
							 | 
						|
								            {
							 | 
						|
								                return null;
							 | 
						|
								            }
							 | 
						|
								
							 | 
						|
								            if (!decimal.TryParse(ssy, out ssyDecimal))
							 | 
						|
								            {
							 | 
						|
								                return null;
							 | 
						|
								            }
							 | 
						|
								            if (szyDecimal > 180 || ssyDecimal > 110)
							 | 
						|
								            {
							 | 
						|
								                return ""Ⅲ级高血压"";
							 | 
						|
								            }
							 | 
						|
								            if (szyDecimal > 160 || ssyDecimal > 100)
							 | 
						|
								            {
							 | 
						|
								                return ""Ⅱ级高血压"";
							 | 
						|
								            }
							 | 
						|
								            if (szyDecimal > 140 || ssyDecimal > 90)
							 | 
						|
								            {
							 | 
						|
								                return ""Ⅰ级高血压"";
							 | 
						|
								            }
							 | 
						|
								            return result;
							 | 
						|
								                      ";
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								            DiagnosisBuilder diagnosisBuilder = new DiagnosisBuilder();
							 | 
						|
								            result = diagnosisBuilder.GetItemDiagnosisResult(patient, code);
							 | 
						|
								            _output.WriteLine("动态结果:" + result);
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        /// <summary>
							 | 
						|
								        /// 
							 | 
						|
								        /// </summary>
							 | 
						|
								        /// <param name="patient"></param>
							 | 
						|
								        /// <returns></returns>
							 | 
						|
								        public string GetItemDiagnosisResultXY(PatientItemDiagnosisInput patient)
							 | 
						|
								        {
							 | 
						|
								            string result = "";
							 | 
						|
								            decimal szyDecimal = 0;
							 | 
						|
								            decimal ssyDecimal = 0;
							 | 
						|
								            var itemResult = patient.Item.Result;
							 | 
						|
								            if (string.IsNullOrWhiteSpace(itemResult))
							 | 
						|
								            {
							 | 
						|
								                return null;
							 | 
						|
								            }
							 | 
						|
								            if (itemResult == "/")
							 | 
						|
								                return null;
							 | 
						|
								            var pos = itemResult.IndexOf("/");
							 | 
						|
								            var szy = itemResult.Substring(0, pos);
							 | 
						|
								            var ssy = itemResult.Substring(pos + 1);
							 | 
						|
								            if (!decimal.TryParse(szy, out szyDecimal))
							 | 
						|
								            {
							 | 
						|
								                return null;
							 | 
						|
								            }
							 | 
						|
								
							 | 
						|
								            if (!decimal.TryParse(ssy, out ssyDecimal))
							 | 
						|
								            {
							 | 
						|
								                return null;
							 | 
						|
								            }
							 | 
						|
								            if (szyDecimal > 180 || ssyDecimal > 110)
							 | 
						|
								            {
							 | 
						|
								                return "Ⅲ级高血压";
							 | 
						|
								            }
							 | 
						|
								            if (szyDecimal > 160 || ssyDecimal > 100)
							 | 
						|
								            {
							 | 
						|
								                return "Ⅱ级高血压";
							 | 
						|
								            }
							 | 
						|
								            if (szyDecimal > 140 || ssyDecimal > 90)
							 | 
						|
								            {
							 | 
						|
								                return "Ⅰ级高血压";
							 | 
						|
								            }
							 | 
						|
								            return result;
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        /// <summary>
							 | 
						|
								        /// 乙肝五项
							 | 
						|
								        /// </summary>
							 | 
						|
								        [Fact]
							 | 
						|
								        public void GetAsbitemDiagnosisResultYgwxTest()
							 | 
						|
								        {
							 | 
						|
								            var patient = new PatientAsbitemDiagnosisInput();
							 | 
						|
								            patient.SexName = "男";
							 | 
						|
								            patient.Age = 30;
							 | 
						|
								            patient.Items = new List<ItemResultInput>()
							 | 
						|
								            {
							 | 
						|
								                new ItemResultInput()
							 | 
						|
								                {
							 | 
						|
								                    ItemId = Guid.NewGuid(),
							 | 
						|
								                    ItemName = "乙肝表面抗原(HBsAg)",
							 | 
						|
								                    Result = "阳性"
							 | 
						|
								                },
							 | 
						|
								                 new ItemResultInput()
							 | 
						|
								                {
							 | 
						|
								                    ItemId = Guid.NewGuid(),
							 | 
						|
								                    ItemName = "乙肝表面抗体(抗-HBs)",
							 | 
						|
								                    Result = "阴性"
							 | 
						|
								                },
							 | 
						|
								                  new ItemResultInput()
							 | 
						|
								                {
							 | 
						|
								                    ItemId = Guid.NewGuid(),
							 | 
						|
								                    ItemName = "乙肝e抗原(HBeAg)",
							 | 
						|
								                    Result = "阳性"
							 | 
						|
								                },
							 | 
						|
								                    new ItemResultInput()
							 | 
						|
								                {
							 | 
						|
								                    ItemId = Guid.NewGuid(),
							 | 
						|
								                    ItemName = "乙肝e抗体(抗-HBe)",
							 | 
						|
								                    Result = "阴性"
							 | 
						|
								                },
							 | 
						|
								                      new ItemResultInput()
							 | 
						|
								                {
							 | 
						|
								                    ItemId = Guid.NewGuid(),
							 | 
						|
								                    ItemName = "乙肝核心抗体(抗-HBc)",
							 | 
						|
								                    Result = "阳性"
							 | 
						|
								                }
							 | 
						|
								            };
							 | 
						|
								            var result = GetAsbitemDiagnosisResultYgwx(patient);
							 | 
						|
								            _output.WriteLine("结果:" + result);
							 | 
						|
								            string code = @"
							 | 
						|
								                      string msg = null;
							 | 
						|
								            string result1 = """";
							 | 
						|
								            string result2= """";
							 | 
						|
								            string result3 = """";
							 | 
						|
								            string result4 = """";
							 | 
						|
								            string result5 = """";
							 | 
						|
								            foreach (var item in patient.Items)
							 | 
						|
								            {
							 | 
						|
								                if(item.ItemName == ""乙肝表面抗原(HBsAg)"")
							 | 
						|
								                {
							 | 
						|
								                    result1 = item.Result;
							 | 
						|
								                }
							 | 
						|
								                if (item.ItemName == ""乙肝表面抗体(抗-HBs)"")
							 | 
						|
								                {
							 | 
						|
								                    result2 = item.Result;
							 | 
						|
								                }
							 | 
						|
								                if (item.ItemName == ""乙肝e抗原(HBeAg)"")
							 | 
						|
								                {
							 | 
						|
								                    result3 = item.Result;
							 | 
						|
								                }
							 | 
						|
								                if (item.ItemName == ""乙肝e抗体(抗-HBe)"")
							 | 
						|
								                {
							 | 
						|
								                    result4 = item.Result;
							 | 
						|
								                }
							 | 
						|
								                if (item.ItemName == ""乙肝核心抗体(抗-HBc)"")
							 | 
						|
								                {
							 | 
						|
								                    result5 = item.Result;
							 | 
						|
								                }
							 | 
						|
								
							 | 
						|
								            }
							 | 
						|
								            switch (result1 + "","" + result2 + "","" + result3 + "","" + result4 + "","" + result5)
							 | 
						|
								            {
							 | 
						|
								                case ""阳性,阴性,阳性,阴性,阳性"":
							 | 
						|
								                    msg = ""乙肝五项检查大三阳"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阳性,阴性,阴性,阳性,阳性"":
							 | 
						|
								                    msg = ""乙肝五项检查小三阳"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阳性,阴性,阳性,阴性,阴性"":
							 | 
						|
								                    msg = ""乙肝五项检查第一项,第三项阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阴性,阴性,阳性,阳性,阳性"":
							 | 
						|
								                    msg = ""乙肝两对半三,四,五阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阳性,阴性,阴性,阴性,阳性"":
							 | 
						|
								                    msg = ""乙肝五项检查第一项,第五项阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阴性,阴性,阴性,阳性,阳性"":
							 | 
						|
								                    msg = ""乙肝五项检查第四项,第五项阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阳性,阴性,阳性,阳性,阴性"":
							 | 
						|
								                    msg = ""乙肝两对半一,三,四阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阴性,阴性,阳性,阴性,阳性"":
							 | 
						|
								                    msg = ""乙肝五项检查第三项,第五项阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阴性,阴性,阴性,阴性,阴性"":
							 | 
						|
								                    msg = ""乙肝五项全阴"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阴性,阳性,阴性,阴性,阴性"":
							 | 
						|
								                    msg = ""乙肝表面抗体阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阳性,阴性,阴性,阴性,阴性"":
							 | 
						|
								                    msg = ""乙肝表面抗原阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阴性,阳性,阴性,阳性,阳性"":
							 | 
						|
								                    msg = ""乙肝五项检查第二,第四,第五项阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阴性,阴性,阴性,阳性,阴性"":
							 | 
						|
								                    msg = ""乙肝e抗体阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阳性,阴性,阴性,阳性,阴性"":
							 | 
						|
								                    msg = ""乙肝五项检查第一项,第四项阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阴性,阳性,阴性,阴性,阳性"":
							 | 
						|
								                    msg = ""乙肝五项检查第二项,第五项阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阴性,阴性,阴性,阴性,阳性"":
							 | 
						|
								                    msg = ""乙肝核心抗体阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阴性,弱阳性,阴性,阴性,阴性"":
							 | 
						|
								                    msg = ""乙肝表面抗体弱阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                case ""阴性,弱阳性,阴性,阴性,阳性"":
							 | 
						|
								                    msg = ""乙肝五项检查第二项弱阳性,第五项阳性"";
							 | 
						|
								                    break;
							 | 
						|
								                default:
							 | 
						|
								                    msg = """";
							 | 
						|
								                    break;
							 | 
						|
								            }
							 | 
						|
								            return msg;
							 | 
						|
								                      ";
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								            DiagnosisBuilder diagnosisBuilder = new DiagnosisBuilder();
							 | 
						|
								            result = diagnosisBuilder.GetAsbitemDiagnosisResult(patient, code);
							 | 
						|
								            _output.WriteLine("动态结果:" + result);
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        public string GetAsbitemDiagnosisResultYgwx(PatientAsbitemDiagnosisInput patient)
							 | 
						|
								        {
							 | 
						|
								            string msg = null;
							 | 
						|
								            string result1 = "";
							 | 
						|
								            string result2 = "";
							 | 
						|
								            string result3 = "";
							 | 
						|
								            string result4 = "";
							 | 
						|
								            string result5 = "";
							 | 
						|
								            foreach (var item in patient.Items)
							 | 
						|
								            {
							 | 
						|
								                if (item.ItemName == "乙肝表面抗原(HBsAg)")
							 | 
						|
								                {
							 | 
						|
								                    result1 = item.Result;
							 | 
						|
								                }
							 | 
						|
								                if (item.ItemName == "乙肝表面抗体(抗-HBs)")
							 | 
						|
								                {
							 | 
						|
								                    result2 = item.Result;
							 | 
						|
								                }
							 | 
						|
								                if (item.ItemName == "乙肝e抗原(HBeAg)")
							 | 
						|
								                {
							 | 
						|
								                    result3 = item.Result;
							 | 
						|
								                }
							 | 
						|
								                if (item.ItemName == "乙肝e抗体(抗-HBe)")
							 | 
						|
								                {
							 | 
						|
								                    result4 = item.Result;
							 | 
						|
								                }
							 | 
						|
								                if (item.ItemName == "乙肝核心抗体(抗-HBc)")
							 | 
						|
								                {
							 | 
						|
								                    result5 = item.Result;
							 | 
						|
								                }
							 | 
						|
								
							 | 
						|
								            }
							 | 
						|
								            switch (result1 + "," + result2 + "," + result3 + "," + result4 + "," + result5)
							 | 
						|
								            {
							 | 
						|
								                case "阳性,阴性,阳性,阴性,阳性":
							 | 
						|
								                    msg = "乙肝五项检查大三阳";
							 | 
						|
								                    break;
							 | 
						|
								                case "阳性,阴性,阴性,阳性,阳性":
							 | 
						|
								                    msg = "乙肝五项检查小三阳";
							 | 
						|
								                    break;
							 | 
						|
								                case "阳性,阴性,阳性,阴性,阴性":
							 | 
						|
								                    msg = "乙肝五项检查第一项,第三项阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阴性,阴性,阳性,阳性,阳性":
							 | 
						|
								                    msg = "乙肝两对半三,四,五阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阳性,阴性,阴性,阴性,阳性":
							 | 
						|
								                    msg = "乙肝五项检查第一项,第五项阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阴性,阴性,阴性,阳性,阳性":
							 | 
						|
								                    msg = "乙肝五项检查第四项,第五项阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阳性,阴性,阳性,阳性,阴性":
							 | 
						|
								                    msg = "乙肝两对半一,三,四阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阴性,阴性,阳性,阴性,阳性":
							 | 
						|
								                    msg = "乙肝五项检查第三项,第五项阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阴性,阴性,阴性,阴性,阴性":
							 | 
						|
								                    msg = "乙肝五项全阴";
							 | 
						|
								                    break;
							 | 
						|
								                case "阴性,阳性,阴性,阴性,阴性":
							 | 
						|
								                    msg = "乙肝表面抗体阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阳性,阴性,阴性,阴性,阴性":
							 | 
						|
								                    msg = "乙肝表面抗原阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阴性,阳性,阴性,阳性,阳性":
							 | 
						|
								                    msg = "乙肝五项检查第二,第四,第五项阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阴性,阴性,阴性,阳性,阴性":
							 | 
						|
								                    msg = "乙肝e抗体阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阳性,阴性,阴性,阳性,阴性":
							 | 
						|
								                    msg = "乙肝五项检查第一项,第四项阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阴性,阳性,阴性,阴性,阳性":
							 | 
						|
								                    msg = "乙肝五项检查第二项,第五项阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阴性,阴性,阴性,阴性,阳性":
							 | 
						|
								                    msg = "乙肝核心抗体阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阴性,弱阳性,阴性,阴性,阴性":
							 | 
						|
								                    msg = "乙肝表面抗体弱阳性";
							 | 
						|
								                    break;
							 | 
						|
								                case "阴性,弱阳性,阴性,阴性,阳性":
							 | 
						|
								                    msg = "乙肝五项检查第二项弱阳性,第五项阳性";
							 | 
						|
								                    break;
							 | 
						|
								                default:
							 | 
						|
								                    msg = "";
							 | 
						|
								                    break;
							 | 
						|
								            }
							 | 
						|
								            return msg;
							 | 
						|
								        }
							 | 
						|
								    }
							 | 
						|
								}
							 |