DRGS 分组器源码

drgs 免费分组器可调用:
实现实时分组,在院分组,可以实现实时控费。
服务器地址

http://121.36.91.34:8002/service.svc?wsdl

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Drgs
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}

    private void button1_Click(object sender, EventArgs e)
    {
      Drgs_Model.ForService.OutputDrgGroup odrg =   WCF.DrgGroup.GetDrgGroup(this.textBox1.Text.Trim());

        if (odrg.STATUS == "SUCESS")
        {
            this.label1.Text = odrg.DRGGOUP;
        }
        else
        {
        }
    }
}

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Drgs_Model;
using System.Web.Script.Serialization;
namespace Drgs.WCF
{
public class DrgGroup
{
public static Drgs_Model.ForService.OutputDrgGroup GetDrgGroup(string inputjson)
{
JavaScriptSerializer jss = new JavaScriptSerializer();
string url = @“http://121.36.91.34:8002/service.svc?wsdl”;
object o = WCF.WCFhelper.ExecuteMetod<WCF.IService>(url, “FindGroup”, inputjson);
Drgs_Model.ForService.OutputDrgGroup outgroup = jss.Deserialize<Drgs_Model.ForService.OutputDrgGroup>(o.ToString());
return outgroup;
}

    //InputDrg id = new InputDrg();
    //id.icdlist = licd;
    //    id.operlist = licd9;
    //    Drgs_Model.DRG_Patient dp = new DRG_Patient();
    //dp.AGE = 23;
    //    dp.DEADFLAG = "0";
    //    dp.SEX = "M";
    //    id.pinfo = dp;
    //    string inputstr = jss.Serialize(id);
  
    //Drgs_Model.OutputDrgGroup outgroup = jss.Deserialize<OutputDrgGroup>(o.ToString());
}

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Reflection;

namespace Drgs.WCF
{
///
/// 使用ChannelFactory为wcf客户端创建独立通道
///
public class WCFhelper
{
public WCFhelper()
{
}

    /// <summary>
    /// 执行方法   WSHttpBinding
    /// </summary>
    /// <typeparam name="T">服务接口</typeparam>
    /// <param name="uri">wcf地址</param>
    /// <param name="methodName">方法名</param>
    /// <param name="args">参数列表</param>
    public static object ExecuteMetod<T>(string uri, string methodName, params object[] args)
    {
        BasicHttpBinding binding = new BasicHttpBinding();   //出现异常:远程服务器返回错误: (415) Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.。
        //WSHttpBinding binding = new WSHttpBinding();
        EndpointAddress endpoint = new EndpointAddress(uri);

        using (ChannelFactory<T> channelFactory = new ChannelFactory<T>(binding, endpoint))
        {
            T instance = channelFactory.CreateChannel();
            using (instance as IDisposable)
            {
                try
                {
                    Type type = typeof(T);
                    MethodInfo mi = type.GetMethod(methodName);
                    return mi.Invoke(instance, args);
                }
                catch (TimeoutException)
                {
                    (instance as ICommunicationObject).Abort();
                    throw;
                }
                catch (CommunicationException)
                {
                    (instance as ICommunicationObject).Abort();
                    throw;
                }
                catch (Exception vErr)
                {
                    System.Windows.Forms.MessageBox.Show(vErr.InnerException.Message);
                    (instance as ICommunicationObject).Abort();
                    throw;
                }
            }
        }


    }


    //nettcpbinding 绑定方式
    public static object ExecuteMethod<T>(string pUrl, string pMethodName, params object[] pParams)
    {
        EndpointAddress address = new EndpointAddress(pUrl);
        Binding bindinginstance = null;
        NetTcpBinding ws = new NetTcpBinding();
        ws.MaxReceivedMessageSize = 20971520;
        ws.Security.Mode = SecurityMode.None;
        bindinginstance = ws;
        using (ChannelFactory<T> channel = new ChannelFactory<T>(bindinginstance, address))
        {
            T instance = channel.CreateChannel();
            using (instance as IDisposable)
            {
                try
                {
                    Type type = typeof(T);
                    MethodInfo mi = type.GetMethod(pMethodName);
                    return mi.Invoke(instance, pParams);
                }
                catch (TimeoutException)
                {
                    (instance as ICommunicationObject).Abort();
                    throw;
                }
                catch (CommunicationException)
                {
                    (instance as ICommunicationObject).Abort();
                    throw;
                }
                catch (Exception vErr)
                {
                    (instance as ICommunicationObject).Abort();
                    throw;
                }
            }
        }
    }
}

[ServiceContract]
public interface IService
{
    [OperationContract]
    string FindGroup(string inputstr);
}

}

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

条形码D

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值