コード例 #1
0
        public string rydj(string USER_ID, string PARAM)
        {
            string retStr = "";

            try
            {
                //根据USER_ID获取缓存的新医疗卡号信息
                string D401_10 = BufferUtil.getBufferByKey(USER_ID, "D401_10");
                //(1)验证输入疾病是否在疾病库中存在,存在可以继续登记
                MZBC_PROC_DIAGNOSIS_CHECK check = new MZBC_PROC_DIAGNOSIS_CHECK();
                string DIAGNOSIS_CODE           = ""; //疾病代码
                check.executeSql(
                    new Dictionary <string, string>()
                {
                    { "DIAGNOSIS_CODE", DIAGNOSIS_CODE }
                }
                    );

                //0	成功
                //1	此疾病在疾病库中不存在
                //2	程序异常
                if (check.getExecuteResultPlainString() != null && check.getExecuteResultPlainString().Length >= 1 &&
                    check.getExecuteResultPlainString().Substring(0, 1) != "0")
                {
                    if (check.getExecuteResultPlainString().Substring(0, 1) == "1")
                    {
                        retStr = DataConvert.getReturnJson("-1", "此疾病在疾病库中不存在");
                    }
                    if (check.getExecuteResultPlainString().Substring(0, 1) == "2")
                    {
                        retStr = DataConvert.getReturnJson("-1", check.getExecuteResultPlainString());
                    }
                    return(retStr);
                }

                //疾病代码存在,可以继续登记
                //(2)检查是否可以做入院登记
                //调用验证住院号是否重复交易,如果重复说明已经登记,此时调用修改住院登记交易;
                //如果不重复调用保存入院登记交易进行入院登记,入院登记成功修改HIS端标志并保存农合信息。
                MZBC_PROC_ZYBZ_NOTICE_CHECK zydjCheck = new MZBC_PROC_ZYBZ_NOTICE_CHECK();
                string AREA_NO = "";
                string D401_21 = "";
                string DEP_ID  = "";
                zydjCheck.executeSql(
                    new Dictionary <string, string>()
                {
                    { "AREA_NO", AREA_NO }, { "D401_10", D401_10 }, { "D401_21", D401_21 }, { "DEP_ID", DEP_ID }
                }
                    );
                //0	成功
                //1	此病人在本院已经做过入院登记
                //2	此病人在其他医院已经做过入院登记
                //3	程序异常
                //此病人在其他医院已经做过入院登记:  2;医院名称(分号分隔)
                //程序异常:                           3;错误信息(分号分隔)
                string flag = zydjCheck.getExecuteResultPlainString().Substring(0, 1);
                if (flag == "2")
                {
                    return(retStr = DataConvert.getReturnJson("-1", "此病人在其他医院已经做过入院登记:" + zydjCheck.getExecuteResultPlainString()));
                }
                if (flag == "3")
                {
                    return(retStr = DataConvert.getReturnJson("-1", "程序异常:" + zydjCheck.getExecuteResultPlainString()));
                }

                string decodeParam = DataConvert.Base64Decode(PARAM); //解码
                Dictionary <string, string> jsonDict = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(decodeParam);

                if (flag == "0")
                {
                    Dictionary <string, string> param = new Dictionary <string, string>();
                    param.Add("COME_AREA", jsonDict["COME_AREA"]); //医疗机构所在地区编码(取用户所在机构地区编码AREA_CODE)
                    param.Add("AREA_CODE", jsonDict["AREA_CODE"]); //地区代码(病人所在地区编码)取前台选择的地区编码
                    param.Add("D401_10", jsonDict["D401_10"]);     //医疗证号
                    param.Add("D504_02", jsonDict["D504_02"]);     //个人编号
                    param.Add("D504_03", jsonDict["D504_03"]);     //姓名
                    param.Add("D504_04", jsonDict["D504_04"]);     //性别(1:男 2:女)传代码
                    param.Add("D504_05", jsonDict["D504_05"]);     //身份证号
                    param.Add("D504_06", jsonDict["D504_06"]);     //年龄
                    param.Add("D504_21", jsonDict["D504_21"]);     //疾病代码
                    param.Add("D504_09", jsonDict["D504_09"]);     //住院号
                    param.Add("D504_10", jsonDict["D504_10"]);     //就诊类型代码(对应s301_05.xls)
                    param.Add("D504_11", jsonDict["D504_11"]);     //入院时间(格式为YYYY-MM-DD)
                    param.Add("D504_14", jsonDict["D504_14"]);     //就医机构代码=DEP_ID
                    param.Add("D504_19", jsonDict["D504_19"]);     //入院状态代码 (对应S301-02.xls)
                    param.Add("D504_16", jsonDict["D504_16"]);     //入院科室代码(对应S201-03.xls)
                    param.Add("D504_28", jsonDict["D504_28"]);     //病人联系电话

                    //保存入院登记
                    ZYBC_PROC_NEW_NOTICE newNotice = new ZYBC_PROC_NEW_NOTICE();
                    newNotice.executeSql(param);

                    //0	成功
                    //1	失败
                    //保存成功:S_Returns= 0;D504_01
                    //D504_01:VARCHAR2(24)  住院登记流水号
                    //保存失败: S_Returns= 1;错误信息  (分号分隔)
                    if (newNotice.getExecuteStatus() == true)
                    {
                        //保存住院登记流水号到HIS
                        string D504_01 = newNotice.getResponseResultWrapperMap()["D504_01"];
                        Dictionary <string, string> record = new Dictionary <string, string>()
                        {
                            { "D401_10", D401_10 },
                            { "D401_21", D401_21 },
                            { "D504_21", jsonDict["D504_21"] },
                            { "D504_01", D504_01 },
                        };
                        HIS.bcZYBC(record);

                        retStr = DataConvert.getReturnJson("0", "保存住院登记成功");
                    }
                    else
                    {
                        retStr = DataConvert.getReturnJson("-1", newNotice.getExecuteResultPlainString());
                    }
                }

                if (flag == "1")
                {
                    //修改住院登记
                    ZYBC_PROC_UPDATE_NOTICE     updateNotice = new ZYBC_PROC_UPDATE_NOTICE();
                    Dictionary <string, string> param        = new Dictionary <string, string>();
                    param.Add("AREA_CODE", jsonDict["AREA_CODE"]); //病人地区编码(取前台选择的地区编码)
                    param.Add("D504_01", jsonDict["D504_01"]);     //住院登记流水号
                    param.Add("D504_21", jsonDict["D504_21"]);     //疾病代码
                    param.Add("D504_09", jsonDict["D504_09"]);     //住院号
                    param.Add("D504_10", jsonDict["D504_10"]);     //就诊类型
                    param.Add("D504_19", jsonDict["D504_19"]);     //入院状态代码(对应S301-02.xls)
                    param.Add("D504_16", jsonDict["D504_16"]);     //入院科室代码(对应S201-03.xls)
                    param.Add("D504_11", jsonDict["D504_11"]);     //入院时间(格式为YYYY-MM-DD)
                    param.Add("D504_28", jsonDict["D504_28"]);     //联系电话

                    updateNotice.executeSql(param);
                    if (updateNotice.getExecuteStatus() == true)
                    {
                        //保存修改到HIS
                        Dictionary <string, string> record = new Dictionary <string, string>()
                        {
                            { "D401_10", D401_10 },
                            { "D401_21", D401_21 },
                            { "D504_21", jsonDict["D504_21"] }
                        };
                        HIS.xgZYBC(record);
                        retStr = DataConvert.getReturnJson("0", "修改住院登记成功");
                    }
                    else
                    {
                        retStr = DataConvert.getReturnJson("-1", updateNotice.getExecuteResultPlainString());
                    }
                }
            }
            catch (Exception ex)
            {
                XnhLogger.log(this.GetType().ToString() + " " + ex.StackTrace);
                retStr = DataConvert.getReturnJson("-1", ex.ToString());
            }
            return(retStr);
        }