public ActionResult SavePatientCharge()
        {
            string          chargeStr = Request.Form["charge"].ToString();
            M_PatientCharge charge    = JsonHelper.GetJsonInfoBy <M_PatientCharge>(chargeStr);

            if (charge == null)
            {
                return(Json(new { result = "ERROR", msg = "解析实体为空!" }, "appliction/json", JsonRequestBehavior.AllowGet));
            }

            M_PatientCharge info = new M_PatientChargeBLL().GetListBy(pc => pc.TaskCode.Equals(charge.TaskCode) && pc.PatientOrder == 1).FirstOrDefault();

            if (info != null)
            {
                if (new M_PatientChargeBLL().Del(info) <= 0)  // 删除旧收费信息
                {
                    return(Json(new { result = "ERROR", msg = "删除旧收费信息失败!" }, "appliction/json", JsonRequestBehavior.AllowGet));
                }
            }

            //查询是否已经填写病历
            M_PatientRecord prinfo = new M_PatientRecordBLL().GetListBy(pr => pr.TaskCode.Equals(charge.TaskCode) && pr.PatientOrder == 1).FirstOrDefault();

            if (prinfo == null)
            {
                M_PatientRecordBLL                   bll    = new M_PatientRecordBLL();
                M_PatientRecord                      pinfo  = null; //病历主表信息
                M_PatientRecordAppend                pra    = null; //病历附表
                M_PatientRecordCPR                   prCPR  = null; //病历附表--心肺复苏
                List <M_PatientRecordDiag>           prDiag = null; //病历子表--初步印象
                List <M_PatientRecordECGImpressions> prECG  = null; //病历子表--心电图印象
                GetPatientRecordInfo(charge.TaskCode, charge.ChargePerson, out pinfo, out pra, out prCPR);
                bll.Insert(pinfo, pra, prCPR, prDiag, prECG);       //新增病历主表、附表、子表
            }

            charge.PatientOrder = 1;  //收费序号目前永远为1
            if (new M_PatientChargeBLL().Add(charge) > 0)
            {
                return(Json(new { result = "OK", msg = "收费成功!" }, "appliction/json", JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { result = "ERROR", msg = "收费失败!" }, "appliction/json", JsonRequestBehavior.AllowGet));
            }
        }
Esempio n. 2
0
        public bool SavePatient()
        {
            string                               state  = "";
            M_PatientRecordBLL                   bll    = new M_PatientRecordBLL();
            M_PatientRecord                      info   = null; //病历主表信息
            M_PatientRecordAppend                pra    = null; //病历附表
            M_PatientRecordCPR                   prCPR  = null; //病历附表--心肺复苏
            List <M_PatientRecordDiag>           prDiag = null; //病历子表--初步印象
            List <M_PatientRecordECGImpressions> prECG  = null; //病历子表--心电图印象

            string             PatientRecord = Request.Form["PatientRecord"].ToString();
            M_AddPatientRecord add           = new M_AddPatientRecord();

            add = JsonHelper.GetJsonInfoBy <M_AddPatientRecord>(PatientRecord);
            if (add != null)
            {
                string TaskCode     = add.TaskCode;
                int    PatientOrder = add.PatientOrder;
                state = add.state;
                info  = add.info;  //病历主表信息
                pra   = add.pra;   //病历附表
                prCPR = add.prCPR; //病历附表--心肺复苏

                if (add.prDiag.Count > 0)
                {
                    prDiag = add.prDiag;
                }                       //病历子表--初步印象
                else
                {
                    prDiag = null;
                }                 //病历子表--初步印象

                if (add.prECG.Count > 0)
                {
                    prECG = add.prECG;
                }                     //病历子表--心电图印象
                else
                {
                    prECG = null;
                }                //病历子表--心电图印象
            }

            bool save = false;

            if (info != null)
            {
                try
                {
                    if (state == "new")
                    {
                        save = bll.Insert(info, pra, prCPR, prDiag, prECG);//新增病历主表、附表、子表
                    }
                    else if (state == "edit")
                    {
                        save = bll.Update(info, pra, prCPR, prDiag, prECG);//修改病历主表、附表、子表
                    }
                }
                catch (Exception e)
                {
                    save = false;
                }
            }
            return(save);
        }
        public ActionResult SavePatientCharge()
        {
            string chargeStr = Request.Form["charge"].ToString();
            M_PatientCharge charge = JsonHelper.GetJsonInfoBy<M_PatientCharge>(chargeStr);
            if (charge == null)
                return Json(new { result = "ERROR", msg = "解析实体为空!" }, "appliction/json", JsonRequestBehavior.AllowGet);

            M_PatientCharge info = new M_PatientChargeBLL().GetListBy(pc => pc.TaskCode.Equals(charge.TaskCode) && pc.PatientOrder == 1).FirstOrDefault();
            if (info != null)
            {
                if (new M_PatientChargeBLL().Del(info) <= 0)  // 删除旧收费信息
                {
                    return Json(new { result = "ERROR", msg = "删除旧收费信息失败!" }, "appliction/json", JsonRequestBehavior.AllowGet);
                }
            }

            //查询是否已经填写病历
            M_PatientRecord prinfo = new M_PatientRecordBLL().GetListBy(pr => pr.TaskCode.Equals(charge.TaskCode) && pr.PatientOrder == 1).FirstOrDefault();
            if (prinfo == null)
            {
                M_PatientRecordBLL bll = new M_PatientRecordBLL();
                M_PatientRecord pinfo = null;//病历主表信息
                M_PatientRecordAppend pra = null;//病历附表
                M_PatientRecordCPR prCPR = null;//病历附表--心肺复苏
                List<M_PatientRecordDiag> prDiag = null;//病历子表--初步印象
                List<M_PatientRecordECGImpressions> prECG = null;//病历子表--心电图印象
                GetPatientRecordInfo(charge.TaskCode,charge.ChargePerson, out pinfo, out pra, out prCPR);
                bll.Insert(pinfo, pra, prCPR, prDiag, prECG);//新增病历主表、附表、子表
            }

            charge.PatientOrder = 1;  //收费序号目前永远为1
            if (new M_PatientChargeBLL().Add(charge) > 0)
                return Json(new { result = "OK", msg = "收费成功!" }, "appliction/json", JsonRequestBehavior.AllowGet);
            else
                return Json(new { result = "ERROR", msg = "收费失败!" }, "appliction/json", JsonRequestBehavior.AllowGet);
        }
Esempio n. 4
0
        public bool SavePatient()
        {
            string state = "";
            M_PatientRecordBLL bll = new M_PatientRecordBLL();
            M_PatientRecord info = null;//病历主表信息
            M_PatientRecordAppend pra = null;//病历附表
            M_PatientRecordCPR prCPR = null;//病历附表--心肺复苏
            List<M_PatientRecordDiag> prDiag = null;//病历子表--初步印象
            List<M_PatientRecordECGImpressions> prECG = null;//病历子表--心电图印象

            string PatientRecord = Request.Form["PatientRecord"].ToString();
            M_AddPatientRecord add = new M_AddPatientRecord();
            add = JsonHelper.GetJsonInfoBy<M_AddPatientRecord>(PatientRecord);
            if (add != null)
            {
                string TaskCode = add.TaskCode;
                int PatientOrder = add.PatientOrder;
                state = add.state;
                info = add.info;//病历主表信息
                pra = add.pra;//病历附表
                prCPR = add.prCPR;//病历附表--心肺复苏

                if (add.prDiag.Count > 0)
                { prDiag = add.prDiag; }//病历子表--初步印象
                else
                { prDiag = null; }//病历子表--初步印象

                if (add.prECG.Count > 0)
                { prECG = add.prECG; }//病历子表--心电图印象
                else
                { prECG = null; }//病历子表--心电图印象
            }

            bool save = false;
            if (info != null)
            {
                try
                {
                    if (state == "new")
                    {
                        save = bll.Insert(info, pra, prCPR, prDiag, prECG);//新增病历主表、附表、子表
                    }
                    else if (state == "edit")
                    {
                        save = bll.Update(info, pra, prCPR, prDiag, prECG);//修改病历主表、附表、子表
                    }
                }
                catch (Exception e)
                {
                    save = false;
                }
            }
            return save;
        }