Example #1
0
        /// <summary>
        /// 参合病人信息查询
        /// </summary>
        public static FindPatientCompInfoResult FindPatientCompInfo(FindPatientCompInfo hisData)
        {
            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.findPatientCompInfo(recieveMsg);
                if (retMsg.DES)
                {
                    retMsg.dataContent = NccmFunction.decrypt(retMsg.dataContent, sKey);
                }
                if (retMsg.GZipCompress)
                {
                    retMsg.dataContent = NccmFunction.gZipDeCompress(retMsg.dataContent);
                }

                Type type = typeof(FindPatientCompInfoResult);
                FindPatientCompInfoResult result = (FindPatientCompInfoResult)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(retMsg.dataContent, type);

                return(result);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
        /// <summary>
        /// 读取病人信息
        /// </summary>
        /// <param name="parameters">查询条件数组,目前只取2长度,分别代表医疗证号和身份证号</param>
        /// <returns></returns>
        public InsurPatientInfo[] GetPatientInfo(string[] parameters)
        {
            string cardNo = parameters[0];
            string idCard = parameters[1];

            FindPatientCompInfo hisData = new FindPatientCompInfo();

            JoinArea joinArea = new JoinArea();

            joinArea.code = JOIN_AREA_CODE;
            joinArea.name = JOIN_AREA_NAME;

            DataClass dataClass = new DataClass();

            dataClass.dataClassName  = NcmsDataClass.新农合数据.ToString();
            dataClass.dataClassValue = ((int)NcmsDataClass.新农合数据).ToString();

            DataType dataType = new DataType();

            dataType.dataTypeName  = "参合信息";
            dataType.dataTypeValue = "2";

            OperType operType = new OperType();

            operType.operTypeName  = "查询";
            operType.operTypeValue = "4";

            Condition AREA = new Condition();           //参合地区

            AREA.condition_displayname = "参合地区";
            AREA.condition_name        = "JOIN_AREA";
            AREA.condition_value       = JOIN_AREA_CODE;

            Condition CARD_ID = new Condition();        //合作医疗证号

            CARD_ID.condition_displayname = "合作医疗证号";
            CARD_ID.condition_name        = "MED_CARD_ID";
            CARD_ID.condition_value       = cardNo; //"20090408" ;

            Condition ID_CARD = new Condition();

            ID_CARD.condition_displayname = "身份证号";
            ID_CARD.condition_name        = "PERSON_IDCARD";
            ID_CARD.condition_value       = idCard;

            Condition[] cond = null;

            if (cardNo.Trim() != "" && idCard.Trim() == "")
            {
                cond = new Condition[] { AREA, CARD_ID };
            }
            else if (cardNo.Trim() == "" && idCard.Trim() != "")
            {
                cond = new Condition[] { AREA, ID_CARD };
            }
            else if (cardNo.Trim() != "" && idCard.Trim() != "")
            {
                cond = new Condition[] { AREA, ID_CARD, CARD_ID };
            }

            hisData.joinArea   = joinArea;
            hisData.dataClass  = dataClass;
            hisData.dataType   = dataType;
            hisData.operType   = operType;
            hisData.conditions = cond;
            hisData.uploadorg  = MED_ORG_CODE;

            FindPatientCompInfoResult result = NccmInterfaces.FindPatientCompInfo(hisData);

            if (result.resultId)
            {
                List <HIS.MZ_BLL.InsurPatientInfo> listPatInfo = new List <InsurPatientInfo>();
                try
                {
                    for (int i = 0; i < result.compPatBaseData.Length; i++)
                    {
                        HIS.MZ_BLL.InsurPatientInfo insurPatientInfo = new InsurPatientInfo();

                        insurPatientInfo.Area_Id     = result.compPatBaseData[i].area_id;
                        insurPatientInfo.Person_Code = result.compPatBaseData[i].person_code;
                        insurPatientInfo.Name        = result.compPatBaseData[i].name;
                        insurPatientInfo.Sex         = result.compPatBaseData[i].sex;
                        insurPatientInfo.IdCard      = result.compPatBaseData[i].idCard;
                        insurPatientInfo.BirthDate   = Convert.ToDateTime(result.compPatBaseData[i].birthdate);
                        //insurPatientInfo.Age = Convert.ToInt32( result.compPatBaseData. );
                        insurPatientInfo.Family_Code  = result.compPatBaseData[i].family_code;
                        insurPatientInfo.Medcard_Id   = cardNo;
                        insurPatientInfo.Medorg_Code  = hospitalInfo.org_id;
                        insurPatientInfo.Medorg_Level = hospitalInfo.hos_level;
                        listPatInfo.Add(insurPatientInfo);
                    }
                    return(listPatInfo.ToArray());
                }
                catch (Exception err)
                {
                    ErrorWriter.WriteLog(err.Message);
                    throw new OperatorException("返回查询结果期间发生错误!");
                }
            }
            else
            {
                throw new Exception(result.resultString);
            }
        }