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.
		
		
		
		
		
			
		
			
				
					
					
						
							278 lines
						
					
					
						
							9.1 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							278 lines
						
					
					
						
							9.1 KiB
						
					
					
				
								
							 | 
						|
								using Shentun.Utilities;
							 | 
						|
								using Xunit.Abstractions;
							 | 
						|
								namespace Shentun.Peis.PlugIns.Gem.Test
							 | 
						|
								{
							 | 
						|
								    public class HisTest
							 | 
						|
								    {
							 | 
						|
								        private readonly ITestOutputHelper _output;
							 | 
						|
								        public HisTest(ITestOutputHelper testOutputHelper)
							 | 
						|
								        {
							 | 
						|
								            _output = testOutputHelper;
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task PatientQuery()
							 | 
						|
								        {
							 | 
						|
								            var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
							 | 
						|
								            var hisPatientQueryInput = new HisPatientQueryInput()
							 | 
						|
								            {
							 | 
						|
								                Data = new HisPatientQueryDataInput()
							 | 
						|
								                {
							 | 
						|
								                    MsgHeader = new HisMsgHeaderInput()
							 | 
						|
								                    {
							 | 
						|
								                        Sender = "PEIS",
							 | 
						|
								                        MsgType = "SVR_ODS_1101",
							 | 
						|
								                        MsgVersion = "3.1",
							 | 
						|
								                    },
							 | 
						|
								                    Patient = new HisPatientQueryPatientInput()
							 | 
						|
								                    {
							 | 
						|
								                        IdCard = "110101202404238836",
							 | 
						|
								                        IdCardCode = "01",
							 | 
						|
								                        Name = "体检调试一",
							 | 
						|
								                        Sex = "1",
							 | 
						|
								                        BirthDate = "2024-04-23",
							 | 
						|
								                        PatientPhone = "13700000001",
							 | 
						|
								                        EthnicGroupCode = "01",
							 | 
						|
								                        WorkUnit = "测试单位",
							 | 
						|
								                        Address = "测试地址"
							 | 
						|
								                    }
							 | 
						|
								                }
							 | 
						|
								            };
							 | 
						|
								
							 | 
						|
								            var result = await patientRegisterPluginsGemHis.PatientQuery(hisPatientQueryInput);
							 | 
						|
								            if(result.MsgHeader.Status != "true")
							 | 
						|
								            {
							 | 
						|
								                _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
							 | 
						|
								                return;
							 | 
						|
								            }
							 | 
						|
								            _output.WriteLine(result.Patient.PatientId);
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task PatientNew()
							 | 
						|
								        {
							 | 
						|
								            var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
							 | 
						|
								            var hisPatientQueryInput = new HisPatientQueryInput()
							 | 
						|
								            {
							 | 
						|
								                Data = new HisPatientQueryDataInput()
							 | 
						|
								                {
							 | 
						|
								                    MsgHeader = new HisMsgHeaderInput()
							 | 
						|
								                    {
							 | 
						|
								                        Sender = "PEIS",
							 | 
						|
								                        MsgType = "SVR_ODS_1101",
							 | 
						|
								                        MsgVersion = "3.1",
							 | 
						|
								                    },
							 | 
						|
								                    Patient = new HisPatientQueryPatientInput()
							 | 
						|
								                    {
							 | 
						|
								                        IdCard = "4306249801019311",
							 | 
						|
								                        IdCardCode = "01",
							 | 
						|
								                        Name = "王五的",
							 | 
						|
								                        Sex = "2",
							 | 
						|
								                        BirthDate = "1993-09-01",
							 | 
						|
								                        PatientPhone = "18911254911",
							 | 
						|
								                        EthnicGroupCode = "01",
							 | 
						|
								                        WorkUnit = "本医院",
							 | 
						|
								                        Address = "本院家属区"
							 | 
						|
								                    }
							 | 
						|
								                }
							 | 
						|
								            };
							 | 
						|
								
							 | 
						|
								            var result = await patientRegisterPluginsGemHis.PatientQuery(hisPatientQueryInput);
							 | 
						|
								            if (result.MsgHeader.Status != "true")
							 | 
						|
								            {
							 | 
						|
								                _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
							 | 
						|
								            }
							 | 
						|
								            else
							 | 
						|
								            {
							 | 
						|
								                _output.WriteLine("病人ID:" + result.Patient.PatientId);
							 | 
						|
								            }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task MecSave()
							 | 
						|
								        {
							 | 
						|
								            var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
							 | 
						|
								            var hisInput = new HisMecSaveInput()
							 | 
						|
								            {
							 | 
						|
								                Data = new HisMecSaveDataInput()
							 | 
						|
								                {
							 | 
						|
								                    MsgHeader = new HisMsgHeaderInput()
							 | 
						|
								                    {
							 | 
						|
								                        Sender = "PEIS",
							 | 
						|
								                        MsgType = "SVR_ODS_6101",
							 | 
						|
								                        MsgVersion = "3.1",
							 | 
						|
								                    },
							 | 
						|
								                   Items =  new List<HisMecSaveDataItemInput>()
							 | 
						|
								                   {
							 | 
						|
								                       new HisMecSaveDataItemInput()
							 | 
						|
								                       {
							 | 
						|
								                           ExamRequestNo = "0003",
							 | 
						|
								                           FeeType = "1",
							 | 
						|
								                           EmpId = "TJ00000007",
							 | 
						|
								                           DeptId = "",
							 | 
						|
								                           DoctId = "",
							 | 
						|
								                           ExeDeptId = "",
							 | 
						|
								                           Tjunit = "本院",
							 | 
						|
								                           Tjfee = "1234567.89",
							 | 
						|
								                           Ztxm = "",
							 | 
						|
								                           Remark = "备注但是发射点法大师傅撒旦"
							 | 
						|
								
							 | 
						|
								                       },
							 | 
						|
								                      
							 | 
						|
								                   }
							 | 
						|
								                }
							 | 
						|
								            };
							 | 
						|
								
							 | 
						|
								            var result = await patientRegisterPluginsGemHis.MecSave(hisInput);
							 | 
						|
								            if (result.MsgHeader.Status != "true")
							 | 
						|
								            {
							 | 
						|
								                _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
							 | 
						|
								            }
							 | 
						|
								            else
							 | 
						|
								            {
							 | 
						|
								                _output.WriteLine("成功:医技序号:" + result.MsgHeader.Yjxh);
							 | 
						|
								            }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task CancelQrCode()
							 | 
						|
								        {
							 | 
						|
								            var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
							 | 
						|
								            var hisInput = new HisCancelQrCodeInput()
							 | 
						|
								            {
							 | 
						|
								                Data = new HisCancelQrCodeDataInput()
							 | 
						|
								                {
							 | 
						|
								                    MsgHeader = new HisMsgHeaderInput()
							 | 
						|
								                    {
							 | 
						|
								                        Sender = "PEIS",
							 | 
						|
								                        MsgType = "SVR_ODS_6105",
							 | 
						|
								                        MsgVersion = "3.1",
							 | 
						|
								                    },
							 | 
						|
								                    Item = new HisCancelQrCodeDataItemInput()
							 | 
						|
								                   {
							 | 
						|
								                       Yjxh = "899",
							 | 
						|
								                       ExamRequestNo = "0001"
							 | 
						|
								                    }
							 | 
						|
								                }
							 | 
						|
								            };
							 | 
						|
								
							 | 
						|
								            var result = await patientRegisterPluginsGemHis.CancelQrCode(hisInput);
							 | 
						|
								            if (result.MsgHeader.Status != "true")
							 | 
						|
								            {
							 | 
						|
								                _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
							 | 
						|
								            }
							 | 
						|
								            else
							 | 
						|
								            {
							 | 
						|
								                _output.WriteLine("成功");
							 | 
						|
								            }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task PayStatus()
							 | 
						|
								        {
							 | 
						|
								            var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
							 | 
						|
								            var hisInput = new HisPayStatusInput()
							 | 
						|
								            {
							 | 
						|
								                Data = new HisPayStatusDataInput()
							 | 
						|
								                {
							 | 
						|
								                    MsgHeader = new HisMsgHeaderInput()
							 | 
						|
								                    {
							 | 
						|
								                        Sender = "PEIS",
							 | 
						|
								                        MsgType = "SVR_ODS_6105",
							 | 
						|
								                        MsgVersion = "3.1",
							 | 
						|
								                    },
							 | 
						|
								                    Item = new HisPayStatusDataItemInput()
							 | 
						|
								                    {
							 | 
						|
								                        Yjxh = "911",
							 | 
						|
								                        ExamRequestNo = "0003"
							 | 
						|
								                    }
							 | 
						|
								                }
							 | 
						|
								            };
							 | 
						|
								
							 | 
						|
								            var result = await patientRegisterPluginsGemHis.PayStatus(hisInput);
							 | 
						|
								            if (result.MsgHeader.Status != "true")
							 | 
						|
								            {
							 | 
						|
								                _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
							 | 
						|
								            }
							 | 
						|
								            else
							 | 
						|
								            {
							 | 
						|
								                _output.WriteLine("成功"+ result.MsgHeader.Detail);
							 | 
						|
								            }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        [Fact]
							 | 
						|
								        public async Task AgreeRefund()
							 | 
						|
								        {
							 | 
						|
								            var patientRegisterPluginsGemHis = new PatientRegisterPluginsGemHis(GetConfigParm());
							 | 
						|
								            var hisInput = new HisAgreeRefundInput()
							 | 
						|
								            {
							 | 
						|
								                Data = new HisAgreeRefundDataInput()
							 | 
						|
								                {
							 | 
						|
								                    MsgHeader = new HisMsgHeaderInput()
							 | 
						|
								                    {
							 | 
						|
								                        Sender = "PEIS",
							 | 
						|
								                        MsgType = "SVR_ODS_6105",
							 | 
						|
								                        MsgVersion = "3.1",
							 | 
						|
								                    },
							 | 
						|
								                    Item = new HisAgreeRefundDataItemInput()
							 | 
						|
								                    {
							 | 
						|
								                        Yjxh = "911",
							 | 
						|
								                        ExamRequestNo = "0003"
							 | 
						|
								                    }
							 | 
						|
								                }
							 | 
						|
								            };
							 | 
						|
								
							 | 
						|
								            var result = await patientRegisterPluginsGemHis.AgreeRefund(hisInput);
							 | 
						|
								            if (result.MsgHeader.Status != "true")
							 | 
						|
								            {
							 | 
						|
								                _output.WriteLine("错误信息:" + result.MsgHeader.Detail);
							 | 
						|
								            }
							 | 
						|
								            else
							 | 
						|
								            {
							 | 
						|
								                _output.WriteLine("成功" + result.MsgHeader.Detail);
							 | 
						|
								            }
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								        [Fact]
							 | 
						|
								        public void XmlSerializer() 
							 | 
						|
								        {
							 | 
						|
								            var hisPatientQueryInput = new HisPatientQueryInput() { 
							 | 
						|
								                Data = new HisPatientQueryDataInput()
							 | 
						|
								                {
							 | 
						|
								                    MsgHeader = new HisMsgHeaderInput()
							 | 
						|
								                    {
							 | 
						|
								                        Sender = "PEIS",
							 | 
						|
								                        MsgType = "SVR_ODS_1101",
							 | 
						|
								                        MsgVersion = "3.1",
							 | 
						|
								                    },
							 | 
						|
								                    Patient = new HisPatientQueryPatientInput()
							 | 
						|
								                    {
							 | 
						|
								                        IdCard = ""
							 | 
						|
								                    }
							 | 
						|
								                }
							 | 
						|
								            };
							 | 
						|
								            var xml = XmlHelper.SerializeToXml(hisPatientQueryInput.Data);
							 | 
						|
								            _output.WriteLine(xml);
							 | 
						|
								        }
							 | 
						|
								
							 | 
						|
								        private string GetConfigParm()
							 | 
						|
								        {
							 | 
						|
								            string configParm;
							 | 
						|
								            string filePath = DirectoryHelper.GetAppDirectory() + "/appsettings.json";
							 | 
						|
								            configParm = File.ReadAllText(filePath);
							 | 
						|
								            return configParm;
							 | 
						|
								
							 | 
						|
								        }
							 | 
						|
								    }
							 | 
						|
								}
							 |