/// <summary> /// 上传匹配信息 /// </summary> /// <param name="hisData"></param> /// <param name="upLoadfaildItems">返回的上传失败的记录</param> /// <param name="strMsg">返回的消息</param> /// <returns></returns> public static bool UploadMatchInfo(RecieveHospitalMatchInfo hisData, out ItemMatchInfo[] upLoadfaildItems, out string strMsg) { upLoadfaildItems = null; strMsg = ""; string strParameter = Newtonsoft.Json.JavaScriptConvert.SerializeObject(hisData); Message recieveMsg = new Message(); recieveMsg.DES = false; recieveMsg.GZipCompress = false; recieveMsg.dataContent = strParameter; Message retMsg = new Message(); try { retMsg = ncmsInterface.recieveHospitalMatchInfo(recieveMsg); if (retMsg.DES) { retMsg.dataContent = NccmFunction.decrypt(retMsg.dataContent, sKey); } if (retMsg.GZipCompress) { retMsg.dataContent = NccmFunction.gZipDeCompress(retMsg.dataContent); } Type type = typeof(RecieveHospitalMatchInfoResult); RecieveHospitalMatchInfoResult result = (RecieveHospitalMatchInfoResult)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(retMsg.dataContent, type); if (result.resultId) { upLoadfaildItems = result.itemMatchInfo; strMsg = result.resultString; return(true); } else { throw new Exception(result.resultString); } } catch (Exception err) { throw err; } }
/// <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; } }