/// <summary> /// 科室床位维护,增加一张新床位 /// </summary> /// <param name="bedlist"></param> /// <returns></returns> public bool insertNewBed(HIS.Model.ZY_NURSE_BED bedlist) { try { IBaseDAL <HIS.Model.ZY_NURSE_BED> s = BindEntity <HIS.Model.ZY_NURSE_BED> .CreateInstanceDAL(oleDb); string string1 = Tables.zy_nurse_bed.BED_NO + oleDb.EuqalTo() + "'" + bedlist.BED_NO + "' and " + Tables.zy_nurse_bed.DEPT_ID + oleDb.EuqalTo() + bedlist.DEPT_ID; if (!BindEntity <HIS.Model.ZY_NURSE_BED> .CreateInstanceDAL(oleDb).Exists(string1)) { BindEntity <HIS.Model.ZY_NURSE_BED> .CreateInstanceDAL(oleDb).Add(bedlist); return(true); } else { return(false); } } catch (Exception e) { throw new Exception(e.Message); } }
/// <summary> /// 床位分配时对应后台床位表的操作 /// </summary> /// <param name="bedinfo"></param> /// <returns></returns> public bool bedAssign(HIS.Model.ZY_NURSE_BED bedinfo, long dept_id) { int deptid = Convert.ToInt32(dept_id); string strWhere2 = Tables.zy_nurse_bed.BED_NO + oleDb.EuqalTo() + "'" + bedinfo.BED_NO.ToString() + "'" + oleDb.And() + Tables.zy_nurse_bed.DEPT_ID + oleDb.EuqalTo() + bedinfo.DEPT_ID + oleDb.And() + Tables.zy_nurse_bed.PATLIST_ID + oleDb.EuqalTo() + 0; bool assignresult = BindEntity <ZY_NURSE_BED> .CreateInstanceDAL(oleDb).Exists(strWhere2); if (assignresult == true) { try { //3月9日修改,出院召回的病人的要删除相应的病人出院标志 string strWhere5 = "patlistid=" + bedinfo.PATLIST_ID; object obj2 = BindEntity <HIS.Model.ZY_PatList> .CreateInstanceDAL(oleDb).GetFieldValue("pattype", strWhere5); int pattype = int.Parse(obj2.ToString()); if (pattype == 6) { return(false); } oleDb.BeginTransaction(); if (pattype == 3) { string strWhere4 = "order_content like '%今日病人出院%' and delete_flag=0 and patid=" + bedinfo.PATLIST_ID; string str4 = "delete_flag=1"; BindEntity <HIS.Model.ZY_DOC_ORDERRECORD> .CreateInstanceDAL(oleDb).Update(strWhere4, str4); string strWhere = "bed_no='" + bedinfo.BED_NO.ToString() + "' and dept_id=" + bedinfo.DEPT_ID; string string1 = "patlist_id=" + bedinfo.PATLIST_ID.ToString(); string string2 = "bed_sex='" + bedinfo.BED_SEX.ToString() + "'"; string string3 = "zz_doc=" + bedinfo.ZZ_DOC.ToString(); string string4 = "zy_doc=" + bedinfo.ZY_DOC.ToString(); BindEntity <HIS.Model.ZY_NURSE_BED> .CreateInstanceDAL(oleDb).Update(strWhere, string1, string2, string3, string4); string strWhere1 = "patlistid=" + bedinfo.PATLIST_ID; string[] str = new string[4]; str[0] = "pattype='2'"; str[1] = "curedoccode='" + bedinfo.ZY_DOC + "'"; str[2] = "bedcode='" + bedinfo.BED_NO + "'"; str[3] = "currdeptcode='" + deptid + "'"; BindEntity <HIS.Model.ZY_PatList> .CreateInstanceDAL(oleDb).Update(strWhere1, str); } //以上是3月9日修改 else { string strWhere = "bed_no='" + bedinfo.BED_NO.ToString() + "' and dept_id=" + bedinfo.DEPT_ID; string string1 = "patlist_id=" + bedinfo.PATLIST_ID.ToString(); string string2 = "bed_sex='" + bedinfo.BED_SEX.ToString() + "'"; string string3 = "zz_doc=" + bedinfo.ZZ_DOC.ToString(); string string4 = "zy_doc=" + bedinfo.ZY_DOC.ToString(); BindEntity <HIS.Model.ZY_NURSE_BED> .CreateInstanceDAL(oleDb).Update(strWhere, string1, string2, string3, string4); string strWhere1 = "patlistid=" + bedinfo.PATLIST_ID; string[] str = new string[4]; str[0] = "pattype='2'"; str[1] = "curedoccode='" + bedinfo.ZY_DOC + "'"; str[2] = "bedcode='" + bedinfo.BED_NO + "'"; str[3] = "currdeptcode='" + deptid + "'"; BindEntity <HIS.Model.ZY_PatList> .CreateInstanceDAL(oleDb).Update(strWhere1, str); } oleDb.CommitTransaction(); return(true); } catch (Exception e) { oleDb.RollbackTransaction(); return(false); throw new Exception(e.Message); } } else { return(false); } }