/// <summary> /// 取消出院结算 /// </summary> /// <param name="hashtable"></param> /// <returns></returns> public bool CancelCharge(System.Collections.Hashtable hashtable) { string Nccm_NO = hashtable["Nccm_NO"].ToString(); BudgetFee hisData = new BudgetFee(); JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; DataClass dataClass = new DataClass(); dataClass.dataClassName = "新农合数据"; dataClass.dataClassValue = "1"; DataType dataType = new DataType(); dataType.dataTypeName = "住院数据"; dataType.dataTypeValue = "2"; OperType operType = new OperType(); operType.operTypeName = "取消登记"; operType.operTypeValue = "7"; ZyPatBaseData patBaseData = new ZyPatBaseData(); patBaseData.hisID = zyPatlist.Nccm_NO;//zyPatlist.CureNo + zyPatlist.PatListID.ToString(); patBaseData.area_id = JOIN_AREA_CODE; patBaseData.person_code = zyPatlist.patientInfo.PatCode; patBaseData.name = zyPatlist.patientInfo.PatName; patBaseData.idCard = zyPatlist.patientInfo.PatNumber; //? patBaseData.medcard_id = zyPatlist.patientInfo.MediCard; //? patBaseData.visit_type = "2"; patBaseData.medorg_code = MED_ORG_CODE; patBaseData.his_billno = Nccm_NO; hisData.uploadPerson = ((HospitalInfo)hospitalInfo).userCode; hisData.joinArea = joinArea; hisData.dataClass = dataClass; hisData.dataType = dataType; hisData.operType = operType; hisData.zyPat = patBaseData; hisData.uploadorg = MED_ORG_CODE; NcmsResult retMsg = NccmInterfaces.CanOutPatZYCharge(hisData); if (retMsg.resultId) { return(true); } else { throw new Exception("农合接口调用失败:" + retMsg.resultString); } }
/// <summary> /// 门诊农合接口 /// </summary> public MZ_NccmInterface() { HisData hisData = new HisData(); hisData.uploadorg = MED_ORG_CODE; hisData.uploadTime = DateTime.Now.ToString("yyyy-MM-dd"); DataClass dataClass = new DataClass(); DataType dataType = new DataType(); dataType.dataTypeName = ""; dataType.dataTypeValue = "1"; JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; hisData.joinArea = joinArea; hisData.dataClass = dataClass; hisData.dataType = dataType; hospitalInfo = NccmInterfaces.DownLoadHospitalInfo(hisData); //初始化匹配列表 matchList = HIS.SYSTEM.Core.BindEntity <Model.NCMS_MATCH_CATALOG_TEMP> .CreateInstanceDAL(oleDb).GetListArray(""); }
/// <summary> /// 住院病人费用上传 /// </summary> /// <param name="hashtable"></param> /// <returns></returns> public bool UploadzyPatFee(System.Collections.Hashtable hashtable) { FeeDetail[] prescriptions = (FeeDetail[])hashtable["FeeDetail"]; ZY_PresOrder zypo = new ZY_PresOrder(); int[] presID = new int[prescriptions.Length]; for (int i = 0; i < prescriptions.Length; i++) { presID[i] = Convert.ToInt32(prescriptions[i].item_sn); } zypo.UpdateComp(presID);//更新为上传标识 BudgetFee hisData = new BudgetFee(); JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; DataType dataType = new DataType(); dataType.dataTypeName = "住院数据"; dataType.dataTypeValue = "2"; ZyPatBaseData zyPat = new ZyPatBaseData(); zyPat.idCard = zyPatlist.patientInfo.PatNumber;//? zyPat.person_code = zyPatlist.patientInfo.PatCode; zyPat.hisID = zyPatlist.Nccm_NO; zyPat.area_id = JOIN_AREA_CODE; zyPat.medorg_code = MED_ORG_CODE;//? hisData.zyPat = zyPat; hisData.feeDetail = prescriptions; hisData.uploadorg = MED_ORG_CODE;//"40086695143010101A2201";//? hisData.dataType = dataType; hisData.joinArea = joinArea; RecieveDetailFeeResult result = NccmInterfaces.UploadZYPatFee(hisData); if (result.resultId) { prescriptions = result.feeDetail; presID = new int[prescriptions.Length]; for (int i = 0; i < prescriptions.Length; i++) { presID[i] = Convert.ToInt32(prescriptions[i].item_sn); } zypo.DelComp(presID);//更新上传失败的项目 return(true); } else { throw new Exception("农合接口调用失败:" + result.resultString); } }
/// <summary> /// 取消入院 /// </summary> /// <param name="hashtable"></param> /// <returns></returns> public bool CancelRegister(System.Collections.Hashtable hashtable) { PatBaseInfo hisData = new PatBaseInfo(); JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; DataClass dataClass = new DataClass(); dataClass.dataClassName = "新农合数据"; dataClass.dataClassValue = "1"; DataType dataType = new DataType(); dataType.dataTypeName = "住院数据"; dataType.dataTypeValue = "2"; OperType operType = new OperType(); operType.operTypeName = "取消登记"; operType.operTypeValue = "7"; PatBaseData patBaseData = new PatBaseData(); patBaseData.hisID = zyPatlist.Nccm_NO;//病人的唯一ID,住院则对应的是住院号,门诊则对应的是门诊号 patBaseData.area_id = JOIN_AREA_CODE; patBaseData.person_code = zyPatlist.patientInfo.PatCode; patBaseData.name = zyPatlist.patientInfo.PatName; patBaseData.idCard = zyPatlist.patientInfo.PatNumber; //?(身份证) patBaseData.medcard_id = zyPatlist.patientInfo.MediCard; //? patBaseData.visit_type = "2"; //住院 hisData.joinArea = joinArea; hisData.dataClass = dataClass; hisData.dataType = dataType; hisData.operType = operType; hisData.baseData = patBaseData; hisData.uploadorg = MED_ORG_CODE; NcmsResult retMsg = NccmInterfaces.CanInpatientRegister(hisData); if (retMsg.resultId) { return(true); } else { throw new Exception("农合接口调用失败:" + retMsg.resultString); } }
/// <summary> /// 农合入院 /// </summary> /// <param name="hashtable"></param> /// <returns></returns> public bool Register(System.Collections.Hashtable hashtable) { PatientSignInfo retMsg = null; PatientSign ps = new PatientSign(); ZyPatBaseData zyPs = new ZyPatBaseData(); JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; zyPs.hisID = zyPatlist.Nccm_NO;//zyPatlist.CureNo + zyPatlist.PatListID.ToString(); zyPs.medorg_code = MED_ORG_CODE; zyPs.area_id = JOIN_AREA_CODE; zyPs.inpat_no = zyPatlist.CureNo.ToString(); zyPs.person_code = zyPatlist.patientInfo.PatCode; zyPs.name = zyPatlist.patientInfo.PatName; zyPs.sex = zyPatlist.patientInfo.PatSex == "男" ? "1" : "2"; zyPs.idCard = zyPatlist.patientInfo.PatNumber;//? zyPs.family_code = zyPatlist.patientInfo.FamilyCode; zyPs.medcard_id = zyPatlist.patientInfo.MediCard; zyPs.medorg_level = "2"; zyPs.visit_type = "2"; zyPs.adm_date = zyPatlist.CureDate.ToString("yyyy-MM-dd"); zyPs.adm_state = "1"; //?zyPatlist.CureState? zyPs.comp_classs = "2"; //? ps.joinArea = joinArea; ps.zyPat = zyPs; ps.uploadorg = MED_ORG_CODE; retMsg = NccmInterfaces.InpatientRegister(ps); if (retMsg.resultId) { return(retMsg.resultId); } else { throw new Exception("农合接口调用失败:" + retMsg.resultString); } }
/// <summary> /// 住院农合接口 /// </summary> public zyNccmInterface() { HisData hisData = new HisData(); hisData.uploadorg = MED_ORG_CODE; hisData.uploadTime = DateTime.Now.ToString("yyyy-MM-dd"); DataClass dataClass = new DataClass(); DataType dataType = new DataType(); dataType.dataTypeName = ""; dataType.dataTypeValue = "1"; JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; hisData.joinArea = joinArea; hisData.dataClass = dataClass; hisData.dataType = dataType; hospitalInfo = NccmInterfaces.DownLoadHospitalInfo(hisData); }
/// <summary> /// 下载病人费用 /// </summary> /// <param name="hashtable"></param> /// <returns></returns> public object DownloadzyPatFee(System.Collections.Hashtable hashtable) { DownLoadItem hisData = new DownLoadItem(); JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; DataType dataType = new DataType(); dataType.dataTypeName = "住院数据"; dataType.dataTypeValue = "2"; Condition CARD_ID = new Condition(); //合作医疗证号 CARD_ID.condition_displayname = "合作医疗证号"; CARD_ID.condition_name = "SN"; CARD_ID.condition_value = zyPatlist.Nccm_NO; //"20090408" ; Condition[] conditions = new Condition[] { CARD_ID }; hisData.uploadorg = MED_ORG_CODE; hisData.dataType = dataType; hisData.joinArea = joinArea; hisData.conditions = conditions; RecieveDetailFeeResult rdf = NccmInterfaces.DownLoadDetailFee(hisData); if (rdf.resultId) { return(ConvertDT(rdf.feeDetail)); } else { throw new Exception("农合接口调用失败:" + rdf.resultString); } }
/// <summary> /// 获取农合医疗机构信息 /// </summary> /// <returns></returns> public static HospitalInfo Get_Ncms_HisInfo() { HisData hisData = new HisData(); hisData.uploadorg = "400866951"; hisData.uploadTime = DateTime.Now.ToString("yyyy-MM-dd"); DataClass dataClass = new DataClass(); DataType dataType = new DataType(); dataType.dataTypeName = ""; dataType.dataTypeValue = "1"; JoinArea joinArea = new JoinArea(); joinArea.code = "430121"; joinArea.name = "长沙县"; hisData.joinArea = joinArea; hisData.dataClass = dataClass; hisData.dataType = dataType; try { HospitalInfo hospitalInfo = NccmInterfaces.DownLoadHospitalInfo(hisData); if (hospitalInfo != null) { return(hospitalInfo); } else { throw new Exception("Invoke Successful but result is null"); } } catch (Exception err) { throw new Exception(err.Message); } }
/// <summary> /// 正式结算 /// </summary> /// <param name="prescriptions">需要结算的处方</param> /// <returns>true:结算成功,false:结算失败</returns> /// <param name="Result">返回的相关信息</param> public bool Charge(Prescription[] prescriptions, out object Result) { Result = null; PatientComp patComp = new PatientComp(); patComp.uploadorg = MED_ORG_CODE; DataClass dataClass = new DataClass(); dataClass.dataClassValue = "1"; patComp.dataClass = dataClass; JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; patComp.joinArea = joinArea; DataType dataType = new DataType(); dataType.dataTypeName = "门诊数据"; dataType.dataTypeValue = "2"; patComp.dataType = dataType; MzPatBaseData mzPat = new MzPatBaseData(); mzPat.idCard = hisOutPatient.InsurInfo.IdCard; mzPat.person_code = hisOutPatient.InsurInfo.Person_Code; mzPat.hisID = hisOutPatient.PatListID.ToString();//本次门诊的唯一号 mzPat.area_id = JOIN_AREA_CODE; mzPat.family_code = hisOutPatient.InsurInfo.Family_Code; mzPat.medorg_code = MED_ORG_CODE; mzPat.medorg_level = hisOutPatient.InsurInfo.Medorg_Level; mzPat.visit_type = "1"; //1,门诊,2-住院 mzPat.age = hisOutPatient.Age.ToString(); mzPat.name = hisOutPatient.PatientName; mzPat.medcard_id = hisOutPatient.InsurInfo.Medcard_Id; patComp.mzPat = mzPat; List <FeeDetail> fees = new List <FeeDetail>(); for (int i = 0; i < prescriptions.Length; i++) { for (int j = 0; j < prescriptions[i].PresDetails.Length; j++) { FeeDetail feeDetail = new FeeDetail(); feeDetail.his_billno = prescriptions[i].ChargeID.ToString(); feeDetail.item_sn = prescriptions[i].PrescriptionID.ToString() + prescriptions[i].PresDetails[j].DetailId.ToString() + prescriptions[i].ChargeID.ToString(); feeDetail.item_code = prescriptions[i].PresDetails[j].ItemId.ToString(); if (prescriptions[i].PresDetails[j].ItemType == "01" || prescriptions[i].PresDetails[j].ItemType == "02" || prescriptions[i].PresDetails[j].ItemType == "03") { feeDetail.item_class = "1"; } else { feeDetail.item_class = "2"; } feeDetail.item_equal = "0"; feeDetail.item_name = prescriptions[i].PresDetails[j].Itemname.Trim(); feeDetail.item_use_time = DateTime.Now.ToString("yyyy-MM-dd"); feeDetail.amount = Convert.ToDouble(prescriptions[i].PresDetails[j].Amount); feeDetail.drugform = ""; feeDetail.doctorTitle = GetDoctorTitle(prescriptions[i].PresDocCode); feeDetail.doctor = prescriptions[i].PresDocCode; feeDetail.money = Convert.ToDouble(prescriptions[i].PresDetails[j].Tolal_Fee); feeDetail.price = Convert.ToDouble(prescriptions[i].PresDetails[j].Sell_price); feeDetail.center_item_code = GetNcmsCenterCode(feeDetail.item_code, feeDetail.item_class); feeDetail.specs = prescriptions[i].PresDetails[j].Standard; feeDetail.unit = prescriptions[i].PresDetails[j].Unit; feeDetail.nccm_comp_status = "0"; feeDetail.feeType = GetClassCode(prescriptions[i].PresDetails[j].BigitemCode); feeDetail.comp_ratio = Convert.ToDouble(GetNcmsCompRate(feeDetail.item_code, feeDetail.item_class)); fees.Add(feeDetail); } } FeeDetail[] detailList = fees.ToArray(); patComp.mzDetail = detailList; //调用接口预算功能 try { CompData[] cpData = NccmInterfaces.OutPatientCharge(patComp); Result = cpData; return(true); } catch (OperatorException operr) { throw operr; } catch (Exception err) { ErrorWriter.WriteLog(err.Source + "\r\n" + err.Message); throw new Exception("新农合接口调用期间发生错误!"); } }
/// <summary> /// 预算(接口预算完成后,回写入参的补偿金额字段以便后续使用) /// </summary> /// <returns>返回医保预算信息</returns> public InsurChargeInfo PreviewCharge(Prescription[] prescriptions) { PatientComp patComp = new PatientComp(); patComp.uploadorg = MED_ORG_CODE; DataClass dataClass = new DataClass(); dataClass.dataClassValue = "1"; patComp.dataClass = dataClass; JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; patComp.joinArea = joinArea; DataType dataType = new DataType(); dataType.dataTypeName = "门诊数据"; dataType.dataTypeValue = "2"; patComp.dataType = dataType; MzPatBaseData mzPat = new MzPatBaseData(); mzPat.idCard = hisOutPatient.InsurInfo.IdCard; mzPat.person_code = hisOutPatient.InsurInfo.Person_Code; mzPat.hisID = hisOutPatient.PatListID.ToString();//本次门诊的唯一号 mzPat.area_id = JOIN_AREA_CODE; mzPat.family_code = hisOutPatient.InsurInfo.Family_Code; mzPat.medorg_code = MED_ORG_CODE; mzPat.medorg_level = hisOutPatient.InsurInfo.Medorg_Level; mzPat.visit_type = "1"; //1,门诊,2-住院 mzPat.age = hisOutPatient.Age.ToString(); mzPat.name = hisOutPatient.PatientName; mzPat.medcard_id = hisOutPatient.InsurInfo.Medcard_Id; mzPat.birthdate = hisOutPatient.InsurInfo.BirthDate.ToString("yyyy-MM-dd"); mzPat.age = hisOutPatient.InsurInfo.Age.ToString(); patComp.mzPat = mzPat; List <FeeDetail> fees = new List <FeeDetail>(); for (int i = 0; i < prescriptions.Length; i++) { for (int j = 0; j < prescriptions[i].PresDetails.Length; j++) { try { FeeDetail feeDetail = new FeeDetail(); feeDetail.his_billno = prescriptions[i].ChargeID.ToString(); feeDetail.item_sn = prescriptions[i].PrescriptionID.ToString() + prescriptions[i].PresDetails[j].DetailId.ToString() + prescriptions[i].ChargeID.ToString(); feeDetail.item_code = prescriptions[i].PresDetails[j].ItemId.ToString(); if (prescriptions[i].PresDetails[j].ItemType == "01" || prescriptions[i].PresDetails[j].ItemType == "02" || prescriptions[i].PresDetails[j].ItemType == "03") { feeDetail.item_class = "1"; } else { feeDetail.item_class = "2"; } feeDetail.item_equal = "0"; feeDetail.item_name = prescriptions[i].PresDetails[j].Itemname.Trim(); feeDetail.item_use_time = DateTime.Now.ToString("yyyy-MM-dd"); feeDetail.amount = Convert.ToDouble(prescriptions[i].PresDetails[j].Amount); feeDetail.drugform = ""; feeDetail.doctorTitle = GetDoctorTitle(prescriptions[i].PresDocCode); feeDetail.doctor = prescriptions[i].PresDocCode; feeDetail.money = Convert.ToDouble(prescriptions[i].PresDetails[j].Tolal_Fee); feeDetail.price = Convert.ToDouble(prescriptions[i].PresDetails[j].Sell_price); feeDetail.center_item_code = GetNcmsCenterCode(feeDetail.item_code, feeDetail.item_class); feeDetail.specs = prescriptions[i].PresDetails[j].Standard; feeDetail.unit = prescriptions[i].PresDetails[j].Unit; feeDetail.nccm_comp_status = "0"; feeDetail.feeType = GetClassCode(prescriptions[i].PresDetails[j].BigitemCode); feeDetail.comp_ratio = Convert.ToDouble(GetNcmsCompRate(feeDetail.item_code, feeDetail.item_class)); fees.Add(feeDetail); } catch (Exception err) { ErrorWriter.WriteLog(err.Message); throw new OperatorException("准备上传数据期间发生错误!"); } } } FeeDetail[] detailList = fees.ToArray(); patComp.mzDetail = detailList; InsurChargeInfo insurChargeInfo = new InsurChargeInfo();//定义的农合结算信息 //调用接口预算功能 try { CompData[] compDatas = NccmInterfaces.OutPatientBudegt(patComp); //判断返回的农合结算结果记录是是否和医院处方数对应 if (compDatas.Length != prescriptions.Length) { throw new NcmsInterfaceException("新农合预算结果的记录数(" + compDatas.Length.ToString() + ")不等于医院上传的处方数(" + prescriptions.Length.ToString() + ")"); } //回写每条明细的补偿金额 for (int i = 0; i < prescriptions.Length; i++) { for (int j = 0; j < compDatas.Length; j++) { if (prescriptions[i].ChargeID.ToString() == compDatas[j].bill_no) { prescriptions[i].RedeemCost = Convert.ToDecimal(compDatas[j].comp_money); break; } } } } catch (NcmsInterfaceException ncmsErr) { throw new OperatorException(ncmsErr.Message); } catch (Exception err) { ErrorWriter.WriteLog(err.Message); ErrorWriter.WriteLog(err.InnerException.Message); throw new Exception("农合预算发生错误!"); } return(insurChargeInfo); }
/// <summary> /// 上传匹配关系 /// </summary> public static void UploadMatchInfo(MatchInfo[] matchList, HospitalInfo hospitalInfo, out string Msg) { JoinArea joinArea = new JoinArea(); joinArea.code = CURRENT_JOINAREA_CODE; joinArea.name = CURRENT_JOINAREA_NAME; DataType dataType = new DataType(); dataType.dataTypeName = NcmsDataType.门诊数据.ToString(); dataType.dataTypeValue = ((int)NcmsDataType.门诊数据).ToString(); //定义本次上传的项目集合 ItemMatchInfo[] matchItems = new ItemMatchInfo[matchList.Length]; for (int i = 0; i < matchList.Length; i++) { ItemMatchInfo matchItem = new ItemMatchInfo(); matchItem.drug_alias = matchList[i].drug_alias; matchItem.drug_form = matchList[i].drug_form; matchItem.drug_type = matchList[i].drug_type; matchItem.hospital_code = matchList[i].hospital_code; matchItem.if_equal = "0"; matchItem.limit_desc = matchList[i].limit_desc; matchItem.medorg_code = hospitalInfo.org_id; matchItem.ncms_code = matchList[i].ncms_code; matchItem.price = matchList[i].price1; matchItem.price1 = matchList[i].price1; matchItem.price2 = matchList[i].price2; matchItem.price3 = matchList[i].price3; matchItem.region_code = CURRENT_REGION_CODE; matchItem.specs = matchList[i].specs; matchItem.status = "1"; matchItem.therapy_content = matchList[i].therapy_content; matchItem.therapy_exclude = matchList[i].therapy_exclude; matchItem.type = matchList[i].type; matchItem.upload_time = DateTime.Now.ToString("yyyy-MM-dd"); matchItem.uploader = hospitalInfo.userCode; matchItem.use_level = matchList[i].use_levle; matchItems[i] = matchItem; } RecieveHospitalMatchInfo hisData = new RecieveHospitalMatchInfo(); hisData.itemMatchInfo = matchItems; hisData.joinArea = joinArea; hisData.dataType = dataType; hisData.uploadorg = "111"; try { ItemMatchInfo[] uploadFailedItems; if (NccmInterfaces.UploadMatchInfo(hisData, out uploadFailedItems, out Msg)) { //回写上传标识nnms_match_catalog_temp.status for (int i = 0; i < matchList.Length; i++) { bool uploadSuccess = true; if (uploadFailedItems != null) { for (int j = 0; j < uploadFailedItems.Length; j++) { //跳过上传失败的记录 if (matchList[i].ncms_code == uploadFailedItems[j].ncms_code && matchList[i].hospital_code == uploadFailedItems[j].hospital_code) { uploadSuccess = false; break; } } } if (uploadSuccess) { string strWhere = HIS.BLL.Tables.ncms_match_catalog_temp.HOSPITAL_CODE + oleDb.EuqalTo() + "'" + matchList[i].hospital_code + "'"; strWhere += oleDb.And() + HIS.BLL.Tables.ncms_match_catalog_temp.NCMS_CODE + oleDb.EuqalTo() + "'" + matchList[i].ncms_code + "'"; HIS.SYSTEM.Core.BindEntity <Model.NCMS_MATCH_CATALOG_TEMP> .CreateInstanceDAL(oleDb).Update(strWhere, "STATUS='1'"); } } } } catch (Exception err) { throw err; } }
/// <summary> /// 下载农合药品目录到本地数据库 /// </summary> public static void DownLoadAndSaveNcmsDrug() { try { //药品列表容器 List <Drug> drugList = new List <Drug>(); //定义入口参数 DownLoadItem hisData = new DownLoadItem(); JoinArea joinArea = new JoinArea(); joinArea.code = CURRENT_JOINAREA_CODE; joinArea.name = CURRENT_JOINAREA_NAME; DataType dataType = new DataType(); dataType.dataTypeName = NcmsDataType.门诊数据.ToString(); dataType.dataTypeValue = ((int)NcmsDataType.门诊数据).ToString(); //项目类型 [1(所有目录)[2(药品目录),3(诊疗项目目录)] Condition condition = new Condition(); condition.condition_name = "CONTENT_TYPE"; condition.condition_value = ((int)DownLoadItemType.DRUG).ToString(); //要下载的页码 整数 int current_page = 1; Condition condition1 = new Condition(); condition1.condition_name = "CURRENT_PAGE"; condition1.condition_value = current_page.ToString(); //要下载的每页大小 Condition condition2 = new Condition(); condition2.condition_name = "PAGE_SIZE"; condition2.condition_value = "100"; hisData.uploadorg = "23423"; hisData.dataType = dataType; hisData.joinArea = joinArea; Condition[] conditions = new Condition[3]; conditions[0] = condition; conditions[1] = condition1; conditions[2] = condition2; hisData.conditions = conditions; //下载第一页并取得页面相关信息 DownLoadCenterItemResult result = NccmInterfaces.DownLoadDrugListInfo(hisData); if (result.resultId) { drugList = result.drug.ToList <Drug>(); int totalPage = result.drugPageInfo.totalPageNo; current_page = 2; while (current_page <= totalPage) { //重新指定要下载的页 hisData.conditions[1].condition_value = current_page.ToString(); result = NccmInterfaces.DownLoadDrugListInfo(hisData); if (result.resultId) { //追加到List for (int i = 0; i < result.drug.Length; i++) { drugList.Add(result.drug[i]); } } else { throw new Exception(result.resultString); } current_page++; } //将药品信息保存到数据库 try { oleDb.BeginTransaction(); HIS.SYSTEM.Core.BindEntity <Model.NCMS_DRUG_CATALOG> .CreateInstanceDAL(oleDb).Delete(""); foreach (Drug drug in drugList) { Model.NCMS_DRUG_CATALOG model = new HIS.Model.NCMS_DRUG_CATALOG(); #region ....... model.DRUG_ALIAS = drug.drug_alias; model.DRUG_CODE = drug.drug_code; model.DRUG_CODE2 = drug.drug_code2; model.DRUG_FORM = drug.drug_form; model.DRUG_NAME = drug.drug_name; model.DRUG_TYPE = drug.drug_type; model.DRUGCLASS_CODE = drug.drugclass_code; model.LIMIT_DEPT = drug.limit_dept; model.LIMIT_DESC = drug.limit_desc; model.LIMIT_DISEASE = drug.limit_disease; model.LIMIT_DOCTOR = drug.limit_doctor; model.LIMIT_FORM = drug.limit_form; model.LIMIT_HOSPITAL = drug.limit_hospital; model.LIMIT_LINE = drug.limit_line; model.LIMIT_MAKER = drug.limit_maker; model.LIMIT_PRICE = drug.limit_price.ToString(); model.LIMIT_PRICEFIELDSPECI = drug.limit_priceSpecified.ToString(); model.LIMIT_UNIT_NAME = drug.limit_unit_name; model.LIMIT_UNIT_NUM = drug.limit_unit_num; model.MARK = drug.mark; model.USE_LEVEL = drug.use_level; #endregion HIS.SYSTEM.Core.BindEntity <Model.NCMS_DRUG_CATALOG> .CreateInstanceDAL(oleDb).Add(model); } oleDb.CommitTransaction(); } catch (Exception err) { oleDb.RollbackTransaction(); throw err; } } else { throw new Exception(result.resultString); } } catch (Exception err) { throw err; } }
/// <summary> /// 下载匹配信息 /// </summary> public static void DownLoadAndSaveMatchInfo() { List <ItemMatchInfo> matchList = new List <ItemMatchInfo>(); DownLoadItem hisData = new DownLoadItem(); JoinArea joinArea = new JoinArea(); joinArea.code = CURRENT_JOINAREA_CODE; joinArea.name = CURRENT_JOINAREA_NAME; DataClass dataClass = new DataClass(); dataClass.dataClassName = NcmsDataClass.新农合数据.ToString(); dataClass.dataClassValue = ((int)NcmsDataClass.新农合数据).ToString(); DataType dataType = new DataType(); dataType.dataTypeName = NcmsDataType.收费项目.ToString(); dataType.dataTypeValue = ((int)NcmsDataType.收费项目).ToString(); OperType operType = new OperType(); operType.operTypeName = NcmsOperType.查询.ToString(); operType.operTypeValue = ((int)NcmsOperType.查询).ToString(); Condition Content_type = new Condition(); Condition Approve_status = new Condition(); Condition Current_page = new Condition(); Condition Page_size = new Condition(); Content_type.condition_displayname = "项目类型"; Content_type.condition_name = "CONTENT_TYPE"; Content_type.condition_value = "1"; Approve_status.condition_displayname = "审核状态"; Approve_status.condition_name = "APPROVE_STATUS"; Approve_status.condition_value = "4"; int current_page = 1; Current_page.condition_displayname = "要下载的页码"; Current_page.condition_name = "CURRENT_PAGE"; Current_page.condition_value = current_page.ToString(); int pageSize = 100; Page_size.condition_displayname = "页面大小"; Page_size.condition_name = "PAGE_SIZE"; Page_size.condition_value = pageSize.ToString(); Condition[] cond = new Condition[] { Content_type, Approve_status, Current_page, Page_size }; hisData.joinArea = joinArea; hisData.dataClass = dataClass; hisData.dataType = dataType; hisData.operType = operType; hisData.conditions = cond; hisData.uploadorg = "400866951"; try { RecieveHospitalMatchInfoResult result = NccmInterfaces.DownLoadMatchInfo(hisData); if (result.resultId) { matchList = result.itemMatchInfo.ToList <ItemMatchInfo>(); current_page = 2; while (1 == 1) { //重新指定要下载的页 hisData.conditions[2].condition_value = current_page.ToString(); result = NccmInterfaces.DownLoadMatchInfo(hisData); if (result.itemMatchInfo == null) { break; } if (result.resultId) { //追加到List for (int i = 0; i < result.itemMatchInfo.Length; i++) { matchList.Add(result.itemMatchInfo[i]); } } else { throw new Exception(result.resultString); } current_page++; } //保存到数据库 try { oleDb.BeginTransaction(); HIS.SYSTEM.Core.BindEntity <Model.NCMS_MATCH_CATALOG> .CreateInstanceDAL(oleDb).Delete(""); foreach (ItemMatchInfo match in matchList) { Model.NCMS_MATCH_CATALOG model = new HIS.Model.NCMS_MATCH_CATALOG(); model.APPROVE_STATUS = match.approve_status; model.APPROVETIME = match.approveTime; model.HOSPITAL_CODE = match.hospital_code; model.IF_EQUAL = match.if_equal; model.MEDORG_CODE = match.medorg_code; model.NCMS_CODE = match.ncms_code; model.REGION_CODE = match.region_code; model.STATUS = match.status; model.TYPE = match.type; model.UPLOAD_TIME = match.upload_time; model.UPLOADER = match.uploader; HIS.SYSTEM.Core.BindEntity <Model.NCMS_MATCH_CATALOG> .CreateInstanceDAL(oleDb).Add(model); } oleDb.CommitTransaction(); } catch (Exception err) { oleDb.RollbackTransaction(); throw err; } } } catch (Exception err) { throw new Exception(err.Message); } }
/// <summary> /// 出院结算 /// </summary> /// <param name="hashtable"></param> /// <returns></returns> public object Charge(System.Collections.Hashtable hashtable) { FeeDetail[] prescriptions = (FeeDetail[])hashtable["FeeDetail"]; string Is_midWay = hashtable["midWay"].ToString(); string Nccm_NO = hashtable["Nccm_NO"].ToString(); ZY_PresOrder zypo = new ZY_PresOrder(); int[] presID = new int[prescriptions.Length]; for (int i = 0; i < prescriptions.Length; i++) { presID[i] = Convert.ToInt32(prescriptions[i].item_sn); } zypo.UpdateComp(presID);//更新为上传标识 PatientComp patComp = new PatientComp(); patComp.uploadorg = "1"; DataClass dataClass = new DataClass(); dataClass.dataClassValue = "2";//门诊是1,住院是2 patComp.dataClass = dataClass; JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; patComp.joinArea = joinArea; DataType dataType = new DataType(); dataType.dataTypeName = "门诊数据"; dataType.dataTypeValue = "2"; patComp.dataType = dataType; ZyPatBaseData zyPat = new ZyPatBaseData(); zyPat.area_id = JOIN_AREA_CODE; zyPat.medorg_code = MED_ORG_CODE; zyPat.hisID = zyPatlist.Nccm_NO;//zyPatlist.CureNo + zyPatlist.PatListID.ToString(); zyPat.his_billno = Nccm_NO; zyPat.person_code = zyPatlist.patientInfo.PatCode; zyPat.name = zyPatlist.patientInfo.PatName; zyPat.sex = zyPatlist.patientInfo.PatSex == "男" ? "1" : "2"; zyPat.idCard = zyPatlist.patientInfo.PatNumber; zyPat.family_code = zyPatlist.patientInfo.FamilyCode; zyPat.medcard_id = zyPatlist.patientInfo.MediCard; zyPat.medorg_level = ((HospitalInfo)hospitalInfo).hos_level; zyPat.is_midway = Is_midWay; //1,中途2出院 zyPat.visit_type = "2"; zyPat.comp_classs = "2"; //? zyPat.adm_date = zyPatlist.CureDate.ToString(); //入院日期 zyPat.status = zyPatlist.CureState; //? zyPat.maindiag_code = zyPatlist.DiseaseCode; zyPat.dis_date = zyPatlist.OutDate.ToString(); patComp.zyPat = zyPat; patComp.zyDetail = prescriptions; patComp.uploadorg = MED_ORG_CODE; CompResult CR = NccmInterfaces.OutZYPatientCharge(patComp); if (CR.resultId) { prescriptions = CR.feeDetail; presID = new int[prescriptions.Length]; for (int i = 0; i < prescriptions.Length; i++) { presID[i] = Convert.ToInt32(prescriptions[i].item_sn); } zypo.DelComp(presID);//更新上传失败的项目 return(Convert.ToDecimal(CR.compData[0].comp_money)); } else { throw new Exception("农合接口调用失败:" + CR.resultString); } }
/// <summary> /// 出院预算 /// </summary> /// <param name="hashtable"></param> /// <returns></returns> public object PreviewCharge(System.Collections.Hashtable hashtable) { FeeDetail[] prescriptions = (FeeDetail[])hashtable["FeeDetail"]; string Is_midWay = hashtable["midWay"].ToString(); PatientComp patComp = new PatientComp(); patComp.uploadorg = "1"; DataClass dataClass = new DataClass(); dataClass.dataClassValue = "2"; patComp.dataClass = dataClass; JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; patComp.joinArea = joinArea; DataType dataType = new DataType(); dataType.dataTypeName = "住院数据"; dataType.dataTypeValue = "2"; patComp.dataType = dataType; ZyPatBaseData zyPat = new ZyPatBaseData(); zyPat.hisID = zyPatlist.Nccm_NO; zyPat.area_id = JOIN_AREA_CODE; zyPat.medorg_code = MED_ORG_CODE; zyPat.person_code = zyPatlist.patientInfo.PatCode; zyPat.name = zyPatlist.patientInfo.PatName; zyPat.sex = zyPatlist.patientInfo.PatSex == "男" ? "1" : "2"; zyPat.idCard = zyPatlist.patientInfo.PatNumber; zyPat.family_code = zyPatlist.patientInfo.FamilyCode; zyPat.medcard_id = zyPatlist.patientInfo.MediCard; zyPat.medorg_level = ((HospitalInfo)hospitalInfo).hos_level; zyPat.visit_type = "2"; zyPat.comp_classs = "2"; //?住院2 zyPat.adm_date = zyPatlist.CureDate.ToString(); //入院日期 zyPat.status = "1"; //(未补)//zyPatlist.CureState;//? zyPat.maindiag_code = zyPatlist.DiseaseCode; zyPat.dis_date = DateTime.Now.ToString(); zyPat.is_midway = "1";//1,中途结算.2,出院结算 patComp.zyPat = zyPat; patComp.zyDetail = prescriptions; patComp.uploadorg = MED_ORG_CODE; //调用接口预算功能 CompResult compresult = NccmInterfaces.OutZYPatientBudegt(patComp); if (compresult.resultId) { return(Convert.ToDecimal(compresult.compData[0].comp_money)); } else { throw new Exception("农合接口调用失败:" + compresult.resultString); } }
/// <summary> /// 退费 /// </summary> /// <param name="OrgPrescription">原始处方</param> /// <param name="DisChargePrescription">冲正的处方</param> /// <returns></returns> public bool CancelCharge(Prescription OrgPrescription, Prescription DisChargePrescription) { CanceDetail hisData = new CanceDetail(); hisData.hos_class = hospitalInfo.hos_class; hisData.hos_level = hospitalInfo.hos_level; hisData.medorg_level = hospitalInfo.org_id; hisData.uploadorg = MED_ORG_CODE; hisData.uploadPerson = hospitalInfo.userCode; hisData.uploadTime = DateTime.Now.ToString("yyyy-MM-dd"); hisData.joinArea = new JoinArea(); hisData.joinArea.code = JOIN_AREA_CODE; hisData.joinArea.name = JOIN_AREA_NAME; hisData.dataClass = new DataClass(); hisData.dataClass.dataClassName = "新农合数据"; hisData.dataClass.dataClassValue = "1"; hisData.dataType = new DataType(); hisData.dataType.dataTypeName = "门诊数据"; hisData.dataType.dataTypeValue = "1"; hisData.operType = new OperType(); hisData.operType.operTypeName = "冲正"; hisData.operType.operTypeValue = "2"; //病人基本信息 hisData.baseData = new PatBaseData(); hisData.baseData.age = hisOutPatient.InsurInfo.Age.ToString(); hisData.baseData.area_id = JOIN_AREA_CODE; hisData.baseData.birthdate = hisOutPatient.InsurInfo.BirthDate.ToString("yyyy-MM-dd"); hisData.baseData.family_code = hisOutPatient.InsurInfo.Family_Code; hisData.baseData.hisID = hisOutPatient.PatListID.ToString(); hisData.baseData.idCard = hisOutPatient.InsurInfo.IdCard; hisData.baseData.medcard_id = hisOutPatient.InsurInfo.Medcard_Id; hisData.baseData.name = hisOutPatient.InsurInfo.Name; hisData.baseData.person_code = hisOutPatient.InsurInfo.Person_Code; hisData.baseData.sex = hisOutPatient.InsurInfo.Sex; hisData.baseData.visit_type = "1"; //指定需要退费的明细(负记录)数量和金额是负数 List <FeeDetail> feeList = new List <FeeDetail>(); for (int i = 0; i < DisChargePrescription.PresDetails.Length; i++) { try { FeeDetail detail = new FeeDetail( ); detail.his_billno = DisChargePrescription.ChargeID.ToString( ); //* detail.item_sn = DisChargePrescription.PrescriptionID.ToString( ) + DisChargePrescription.PresDetails[i].DetailId.ToString( ) + DisChargePrescription.ChargeID.ToString( ); //* detail.item_code = DisChargePrescription.PresDetails[i].ItemId.ToString( ); //* if (DisChargePrescription.PresDetails[i].ItemType == "01" || DisChargePrescription.PresDetails[i].ItemType == "02" || DisChargePrescription.PresDetails[i].ItemType == "03") { detail.item_class = "1"; } else { detail.item_class = "2"; } detail.item_equal = "0"; // detail.item_name = DisChargePrescription.PresDetails[i].Itemname; //* detail.item_use_time = DisChargePrescription.PresDate.ToString("yyyy-MM-dd"); //* detail.amount = Convert.ToDouble(DisChargePrescription.PresDetails[i].Amount); //* detail.drugform = ""; // detail.doctorTitle = ""; // detail.doctor = DisChargePrescription.PresDocCode; // detail.money = Convert.ToDouble(DisChargePrescription.PresDetails[i].Tolal_Fee); //* detail.price = Convert.ToDouble(DisChargePrescription.PresDetails[i].Sell_price); //* detail.center_item_code = GetNcmsCenterCode(detail.item_code, detail.item_class); // detail.specs = ""; // detail.unit = DisChargePrescription.PresDetails[i].Unit; // detail.reverse_date = DateTime.Now.ToString("yyyy-MM-dd"); //* 冲正日期 detail.reverse_person = hisData.uploadPerson; //* 冲正人 detail.reverse_sn = OrgPrescription.PrescriptionID.ToString( ) + OrgPrescription.PresDetails[i].DetailId.ToString( ) + OrgPrescription.ChargeID.ToString( ); //* 冲正对应的正记录的ID feeList.Add(detail); } catch (OperatorException operr) { throw operr; } catch (Exception err) { ErrorWriter.WriteLog(err.Message); throw new Exception("数据上传期间发生错误!"); } } hisData.cancelData = feeList.ToArray(); try { object obj = NccmInterfaces.OutPatientCancelCharge(hisData); return(true); } catch (OperatorException operr) { throw operr; } catch (Exception err) { ErrorWriter.WriteLog(err.Source + "\r\n" + err.Message); throw new Exception("农合接口退费发生错误!"); } }
/// <summary> /// 读取病人信息 /// </summary> /// <param name="parameters">查询条件数组,目前只取2长度,分别代表医疗证号和身份证号</param> /// <returns></returns> public InsurPatientInfo[] GetPatientInfo(string[] parameters) { string cardNo = parameters[0]; string idCard = parameters[1]; FindPatientCompInfo hisData = new FindPatientCompInfo(); JoinArea joinArea = new JoinArea(); joinArea.code = JOIN_AREA_CODE; joinArea.name = JOIN_AREA_NAME; DataClass dataClass = new DataClass(); dataClass.dataClassName = NcmsDataClass.新农合数据.ToString(); dataClass.dataClassValue = ((int)NcmsDataClass.新农合数据).ToString(); DataType dataType = new DataType(); dataType.dataTypeName = "参合信息"; dataType.dataTypeValue = "2"; OperType operType = new OperType(); operType.operTypeName = "查询"; operType.operTypeValue = "4"; Condition AREA = new Condition(); //参合地区 AREA.condition_displayname = "参合地区"; AREA.condition_name = "JOIN_AREA"; AREA.condition_value = JOIN_AREA_CODE; Condition CARD_ID = new Condition(); //合作医疗证号 CARD_ID.condition_displayname = "合作医疗证号"; CARD_ID.condition_name = "MED_CARD_ID"; CARD_ID.condition_value = cardNo; //"20090408" ; Condition ID_CARD = new Condition(); ID_CARD.condition_displayname = "身份证号"; ID_CARD.condition_name = "PERSON_IDCARD"; ID_CARD.condition_value = idCard; Condition[] cond = null; if (cardNo.Trim() != "" && idCard.Trim() == "") { cond = new Condition[] { AREA, CARD_ID }; } else if (cardNo.Trim() == "" && idCard.Trim() != "") { cond = new Condition[] { AREA, ID_CARD }; } else if (cardNo.Trim() != "" && idCard.Trim() != "") { cond = new Condition[] { AREA, ID_CARD, CARD_ID }; } hisData.joinArea = joinArea; hisData.dataClass = dataClass; hisData.dataType = dataType; hisData.operType = operType; hisData.conditions = cond; hisData.uploadorg = MED_ORG_CODE; FindPatientCompInfoResult result = NccmInterfaces.FindPatientCompInfo(hisData); if (result.resultId) { List <HIS.MZ_BLL.InsurPatientInfo> listPatInfo = new List <InsurPatientInfo>(); try { for (int i = 0; i < result.compPatBaseData.Length; i++) { HIS.MZ_BLL.InsurPatientInfo insurPatientInfo = new InsurPatientInfo(); insurPatientInfo.Area_Id = result.compPatBaseData[i].area_id; insurPatientInfo.Person_Code = result.compPatBaseData[i].person_code; insurPatientInfo.Name = result.compPatBaseData[i].name; insurPatientInfo.Sex = result.compPatBaseData[i].sex; insurPatientInfo.IdCard = result.compPatBaseData[i].idCard; insurPatientInfo.BirthDate = Convert.ToDateTime(result.compPatBaseData[i].birthdate); //insurPatientInfo.Age = Convert.ToInt32( result.compPatBaseData. ); insurPatientInfo.Family_Code = result.compPatBaseData[i].family_code; insurPatientInfo.Medcard_Id = cardNo; insurPatientInfo.Medorg_Code = hospitalInfo.org_id; insurPatientInfo.Medorg_Level = hospitalInfo.hos_level; listPatInfo.Add(insurPatientInfo); } return(listPatInfo.ToArray()); } catch (Exception err) { ErrorWriter.WriteLog(err.Message); throw new OperatorException("返回查询结果期间发生错误!"); } } else { throw new Exception(result.resultString); } }
/// <summary> /// 下载诊疗服务项目 /// </summary> public static void DownLoadAndSavNcmsTherapy() { try { //药品列表容器 List <Therapy> theraypList = new List <Therapy>(); //定义入口参数 DownLoadItem hisData = new DownLoadItem(); JoinArea joinArea = new JoinArea(); joinArea.code = CURRENT_JOINAREA_CODE; joinArea.name = CURRENT_JOINAREA_NAME; DataType dataType = new DataType(); dataType.dataTypeName = NcmsDataType.门诊数据.ToString(); dataType.dataTypeValue = ((int)NcmsDataType.门诊数据).ToString(); //项目类型 [1(所有目录)[2(药品目录),3(诊疗项目目录)] Condition condition = new Condition(); condition.condition_name = "CONTENT_TYPE"; condition.condition_value = ((int)DownLoadItemType.THERAPY).ToString(); //要下载的页码 整数 int current_page = 1; Condition condition1 = new Condition(); condition1.condition_name = "CURRENT_PAGE"; condition1.condition_value = current_page.ToString(); //要下载的每页大小 Condition condition2 = new Condition(); condition2.condition_name = "PAGE_SIZE"; condition2.condition_value = "100"; hisData.uploadorg = "23423"; hisData.dataType = dataType; hisData.joinArea = joinArea; Condition[] conditions = new Condition[3]; conditions[0] = condition; conditions[1] = condition1; conditions[2] = condition2; hisData.conditions = conditions; //下载第一页并取得页面相关信息 DownLoadCenterItemResult result = NccmInterfaces.DownLoadDrugListInfo(hisData); if (result.resultId) { theraypList = result.therapy.ToList <Therapy>(); int totalPage = result.therapyPageInfo.totalPageNo; current_page = 2; while (current_page <= totalPage) { //重新指定要下载的页 hisData.conditions[1].condition_value = current_page.ToString(); result = NccmInterfaces.DownLoadTherapyListInfo(hisData); if (result.resultId) { //追加到List for (int i = 0; i < result.therapy.Length; i++) { theraypList.Add(result.therapy[i]); } } else { throw new Exception(result.resultString); } current_page++; } //将药品信息保存到数据库 try { oleDb.BeginTransaction(); HIS.SYSTEM.Core.BindEntity <Model.NCMS_THERAPY_CATALOG> .CreateInstanceDAL(oleDb).Delete(""); foreach (Therapy therapy in theraypList) { Model.NCMS_THERAPY_CATALOG model = new HIS.Model.NCMS_THERAPY_CATALOG(); #region ....... model.EXCLUDE_CONTENT = therapy.exclude_content; model.FINANCE_TYPE = therapy.finance_type; model.ITEM_CODE = therapy.item_code; model.ITEM_CONTENT = therapy.item_content; model.ITEM_NAME = ConvertSpeciString(therapy.item_name); model.MARK = therapy.mark; model.MEDCLASS_CODE = therapy.medclass_code; model.PRICE1 = therapy.price1; model.PRICE2 = therapy.price2; model.PRICE3 = therapy.price3; model.SPECS = therapy.specs; model.UNIT = therapy.unit; #endregion HIS.SYSTEM.Core.BindEntity <Model.NCMS_THERAPY_CATALOG> .CreateInstanceDAL(oleDb).Add(model); } oleDb.CommitTransaction(); } catch (Exception err) { oleDb.RollbackTransaction(); throw err; } } else { throw new Exception(result.resultString); } } catch (Exception err) { throw err; } }