private void SyncPatientByPatientId(string patientID) { if (!string.IsNullOrEmpty(patientID)) { if (ExtendAppContext.CurntSelect.IsSync) { string ret = ""; ret = new SyncInfoService().SyncPatientInfoAndInHospital(patientID); ret += new SyncInfoService().SyncScheduleInfo(patientID, serverTime); if (!string.IsNullOrEmpty(ret)) { MessageBoxFormPC.Show(ret); } } } emptyInpNoOrPatID = false; bool flag = true; if (patientID != "") { patMasterIndex = OperationInfoService.GetPatMasterIndex(patientID); List <MED_PAT_VISIT> patVisitList = OperationInfoService.GetPatVisitList(patientID); if (patVisitList != null && patVisitList.Count > 0) { flag = flag & false; patVisit = patVisitList[0]; visitID = Convert.ToInt32(patVisitList[0].GetValue("VISIT_ID")); } else { flag = flag & true; patVisit = new MED_PAT_VISIT(); visitID = 1; patVisit.SetValue("PATIENT_ID", patientID); } if (patMasterIndex == null) { flag = flag & true; patMasterIndex = new MED_PAT_MASTER_INDEX(); patMasterIndex.SetValue("PATIENT_ID", patientID); emptyInpNoOrPatID = flag; BindData(); MessageBoxFormPC.Show("当前输入患者ID,需要手动输入患者信息进行急诊登记", "系统提示"); // return; } operScheduleList = OperationInfoService.GetOperScheduleList(patientID, visitID).Where(x => x.SCHEDULED_DATE_TIME.Value >= serverTime & x.OPER_STATUS_CODE == 0).ToList(); patInHospital = OperationInfoService.GetPatsInHospitalByID(patientID, visitID); GetScheduleOperInfo(); if (scheduleOperInfoDT != null && scheduleOperInfoDT.Rows.Count > 0) { BindGridViewData(dgvScheduleOperInfo, scheduleOperInfoDT); } List <MED_OPERATION_MASTER> operMasterList = OperationInfoService.GetOperMasterList(patientID, visitID); if (operMasterList != null && operMasterList.Count > 0) { operID = Convert.ToInt32(operMasterList[0].GetValue("OPER_ID")) + 1; } operationMaster = new MED_OPERATION_MASTER(); operationMaster.PATIENT_ID = patientID; operationMaster.VISIT_ID = visitID; operationMaster.OPER_ID = operID; BindData(); } }
protected override void OnSaveData(Dictionary <string, DataTable> dataSource)//, ref bool bNeedMsg { foreach (MTextBox mtb in textBoxs) { if (string.IsNullOrEmpty(mtb.Text) && !string.IsNullOrEmpty(mtb.InputNeededMessage)) { MessageBoxFormPC.Show("*号为必填项目,请重新填写"); // bNeedMsg = false; return; } } string patientID = BindControls("MED_PAT_MASTER_INDEX", "PATIENT_ID"); if (operationMaster == null) { operationMaster = new MED_OPERATION_MASTER(); } operationMaster.SetValue("PATIENT_ID", patientID); operationMaster.SetValue("VISIT_ID", visitID); operationMaster.SetValue("OPER_ID", operID); operationMaster.SetValue("OPER_ROOM", ExtendAppContext.CurntSelect.OperRoom); operationMaster.SetValue("HOSP_BRANCH", ExtendAppContext.CurntSelect.HospBranchCode); operationMaster.SetValue("EMERGENCY_IND", BindControls("MED_OPERATION_MASTER", "EMERGENCY_IND")); operationMaster.SetValue("DEPT_CODE", BindControls("MED_OPERATION_MASTER", "DEPT_CODE")); operationMaster.SetValue("BED_NO", BindControls("MED_OPERATION_MASTER", "BED_NO")); operationMaster.SetValue("SCHEDULED_DATE_TIME", BindControls("MED_OPERATION_MASTER", "SCHEDULED_DATE_TIME")); operationMaster.SetValue("OPER_ROOM_NO", BindControls("MED_OPERATION_MASTER", "OPER_ROOM_NO")); operationMaster.SetValue("SEQUENCE", BindControls("MED_OPERATION_MASTER", "SEQUENCE")); operationMaster.SetValue("ANES_DOCTOR", BindControls("MED_OPERATION_MASTER", "ANES_DOCTOR")); operationMaster.SetValue("DIAG_BEFORE_OPERATION", BindControls("MED_OPERATION_MASTER", "DIAG_BEFORE_OPERATION")); operationMaster.SetValue("OPERATION_NAME", BindControls("MED_OPERATION_MASTER", "OPERATION_NAME")); operationMaster.SetValue("OPER_STATUS_CODE", 2); if (currentOperSchedule != null) { currentOperSchedule.SetValue("OPER_STATUS_CODE", 2); } if (patVisit == null) { patVisit = new MED_PAT_VISIT(); } patVisit.SetValue("PATIENT_ID", patientID); patVisit.SetValue("VISIT_ID", visitID); patVisit.SetValue("INP_NO", BindControls("MED_PATS_IN_HOSPITAL", "INP_NO")); if (patMasterIndex == null) { patMasterIndex = new MED_PAT_MASTER_INDEX(); } patMasterIndex.SetValue("PATIENT_ID", patientID); patMasterIndex.SetValue("NAME", BindControls("MED_PAT_MASTER_INDEX", "NAME")); patMasterIndex.SetValue("SEX", BindControls("MED_PAT_MASTER_INDEX", "SEX")); patMasterIndex.SetValue("DATE_OF_BIRTH", BindControls("MED_PAT_MASTER_INDEX", "DATE_OF_BIRTH")); string strOperName = BindControls("MED_OPERATION_MASTER", "OPER_NAME"); if (!string.IsNullOrEmpty(strOperName)) { string[] operNameArr = strOperName.Split('+'); for (int i = 0; i < operNameArr.Length; i++) { MED_OPERATION_NAME operName = new MED_OPERATION_NAME(); operName.SetValue("PATIENT_ID", operationMaster.PATIENT_ID); operName.SetValue("VISIT_ID", operationMaster.VISIT_ID); operName.SetValue("OPER_ID", operationMaster.OPER_ID); operName.SetValue("OPER_NO", i + 1); operName.SetValue("OPER_NAME", operNameArr[i].ToString()); operNameNewList.Add(operName); } } MED_ANESTHESIA_PLAN anesPlan = OperationInfoService.GetAnesPlan(patientID, visitID, operID); MED_ANESTHESIA_PLAN_PMH anesPlanPmh = OperationInfoService.GetAnesPlanPmh(patientID, visitID, operID); MED_ANESTHESIA_PLAN_EXAM anesPlanExam = OperationInfoService.GetAnesPlanExam(patientID, visitID, operID); if (anesPlan == null) { anesPlan = new MED_ANESTHESIA_PLAN(); anesPlan.SetValue("PATIENT_ID", patientID); anesPlan.SetValue("VISIT_ID", visitID); anesPlan.SetValue("OPER_ID", operID); } if (anesPlanPmh == null) { anesPlanPmh = new MED_ANESTHESIA_PLAN_PMH(); anesPlanPmh.SetValue("PATIENT_ID", patientID); anesPlanPmh.SetValue("VISIT_ID", visitID); anesPlanPmh.SetValue("OPER_ID", operID); } if (anesPlanExam == null) { anesPlanExam = new MED_ANESTHESIA_PLAN_EXAM(); anesPlanExam.SetValue("PATIENT_ID", patientID); anesPlanExam.SetValue("VISIT_ID", visitID); anesPlanExam.SetValue("OPER_ID", operID); } OperationInfoService.SavePatientOperation(currentOperSchedule, patVisit, patMasterIndex, null, operNameNewList, operationMaster, anesPlan, anesPlanPmh, anesPlanExam, null); }
private void SyncPatientByPatientId(string patientID) { if (!string.IsNullOrEmpty(patientID)) { if (ExtendApplicationContext.Current.IsSync) { string ret = ""; ret = syncInfoRepository.SyncPatientInfoAndInHospital(patientID).Data; ret += syncInfoRepository.SyncScheduleInfo(patientID, accountRepository.GetServerTime().Data).Data; if (!string.IsNullOrEmpty(ret)) { MessageBoxFormPC.Show(ret); } } } bool flag = true; if (patientID != "") { patMasterIndex = operationInfoRepository.GetPatMasterIndex(patientID).Data; MED_PATS_IN_HOSPITAL patsInHospital = null; if (patMasterIndex == null) { patsInHospital = operationInfoRepository.GetPatsInHospital(patientID).Data; if (patsInHospital != null) { patientID = patsInHospital.PATIENT_ID; patMasterIndex = operationInfoRepository.GetPatMasterIndex(patientID).Data; } } List <MED_PAT_VISIT> patVisitList = operationInfoRepository.GetPatVisitList(patientID).Data; if (patVisitList != null && patVisitList.Count > 0) { flag = flag & false; patVisit = patVisitList[0]; _visitID = Convert.ToInt32(patVisitList[0].GetValue("VISIT_ID")); } else { flag = flag & true; patVisit = new MED_PAT_VISIT(); _visitID = 1; patVisit.SetValue("PATIENT_ID", patientID); } if (patMasterIndex == null) { flag = flag & true; patMasterIndex = new MED_PAT_MASTER_INDEX(); patMasterIndex.SetValue("PATIENT_ID", patientID); MessageBoxFormPC.Show("当前输入患者ID,需要手动输入患者信息进行急诊登记", "系统提示"); // return; } List <MED_OPERATION_MASTER> operMasterList = operationInfoRepository.GetOperMasterList(patientID, _visitID).Data; if (operMasterList != null && operMasterList.Count > 0) { _operID = Convert.ToInt32(operMasterList[0].GetValue("OPER_ID")) + 1; } operationMaster = new MED_OPERATION_MASTER(); operationMaster.PATIENT_ID = patientID; operationMaster.VISIT_ID = _visitID; operationMaster.OPER_ID = _operID; operationMaster.OPER_ROOM = ExtendApplicationContext.Current.OperRoom; operationMaster.OPER_ROOM_NO = ExtendApplicationContext.Current.OperRoomNo; operationMaster.HOSP_BRANCH = ExtendApplicationContext.Current.HospBranchCode; operationMaster.SCHEDULED_DATE_TIME = accountRepository.GetServerTime().Data; if (patsInHospital != null) { patVisit.INP_NO = patsInHospital.INP_NO; operationMaster.WARD_CODE = patsInHospital.WARD_CODE; operationMaster.DEPT_CODE = patsInHospital.WARD_CODE; operationMaster.BED_NO = patsInHospital.BED_NO; } else { patsInHospital = operationInfoRepository.GetPatsInHospitalByID(patientID, _visitID).Data; patVisit.INP_NO = patsInHospital.INP_NO; operationMaster.WARD_CODE = patsInHospital.WARD_CODE; operationMaster.DEPT_CODE = patsInHospital.WARD_CODE; operationMaster.BED_NO = patsInHospital.BED_NO; } ExtendApplicationContext.Current.MED_PAT_MASTER_INDEX = patMasterIndex; ExtendApplicationContext.Current.MED_OPERATION_MASTER = operationMaster; ExtendApplicationContext.Current.MED_PAT_VISIT = patVisit; anesPlan = new DocDataRepository().GetAnesthesiaPlan(_patientID, _visitID, _operID); _patientCard = new MED_PATIENT_CARD(); foreach (string column in _patientCard.GetPropsName()) { foreach (string col in patMasterIndex.GetPropsName()) { if (column == col) { _patientCard.SetValue(column, patMasterIndex.GetValue(col)); } } foreach (string col in operationMaster.GetPropsName()) { if (column == col) { _patientCard.SetValue(column, operationMaster.GetValue(col)); } } foreach (string col in patVisit.GetPropsName()) { if (column == col) { _patientCard.SetValue(column, patVisit.GetValue(col)); } } } } }