本文整理汇总了Python中DoctorSpring.models.Diagnose.ossUploaded方法的典型用法代码示例。如果您正苦于以下问题:Python Diagnose.ossUploaded方法的具体用法?Python Diagnose.ossUploaded怎么用?Python Diagnose.ossUploaded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DoctorSpring.models.Diagnose
的用法示例。
在下文中一共展示了Diagnose.ossUploaded方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dicomfileUpload
# 需要导入模块: from DoctorSpring.models import Diagnose [as 别名]
# 或者: from DoctorSpring.models.Diagnose import ossUploaded [as 别名]
def dicomfileUpload():
userId=session.get('userId')
if userId is None:
return redirect(LOGIN_URL)
userId=string.atoi(userId)
type=request.form.get('type')
diagnoseId=request.form.get("diagnoseId")
if diagnoseId is None:
return jsonify({'code': 1, 'message' : "error", 'data': ''})
diagnoseId=string.atoi(diagnoseId)
if type:
type=string.atoi(type)
else:
type=constant.FileType.Dicom
try:
diagnose=Diagnose.getDiagnoseById(diagnoseId)
if diagnose and diagnose.pathologyId:
file_infos = []
files = request.files
for key, file in files.iteritems():
if file and allowed_file(file.filename):
filename = file.filename
# file_url = oss_util.uploadFile(diagnoseId, filename)
from DoctorSpring.util.oss_util import uploadFileFromFileStorage
fileurl = uploadFileFromFileStorage(diagnoseId, filename, file,'',{})
new_file = File(FileType.Dicom, filename, '11', fileurl,diagnose.pathologyId)
File.save(new_file)
if type==FileType.Dicom:
filesAboutDiagnose=File.getFiles(diagnose.pathologyId,FileType.FileAboutDiagnose)
if filesAboutDiagnose and len(filesAboutDiagnose)>0:
diagnoseChange=Diagnose()
diagnoseChange.id=diagnoseId
diagnoseChange.ossUploaded=constant.DiagnoseUploaed.Uploaded
diagnose.uploadUserId=userId
Diagnose.update(diagnoseChange)
if type==FileType.FileAboutDiagnose:
filesAboutDiagnose=File.getFiles(diagnose.pathologyId,FileType.Dicom)
if filesAboutDiagnose and len(filesAboutDiagnose)>0:
diagnoseChange=Diagnose()
diagnoseChange.id=diagnoseId
diagnoseChange.ossUploaded=constant.DiagnoseUploaed.Uploaded
diagnose.uploadUserId=userId
Diagnose.update(diagnoseChange)
file_infos.append(dict(id=new_file.id,
name=filename,
size=11,
url=fileurl))
else:
return jsonify({'code': 1, 'message' : "error", 'data': ''})
return jsonify(files=file_infos)
except Exception,e:
print e.message
return jsonify({'code': 1, 'message' : "error", 'data': ''})