/// <summary> /// 住院发药记录登记 /// </summary> public int InsertIprslip(InPatientCheck inPatient) { if (inPatient == null) { return(0); } var sql = $@" INSERT INTO TWOCS_IPRSLIP( PTNO, BI, INDATE, ADMSEQNO, WARDCODE, ROOMCODE, BEDNO, DEPTCODE, DRCODE, ORDERGUBUN, ORDERCODE, BOHUMCODE, BDATE, SUCODE, BUN, SLIPNO, PLUSCODE, PLUSNAME, CONTENTS, BCONTENTS, REALQTY, DIV, NAL, QTY, JSQTY, GRP, POWDER, TFLAG, SELF, ER, REMARK, PRN, STATUS, BASEUNIT, LABELUNIT, BASEAMT, AMT1, AMT2, ORDERNO, PKORDERNO, SEQNO, INSERTID, INSERTBUSE, INSERTDATE, INSERTTIME, PUMCODE,CHUANGKOU ) SELECT I.PTNO, I.BI, I.INDATE, I.ADMSEQNO, I.WARDCODE, M.ROOMCODE, M.BEDNO, I.DEPTCODE, I.DRCODE, I.ORDERGUBUN, I.ORDERCODE, C.BOHUMCODE, I.BDATE, I.SUCODE, I.BUN, I.SLIPNO, I.PLUSCODE, I.PLUSNAME, I.CONTENTS, I.BCONTENTS, I.REALQTY, I.DIV, I.NAL, I.QTY, I.JSQTY, I.GRP, I.POWDER, I.TFLAG, I.SELF, I.ER, I.REMARK, I.PRN, I.STATUS, C.BASEUNIT, C.LABELUNIT, T.BOAMT BASEAMT,T.BOAMT * I.JSQTY AMT1, '' AMT2, I.ORDERNO, I.PKORDERNO, ROWNUM, '001757', '20010107', TRUNC(SYSDATE), TO_CHAR(SYSDATE,'HH24:MI:SS'), T.PUMCODE ,'MZ' FROM TW_HSP_OCS.TWOCS_IORDER_ZG I, TW_HSP_OCS.TWOCS_ORDERCODE C, TW_HSP_PMPA.TWBAS_TSUGA T, TW_HSP_PMPA.TWBAS_NSUGA N, TW_HSP_PMPA.VIEW_MASTER M WHERE I.PTNO = '{inPatient.PTNO}' AND I.BDATE <= TO_DATE('{Environ.SlowTime.ToString("yyyy-MM-dd")}','YYYY-MM-DD') AND I.BDATE >= TO_DATE('{Environ.SlowTime.AddDays(-2).ToString("yyyy-MM-dd")}','YYYY-MM-DD') AND I.GBPICKUP = '1' AND SUBSTR(I.SENDDEPT1,1,2) = '70' AND I.GBAUTO NOT IN ('T','Z') AND I.STATUS = '0' AND I.ORDERGUBUN = 'H' --AND I.WARDCODE = '{inPatient.WARDCODE}' --AND I.DEPTCODE = '{inPatient.DEPTCODE}' --AND I.DRCODE = '{inPatient.DRCODE}' AND I.JUPSU = '0' AND N.SUNEXT = I.SUCODE AND (I.STOPCHKID IS NULL OR TRIM(I.STOPCHKID) = '') AND I.STOPCHKDATE IS NULL AND I.SUNSUNAP ='3' AND I.ORDERCODE = C.ORDERCODE AND I.SUCODE = T.SUCODE AND I.PTNO = M.PTNO "; var count = DBaser.Execute(sql, new WhereBuilder()); return(count); }
/// <summary> /// 更新发药记录表预约状态 /// </summary> /// <param name="ptno">患者编号</param> /// <param name="presno">处方号</param> /// <param name="tuyakNo">发药序号</param> /// <param name="window">窗口号</param> public int PrslipMedicationAppointment(string ptno, string presno, string tuyakNo, string window) { if (ptno.IsEmpty()) { throw new Exception("患者编号为空"); } if (presno.IsEmpty()) { throw new Exception("处方号为空"); } if (tuyakNo.IsEmpty()) { throw new Exception("发药序号为空"); } if (window.IsEmpty()) { throw new Exception("窗口为空"); } var wb = new WhereBuilder(); //wb.And("PTNO", ptno, true); //wb.And("PRESNO", presno, true); //wb.And("STATUS", "0", true); //wb.And("CHECKDATE IS NULL",AnalyzableKind.KeepOriginal); //wb.And("CHECKTIME IS NULL", AnalyzableKind.KeepOriginal); //DBaser.Update("TWOCS_PRSLIP"); //DBaser["CHECKDATE"] = Environ.SlowTime.Date; //DBaser["CHECKTIME"] = Environ.SlowTime; //DBaser["FLAG"] = "1"; //DBaser["TuyakNo"] = tuyakNo; //DBaser["CHUANGKOU"] = window; //var count = DBaser.AcceptChanges(wb); var sql = $@" Update TWOCS_PRSLIP Set TUYAKNO = '{tuyakNo}', CHUANGKOU = '{window}', CHECKDATE = to_date('{Environ.SlowTime.ToString("yyyy-MM-dd")}','yyyy-mm-dd hh24:mi:ss'), FLAG = 1, CHECKTIME = to_date('{Environ.SlowTime.ToString("yyyy-MM-dd HH:mm:ss")}','yyyy-mm-dd hh24:mi:ss') Where PTNO = '{ptno}' And PRESNO = '{presno}' --And STATUS = '0' --And CHECKDATE IS NULL --And CHECKTIME IS NULL"; var count = DBaser.Execute(sql, wb); //if (count <= 0) // throw new Exception($"更新医嘱状态失败", new Exception($"患者编号:{ptno} 处方号:{presno}")); return(count); }
/// <summary> /// /// </summary> public int UpdateIOrderZG(InPatientCheck inPatient) { if (inPatient == null) { return(0); } var sql = $@" UPDATE TW_HSP_OCS.TWOCS_IORDER_ZG I SET I.JUPSU = '1' WHERE I.ROWID IN ( SELECT I.ROWID FROM TW_HSP_OCS.TWOCS_IORDER_ZG I, TW_HSP_PMPA.TWBAS_NSUGA N WHERE I.PTNO = '{inPatient.PTNO}' AND I.BDATE <= TO_DATE('{Environ.SlowTime.ToString("yyyy-MM-dd")}','YYYY-MM-DD') AND I.BDATE >= TO_DATE('{Environ.SlowTime.AddDays(-2).ToString("yyyy-MM-dd")}','YYYY-MM-DD') AND I.GBPICKUP = '1' AND SUBSTR(I.SENDDEPT1,1,1) = '7' AND I.GBAUTO NOT IN ('T','Z') AND I.STATUS = '0' AND I.SUNSUNAP = '3' AND I.ORDERGUBUN = 'H' AND I.WARDCODE = '{inPatient.WARDCODE}' AND I.DEPTCODE = '{inPatient.DEPTCODE}' AND I.DRCODE = '{inPatient.DRCODE}' AND I.JUPSU = '0' AND N.SUNEXT = I.SUCODE AND (I.STOPCHKID IS NULL OR TRIM(I.STOPCHKID) = '') AND I.STOPCHKDATE IS NULL ) "; var count = DBaser.Execute(sql, new WhereBuilder()); return(count); }