• his接口


    最近开发一个医院信息系统的接口
    首先是医疗的基本知识 门诊 医生 科室 费用 药品,这些都是在数据库里。
    需要两个接口一个是手机端 一个是其他平台进行转诊

    主要的技术是这些
    手机端主要是
    webservices TaoguWebService.asmx
    主要就是 我提供接口
    1 从传入的json 得到传入实体类 
    2 通过传入实体类在sql中查询
    3 查询结果给传出的实体类 转化成json返回
    
           /// <summary>
            /// 1.13 BSC_013 查询病人就诊信息 ok
            /// </summary>
            /// <param name="HospitalID"></param>
            /// <returns></returns>
            [WebMethod]
            public string getPatientStatus(string hospitalId, string jsonparams)
            {
                hospitalId = getHospitalId(hospitalId);
    
                var inObject = JsonConvert.DeserializeObject<Invisit>(jsonparams);
    
                if (inObject == null)
                {
                    var jon1 = new { code = "1", codeDesc = "请传HIS系统中的患者Id" };
                    string json1 = JsonConvert.SerializeObject(jon1);
                    return json1;
                }
                else
                {
                    if (string.IsNullOrEmpty(inObject.patientIdFromHIS) &&
                        (string.IsNullOrEmpty(inObject.timeStart) || string.IsNullOrEmpty(inObject.timeEnd)))
                    {
                        var jon1 = new { code = "1", codeDesc = "请传HIS系统中的患者Id" };
                        string json1 = JsonConvert.SerializeObject(jon1);
                        return json1;
                    }
                }
    
                var dt = TaoguBLL.getPatientStatus(hospitalId, inObject.patientIdFromHIS, inObject.timeStart, inObject.timeEnd);
    
                List<OutVisit> ls = new List<OutVisit>();
                foreach (System.Data.DataRow dr in dt.Rows)
                {
                    OutVisit outObject = new OutVisit();
                    outObject.hospitalIdFromHIS = dr["HospitalID"].ToString();
                    outObject.patientIdFromHis = dr["PatientID"].ToString();
                    outObject.name = dr["PatientName"].ToString();
                    outObject.regServiceNo = dr["visitNo"].ToString();
                    outObject.deptIdFromHIS = dr["Dept"].ToString();
    
                    outObject.deptName = dr["DeptName"].ToString();
                    outObject.doctorIdFromHIS = dr["Doctor"].ToString();
                    outObject.doctorName = dr["Name"].ToString();
                    outObject.regServiceType = dr["title"].ToString();
                    outObject.regDate = dr["VisitDate"].ToString();
    
                    outObject.patientStatus = dr["RegistStatus"].ToString();
                    outObject.regLoc = "";
    
                    ls.Add(outObject);
                }
                var jon = new { ListPatientStatus = ls };
                string json = JsonConvert.SerializeObject(jon);
                return json;
    
                //string json = JsonConvert.SerializeObject(ls);
                //return json;
            }
    
    其他平台主要是对xml的解析 主要是我调用其他平台接口
    HandlerSXZZ.ashx
    1 从html端得到入参 调用cs代码
    2 入参转化成对象 对象再转化成xml 调用别人的webservice
    3 返回的xml 转化成json 返回给html
    4 js将返回的json转化成js对象 修改界面
    
    function a() {
                                                //debugger;
    
    
                                                b = $("#ZZBH").val();
                                                if (!b) {
                                                    alert("请填写编号");
                                                    return;
                                                }
    
                                                var obj = {};
                                                obj.ZZBH = b;
    
                                                c = Sys.Serialization.JavaScriptSerializer.serialize(obj);
    
                                                $.ajax({
                                                    type: "post",
                                                    url: "../WebService/ReferralService/HandlerSXZZ.ashx",
                                                    data: { dowork: "cxhzzzxx", indata: c },
                                                    dataType: "text",
                                                    beforeSend: function (XMLHttpRequest) {
    
                                                    },
                                                    complete: function () { },
                                                    success: function (data) {
                                                        //alert(data);
                                                        //debugger;
                                                        var Outdata = Sys.Serialization.JavaScriptSerializer.deserialize(data);
                                                        var Outcxhzzzxx = Outdata.response.DUALREFERRALNEW;
                                                        //alert(Outcxhzzzxx.HZXXXM);
    
                                                        //姓名
                                                        $("#txt_Name").val(Outcxhzzzxx.HZXXXM);
                                                        //病人ID
                                                        $("#txt_PatientID").val(Outcxhzzzxx.HZZSYH);
                                                        //转出机构
                                                        $("#txt_TransferHospital").val(Outcxhzzzxx.ZCYLJGZZJGMC);
                                                        //转出医生
                                                        $("#txt_TransferDoctor").val(Outcxhzzzxx.ZZYSMC);
    
                                                    },
                                                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                                                        alert(XMLHttpRequest.responseText);
                                                    }
                                                });
    
                                            }
    
            public void ProcessRequest(HttpContext context)
            {
                context.Response.ContentType = "text/plain";
                //context.Response.Write("Hello World");
    
                //dcInfo dcinfo = new ReferralService.dcInfo();
    
                dcMsg dcmsg = new ReferralService.dcMsg();
    
                //ImplementSXZZ interfaceSXZZ = new ImplementSXZZ();
                ImplementTest interfaceSXZZ = new ImplementTest();
    
                string indata = context.Request["indata"].ToString();
    
                switch (context.Request["dowork"].ToString())
                {
                    case "cxhzzzxx":
                        var indcInfo = JsonConvert.DeserializeObject<Incxhzzzxx>(indata);
                        //var indcMsg = JsonConvert.DeserializeObject<Incxhzzzxx>(indata);
    
                        var dcInfo = new { request = new { objectList = new { DUALREFERRALNEW = indcInfo } } };
    
                        var json = JsonConvert.SerializeObject(dcInfo);
    
                        var indcinfo = CommonSXZZ.Json2Xml(json);
    
                        dcmsg.bussinessCode = "DR_011";
                        var dcMsg = new { request = new { header = dcmsg } };
                        //dcinfo.DUALREFERRALNEW = inObject;
    
                        json = JsonConvert.SerializeObject(dcMsg);
                        var indcmsg = CommonSXZZ.Json2Xml(json);
    
                        //调用主方法
                        string returnjson = interfaceSXZZ.cxhzzzxx(indcmsg, indcinfo);
    
                        string returnstring = CommonSXZZ.Xml2Json(returnjson);
    
                        context.Response.Write(returnstring);
    
                        break;
    
                    default:
                        break;
                }
            }
    
        public class CommonSXZZ
        {
    
            public static string Json2Xml(string sJson)
            {
    
                XmlDocument doc2 = JsonConvert.DeserializeXmlNode(sJson);
                return doc2.InnerXml.ToString();
    
            }
            public static string Xml2Json(string xml)
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xml);
                string json = Newtonsoft.Json.JsonConvert.SerializeXmlNode(doc);
                return json;
            }
    
    
        }
  • 相关阅读:
    poj 3264 Balanced Lineup
    poj 2762 Going from u to v or from v to u?
    hdu 3671 Boonie and Clyde
    zoj 3195 Design the city
    poj 1523 SPF
    Codeforces Polo the Penguin and Matrix
    MVC原理的简述(转)
    C#访问权限修饰符
    XML Schema介绍
    Sql批量删除/插入
  • 原文地址:https://www.cnblogs.com/frog2008/p/6781886.html
Copyright © 2020-2023  润新知