private WyNhRegister PinfoToWyNhRegister(PatientInfo pInfo) { WyNhRegister nhPerson = new WyNhRegister(); nhPerson.FunHrStr = pInfo.NhInfo.FunHrStr; nhPerson.NhRegID = Guid.NewGuid(); nhPerson.OrganCode = GSettings.OrganIDRemote; nhPerson.AccountYear = GSettings.AccountYear; nhPerson.CoopMedCode = pInfo.NhInfo.coopMedCode; nhPerson.ExpressionID = ((int)pInfo.NhZybxgs).ToString(); nhPerson.PatientName = pInfo.NhInfo.name; nhPerson.AiIDNo = pInfo.NhInfo.aiIDNo; nhPerson.IllCode = pInfo.oRyIll.IllCode; nhPerson.IllName = pInfo.oRyIll.IllDesc; nhPerson.InDate = (pInfo.Ryrq ?? DateTime.Now).ToString("yyyy-MM-dd HH:mm:ss"); nhPerson.AdLimitDef = GSettings.AdLimitDef; nhPerson.DoctorName = string.Format("{0}", pInfo.oZyDoctor.zgmc); nhPerson.PatientID = string.Format("{0}@@{1}@@{0}@@{2}", pInfo.HisZyh, pInfo.oZyDoctor.bm.bmdm, GSettings.OperatorName); nhPerson.ExpenseKind = ((int)pInfo.NhExpenseKind).ToString(); nhPerson.IsFail = 0; nhPerson.Zyh = pInfo.HisZyh.Value; nhPerson.AreaCode = pInfo.NhInfo.areaCode; if (pInfo.NhInfo is HrGetZzinfo_zz) { nhPerson.TurnID = ((HrGetZzinfo_zz)pInfo.NhInfo).transfNo; } return(nhPerson); }
private WyNhRegister PinfoToWyNhRegister(PatientInfo pInfo) { WyNhRegister nhPerson = new WyNhRegister(); nhPerson.FunHrStr = pInfo.NhInfo.FunHrStr; nhPerson.NhRegID = Guid.NewGuid(); nhPerson.OrganCode = GSettings.OrganIDRemote; nhPerson.AccountYear = GSettings.AccountYear; nhPerson.CoopMedCode = pInfo.NhInfo.coopMedCode; nhPerson.ExpressionID = ((int)pInfo.NhZybxgs).ToString(); nhPerson.PatientName = pInfo.NhInfo.name; nhPerson.AiIDNo = pInfo.NhInfo.aiIDNo; nhPerson.IllCode = pInfo.oRyIll.IllCode; nhPerson.IllName = pInfo.oRyIll.IllDesc; nhPerson.InDate = (pInfo.Ryrq ?? DateTime.Now).ToString("yyyy-MM-dd HH:mm:ss"); nhPerson.AdLimitDef = GSettings.AdLimitDef; nhPerson.DoctorName = string.Format("{0}", pInfo.oZyDoctor.zgmc); nhPerson.PatientID = string.Format("{0}@@{1}@@{0}@@{2}",pInfo.HisZyh,pInfo.oZyDoctor.bm.bmdm,GSettings.OperatorName); nhPerson.ExpenseKind = ((int)pInfo.NhExpenseKind).ToString(); nhPerson.IsFail = 0; nhPerson.Zyh = pInfo.HisZyh.Value; nhPerson.AreaCode = pInfo.NhInfo.areaCode; if (pInfo.NhInfo is HrGetZzinfo_zz) { nhPerson.TurnID = ((HrGetZzinfo_zz)pInfo.NhInfo).transfNo; } return nhPerson; }
public Guid NewNhRegister(DTO.PatientInfo pInfo) { WyNhRegister newNhReg = null; int hr = -1; StringBuilder sb = null; try { if (pInfo.HisZybrlx == EnumRyLb.农村合作医疗病人 && pInfo.NhInfo is NhPersonInfoBase) { //如果是农合病人,则判断是本地农合还是异地农合,这个是通过pinfo的类型来判断 if (pInfo.NhInfo is HrGetHzPersonInfo) { //本地农合患者: newNhReg = PinfoToWyNhRegister(pInfo); using (DCCbhisDataContext db = new DCCbhisDataContext(GSettings.HisConnStr)) { db.WyNhRegister.InsertOnSubmit(newNhReg); db.SubmitChanges(); //开始调用接口上传注册信息 sb = new StringBuilder(1024); hr = NhLocalWrap.SaveInHosInfo(GSettings.ParamLocalOrganID, newNhReg.CoopMedCode, newNhReg.ExpressionID, newNhReg.PatientName, newNhReg.AiIDNo, newNhReg.IllCode, newNhReg.IllName, newNhReg.InDate, newNhReg.Adke, newNhReg.AdLimitDef, newNhReg.DoctorName, newNhReg.PatientID, "0", newNhReg.DiagNo, newNhReg.ExpenseKind, newNhReg.LimitIllCode, sb); if (hr < 0) { //接口调用失败,删除已保存在本地的农合登记信息,并抛出异常 db.WyNhRegister.DeleteOnSubmit(newNhReg); db.SubmitChanges(); throw new Exception(sb.ToString()); } else { newNhReg.DiagNo = sb.ToString(); db.SubmitChanges(); } } //本地农合插入结束 } else { //异地农合插入开始 newNhReg = PinfoToWyNhRegister(pInfo); using (DCCbhisDataContext db = new DCCbhisDataContext(GSettings.HisConnStr)) { db.WyNhRegister.InsertOnSubmit(newNhReg); db.SubmitChanges(); //开始调用接口上传注册信息 sb = new StringBuilder(1024); hr = NhLocalWrap.zzSaveInHosInfo(GSettings.ParamRemoteOrganID, newNhReg.AreaCode, newNhReg.CoopMedCode, newNhReg.ExpressionID, newNhReg.AiIDNo, newNhReg.TurnID.Value, newNhReg.IllCode, newNhReg.IllName, newNhReg.InDate, newNhReg.Adke, newNhReg.AdLimitDef, newNhReg.DoctorName, newNhReg.PatientID, newNhReg.ExpenseKind, newNhReg.LimitIllCode, sb); if (hr < 0) { //接口调用失败,删除已保存在本地的农合登记信息,并抛出异常 db.WyNhRegister.DeleteOnSubmit(newNhReg); db.SubmitChanges(); throw new Exception(sb.ToString()); } else { newNhReg.DiagNo = sb.ToString(); db.SubmitChanges(); } } //异地农合插入结束 } return(newNhReg.NhRegID); } else { throw new ArgumentException("不是农合患者或者患者类型选择错误"); } } catch (System.Exception ex) { throw new ArgumentException("农合入院登记错误:" + ex.Message); } }