Ejemplo n.º 1
0
Archivo: Market.py Proyecto: zhmsg/dms
 def new(self, data_no, market_info, inputuser):
     if check_chinese(market_info["source"], max_len=40) is False:
         return False, u"数据来源单位只能是中文且长度不大于40"
     if check_chinese(market_info["diagnosis"], max_len=40) is False:
         return False, u"临床诊断只能是中文且长度不大于40"
     now_time = datetime.now().strftime(TIME_FORMAT)
     insert_sql = "INSERT INTO %s (data_no," % self.market
     values_sql = " VALUES ('%s'," % data_no
     for att in self.attribute:
         insert_sql += "%s," % att
         if att not in market_info:
             return False, u"upload_info缺少必要参数%s" % att
         values_sql += "'%s'," % market_info[att]
     values_sql += "'%s','%s')" % (now_time, inputuser)
     insert_sql += "inputtime,inputuser)%s" % values_sql
     self.db.execute(insert_sql)
     return True, ""
Ejemplo n.º 2
0
Archivo: Upload.py Proyecto: zhmsg/dms
 def new(self, data_no, upload_info, inputuser):
     if check_chinese(upload_info["person"], max_len=5) is False:
         return False, u"上传负责人只能是中文且长度不大于5"
     now_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
     insert_sql = "INSERT INTO %s (data_no," % self.upload
     values_sql = " VALUES ('%s'," % data_no
     for att in self.attribute:
         insert_sql += "%s," % att
         if att not in upload_info:
             return False, u"upload_info缺少必要参数%s" % att
         values_sql += "'%s'," % upload_info[att]
     values_sql += "'%s','%s')" % (now_time, inputuser)
     insert_sql += "inputtime,inputuser)%s" % values_sql
     self.db.execute(insert_sql)
     return True, ""