/// <summary> /// 获取病人最新体征情况 GL 2015-10-10 /// </summary> /// <param name="UserId"></param> /// <param name="ItemType"></param> /// <param name="ItemCode"></param> /// <returns></returns> public ValueTime GetLatestPatientVitalSigns(DataConnection pclsCache, string UserId, string ItemType, string ItemCode) { ValueTime item = new ValueTime(); try { if (!pclsCache.Connect()) { return item; } InterSystems.Data.CacheTypes.CacheSysList list = null; list = Ps.VitalSigns.GetLatestPatientVitalSigns(pclsCache.CacheConnectionObject, UserId, ItemType, ItemCode); if (list != null) { item.Value = list[0]; item.RecordDate = list[1]; item.RecordTime = list[2]; } return item; } catch (Exception ex) { HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "VitalInfoMethod.GetLatestPatientVitalSigns", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace); return item; } finally { pclsCache.DisConnect(); } }
/// <summary> /// 浙大输出接口 LY 2015-10-29 /// </summary> /// <param name="PatientId"></param> /// <returns></returns> public string GetPatientInfo(DataConnection pclsCache, string PatientId) { List<TypeAndName> List = new List<TypeAndName>(); List.Add(new TypeAndName { Type = "ubid", Name = "DW0101111447049158" }); PatBasicInfo BasicInfo = new UsersRepository().GetPatBasicInfo(pclsCache, PatientId); if (BasicInfo == null) return "病人不存在"; List.Add(new TypeAndName { Type = "name", Name = BasicInfo.UserName }); List.Add(new TypeAndName { Type = "age", Name = BasicInfo.Age }); List.Add(new TypeAndName { Type = "sex", Name = BasicInfo.Gender }); string PhoneNumber = new UsersMethod().GetPhoneNoByUserId(pclsCache, PatientId); List.Add(new TypeAndName { Type = "mobilephone", Name = PhoneNumber }); ValueTime H = new ValueTime(); H = new VitalInfoRepository().GetLatestPatientVitalSigns(pclsCache, PatientId, "Height", "Height_1"); string Height = H.Value; ValueTime W = new ValueTime(); W = new VitalInfoRepository().GetLatestPatientVitalSigns(pclsCache, PatientId, "Weight", "Weight_1"); string Weight = W.Value; ValueTime Wa = new ValueTime(); Wa = new VitalInfoRepository().GetLatestPatientVitalSigns(pclsCache, PatientId, "Waistline", "Waistline_1"); string Waistline = Wa.Value; if (Height == null) Height = ""; if (Weight == null) Weight = ""; List.Add(new TypeAndName { Type = "height", Name = Height }); List.Add(new TypeAndName { Type = "weight", Name = Weight }); List.Add(new TypeAndName { Type = "birthday", Name = BasicInfo.Birthday.Insert(4,"-").Insert(7,"-") }); if (Waistline != null) List.Add(new TypeAndName { Type = "waistline", Name = Waistline }); try { string BasicJson = "{"; foreach (TypeAndName Line in List) { BasicJson = BasicJson + '"' + Line.Type + '"' + ':' + '"' + Line.Name + '"' + ','; } BasicJson = BasicJson.TrimEnd(','); BasicJson += "}"; byte[] bytedata = Encoding.UTF8.GetBytes(BasicJson); string content = Convert.ToBase64String(bytedata, 0, bytedata.Length); content = "type=docapp&action=004&content=" + content + "&contentkey=#HQ*" + content; string Url = "http://qacsupport.duapp.com/port/port.php"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; byte[] bytes = Encoding.UTF8.GetBytes(content); request.ContentLength = bytes.Length; //request.Timeout = 10000; Stream reqstream = request.GetRequestStream(); reqstream.Write(bytes, 0, bytes.Length); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream streamReceive = response.GetResponseStream(); Encoding encoding = Encoding.UTF8; StreamReader streamReader = new StreamReader(streamReceive, encoding); string strResult = streamReader.ReadToEnd(); streamReceive.Dispose(); streamReader.Dispose(); return strResult; } catch (WebException ex) { using (WebResponse response = ex.Response) { HttpWebResponse httpResponse = (HttpWebResponse)response; Console.WriteLine("Error code: {0}", httpResponse.StatusCode); using (Stream data = response.GetResponseStream()) using (var reader = new StreamReader(data)) { string text = reader.ReadToEnd(); Console.WriteLine(text); } } return ex.Message; } }