/// <summary> /// 增加和保存 /// </summary> /// <param name="info"></param> public void SaveInfo(CD_HospitalRecord info) { if (!string.IsNullOrWhiteSpace(info.HospitalRecordId) && info.HospitalRecordId != "null") { info.UpdateTime = DateTime.Now; info.CreateTime = null; info.UpdateM("HospitalRecordId"); } else { if (!string.IsNullOrWhiteSpace(info.InpatientId) && info.InpatientId != "null") { CD_HospitalRecord nowinfo = GetInfoByInpatientId(info.InpatientId); if (nowinfo != null) { info.UpdateTime = DateTime.Now; info.CreateTime = null; info.UpdateM("InpatientId"); } else { info.HospitalRecordId = CommonService.GetPrimaryId(new GI_SerialInfo() { Name = "CD_HospitalRecord", ColumnName = "HospitalRecordId", OrganID = info.OrganID }) + ""; info.Creator = info.Updater; //添加的情况下创建医生就是修改医生 info.CreateTime = DateTime.Now; //添加情况下 info.UpdateTime = DateTime.Now; info.SaveModelM(); } } } }
/// <summary> /// 根据住院病人id获得入院记录 /// </summary> /// <returns></returns> public string GetInfoByInpatientId() { return(base.ExecuteActionJsonResult("获取入院记录信息", () => { CD_HospitalRecord info = service.GetInfoByInpatientId(Request["InpatientId"]); return new WebApi_Result() { data = info }; })); }
/// <summary> /// 保存记录类型并跳转 /// </summary> /// <returns></returns> public ActionResult AddHospitalRecord() { CD_HospitalRecord info = base.GetPageData <CD_HospitalRecord>(0); info.InpatientId = Request["InpatientId"]; int rtype = 0; int.TryParse(Request["RecordType"], out rtype); info.RecordType = rtype; service.SaveInfo(info); return(Redirect("/page/DoctorPages/HospitalRecordEdit")); }
/// <summary> /// 增加和保存数据 /// </summary> /// <returns></returns> public string Save() { return(base.ExecuteActionJsonResult("保存信息", () => { CD_HospitalRecord info = base.GetPageData <CD_HospitalRecord>(0); info.HospitalRecordId = string.IsNullOrWhiteSpace(info.HospitalRecordId) ? null : info.HospitalRecordId; service.SaveInfo(info); string infomsg = info.RecordState == 0 ? "暂存信息成功" : "保存信息成功"; return new WebApi_Result() { msg = infomsg }; })); }
/// <summary> /// 打开入院记录,如果以及有入院记录展示打印页面,如果没有入院记录展示编辑页面 /// </summary> /// <returns></returns> public ActionResult HospitalRecordRoute() { HospitalRecordService service = new HospitalRecordService(); CD_HospitalRecord info = service.GetInfoByInpatientId(Request["InpatientId"]); if (info != null) { return(View("HospitalRecord")); } else { return(View("HospitalRecordType")); } }
/// <summary> /// 保存诊断数据 /// </summary> /// <returns></returns> public string SaveInfo() { return(base.ExecuteActionJsonResult("诊断保存", () => { CD_PatientDiagnosis entity = base.GetPageData <CD_PatientDiagnosis>(0); CD_HospitalRecord hospitalRecord = hospitalrecordservice.GetInfoByInpatientId(entity.InpatientId); if (hospitalRecord == null) { return new WebApi_Result() { code = 0, msg = "请先保存入院记录" }; } entity.ICDCode = string.IsNullOrWhiteSpace(entity.ICDCode) ? null : entity.ICDCode; var DiagnosisIdList = (entity.DiagnosisId + "").Split(','); for (int i = 0; i < entity.ICDCode.Split(',').Length; i++) { var cur_entity = base.GetPageData <CD_PatientDiagnosis>(0); if (DiagnosisIdList.Length > i) { cur_entity.DiagnosisId = DiagnosisIdList[i]; } else { cur_entity.DiagnosisId = ""; } cur_entity.ParentId = string.IsNullOrWhiteSpace(cur_entity.ParentId) ? "0" : cur_entity.ParentId; cur_entity.ICDCode = entity.ICDCode.Split(',')[i]; cur_entity.DiagnosisName = entity.DiagnosisName.Split(',')[i]; UserToken ut = UserTokenManager.GetUserToken(Request["token"]); cur_entity.RecordUserId = cur_entity.Creator = ut.UserId; cur_entity.RecordUserName = ut.USERNAME; if (cur_entity.DiagnosisTime == null) { cur_entity.DiagnosisTime = DateTime.Now; } //病历记录id cur_entity.RecordId = hospitalRecord.HospitalRecordId; patientDiagnosisService.SaveInfo(cur_entity); } return new WebApi_Result(); })); }
/// <summary> /// 根据住院病人id获得入院记录 /// </summary> /// <returns></returns> public CD_HospitalRecord GetInfoByInpatientId(string InpatientId) { CD_HospitalRecord info = EntityOperate <CD_HospitalRecord> .GetEntityById(InpatientId, "InpatientId"); if (info != null) { if (!string.IsNullOrWhiteSpace(info.Creator)) { GI_UserInfo Creator = EntityOperate <GI_UserInfo> .GetEntityById(info.Creator, "UserID"); info.CreatorName = Creator?.UserName; } if (!string.IsNullOrWhiteSpace(info.Updater)) { GI_UserInfo Updater = EntityOperate <GI_UserInfo> .GetEntityById(info.Updater, "UserID"); info.UpdaterName = Updater?.UserName; } } return(info); }