///// <summary> ///// 更新复核信息 ///// </summary> ///// <param name="hid">医院id</param> ///// <returns>int对象</returns> public int getEntrustNumber(int hid) { string sql = "select id,entrustNumber,updateDate from entrustNumber where Hospitalid=" + hid; string nowDate = DateTime.Now.ToString("yyyyMM"); DataTable dt = db.get_DataTable(sql); if (dt.Rows.Count > 0) { string updateDate = dt.Rows[0]["updateDate"].ToString(); string id = dt.Rows[0]["id"].ToString(); int entrustNumber = Convert.ToInt32(dt.Rows[0]["entrustNumber"].ToString()); if (!updateDate.Equals(nowDate)) { entrustNumber++; string updateSql = "update entrustNumber set entrustNumber=" + entrustNumber + ",updateDate='" + nowDate + "' where id=" + id; db.cmd_Execute(updateSql); } return(entrustNumber); } else { string sqlStr = "insert into entrustNumber(Hospitalid,entrustNumber,updateDate) values('" + hid + "','1','" + nowDate + "')"; db.cmd_Execute(sqlStr); } return(1); }
public int updateDelivery(int DecoctingNum, string Sendpersonnel, string SendTime, string Sendstate, string Starttime, string Remarks, string kd_type, string kd_num, string demo) { int end = 0; int a = 0; string sql = ""; string str = "select id from tisaneinfo where id = '" + DecoctingNum + "'"; SqlDataReader sr = db.get_Reader(str); if (sr.Read()) { string result = sr["id"].ToString(); a = Convert.ToInt32(result); sql = "update Delivery set DecoctingNum = '" + a + "',Sendpersonnel='" + Sendpersonnel + "',SendTime='" + SendTime + "',Sendstate='" + Sendstate + "',Starttime='" + Starttime + "',Remarks='" + Remarks + "',kd_type='" + kd_type + "'," + "kd_num='" + kd_num + "'," + "demo='" + demo + "'" + " where id = '" + DecoctingNum + "'"; end = db.cmd_Execute(sql); } else { end = 0; } return(end); }
/// <summary> /// 添加员工信息 /// </summary> /// <param name="einfo"></param> /// <returns></returns> public int AddEmployee(string JobNum, string EName, string Role, string Age, string Sex, string Nation, string Phone, string Address, string Origin, string password, string room) { String strSql = ""; int end = 0; string EmNumAName = JobNum + " " + EName; DataBaseLayer db = new DataBaseLayer(); string tate = "select JobNum from Employee where JobNum = '" + JobNum + "'"; SqlDataReader tate1 = db.get_Reader(tate); if (tate1.Read()) { strSql = ""; } else { strSql = "insert into Employee(JobNum,EName,Role,Sex,Age,Phone,Address,Nation,Origin,pwd,EmNumAName,room) "; strSql += "values ('" + JobNum + "','" + EName + "','" + Role + "','" + Sex + "',"; strSql += "'" + Age + "','" + Phone + "','" + Address + "','" + Nation + "','" + Origin + "','" + password + "','" + EmNumAName + "','" + room + "')"; } if (strSql == "") { end = 0; } else { string[] rolelist = Role.Split(','); for (int i = 0; i < rolelist.Length; i++) { string userRole = "insert into tbUserRole(UserId,RoleId)values('" + JobNum + "','" + rolelist[i] + "')"; db.cmd_Execute(userRole); } end = db.cmd_Execute(strSql); } return(end); }
///// <summary> ///// 更新复核信息 ///// </summary> ///// <param name="id">id</param> ///// <returns>int对象</returns> public int addRechecked(int userid, string wordDate, string barcode, string wordcontent, string tisaneNum, string imgname, string userName) { string sql = "insert into Audit(ReviewPer,AuditTime,barcode,pid,imgname,AuditStatus,employeeId) values('" + userName + "','" + wordDate + "','" + barcode + "','" + tisaneNum + "','" + imgname + "','1','" + userid + "')"; string sql2 = "update prescription set doperson ='" + userName + "', curstate = '复核' where id = '" + tisaneNum + "'"; db.cmd_Execute(sql2); return(db.cmd_Execute(sql)); }
public int AddAudit(int DecoctingNum, string ReviewPer) { System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now;//获取当前时间 String sql = ""; int end = 0; string per = ReviewPer.Substring(6); string employeeid = ""; string str3 = "select id from employee where EmNumAName ='" + ReviewPer + "'"; SqlDataReader sr3 = db.get_Reader(str3); if (sr3.Read()) { employeeid = sr3["id"].ToString(); } string str = "select id from prescription where id in (select prescriptionId from adjust where status = 1 ) and id not in (select pid from InvalidPrescription) and id = '" + DecoctingNum + "'"; SqlDataReader sr = db.get_Reader(str); if (sr.Read()) { string result = sr["id"].ToString(); int a = Convert.ToInt32(result); string str1 = "select * from Audit where pid = '" + a + "'"; SqlDataReader sr1 = db.get_Reader(str1); if (sr1.Read()) { sql = ""; } else { sql = "INSERT INTO [Audit](AuditTime,pid,ReviewPer,AuditStatus,employeeId) VALUES('" + currentTime + "','" + a + "','" + per + "',1,'" + employeeid + "')"; if (db.cmd_Execute(sql) == 1) { sql = "update prescription set doperson ='" + per + "', curstate = '复核' where id = '" + a + "'"; } } } else { sql = ""; } if (sql == "") { end = 0; } else { end = db.cmd_Execute(sql); } return(end);; }
public int AddDelivery(int userid, string wordDate, string barcode, string tisaneNum, string imgname, string userName) { // string sql = "insert into Delivery(employeeId,SendTime,barcode,DecoctingNum,imgname,Sendstate,Sendpersonnel) values('" + userid + "','" + wordDate + "','" + barcode + "','" + tisaneNum + "','" + imgname + "','1" + "','" + userName + "')"; string sql = "update Delivery set employeeId='" + userid + "',SendTime='" + wordDate + "',barcode='" + barcode + "',imgname='" + imgname + "',Sendstate='1',Sendpersonnel='" + userName + "' where DecoctingNum='" + tisaneNum + "'"; string sql2 = "update prescription set doperson ='" + userName + "',curstate = '已发货' where id = '" + tisaneNum + "'"; db.cmd_Execute(sql2); return(db.cmd_Execute(sql)); }
///// <summary> ///// 添加药品匹配信息 ///// </summary> ///// <param name="drugMatchingInfo)">药品匹配信息/param> ///// <returns>int对象</returns> public int insertDrugMatching(DrugMatchingInfo drugMatchingInfo) { String sql = "insert into DrugMatching(hospitalId,hospitalName,hdrugNum,ypcdrugNum,hdrugName,ypcdrugName," + "hdrugOriginAddress,ypcdrugOriginAddress,hdrugSpecs,ypcdrugSpecs,hdrugTotal,ypcdrugTotal,pspNum," + "ypcdrugPositionNum,pspId,drugId) values('" + drugMatchingInfo.hospitalId + "','" + drugMatchingInfo.hospitalName + "','" + drugMatchingInfo.hdrugNum + "','" + drugMatchingInfo.ypcdrugNum + "','" + drugMatchingInfo.hdrugName + "','" + drugMatchingInfo.ypcdrugName + "','" + drugMatchingInfo.hdrugOriginAddress + "','" + drugMatchingInfo.ypcdrugOriginAddress + "','" + drugMatchingInfo.hdrugSpecs + "','" + drugMatchingInfo.ypcdrugSpecs + "','" + drugMatchingInfo.hdrugTotal + "','" + drugMatchingInfo.ypcdrugTotal + "','" + drugMatchingInfo.pspNum + "','" + drugMatchingInfo.ypcdrugPositionNum + "','" + drugMatchingInfo.pspId + "','" + drugMatchingInfo.drugId + "')"; return(db.cmd_Execute(sql)); }
public int AddMedicineWarehouseInven(string fromid, string drugnum, string InventoryPer, string ActualCapacity, string InventoryStatus, string StorageCondition, string Rmarkes) { DataBaseLayer db = new DataBaseLayer(); String strSql = ""; int end = 0; System.DateTime currentTime = new System.DateTime(); currentTime = System.DateTime.Now;//获取当前时间 System.DateTime nowtime = new System.DateTime(); nowtime = System.DateTime.Now; string t = nowtime.ToLongTimeString().ToString(); string date = currentTime.ToString("yyyy/MM/dd"); string time = t; strSql = "insert into WarehouseInvenmedical(Warehouse,InventoryPer,ActualCapacity,InventoryStatus,StorageCondition,time,date,remark,productbatch) "; strSql += "values ('" + fromid + "','" + InventoryPer + "','" + ActualCapacity + "','" + InventoryStatus + "','" + StorageCondition + "','" + time + "','" + date + "','" + Rmarkes + "','" + drugnum + "')"; if (strSql == "") { end = 0; } else { end = db.cmd_Execute(strSql); } return(end); }
/// <summary> /// 添加员工信息 /// </summary> /// <param name="einfo"></param> /// <returns></returns> public int AddEmployee(string JobNum, string EName, string Role, string Age, string Sex, string Nation, string Phone, string Address, string Origin, string password) { String strSql = ""; int end = 0; string EmNumAName = JobNum + " " + EName; DataBaseLayer db = new DataBaseLayer(); string tate = "select JobNum from Employee where JobNum = '" + JobNum + "'"; SqlDataReader tate1 = db.get_Reader(tate); if (tate1.Read()) { strSql = ""; } else { strSql = "insert into Employee(JobNum,EName,Role,Sex,Age,Phone,Address,Nation,Origin,pwd,EmNumAName) "; strSql += "values ('" + JobNum + "','" + EName + "','" + Role + "','" + Sex + "',"; strSql += "'" + Age + "','" + Phone + "','" + Address + "','" + Nation + "','" + Origin + "','" + password + "','" + EmNumAName + "')"; } if (strSql == "") { end = 0; } else { end = db.cmd_Execute(strSql); } return(end); }
public bool AddDrug_1(DrugInfo dinfo) { DataBaseLayer db = new DataBaseLayer(); int n = 0; //string stateSql = "select prescriptionId from PrescriptionCheckState where checkStatus = 1 and prescriptionId = (select id from prescription as p where p.Pspnum = '" + dinfo.strPspnum + "' and p.hospitalid = '" + dinfo.nHospitalNum + "')"; string stateSql = "select prescriptionId from PrescriptionCheckState where checkStatus = 0 and prescriptionId in(select id from prescription as p where p.Pspnum = '" + dinfo.strPspnum + "' and p.hospitalid = '" + dinfo.nHospitalNum + "')"; db.write_log_txt("insert drug_2:" + stateSql); SqlDataReader srd = db.get_Reader(stateSql); //string q = srd["Pspnum"].ToString(); // if (srd.Read()) // { // n = 0; // } // else // { string stateSql1 = "select id from prescription as p where p.Pspnum = '" + dinfo.strPspnum + "' and p.hospitalid = '" + dinfo.nHospitalNum + "'"; SqlDataReader srd1 = db.get_Reader(stateSql1); string pid = ""; if (srd1.Read()) { pid = srd1["id"].ToString(); } string str = "select * from drug where pid='" + pid + "' and drugnum ='" + dinfo.strDrugNum + "' and drugname ='" + dinfo.strDrugName + "'"; SqlDataReader srd4 = db.get_Reader(str); if (srd4.Read()) { n = -1; } else { string strSql = "insert into drug(customid,Hospitalid,Pspnum,drugnum,drugname,drugdescription,"; strSql += "drugposition,drugallnum,drugweight,tienum,description,pid) "; strSql += "values(" + dinfo.nCustomId + "," + dinfo.nHospitalNum + ",'" + dinfo.strPspnum + "',"; strSql += "'" + dinfo.strDrugNum + "','" + dinfo.strDrugName + "','" + dinfo.strDrugDsp + "','" + dinfo.strDrugPosition + "',"; strSql += "" + dinfo.nAllNum + "," + dinfo.dWeight + "," + dinfo.nTieNum + ",'" + dinfo.strDsp + "'," + "'" + pid + "')"; db.write_log_txt("药品录入:" + strSql); n = db.cmd_Execute(strSql); } // } if (n > 0) { return(true); } else if (n == 0) { // Response.Write("<script>alert('录入药品重复');window.parent.loginview();</script>"); return(true); } else { return(true); } }
public int updateHospitalInfo(int id, string hname, string hshortname, string hnum, string contacter, string phone, string address, string pricetype) { //string strSql = "select id,JobNum,EName,Role,Sex,Age,Phone,Address,Nation,Origin from Employee where id = " + id; int end = 0; DataBaseLayer db = new DataBaseLayer(); string tate = "select hnum from hospital where hnum = '" + hnum + "' and id != '" + id + "'"; SqlDataReader tate1 = db.get_Reader(tate); if (tate1.Read()) { end = 0; } else { /* string tate2 = "select settler from hospital where settler = '" + settler + "' and id != '" + id + "'"; * SqlDataReader tatea = db.get_Reader(tate2); * if (tatea.Read()) * { * end = 0; * } * else * {*/ string sql = "update hospital set hname='" + hname + "',hshortname='" + hshortname + "',hnum='" + hnum + "',contacter='" + contacter + "',phone='" + phone + "',address='" + address + "',pricetype='" + pricetype + "' where id = " + id + ""; end = db.cmd_Execute(sql); // } } return(end); }
public int AddHospital(string hname, string hshortname, string hnum, string contacter, string phone, string address, string pricetype) { int end = 0; DataBaseLayer db = new DataBaseLayer(); string tate = "select hnum from hospital where hnum = '" + hnum + "' "; SqlDataReader tate1 = db.get_Reader(tate); if (tate1.Read()) { end = 0; } else { /*string tate2 = "select settler from hospital where settler = '" + settler + "' "; * SqlDataReader tatea = db.get_Reader(tate2); * if (tatea.Read()) * { * end = 0; * } * else * {*/ //泡药显示 DrugDisplayState 煎药显示 ChineseDisplayState 发药显示 DrugSendDisplayState string strSql = "insert into hospital(hnum,hname,hshortname,contacter,phone,address,pricetype, DrugDisplayState,ChineseDisplayState,DrugSendDisplayState) "; strSql += "values ('" + hnum + "','" + hname + "','" + hshortname + "','" + contacter + "',"; strSql += "'" + phone + "','" + address + "','" + pricetype + "','0','0','0')"; end = db.cmd_Execute(strSql); // } } return(end); }
public int AddprescriptionSubsidiary(prescriptionSubsidiaryModel model) { string strSql = @" INSERT INTO prescriptionSubsidiary (pid ,[unitPrice] ,[totalPrice] ,[insuranceNumber] ,[outpatientNumber] ,[outpatientIndex] ,[patientIndex] ,ptype) VALUES ('" + model.pid + "','" + model.unitPrice + "','" + model.totalPrice + "','" + model.insuranceNumber + "','" + model.outpatientNumber + "','" + model.outpatientIndex + "','" + model.patientIndex + "'," + model.ptype + ")"; int i = db.cmd_Execute(strSql); return(i); }
public bool AddDrug(DrugInfo dinfo) { DataBaseLayer db = new DataBaseLayer(); int n = 0; string stateSql = "select prescriptionId from PrescriptionCheckState where checkStatus = 1 and prescriptionId = (select id from prescription as p where p.Pspnum = '" + dinfo.strPspnum + "' and p.hospitalid = '" + dinfo.nHospitalNum + "')"; SqlDataReader srd = db.get_Reader(stateSql); //string q = srd["Pspnum"].ToString(); if (srd.Read()) { n = 0; } else { string stateSql1 = "select id from prescription as p where p.Pspnum = '" + dinfo.strPspnum + "' and p.hospitalid = '" + dinfo.nHospitalNum + "'"; SqlDataReader srd1 = db.get_Reader(stateSql1); string pid = ""; if (srd1.Read()) { pid = srd1["id"].ToString(); } string str = "select * from drug where pid='" + pid + "' and drugnum ='" + dinfo.strDrugNum + "' and drugname ='" + dinfo.strDrugName + "'"; SqlDataReader srd4 = db.get_Reader(str); if (srd4.Read()) { n = 0; } else { string strSql = "insert into drug(customid,Hospitalid,Pspnum,drugnum,drugname,drugdescription,"; strSql += "drugposition,drugallnum,drugweight,tienum,description,wholesaleprice,retailprice,pid) "; strSql += "values(" + dinfo.nCustomId + "," + dinfo.nHospitalNum + ",'" + dinfo.strPspnum + "',"; strSql += "'" + dinfo.strDrugNum + "','" + dinfo.strDrugName + "','" + dinfo.strDrugDsp + "','" + dinfo.strDrugPosition + "',"; strSql += "" + dinfo.nAllNum + "," + dinfo.dWeight + "," + dinfo.nTieNum + ",'" + dinfo.strDsp + "'," + dinfo.dWholeSalePrice + ","; strSql += "" + dinfo.dRetailPrice + ",'" + pid + "')"; n = db.cmd_Execute(strSql); } } if (n > 0) { return(true); } else { return(false); } }
public int updateWarehouseInvenInfo(int id, string Warehouse, string InventoryPer, string ActualCapacity, string InventoryStatus, string StorageCondition, string remark) { int end = 0; string sql = ""; string str = "select Warehouse from WarehouseInven where id = " + id + " "; SqlDataReader sr = db.get_Reader(str); if (!sr.Read()) { end = 0; } else { sql = "update WarehouseInven set Warehouse='" + Warehouse + "',InventoryPer='" + InventoryPer + "',ActualCapacity='" + ActualCapacity + "',InventoryStatus='" + InventoryStatus + "',StorageCondition='" + StorageCondition + "',remark='" + remark + "'where id = " + id + ""; end = db.cmd_Execute(sql); } return(end); }
//添加匹配列表信息 public int Adddrugmatchinginfo(string hospitalname, string DrugName12, string DrugCode1, string ypcdrugname, string ypcdrugcode) { int end = 0; string strSql = ""; string str1 = "select * from drugadmin where drugname ='" + ypcdrugname + "' and drugcode ='" + ypcdrugcode + "'"; SqlDataReader sdr1 = db.get_Reader(str1); if (sdr1.Read()) { string str2 = "select * from ypcdrug where drugNum ='" + DrugCode1 + "' and hospitalid ='" + hospitalname + "'"; SqlDataReader sdr2 = db.get_Reader(str2); if (sdr2.Read()) { } else { strSql = "insert into ypcdrug(drugName, drugNum, drugDetailedName, drugAlias,hospitalid) "; strSql += "values ('" + DrugName12 + "','" + DrugCode1 + "','" + ypcdrugname + "','" + ypcdrugcode + "','" + hospitalname + "')"; end = db.cmd_Execute(strSql); } } else { } return(end); }