Exemplo n.º 1
0
        /// <summary>
        /// 医嘱签署
        /// </summary>
        /// <param name="orders"></param>
        /// <param name="patInfo"></param>
        /// <returns></returns>
        public bool SignOrders(CiOrderDO[] orders, Ent4BannerDTO ent4BannerDto, FMap2 map2)
        {
            // TODO:填写医嘱签署逻辑
            if (orders == null || orders.Length == 0)
            {
                return(false);
            }

            OrderOperateDTO operateDTO = new OrderOperateDTO();
            // 增加就诊上下文环境,用户医嘱签署时,在医嘱中保存保外诊断相关属性
            CiEnContextDTO contextDTO = CiEnContextUtil.GetCiEnContext(ent4BannerDto, EmsAppModeEnum.SVEMSAPPMODE, this.context);

            operateDTO.Document = new FArrayList();
            orders.ToList <CiOrderDO>().ForEach(ord => { operateDTO.Document.append(ord.Id_or); });


            operateDTO.EnContext = contextDTO;
            operateDTO.Extension = map2;
            OrderRstDTO orderRstDTO = orderActionSign.exec(new OrderOperateDTO[] { operateDTO })[0];

            if (orderRstDTO == null)
            {
                return(false);
            }
            FMap2 emsExtension = orderRstDTO.Extension;

            if (emsExtension != null)
            {
                if (emsExtension["specilDrugs"] != null)
                {
                    //特殊药判断提示
                    if (!this.IsContinue("提示", emsExtension["specilDrugs"].ToString()))
                    {
                        return(SignOrders(orders, ent4BannerDto, emsExtension));
                    }
                    else
                    {
                        return(false);
                    }
                }
                //医保规则
                if (emsExtension["hprule"] != null)
                {
                    FArrayList2 hplist      = (FArrayList2)emsExtension["hprule"];
                    bool        information = false; // fasle  提示, true 终止

                    if (hplist != null && hplist.Count > 0)
                    {
                        List <MedicalSharingDTO> medicalSharinglist = new List <MedicalSharingDTO>();

                        foreach (MedicalSharingDTO dto in hplist)
                        {
                            if (dto != null && dto.Code == "Stop")
                            {
                                information = true;
                            }
                            medicalSharinglist.Add(dto);
                        }
                        using (MedicalSharingInfoForm from = new MedicalSharingInfoForm(medicalSharinglist))
                        {
                            from.Text = "医保规则验证";
                            if (information)
                            {
                                from.confirmBtn.Visible = false;
                                from.cancelBtn.Text     = "确定";
                            }
                            else
                            {
                                from.cancelBtn.Visible = false;
                                from.confirmBtn.Text   = "确定";
                            }
                            if (from.ShowDialog() == DialogResult.OK)
                            {
                                return(SignOrders(orders, ent4BannerDto, emsExtension));
                            }
                            else
                            {
                                return(false);
                            }
                        }
                    }
                }
                if (emsExtension["willCheckIdOrs"] != null)
                {
                    //医保和临床路径未判断的话,就弹窗进行判断
                    FArrayList   willCheckIdOrs = (FArrayList)emsExtension["willCheckIdOrs"];
                    string[]     id_ors         = willCheckIdOrs.Cast <string>().ToArray();
                    OrReport     report         = new OrReport(id_ors);
                    DialogResult result         = report.ShowDialog(XFormManager.MainFrom);
                    if (result == DialogResult.OK)
                    {
                        FMap2 map = map2;
                        return(SignOrders(orders, ent4BannerDto, map));
                    }
                    else
                    {
                        return(false);
                    }
                }

                if (emsExtension.Keys.Contains("UnCheckIdors"))
                {
                    //开立权限校验
                    FArrayList    uncheckidList = emsExtension["UnCheckIdors"] as FArrayList;
                    List <string> uncheckids    = uncheckidList.Cast <String>().ToList();
                    if (uncheckids.Count == orders.Length)
                    {
                        this.ShowInfo(emsExtension["ErrMsg"].ToString());
                        return(false);
                    }
                    if (!this.IsContinue("提示", emsExtension["ErrMsg"] + "是否继续?"))
                    {
                        return(false);
                    }
                    else
                    {
                        if (uncheckids.Count > 0)
                        {
                            List <CiOrderDO> ciordlist = orders.ToList();
                            foreach (string idor in uncheckids)
                            {
                                ciordlist.Remove(ciordlist.Find(p => p.Id_or == idor.Trim()));
                            }
                            FMap2 map = new FMap2();
                            return(SignOrders(ciordlist.ToArray(), ent4BannerDto, map));
                        }
                    }
                }

                if (emsExtension["checkPatInfoSrvs"] != null)
                {
                    // 如果是毒麻药,需要保存代理人信息
                    FArrayList              checkPatInfoSrvs = (FArrayList)emsExtension["checkPatInfoSrvs"];
                    OrSrvAgentInfoDO        agentInfo        = LogicEx.GetInstance().newOrSrvAgentInfoDOFromBanner(ent4BannerDto);
                    CheckPatAgentInfoDialog dialog           = new CheckPatAgentInfoDialog(agentInfo, checkPatInfoSrvs);
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        this.maintainService.saveCheckPatInfo(checkPatInfoSrvs, agentInfo);
                        FMap2 map = new FMap2();
                        return(SignOrders(orders, ent4BannerDto, map));
                    }
                    else
                    {
                        return(false);
                    }
                }

                this.initMrSignCiOrderList(emsExtension);
            }

            return(true);
        }