예제 #1
0
 public Response QueryUser(string email, string pwd)
 {
     Response res = new Response();
     DaoUserInfo dao = new DaoUserInfo();
     if (dao.Exists(email))
     {
         res.Code = ResCode.SUCCESS;
         res.Data = dao.SelectByEmailPwd(email, pwd);
         if (res.Data == null)
         {
             res.Code = ResCode.ERROREMAILPWD;
             res.Msg = ResCode.STRERROREMAILPWD;
         }
     }
     else
     {
         res.Code = ResCode.NONEUSER;
         res.Msg = ResCode.STRNONEUSER;
     }
     return res;
 }
예제 #2
0
파일: LabTestMaster.cs 프로젝트: aj-hc/ZSSY
        public string GetData(string patientId, string visitId)
        {
            string data = string.Empty;
            respondData.State = Model.State.err;
            respondData.Data = string.Empty;

            data = GetDataFromHP(patientId, visitId);
            if (!string.IsNullOrEmpty(data))
            {
                bool tranRes = true;
                //XmlDocument xd = Common.XmlHelper.XMLLoad("/configXML/GetPatientLabMaster.xml");
                XmlDocument xd = Common.XmlHelper.XMLLoad(data, ref tranRes);
                if (tranRes && xd != null)
                {
                    Response resp = new Response();
                    //转换成功
                    XmlNode xn = xd.SelectSingleNode("/Response");
                    string xml2Str1 = JsonConvert.SerializeXmlNode(xn, Newtonsoft.Json.Formatting.None, true);
                    try
                    {
                        resp = JsonConvert.DeserializeObject<Response>(xml2Str1);
                    }
                    catch (Exception ex)
                    {
                        Common.LogHelper.WriteError(ex);
                        resp.Name = xd.SelectSingleNode("/Response/Name") == null ? "" : (xd.SelectSingleNode("/Response/Name").InnerText);
                        resp.PatientId = xd.SelectSingleNode("/Response/PatientId") == null ? "" : (xd.SelectSingleNode("/Response/PatientId").InnerText);
                        resp.ResultCode = xd.SelectSingleNode("/Response/ResultCode") == null ? "" : (xd.SelectSingleNode("/Response/ResultCode").InnerText);
                        resp.ResultContent = xd.SelectSingleNode("/Response/ResultContent") == null ? "" : (xd.SelectSingleNode("/Response/ResultContent").InnerText);
                        resp.VisitId = xd.SelectSingleNode("/Response/VisitId")== null ? "" : (xd.SelectSingleNode("/Response/VisitId").InnerText);
                    }
                    XmlNodeList xl = xd.SelectNodes("/Response/LabTestMasters/LabTestMaster") == null ? null : xd.SelectNodes("/Response/LabTestMasters/LabTestMaster");
                    List<Model.ZSSY.LabTestMaster> list = new List<Model.ZSSY.LabTestMaster>();
                    if (xl!=null)
                    {
                        foreach (XmlNode item in xl)
                        {
                            try
                            {
                                string xmlStr = JsonConvert.SerializeXmlNode(item, Newtonsoft.Json.Formatting.None, true);
                                list.Add(JsonConvert.DeserializeObject<Model.ZSSY.LabTestMaster>(xmlStr));
                            }
                            catch (Exception ex)
                            {
                                Common.LogHelper.WriteError(ex);
                                continue;
                            }
                        }
                        resp.LabTestMaste = list.OrderBy(a => a.TestCause).ToList();
                    }
                    respondData.Data = resp;
                    respondData.Msg = "调用医院接口成功";
                    respondData.State = Model.State.ok;
                }
                else
                {
                    respondData.Msg = "调用医院接口成功,无数据";
                }
            }
            else
            {
                respondData.Msg = "调用医院接口失败";
            }
            return JsonConvert.SerializeObject(respondData);
        }
예제 #3
0
 public Response RegisterUser(string email, string pwd)
 {
     Response res = new Response();
     DaoUserInfo dao = new DaoUserInfo();
     if (dao.Exists(email))
     {
         res.Code = ResCode.USERALREADYEXISTS;
         res.Msg = ResCode.STRUSERALREADYEXISTS;
     }
     else
     {
         if (dao.Insert(email, pwd))
         {
             res.Code = ResCode.SUCCESS;
         }
     }
     return res;
 }