| 
					
					
						
							
						
					
					
				 | 
				@ -43,235 +43,257 @@ namespace Shentun.Peis.PlugIns.Gem | 
			
		
		
	
		
			
				 | 
				 | 
				        { | 
				 | 
				 | 
				        { | 
			
		
		
	
		
			
				 | 
				 | 
				            await LoginAsync(); | 
				 | 
				 | 
				            await LoginAsync(); | 
			
		
		
	
		
			
				 | 
				 | 
				            await InitAsync(); | 
				 | 
				 | 
				            await InitAsync(); | 
			
		
		
	
		
			
				 | 
				 | 
				            for(var i = 0;i<30;i++) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            for (var i = 0; i < 30; i++) | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				                var qztlPatientRegisterFromInterface = await CallInterfaceServiceAsync(); | 
				 | 
				 | 
				                var qztlPatientRegisterFromInterface = await CallInterfaceServiceAsync(); | 
			
		
		
	
		
			
				 | 
				 | 
				                if (qztlPatientRegisterFromInterface == null || !qztlPatientRegisterFromInterface.plans.Any()) | 
				 | 
				 | 
				                if (qztlPatientRegisterFromInterface == null || !qztlPatientRegisterFromInterface.plans.Any()) | 
			
		
		
	
		
			
				 | 
				 | 
				                { | 
				 | 
				 | 
				                { | 
			
		
		
	
		
			
				 | 
				 | 
				                    return; | 
				 | 
				 | 
				                    return; | 
			
		
		
	
		
			
				 | 
				 | 
				                } | 
				 | 
				 | 
				                } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                //设置导入人员信息
 | 
				 | 
				 | 
				                //设置导入人员信息
 | 
			
		
		
	
		
			
				 | 
				 | 
				                foreach (var patient in qztlPatientRegisterFromInterface.plans) | 
				 | 
				 | 
				                foreach (var patient in qztlPatientRegisterFromInterface.plans) | 
			
		
		
	
		
			
				 | 
				 | 
				                { | 
				 | 
				 | 
				                { | 
			
		
		
	
		
			
				 | 
				 | 
				                    //婚姻状况
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var maritalStatusId = ConvertMaritalStatus(patient.wedding); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    //人员类别
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var personnelType = ConvertPersonnelType(patient.tjJieduan); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    //性别
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var sexId = ConvertSex(patient.sex); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    //体检类别
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var medicalTypeName = patient.tjpcV; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    MedicalTypeDto medicalTypeDto = null; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (!string.IsNullOrWhiteSpace(medicalTypeName)) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    try | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				                    { | 
			
		
		
	
		
			
				 | 
				 | 
				                        medicalTypeDto = await CallAppServiceAsync<DisplayNameInputDto, MedicalTypeDto>( | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                       "api/app/MedicalType/GetByDisplayName", new DisplayNameInputDto() { DisplayName = medicalTypeName }); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        if (medicalTypeDto == null) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        //婚姻状况
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var maritalStatusId = ConvertMaritalStatus(patient.wedding); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        //人员类别
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var personnelType = ConvertPersonnelType(patient.tjJieduan); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        //性别
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var sexId = ConvertSex(patient.sex); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        //体检类别
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var medicalTypeName = patient.tjpcV; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        MedicalTypeDto medicalTypeDto = null; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (!string.IsNullOrWhiteSpace(medicalTypeName)) | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            var createMedicalTypeDto = new CreateMedicalTypeDto() | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            medicalTypeDto = await CallAppServiceAsync<DisplayNameInputDto, MedicalTypeDto>( | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                           "api/app/MedicalType/GetByDisplayName", new DisplayNameInputDto() { DisplayName = medicalTypeName }); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            if (medicalTypeDto == null) | 
			
		
		
	
		
			
				 | 
				 | 
				                            { | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				                                DisplayName = medicalTypeName, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            }; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            medicalTypeDto = await CallAppServiceAsync<CreateMedicalTypeDto, MedicalTypeDto>( | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            "api/app/medical-type", new CreateMedicalTypeDto() { DisplayName = medicalTypeName }); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                var createMedicalTypeDto = new CreateMedicalTypeDto() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                    DisplayName = medicalTypeName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                }; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                medicalTypeDto = await CallAppServiceAsync<CreateMedicalTypeDto, MedicalTypeDto>( | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                "api/app/medical-type", new CreateMedicalTypeDto() { DisplayName = medicalTypeName }); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        //职称
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var jobTitle = ConvertJobTitle(patient.gradeZwV); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        //职务
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var jobPost = ConvertJobPost(patient.tjTab1); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        string workTypeV = patient.workTypeV; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (string.IsNullOrWhiteSpace(workTypeV)) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            workTypeV = ""; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        else | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            workTypeV = "," + workTypeV; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        jobPost = jobPost + workTypeV; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (!string.IsNullOrWhiteSpace(jobPost) && jobPost.Length >= 10) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            jobPost = jobPost.Substring(0, 10);//只能存储10个汉字
 | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    //职称
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var jobTitle = ConvertJobTitle(patient.gradeZwV); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    //职务
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var jobPost = ConvertJobPost(patient.tjTab1); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    string workTypeV = patient.workTypeV; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (string.IsNullOrWhiteSpace(workTypeV)) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        workTypeV = ""; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    else | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        workTypeV = "," + workTypeV; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    jobPost = jobPost + workTypeV; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (!string.IsNullOrWhiteSpace(jobPost) && jobPost.Length >= 10) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        jobPost = jobPost.Substring(0, 10);//只能存储10个汉字
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                    //查找子单位是否存在,如存在获取子单位id,如果不存在这创建子单位
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var orgName = patient.orgName; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var pos = orgName.IndexOf("_"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    orgName = orgName.Substring(0, pos); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (string.IsNullOrWhiteSpace(patient.mobile)) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        //青海省第五人民医院要强行设置为 11111111111
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var customerOrgDtos = await CallAppServiceAsync<CustomerOrgIdInputDto, List<CustomerOrgDto>>( | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                       "api/app/CustomerOrg/GetChildCustomerOrgsById", | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                       new CustomerOrgIdInputDto() { CustomerOrgId = _importCustomerOrgId }); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    CustomerOrgDto customerOrgDto = null; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (customerOrgDtos != null && customerOrgDtos.Any()) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        customerOrgDto = customerOrgDtos.Where(o => o.DisplayName == orgName).FirstOrDefault(); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (customerOrgDto == null) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        customerOrgDto = await CallAppServiceAsync<CreateCustomerOrgDto, CustomerOrgDto>( | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                      "api/app/customerorg/create", new CreateCustomerOrgDto() | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                      { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                          MedicalCenterId = _customerOrgDto.MedicalCenterId , | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                          ParentId = _importCustomerOrgId, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                          DisplayName = orgName, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                          ShortName = orgName, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                          IsActive = 'Y', | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                          IsLock = 'Y' | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                      }); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    CustomerOrgGroupDto customerOrgGroupDto; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (patient.ifFj == 1) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        //复检
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        //加载单位分组信息
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        _customerOrgGroupDtos = await CallAppServiceAsync<Guid, List<CustomerOrgGroupDto>>( | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            "api/app/customer-org-group/in-customer-org-id/" + _importCustomerOrgId.ToString() | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            , Guid.Empty, "get"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        customerOrgGroupDto = _customerOrgGroupDtos.Where(o => o.DisplayName == "复检").FirstOrDefault(); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        if (customerOrgGroupDto == null) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        //查找子单位是否存在,如存在获取子单位id,如果不存在这创建子单位
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var orgName = patient.orgName; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var pos = orgName.IndexOf("_"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        orgName = orgName.Substring(0, pos); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (string.IsNullOrWhiteSpace(patient.mobile)) | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            throw new Exception("没有复检这个分组"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            //青海省第五人民医院要强行设置为 11111111111
 | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    else | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        List<string> groupNames = new List<string>(); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        if (patient.ifGy == 1) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var customerOrgDtos = await CallAppServiceAsync<CustomerOrgIdInputDto, List<CustomerOrgDto>>( | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                           "api/app/CustomerOrg/GetChildCustomerOrgsById", | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                           new CustomerOrgIdInputDto() { CustomerOrgId = _importCustomerOrgId }); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        CustomerOrgDto customerOrgDto = null; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (customerOrgDtos != null && customerOrgDtos.Any()) | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            groupNames.Add("高原"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            customerOrgDto = customerOrgDtos.Where(o => o.DisplayName == orgName).FirstOrDefault(); | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                        else if (patient.ifJk == 1) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (customerOrgDto == null) | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            groupNames.Add("健康"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            customerOrgDto = await CallAppServiceAsync<CreateCustomerOrgDto, CustomerOrgDto>( | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                          "api/app/customerorg/create", new CreateCustomerOrgDto() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                          { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                              MedicalCenterId = _customerOrgDto.MedicalCenterId, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                              ParentId = _importCustomerOrgId, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                              DisplayName = orgName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                              ShortName = orgName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                              IsActive = 'Y', | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                              IsLock = 'Y' | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                          }); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        CustomerOrgGroupDto customerOrgGroupDto; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (patient.ifFj == 1) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            //复检
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            //加载单位分组信息
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            _customerOrgGroupDtos = await CallAppServiceAsync<Guid, List<CustomerOrgGroupDto>>( | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                "api/app/customer-org-group/in-customer-org-id/" + _importCustomerOrgId.ToString() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                , Guid.Empty, "get"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            customerOrgGroupDto = _customerOrgGroupDtos.Where(o => o.DisplayName == "复检").FirstOrDefault(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            if (customerOrgGroupDto == null) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                throw new Exception("没有复检这个分组"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                        else | 
				 | 
				 | 
				                        else | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            throw new Exception("分组名称必须是高原或健康体检二选一"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            List<string> groupNames = new List<string>(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            if (patient.ifGy == 1) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                groupNames.Add("高原"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            else if (patient.ifJk == 1) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                groupNames.Add("健康"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            else | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                throw new Exception("分组名称必须是高原或健康体检二选一"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            if (patient.ifGt == 1) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                groupNames.Add("高铁"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            if (patient.ifWh == 1) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                groupNames.Add("职害"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            if (patient.ifCw == 1) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                groupNames.Add("普速"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            if (patient.ifMain == 1) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                groupNames.Add("行车"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            if (patient.ifCy == 1) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                groupNames.Add("从业"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            customerOrgGroupDto = await GetCustomerOrgGroup(groupNames, sexId, maritalStatusId); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        //获取病人ID
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var patientRegister = new CreatePatientRegisterDto() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            MedicalCenterId = _customerOrgDto.MedicalCenterId, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            //PatientRegisterId = null,
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            //PatientId = null,
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            IsMaxMedicalTimes = 'Y', | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            CompleteFlag = '0', | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            CustomerOrgId = customerOrgDto.Id, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            CustomerOrgRegisterId = _customerOrgRegisterDto.Id, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            CustomerOrgGroupId = customerOrgGroupDto.Id, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            PatientName = patient.personName, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            SexId = sexId, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            Age = patient.age, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            MaritalStatusId = maritalStatusId, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            MobileTelephone = patient.mobile, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            Planuserid = patient.id.ToString(), | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            IdNo = patient.cardId, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            //PersonnelTypeId = personnelType.Id,
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            JobTitle = jobTitle, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            Remark = patient.remark, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            JobPost = jobPost, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            Remark2 = patient.tjOpinion, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            Remark3 = patient.fjOpinion, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            QztlIsFj = patient.ifFj == 1 ? 'Y' : 'N', | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            QztlIsGt = patient.ifGt == 1 ? 'Y' : 'N', | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            QztlIsWh = patient.ifWh == 1 ? 'Y' : 'N', | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            QztlIsCw = patient.ifCw == 1 ? 'Y' : 'N', | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            QztlIsMain = patient.ifMain == 1 ? 'Y' : 'N', | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            QztlIsCy = patient.ifCy == 1 ? 'Y' : 'N', | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            IsQztlImport = 'Y' | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        }; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (!string.IsNullOrWhiteSpace(patient.cardId)) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            var patientInfo = await CallAppServiceAsync<IdNoInputDto, PatientDto>( | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                       "api/app/patient/GetByIdNo", | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                          new IdNoInputDto() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                          { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                              IdNo = patient.cardId | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                          }); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            if (patientInfo != null) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                patientRegister.PatientId = patientInfo.Id; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                        if (patient.ifGt == 1) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (medicalTypeDto != null) | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            groupNames.Add("高铁"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            patientRegister.MedicalTypeId = medicalTypeDto.Id; | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                        if (patient.ifWh == 1) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (personnelType != null) | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            groupNames.Add("职害"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            patientRegister.PersonnelTypeId = personnelType.Id; | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                        if (patient.ifCw == 1) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (patient.ifGy == 1) | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            groupNames.Add("普速"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            patientRegister.QztlType = '0'; | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                        if (patient.ifMain == 1) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        else if (patient.ifJk == 1) { } | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            groupNames.Add("行车"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            patientRegister.QztlType = '1'; | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                        if (patient.ifCy == 1) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        patientRegister.RegisterCheckAsbitems = new List<CreatePatientRegisterRegisterCheckAsbitem>(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        //获取分组信息
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var customerOrgGroupDetailOrAsbitemDtos = await CallAppServiceAsync<Guid, List<CustomerOrgGroupDetailOrAsbitemDto>>( | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                "api/app/customerorggroupdetail/getcustomerorggroupdetailinasbitem?CustomerOrgGroupId=" + customerOrgGroupDto.Id.ToString() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                , Guid.Empty, "get"); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (!customerOrgGroupDetailOrAsbitemDtos.Any()) | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            groupNames.Add("从业"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            throw new Exception("分组未包含项目"); | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                        customerOrgGroupDto = await GetCustomerOrgGroup(groupNames, sexId, maritalStatusId); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        foreach (var asbitem in customerOrgGroupDetailOrAsbitemDtos) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            patientRegister.RegisterCheckAsbitems.Add(new CreatePatientRegisterRegisterCheckAsbitem() | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                AsbitemId = asbitem.AsbitemId, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                StandardPrice = asbitem.Price, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                ChargePrice = asbitem.CustomerOrgGroupDetailPrice, | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                PayTypeFlag = '1', | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                IsCharge = 'N', | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                                Amount = asbitem.CustomerOrgGroupDetailAmount | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            }); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        await CallAppServiceAsync<CreatePatientRegisterDto, object>( | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                          "api/PatientRegister/CreatePatientRegister", | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                          patientRegister); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var succesIds = new List<string>(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        var deleteIds = new List<string>(); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        succesIds.Add(patientRegister.Planuserid); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        await NoteOk(succesIds, deleteIds); | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				                    } | 
			
		
		
	
		
			
				 | 
				 | 
				                    //获取病人ID
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var patientRegister = new CreatePatientRegisterDto() | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        MedicalCenterId = _customerOrgDto.MedicalCenterId, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        //PatientRegisterId = null,
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        //PatientId = null,
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        IsMaxMedicalTimes = 'Y', | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        CompleteFlag = '0', | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        CustomerOrgId = customerOrgDto.Id, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        CustomerOrgRegisterId = _customerOrgRegisterDto.Id, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        CustomerOrgGroupId = customerOrgGroupDto.Id, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        PatientName = patient.personName, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        SexId = sexId, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        Age = patient.age, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        MaritalStatusId = maritalStatusId, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        MobileTelephone = patient.mobile, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        Planuserid = patient.id.ToString(), | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        IdNo = patient.cardId, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        //PersonnelTypeId = personnelType.Id,
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        JobTitle = jobTitle, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        Remark = patient.remark, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        JobPost = jobPost, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        Remark2 = patient.tjOpinion, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        Remark3 = patient.fjOpinion, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        QztlIsFj = patient.ifFj == 1 ? 'Y' : 'N', | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        QztlIsGt = patient.ifGt == 1 ? 'Y' : 'N', | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        QztlIsWh = patient.ifWh == 1 ? 'Y' : 'N', | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        QztlIsCw = patient.ifCw == 1 ? 'Y' : 'N', | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        QztlIsMain = patient.ifMain == 1 ? 'Y' : 'N', | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        QztlIsCy = patient.ifCy == 1 ? 'Y' : 'N', | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        IsQztlImport = 'Y' | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    }; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (!string.IsNullOrWhiteSpace(patient.cardId)) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                    catch (Exception ex) | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				                    { | 
			
		
		
	
		
			
				 | 
				 | 
				                        var patientInfo = await CallAppServiceAsync<IdNoInputDto, PatientDto>( | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                                   "api/app/patient/GetByIdNo", | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                                      new IdNoInputDto() | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                                      { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                                          IdNo = patient.cardId | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                                      }); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        if (patientInfo != null) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if (ex.Message.Contains("人员信息姓名和性别和原来的信息都不一致") || | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            ex.Message.Contains("身份证号解析出的性别与填入的性别不一致")) | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            patientRegister.PatientId = patientInfo.Id; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            continue; | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                         | 
				 | 
				 | 
				                         | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (medicalTypeDto != null) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        patientRegister.MedicalTypeId = medicalTypeDto.Id; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (personnelType != null) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        patientRegister.PersonnelTypeId = personnelType.Id; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (patient.ifGy == 1) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        patientRegister.QztlType = '0'; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    else if (patient.ifJk == 1) { } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        patientRegister.QztlType = '1'; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    patientRegister.RegisterCheckAsbitems = new List<CreatePatientRegisterRegisterCheckAsbitem>(); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    //获取分组信息
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var customerOrgGroupDetailOrAsbitemDtos = await CallAppServiceAsync<Guid, List<CustomerOrgGroupDetailOrAsbitemDto>>( | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            "api/app/customerorggroupdetail/getcustomerorggroupdetailinasbitem?CustomerOrgGroupId=" + customerOrgGroupDto.Id.ToString() | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            , Guid.Empty, "get"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    if (!customerOrgGroupDetailOrAsbitemDtos.Any()) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        throw new Exception("分组未包含项目"); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    foreach (var asbitem in customerOrgGroupDetailOrAsbitemDtos) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        patientRegister.RegisterCheckAsbitems.Add(new CreatePatientRegisterRegisterCheckAsbitem() | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        else | 
			
		
		
	
		
			
				 | 
				 | 
				                        { | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				                            AsbitemId = asbitem.AsbitemId, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            StandardPrice = asbitem.Price, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            ChargePrice = asbitem.CustomerOrgGroupDetailPrice, | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            PayTypeFlag = '1', | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            IsCharge = 'N', | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                            Amount = asbitem.CustomerOrgGroupDetailAmount | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                        }); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            throw ex; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				                    } | 
			
		
		
	
		
			
				 | 
				 | 
				                    await CallAppServiceAsync<CreatePatientRegisterDto, object>( | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                      "api/PatientRegister/CreatePatientRegister", | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                      patientRegister); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var succesIds = new List<string>(); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    var deleteIds = new List<string>(); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    succesIds.Add(patientRegister.Planuserid); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                    await NoteOk(succesIds, deleteIds); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				                } | 
				 | 
				 | 
				                } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				            } | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -345,7 +367,7 @@ namespace Shentun.Peis.PlugIns.Gem | 
			
		
		
	
		
			
				 | 
				 | 
				                    CustomerOrgId = _importCustomerOrgId, | 
				 | 
				 | 
				                    CustomerOrgId = _importCustomerOrgId, | 
			
		
		
	
		
			
				 | 
				 | 
				                }); | 
				 | 
				 | 
				                }); | 
			
		
		
	
		
			
				 | 
				 | 
				            //加载人员类别列表
 | 
				 | 
				 | 
				            //加载人员类别列表
 | 
			
		
		
	
		
			
				 | 
				 | 
				             _personnelTypes = await CallAppServiceAsync<string, List<PersonnelTypeDto>>("api/app/PersonnelType/GetAll", ""); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            _personnelTypes = await CallAppServiceAsync<string, List<PersonnelTypeDto>>("api/app/PersonnelType/GetAll", ""); | 
			
		
		
	
		
			
				 | 
				 | 
				        } | 
				 | 
				 | 
				        } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -379,7 +401,10 @@ namespace Shentun.Peis.PlugIns.Gem | 
			
		
		
	
		
			
				 | 
				 | 
				                        result = await response.Content.ReadAsStringAsync(); | 
				 | 
				 | 
				                        result = await response.Content.ReadAsStringAsync(); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                        result = result.Replace(":\"[{", ":[{").Replace("}]\"", "}]").Replace("\\", ""); | 
				 | 
				 | 
				                        result = result.Replace(":\"[{", ":[{").Replace("}]\"", "}]").Replace("\\", ""); | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        if(result.IndexOf("status") < 0) | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                            throw new Exception($"调用WebApi中无status,返回值:" + result); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                        QztlPatientRegisterFromInterface? resultDto = JsonConvert.DeserializeObject<QztlPatientRegisterFromInterface>(result); | 
				 | 
				 | 
				                        QztlPatientRegisterFromInterface? resultDto = JsonConvert.DeserializeObject<QztlPatientRegisterFromInterface>(result); | 
			
		
		
	
		
			
				 | 
				 | 
				                        if (resultDto != null) | 
				 | 
				 | 
				                        if (resultDto != null) | 
			
		
		
	
		
			
				 | 
				 | 
				                        {  | 
				 | 
				 | 
				                        {  | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -632,7 +657,7 @@ namespace Shentun.Peis.PlugIns.Gem | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				        public async Task NoteOk(List<string> successIds, List<string> deleteIds) | 
				 | 
				 | 
				        public async Task NoteOk(List<string> successIds, List<string> deleteIds) | 
			
		
		
	
		
			
				 | 
				 | 
				        { | 
				 | 
				 | 
				        { | 
			
		
		
	
		
			
				 | 
				 | 
				            if(successIds == null || deleteIds == null) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            if (successIds == null || deleteIds == null) | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				                return; | 
				 | 
				 | 
				                return; | 
			
		
		
	
		
			
				 | 
				 | 
				            } | 
				 | 
				 | 
				            } | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -642,9 +667,9 @@ namespace Shentun.Peis.PlugIns.Gem | 
			
		
		
	
		
			
				 | 
				 | 
				                return; | 
				 | 
				 | 
				                return; | 
			
		
		
	
		
			
				 | 
				 | 
				            } | 
				 | 
				 | 
				            } | 
			
		
		
	
		
			
				 | 
				 | 
				            string successIdStr = ""; | 
				 | 
				 | 
				            string successIdStr = ""; | 
			
		
		
	
		
			
				 | 
				 | 
				            for (var i = 0 ; i < successIds.Count; i++) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				            for (var i = 0; i < successIds.Count; i++) | 
			
		
		
	
		
			
				 | 
				 | 
				            { | 
				 | 
				 | 
				            { | 
			
		
		
	
		
			
				 | 
				 | 
				                if(i == 0) | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                if (i == 0) | 
			
		
		
	
		
			
				 | 
				 | 
				                { | 
				 | 
				 | 
				                { | 
			
		
		
	
		
			
				 | 
				 | 
				                    successIdStr = successIds[i]; | 
				 | 
				 | 
				                    successIdStr = successIds[i]; | 
			
		
		
	
		
			
				 | 
				 | 
				                } | 
				 | 
				 | 
				                } | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
						
							
						
					
					
				 | 
				@ -725,7 +750,7 @@ namespace Shentun.Peis.PlugIns.Gem | 
			
		
		
	
		
			
				 | 
				 | 
				                            } | 
				 | 
				 | 
				                            } | 
			
		
		
	
		
			
				 | 
				 | 
				                            return; | 
				 | 
				 | 
				                            return; | 
			
		
		
	
		
			
				 | 
				 | 
				                        } | 
				 | 
				 | 
				                        } | 
			
		
		
	
		
			
				 | 
				 | 
				                        return ; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				                        return; | 
			
		
		
	
		
			
				 | 
				 | 
				                    } | 
				 | 
				 | 
				                    } | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				                } | 
				 | 
				 | 
				                } | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
					
				 | 
				
  |