/// <summary>
        /// icd10对码
        /// </summary>
        /// <param name="param"></param>
        public void Icd10PairCode(Icd10PairCodeParam param)
        {  //回参构建
            var icd10List = new List <Icd10PairCodeDateXml>();

            icd10List.Add(new Icd10PairCodeDateXml()
            {
                DiseaseId     = param.DiseaseId,
                DiseaseName   = param.ProjectName,
                DiseaseCoding = param.ProjectCode
            });
            var dd = new Icd10PairCodeDateXml()
            {
                DiseaseId     = param.DiseaseId,
                DiseaseName   = param.ProjectName,
                DiseaseCoding = param.ProjectCode
            };
            var xmlData = new Icd10PairCodeXml()
            {
                row = icd10List
            };
            var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
            var saveXml         = new SaveXmlDataParam()
            {
                User = param.User,
                MedicalInsuranceBackNum = "CXJB002",
                MedicalInsuranceCode    = "91",
                BusinessId = param.BusinessId,
                BackParam  = strXmlBackParam
            };

            //存基层
            _webServiceBasic.SaveXmlData(saveXml);
            _hisSqlRepository.Icd10PairCode(param);
        }
        public ApiJsonResultData MedicalInsuranceXmlCancel([FromUri] MedicalInsuranceXmlUiParam param)
        {
            return(new ApiJsonResultData(ModelState, new UiInIParam()).RunWithTry(y =>
            {
                var userBase = webServiceBasicService.GetUserBaseInfo(param.UserId);
                userBase.TransKey = param.TransKey;
                //回参构建
                var xmlData = new HospitalSettlementCancelXml()
                {
                    SettlementNo = param.SettlementNo,
                };
                var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
                var saveXml = new SaveXmlDataParam()
                {
                    User = userBase,
                    MedicalInsuranceBackNum = "CXJB011",
                    MedicalInsuranceCode = "42",
                    BusinessId = param.BusinessId,
                    BackParam = strXmlBackParam
                };
                //存基层
                webServiceBasic.SaveXmlData(saveXml);
                //var userBase = webServiceBasicService.GetUserBaseInfo(param.UserId);
                ////更新医保信息
                //var strXmlIntoParam = XmlSerializeHelper.XmlParticipationParam();
                ////回参构建
                //var xmlData = new HospitalizationRegisterCancelXml()
                //{

                //    MedicalInsuranceHospitalizationNo = "44116476",

                //};

                //var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
                //var saveXmlData = new SaveXmlData();
                //saveXmlData.OrganizationCode = userBase.OrganizationCode;
                //saveXmlData.AuthCode = userBase.AuthCode;
                //saveXmlData.BusinessId = param.BusinessId;
                //saveXmlData.TransactionId = Guid.Parse("EA144C5D-1146-4229-87FB-7D9EEA0B3F78").ToString("N");
                //saveXmlData.MedicalInsuranceBackNum = "CXJB003";
                //saveXmlData.BackParam = CommonHelp.EncodeBase64("utf-8", strXmlBackParam);
                //saveXmlData.IntoParam = CommonHelp.EncodeBase64("utf-8", strXmlIntoParam);
                //saveXmlData.MedicalInsuranceCode = "22";
                //saveXmlData.UserId = userBase.UserId;
                ////存基层
                //webServiceBasic.HIS_InterfaceList("38", JsonConvert.SerializeObject(saveXmlData));
            }));
        }
        /// <summary>
        /// 职工入院登记
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public WorkerHospitalizationRegisterDto WorkerHospitalizationRegister(WorKerHospitalizationRegisterUiParam param)
        {//his登陆
            var userBase = _serviceBasicService.GetUserBaseInfo(param.UserId);

            userBase.TransKey = param.TransKey;
            var infoData = new GetInpatientInfoParam()
            {
                User       = userBase,
                BusinessId = param.BusinessId,
            };
            //获取医保病人
            var inpatientData = _serviceBasicService.GetInpatientInfo(infoData);

            if (inpatientData == null)
            {
                throw new Exception("获取医保病人失败!!!");
            }
            var workerParam = GetWorkerHospitalizationRegisterParam(param, inpatientData, userBase);
            //医保执行
            var registerData = _workerMedicalInsuranceRepository.WorkerHospitalizationRegister(workerParam);

            if (registerData == null)
            {
                throw new Exception("职工入院登记未反馈数据!!!");
            }
            var saveData = new MedicalInsuranceDto
            {
                AdmissionInfoJson = JsonConvert.SerializeObject(workerParam),
                BusinessId        = param.BusinessId,
                Id                                = Guid.NewGuid(),
                IsModify                          = false,
                InsuranceType                     = 310,
                MedicalInsuranceState             = MedicalInsuranceState.MedicalInsuranceHospitalized,
                MedicalInsuranceHospitalizationNo = registerData.MedicalInsuranceHospitalizationNo,
                AfferentSign                      = param.AfferentSign,
                IdentityMark                      = param.IdentityMark
            };

            //存中间库
            _medicalInsuranceSqlRepository.SaveMedicalInsurance(userBase, saveData);
            //回参构建
            var xmlData = new HospitalizationRegisterXml()
            {
                MedicalInsuranceType = "1",
                MedicalInsuranceHospitalizationNo = registerData.MedicalInsuranceHospitalizationNo,
                InsuranceNo = null,
            };
            var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
            var saveXml         = new SaveXmlDataParam()
            {
                User = userBase,
                MedicalInsuranceBackNum = "zydj",
                MedicalInsuranceCode    = "21",
                BusinessId = param.BusinessId,
                BackParam  = strXmlBackParam
            };

            //存基层
            _webBasicRepository.SaveXmlData(saveXml);
            saveData.MedicalInsuranceState = MedicalInsuranceState.HisHospitalized;
            //更新中间库
            _medicalInsuranceSqlRepository.SaveMedicalInsurance(userBase, saveData);
            //保存入院数据
            infoData.IsSave = true;
            _serviceBasicService.GetInpatientInfo(infoData);
            return(registerData);
        }
        /// <summary>
        /// 门诊费用录入
        /// </summary>
        public OutpatientDepartmentCostInputDto OutpatientDepartmentCostInput(GetOutpatientPersonParam param)
        {
            OutpatientDepartmentCostInputDto resultData = null;
            //获取门诊病人数据
            var outpatientPerson = _serviceBasicService.GetOutpatientPerson(param);

            if (outpatientPerson == null)
            {
                throw new Exception("his中未获取到当前病人!!!");
            }
            //if (string.IsNullOrWhiteSpace(outpatientPerson.IdCardNo)) throw new Exception("当前病人的身份证号码不能为空!!!");
            var inputParam = new OutpatientDepartmentCostInputParam()
            {
                AllAmount    = outpatientPerson.MedicalTreatmentTotalCost,
                IdentityMark = param.IdentityMark,
                AfferentSign = param.AfferentSign,
                Operators    = param.User.UserName
            };

            //医保数据写入
            resultData = _outpatientDepartmentRepository.OutpatientDepartmentCostInput(inputParam);
            if (resultData == null)
            {
                throw new Exception("门诊费用医保执行失败!!!");
            }

            param.IsSave = true;
            param.Id     = Guid.NewGuid();
            //保存门诊病人
            _serviceBasicService.GetOutpatientPerson(param);
            //中间层数据写入
            var saveData = new MedicalInsuranceDto
            {
                AdmissionInfoJson = JsonConvert.SerializeObject(param),
                BusinessId        = param.UiParam.BusinessId,
                Id                                = Guid.NewGuid(),
                IsModify                          = false,
                InsuranceType                     = 999,
                MedicalInsuranceState             = MedicalInsuranceState.MedicalInsuranceHospitalized,
                MedicalInsuranceHospitalizationNo = resultData.DocumentNo,
                AfferentSign                      = param.AfferentSign,
                IdentityMark                      = param.IdentityMark
            };

            //存中间库
            _medicalInsuranceSqlRepository.SaveMedicalInsurance(param.User, saveData);

            //日志写入
            _systemManageRepository.AddHospitalLog(new AddHospitalLogParam()
            {
                User            = param.User,
                JoinOrOldJson   = JsonConvert.SerializeObject(inputParam),
                ReturnOrNewJson = JsonConvert.SerializeObject(resultData),
                RelationId      = param.Id,
                BusinessId      = param.UiParam.BusinessId,
                Remark          = "[R][OutpatientDepartment]门诊病人结算"
            });
            //获取病人的基础信息
            var userInfoData = _residentMedicalInsuranceRepository.GetUserInfo(new ResidentUserInfoParam()
            {
                IdentityMark = param.IdentityMark,
                AfferentSign = param.AfferentSign,
            });
            //回参构建
            var xmlData = new OutpatientDepartmentCostXml()
            {
                AccountBalance = userInfoData.InsuranceType == "342" ? userInfoData.ResidentInsuranceBalance : userInfoData.WorkersInsuranceBalance,
                MedicalInsuranceOutpatientNo = resultData.DocumentNo,
                CashPayment          = resultData.SelfPayFeeAmount,
                SettlementNo         = resultData.DocumentNo,
                AllAmount            = outpatientPerson.MedicalTreatmentTotalCost,
                PatientName          = outpatientPerson.PatientName,
                AccountAmountPay     = 0,
                MedicalInsuranceType = userInfoData.InsuranceType == "310" ? "1" : userInfoData.InsuranceType,
            };

            var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
            var saveXml         = new SaveXmlDataParam()
            {
                User = param.User,
                MedicalInsuranceBackNum = "zydj",
                MedicalInsuranceCode    = "48",
                BusinessId = param.UiParam.BusinessId,
                BackParam  = strXmlBackParam
            };

            //存基层
            _webBasicRepository.SaveXmlData(saveXml);
            var updateParam = new UpdateMedicalInsuranceResidentSettlementParam()
            {
                UserId = param.User.UserId,
                ReimbursementExpensesAmount = resultData.ReimbursementExpensesAmount,
                SelfPayFeeAmount            = resultData.SelfPayFeeAmount,
                OtherInfo    = JsonConvert.SerializeObject(resultData),
                Id           = saveData.Id,
                SettlementNo = resultData.DocumentNo,
                MedicalInsuranceAllAmount = outpatientPerson.MedicalTreatmentTotalCost,
                SettlementTransactionId   = param.User.TransKey,
                MedicalInsuranceState     = MedicalInsuranceState.HisSettlement
            };

            //更新中间层
            _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateParam);

            return(resultData);
        }
Esempio n. 5
0
        /// <summary>
        /// 门诊异地划卡
        /// </summary>
        /// <param name="param"></param>
        public WorkerHospitalSettlementCardBackDto YdOutpatientPayCard(GetYdOutpatientPayCardParam param)
        {
            var resultData = new WorkerHospitalSettlementCardBackDto();
            var outputData =
                XmlSerializeHelper.YdDeSerializer <YdOutpatientPayCardXml>(param.SettlementJson);
            //YdOutpatientPayCardXml
            var userBase = _serviceBasicService.GetUserBaseInfo(param.UserId);

            userBase.TransKey = param.TransKey;
            //门诊病人信息存储
            var id = Guid.NewGuid();
            var outpatientParam = new GetOutpatientPersonParam()
            {
                User    = userBase,
                UiParam = param,
                Id      = id,
                IsSave  = true,
            };
            var outpatientPerson = _serviceBasicService.GetOutpatientPerson(outpatientParam);

            if (outpatientPerson == null)
            {
                throw new Exception("his中未获取到当前病人!!!");
            }
            //储存明细
            var outpatientDetailPerson = _serviceBasicService.GetOutpatientDetailPerson(new OutpatientDetailParam()
            {
                User       = userBase,
                BusinessId = param.BusinessId,
                IsSave     = true,
                PatientId  = id.ToString()
            });
            var queryResidentParam = new QueryMedicalInsuranceResidentInfoParam()
            {
                BusinessId = param.BusinessId,
            };

            //日志写入
            _systemManageRepository.AddHospitalLog(new AddHospitalLogParam()
            {
                User            = userBase,
                JoinOrOldJson   = JsonConvert.SerializeObject(param),
                ReturnOrNewJson = JsonConvert.SerializeObject(outputData),
                RelationId      = outpatientParam.Id,
                BusinessId      = param.BusinessId,
                Remark          = outputData.SerialNumber + "异地刷卡支付"
            });
            //获取医保病人信息
            var residentData = _medicalInsuranceSqlRepository.QueryMedicalInsuranceResidentInfo(queryResidentParam);

            if (residentData.MedicalInsuranceState != MedicalInsuranceState.MedicalInsurancePreSettlement)
            {
                throw new Exception("当前病人未办理预结算,不能办理结算!!!");
            }
            //存中间库

            var updateData = new UpdateMedicalInsuranceResidentSettlementParam()
            {
                UserId           = userBase.UserId,
                SelfPayFeeAmount = CommonHelp.ValueToDouble(outpatientPerson.MedicalTreatmentTotalCost - outputData.AccountPayAmount),
                OtherInfo        = JsonConvert.SerializeObject(resultData),
                Id           = residentData.Id,
                SettlementNo = outputData.SerialNumber,
                MedicalInsuranceAllAmount = outpatientPerson.MedicalTreatmentTotalCost,
                SettlementTransactionId   = userBase.UserId,
                MedicalInsuranceState     = MedicalInsuranceState.MedicalInsuranceSettlement,
                SettlementType            = "2",
                PatientId = id.ToString()
            };

            //存入中间层
            _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateData);

            // 回参构建
            var xmlData = new OutpatientDepartmentCostXml()
            {
                AccountBalance = param.AccountBalance,
                MedicalInsuranceOutpatientNo = outputData.SerialNumber,
                CashPayment          = outputData.CashPayAmount,
                SettlementNo         = outputData.SerialNumber,
                AllAmount            = CommonHelp.ValueToDouble(outpatientPerson.MedicalTreatmentTotalCost),
                PatientName          = outpatientPerson.PatientName,
                AccountAmountPay     = outputData.AccountPayAmount,
                MedicalInsuranceType = "1",
            };
            var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
            var saveXml         = new SaveXmlDataParam()
            {
                User = userBase,
                MedicalInsuranceBackNum = "zydj",
                MedicalInsuranceCode    = "48",
                BusinessId = param.BusinessId,
                BackParam  = strXmlBackParam
            };

            //存基层
            _webBasicRepository.SaveXmlData(saveXml);
            var updateParamData = new UpdateMedicalInsuranceResidentSettlementParam()
            {
                UserId = param.UserId,
                Id     = residentData.Id,
                MedicalInsuranceState = MedicalInsuranceState.HisSettlement,
                IsHisUpdateState      = true
            };

            //  更新中间层
            _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateParamData);
            resultData.AccountBalance = param.AccountBalance;
            resultData.AccountPayment = outputData.AccountPayAmount;
            resultData.CashPayment    = outputData.CashPayAmount;

            return(resultData);
        }
        /// <summary>
        /// 入院登记
        /// </summary>
        /// <returns></returns>
        public void HospitalizationRegister(ResidentHospitalizationRegisterUiParam param)
        { //his登陆
            var userBase = _webserviceBasicService.GetUserBaseInfo(param.UserId);

            userBase.TransKey = param.TransKey;
            var infoData = new GetInpatientInfoParam()
            {
                User       = userBase,
                BusinessId = param.BusinessId,
            };
            //获取医保病人
            var inpatientData = _webserviceBasicService.GetInpatientInfo(infoData);
            var registerParam = GetResidentHospitalizationRegisterParam(param, inpatientData);
            var residentData  = _residentMedicalInsuranceRepository.HospitalizationRegister(registerParam);
            var saveData      = new MedicalInsuranceDto
            {
                AdmissionInfoJson = JsonConvert.SerializeObject(registerParam),
                BusinessId        = param.BusinessId,
                Id            = Guid.NewGuid(),
                InsuranceType = 342,
                MedicalInsuranceHospitalizationNo = residentData.MedicalInsuranceInpatientNo,
                MedicalInsuranceState             = MedicalInsuranceState.MedicalInsuranceHospitalized,
                AfferentSign = param.AfferentSign,
                IdentityMark = param.IdentityMark
            };

            //保存中间库
            _medicalInsuranceSqlRepository.SaveMedicalInsurance(userBase, saveData);
            //回参构建
            var xmlData = new HospitalizationRegisterXml()
            {
                MedicalInsuranceType = "10",
                MedicalInsuranceHospitalizationNo = residentData.MedicalInsuranceInpatientNo,
                InsuranceNo = null,
            };
            var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
            var saveXml         = new SaveXmlDataParam()
            {
                User = userBase,
                MedicalInsuranceBackNum = "CXJB002",
                MedicalInsuranceCode    = "21",
                BusinessId = param.BusinessId,
                BackParam  = strXmlBackParam
            };

            //存基层
            _webBasicRepository.SaveXmlData(saveXml);
            //更新中间库
            saveData.MedicalInsuranceState = MedicalInsuranceState.HisHospitalized;
            _medicalInsuranceSqlRepository.SaveMedicalInsurance(userBase, saveData);
            //日志
            var logParam = new AddHospitalLogParam
            {
                User            = userBase,
                RelationId      = saveData.Id,
                JoinOrOldJson   = JsonConvert.SerializeObject(param),
                ReturnOrNewJson = JsonConvert.SerializeObject(residentData),
                BusinessId      = param.BusinessId,
                Remark          = "医保入院登记;TransactionId:" + userBase.TransKey
            };

            _systemManageRepository.AddHospitalLog(logParam);
            //保存入院数据
            infoData.IsSave = true;
            _webserviceBasicService.GetInpatientInfo(infoData);
        }
Esempio n. 7
0
        /// <summary>
        /// 取消医保出院结算
        /// </summary>
        /// <param name="param"></param>
        /// <param name="infoParam"></param>
        /// <returns></returns>
        public void LeaveHospitalSettlementCancel(LeaveHospitalSettlementCancelParam param,
                                                  LeaveHospitalSettlementCancelInfoParam infoParam)
        {
            var cancelLimit = param.CancelLimit;

            if (param.CancelLimit == "1")
            {
                Cancel(param);
                var updateParam = new UpdateMedicalInsuranceResidentSettlementParam()
                {
                    UserId = infoParam.User.UserId,
                    Id     = infoParam.Id,
                    CancelTransactionId   = infoParam.User.TransKey,
                    MedicalInsuranceState = MedicalInsuranceState.MedicalInsurancePreSettlement
                };
                //存入中间层
                _medicalInsuranceSqlRepository.UpdateMedicalInsuranceResidentSettlement(updateParam);
                //添加日志
                var logParam = new AddHospitalLogParam()
                {
                    JoinOrOldJson = JsonConvert.SerializeObject(param),
                    User          = infoParam.User,
                    Remark        = "居民住院结算取消",
                    RelationId    = infoParam.Id,
                };
                //回参构建
                var xmlData = new HospitalizationRegisterXml()
                {
                    MedicalInsuranceHospitalizationNo = param.MedicalInsuranceHospitalizationNo,
                };
                var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
                var saveXml         = new SaveXmlDataParam()
                {
                    User = infoParam.User,
                    MedicalInsuranceBackNum = "CXJB011",
                    MedicalInsuranceCode    = "42",
                    BusinessId = infoParam.BusinessId,
                    BackParam  = strXmlBackParam
                };
                //存基层
                _webBasicRepository.SaveXmlData(saveXml);
            }
            else if (param.CancelLimit == "2") //取消入院登记并删除资料
            {
                Cancel(param);
                //回参构建
                var xmlData = new HospitalizationRegisterCancelXml()
                {
                    MedicalInsuranceHospitalizationNo = param.MedicalInsuranceHospitalizationNo
                };
                var strXmlBackParam = XmlSerializeHelper.HisXmlSerialize(xmlData);
                var saveXml         = new SaveXmlDataParam()
                {
                    User = infoParam.User,
                    MedicalInsuranceBackNum = "CXJB004",
                    MedicalInsuranceCode    = "22",
                    BusinessId = infoParam.BusinessId,
                    BackParam  = strXmlBackParam
                };
                //存基层
                _webBasicRepository.SaveXmlData(saveXml);
            }
            void Cancel(LeaveHospitalSettlementCancelParam paramc)
            {
                var xmlStr = XmlHelp.SaveXml(paramc);

                if (xmlStr)
                {
                    int result = MedicalInsuranceDll.CallService_cxjb("CXJB011");
                    if (result == 1)
                    {
                        var data = XmlHelp.DeSerializerModel(new IniDto(), true);
                    }
                }
            }
        }