本文整理汇总了Python中DoctorSpring.models.Diagnose类的典型用法代码示例。如果您正苦于以下问题:Python Diagnose类的具体用法?Python Diagnose怎么用?Python Diagnose使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Diagnose类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateReport
def updateReport():
userId=session['userId']
user=User.getById(userId)
if user is None:
return json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False)
# if UserRole.checkRole(db_session,userId,constant.RoleId.Doctor):
# return json.dumps(rs.PERMISSION_DENY.__dict__,ensure_ascii=False)
form = ReportForm(request.form)
if form.reportId:
#session['remember_me'] = form.remember_me.data
# login and validate the user...
if form.status and form.status==constant.ReportStatus.Commited:
fileUrl=pdf_utils.generatorPdf(form.diagnoseId)#需要先生存文檔上傳到服務器,獲取url
report=Report.update(form.reportId,constant.ReportType.Doctor,form.status,fileUrl,form.techDesc,form.imageDesc,form.diagnoseDesc)
Diagnose.changeDiagnoseStatus(form.diagnoseId,constant.DiagnoseStatus.Diagnosed)
#需要給用戶發信和記錄操作日誌
diagnose=Diagnose.getDiagnoseById(form.diagnoseId)
sendMessageAndRecordLog(diagnose,userId)
else:
fileUrl=None#這是草稿,不需要生存文檔
diagnose=Diagnose.getDiagnoseById(form.diagnoseId)
if diagnose is None:
return json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False)
report=Report.update(form.reportId,constant.ReportType.Doctor,form.status,fileUrl,form.techDesc,form.imageDesc,form.diagnoseDesc)
recordDiagnoseLog(diagnose,userId)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
示例2: addDiagnoseComment
def addDiagnoseComment():
form = CommentsForm(request.form)
resultForm=form.validate()
if resultForm.status==rs.SUCCESS.status:
#session['remember_me'] = form.remember_me.data
# login and validate the user...
diagnoseComment=Comment(form.userId,form.receiverId,form.diagnoseId,form.content)
db_session.add(diagnoseComment)
db_session.commit()
db_session.flush()
score=constant.DiagnoseScore[form.score]
diagnose=Diagnose.getDiagnoseById(form.diagnoseId)
diagnose.score=form.score
Diagnose.save(diagnose)
#为医生添加一些冗余字段
if hasattr(diagnose,'doctor'):
doctor=diagnose.doctor
if score!=0:
if doctor.goodFeedbackCount:
doctor.goodFeedbackCount+=1
else:
doctor.goodFeedbackCount=1
if doctor.feedbackCount:
doctor.feedbackCount+=1
else:
doctor.feedbackCount=1
Doctor.save(doctor)
#flash('成功添加诊断评论')
return jsonify(rs.SUCCESS.__dict__)
return jsonify(rs.FAILURE.__dict__)
示例3: evaluateDiagnose
def evaluateDiagnose(diagnoseId):
userId=session['uesrId']
if userId is None:
return json.dumps(rs.NO_LOGIN.__dict__,ensure_ascii=False)
userId=string.atoi(userId)
score=request.args.get('score')
description=request.args.get('description')
if score:
score=string.atoi(score)
else:
return json.dumps(rs.PARAM_ERROR.__dict__,ensure_ascii=False)
diagnose=Diagnose.getDiagnoseById(diagnoseId)
if diagnose is None:
return json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False)
if hasattr(diagnose,'patient') and diagnose.patient and diagnose.patient.userID and diagnose.patient.userID==userId:
diagnose.status=constant.DiagnoseStatus.Diagnosed
diagnose.score=score
Diagnose.save(diagnose)
diagoseLog=DiagnoseLog(userId,diagnoseId,constant.DiagnoseLogAction.DiagnoseFinished)
diagoseLog.description=description
DiagnoseLog.save(db_session,diagoseLog)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
else:
return json.dumps(rs.PERMISSION_DENY.__dict__,ensure_ascii=False)
示例4: rollbackDiagnose
def rollbackDiagnose(diagnoseId):
userId=session['userId']
if userId is None:
return json.dumps(rs.NO_LOGIN.__dict__,ensure_ascii=False)
userId=string.atoi(userId)
status=request.form.get('status')
comments=request.form.get('comments')
if status:
status=string.atoi(status)
diagnose=Diagnose.getDiagnoseById(diagnoseId)
if diagnose is None:
return json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False)
if hasattr(diagnose,'adminId') and diagnose.adminId and diagnose.adminId==userId:
if status is None:
status=constant.DiagnoseStatus.Draft
diagnose.status=status
Diagnose.save(diagnose)
diagoseLog=DiagnoseLog(userId,diagnoseId,constant.DiagnoseLogAction.DiagnoseNeedUpateAction)
diagoseLog.description=comments
DiagnoseLog.save(db_session,diagoseLog)
if hasattr(diagnose,'patient') and diagnose.patient.userID:
content=dataChangeService.getPatienDiagnoseMessageContent(diagnose)
#诊断通知
message=Message(constant.DefaultSystemAdminUserId,diagnose.patient.userID,'诊断通知',content,constant.MessageType.Diagnose)
Message.save(message)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
else:
return json.dumps(rs.PERMISSION_DENY.__dict__,ensure_ascii=False)
示例5: AlipayCallbackUrl
def AlipayCallbackUrl():
userId='9'
if session.has_key('userId'):
userId=session['userId']
if userId is None:
redirect(LOGIN_URL)
params=AlipayCallBackInfo(request.args)
payRecord=AlipayChargeRecord(params.diagnoseSeriesNumber,params.buyer_email,params.buyer_id,params.is_success,params.notify_time,
params.notify_type,params.total_fee,params.trade_no,params.trade_status,params.out_trade_no)
AlipayChargeRecord.save(payRecord)
if params.is_success=='T' and params.trade_status=='TRADE_SUCCESS':
diagnose=Diagnose.getDiagnoseByDiagnoseSeriesNo(params.diagnoseSeriesNumber)
if diagnose:
diagnoseId=diagnose.id
alipayLog=AlipayLog(userId,diagnoseId,constant.AlipayLogAction.PayFilished)
AlipayLog.save(alipayLog)
diagnose.status=constant.DiagnoseStatus.NeedTriage
Diagnose.save(diagnose)
result=rs.ResultStatus(rs.SUCCESS.status,'支付成功')
return json.dumps(result.__dict__,ensure_ascii=False)
else:
# alipayLog=AlipayLog(userId,params.diagnoseSeriesNumber,constant.AlipayLogAction.PayFilished)
# AlipayLog.save(alipayLog)
LOG.error("支付成功,但系统诊断已经取消(诊断序列号:%s)",params.diagnoseSeriesNumber)
result=rs.ResultStatus(rs.SUCCESS.status,'支付成功,但系统诊断已经取消')
return json.dumps(result.__dict__,ensure_ascii=False)
# alipayLog=AlipayLog(userId,params.diagnoseSeriesNumber,constant.AlipayLogAction.PayFailure)
# AlipayLog.save(alipayLog)
LOG.error("支付失败(诊断序列号:%s)",params.diagnoseSeriesNumber)
result=rs.ResultStatus(rs.FAILURE.status,'支付失败')
return json.dumps(result.__dict__,ensure_ascii=False)
示例6: rollbackDiagnose
def rollbackDiagnose(diagnoseId):
userId=session['userId']
if userId is None:
return json.dumps(rs.NO_LOGIN.__dict__,ensure_ascii=False)
userId=string.atoi(userId)
status=request.form.get('status')
comments=request.form.get('comments')
if status:
status=string.atoi(status)
diagnose=Diagnose.getDiagnoseById(diagnoseId)
if diagnose is None:
return json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False)
if (hasattr(diagnose,'adminId') and diagnose.adminId and diagnose.adminId==userId) or (hasattr(diagnose,'doctorId') and diagnose.doctorId and diagnose.doctor.userId == userId):
if status is None:
status=constant.DiagnoseStatus.Draft
diagnose.status=status
Diagnose.save(diagnose)
diagoseLog=DiagnoseLog(userId,diagnoseId,constant.DiagnoseLogAction.DiagnoseNeedUpateAction)
diagoseLog.description=comments
DiagnoseLog.save(db_session,diagoseLog)
if hasattr(diagnose,'patient') and diagnose.patient.userID:
content=dataChangeService.getPatienDiagnoseMessageContent(diagnose)
#诊断通知
message=Message(constant.DefaultSystemAdminUserId,diagnose.patient.userID,'诊断通知',content,constant.MessageType.Diagnose)
Message.save(message)
if(hasattr(diagnose,'doctorId') and diagnose.doctorId and diagnose.doctor.userId == userId):
reportDiagnoseRelations = ReportDiagnoseRelation.getReportsByDiagnoseId(diagnose.id)
for reportDiagnoseRelation in reportDiagnoseRelations:
if reportDiagnoseRelation.report.status != constant.ReportStatus.Del:
if reportDiagnoseRelation.report.type == constant.ReportType.Doctor:
print 'doctor report'
#delete doctor report if exist
# reportDiagnoseRelation.report.status = constant.ModelStatus.Del
Report.update(reportDiagnoseRelation.report.id,status=constant.ReportStatus.Del)
ReportDiagnoseRelation.update(reportDiagnoseRelation.id,status=constant.ModelStatus.Del)
elif reportDiagnoseRelation.report.type == constant.ReportType.Admin:
print 'admin report'
#set diagnose report to admin report
diagnose.reportId = reportDiagnoseRelation.report.id
Diagnose.update(diagnose)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
else:
return json.dumps(rs.PERMISSION_DENY.__dict__,ensure_ascii=False)
示例7: applyDiagnose
def applyDiagnose():
if session.has_key('userId'):
userId=session['userId']
if userId is None:
return redirect('/loginPage')
data = {}
hospitals = Hospital.getAllHospitals(db_session)
hospitalsDict = object2dict.objects2dicts(hospitals)
data['hospitals'] = hospitalsDict
positions = Position.getPositions()
positionsDict = object2dict.objects2dicts(positions)
data['positions'] = positionsDict
locations = Location.getAllLocations(db_session)
locationsDict = object2dict.objects2dicts(locations)
data['locations'] = locationsDict
if 'edit' in request.args.keys() and 'diagnoseid' in request.args.keys():
new_diagnose = Diagnose.getDiagnoseById(request.args['diagnoseid'])
data['edit'] = 1
else:
new_diagnose = Diagnose.getNewDiagnoseByStatus(ModelStatus.Draft, session['userId'])
if new_diagnose is not None:
data['doctor'] = new_diagnose.doctor
data['patient'] = new_diagnose.patient
data['pathology'] = new_diagnose.pathology
new_file = File.getFiles(new_diagnose.pathologyId, constant.FileType.Dicom)
data['dicomfile'] = new_file
new_files = File.getFiles(new_diagnose.pathologyId, constant.FileType.FileAboutDiagnose)
data['fileAboutDiagnose'] = new_files
pathologyPositions = []
if hasattr(new_diagnose, 'pathology') and hasattr(new_diagnose.pathology, 'pathologyPostions'):
pathologyPositions = object2dict.objects2dicts(new_diagnose.pathology.pathologyPostions)
data['pathologyPositions'] = pathologyPositions
patients = Patient.get_patient_by_user(session['userId'])
if patients is None or len(patients) < 1:
patientdict = []
else:
patientdict = object2dict.objects2dicts(patients)
data['patientdict'] = patientdict
return render_template("applyDiagnose.html", result=data)
示例8: changeDiagnoseToNeedPay
def changeDiagnoseToNeedPay(diagnoseId):
try:
loginUserId=session.get('userId')
if loginUserId is None:
return
fileIds = request.form.getlist('fileIds')
loginUserId=string.atoi(loginUserId)
diagnose=Diagnose.getDiagnoseById(diagnoseId)
if diagnose is None or (not hasattr(diagnose,"patient")) or diagnose.patient is None:
return
userID=diagnose.patient.userID
if userID==loginUserId or diagnose.uploadUserId==loginUserId:
# diagnose=Diagnose()
# diagnose.id=diagnoseId
#update by lichuan
# diagnose.status= constant.DiagnoseStatus.NeedPay
# Diagnose.update(diagnose)
from DoctorSpring.views.front import sendAllMessage,checkFilesExisting
from DoctorSpring.models.diagnoseDocument import File
if(checkFilesExisting(diagnose)):
# newDiagnose= Diagnose()
# newDiagnose.id=diagnoseId
if diagnose.status == constant.DiagnoseStatus.NeedUpdate:
new_diagnoselog = DiagnoseLog(diagnose.uploadUserId, diagnose.id, DiagnoseLogAction.DiagnoseNeedUpateRecommitAction)
DiagnoseLog.save(db_session, new_diagnoselog)
diagnose.status = constant.DiagnoseStatus.Triaging
Diagnose.update(diagnose)
pathologyId = diagnose.pathologyId
File.cleanAllDirtyFile(fileIds, pathologyId)
else:
diagnose.status = constant.DiagnoseStatus.NeedPay
Diagnose.update(diagnose)
#清除以前的无用文件
pathologyId = diagnose.pathologyId
File.cleanAllDirtyFile(fileIds, pathologyId)
sendAllMessage(userID,diagnose)
else:
return json.dumps(rs.FAILURE.__dict__,"需要上传DICOM文件和诊断文件")
#end update
except Exception,e:
LOG.error(e.message)
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
示例9: updateReport
def updateReport():
userId=session['userId']
user=User.getById(userId)
if user is None:
return json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False)
# if UserRole.checkRole(db_session,userId,constant.RoleId.Doctor):
# return json.dumps(rs.PERMISSION_DENY.__dict__,ensure_ascii=False)
form = ReportForm(request.form)
patient_id = Diagnose.get_patientID_by_diagnoseID(form.diagnoseId)
identity_Phone = Patient.get_identityPhone_by_patientID(patient_id)
#identityPhone = Patient.get_identityPhone_by_patientID(patient_id)[0].decode(encoding='UTF-8')
identityPhone = identity_Phone[0]
#print(identityPhone)
if form.reportId:
#session['remember_me'] = form.remember_me.data
# login and validate the user...
if form.status and form.status==constant.ReportStatus.Commited:
#first update based on form , then generate html
Report.update(reportId=form.reportId,techDesc=form.techDesc,imageDesc=form.imageDesc,diagnoseDesc=form.diagnoseDesc)
# fileUrl=pdf_utils.generatorPdf(form.diagnoseId, identityPhone)#需要先生存文檔上傳到服務器,獲取url
fileUrl=pdf_utils.generatorHtml(form.diagnoseId, identityPhone)
if fileUrl:
report=Report.update(form.reportId,constant.ReportType.Doctor,form.status,fileUrl,form.techDesc,form.imageDesc,form.diagnoseDesc)
Diagnose.changeDiagnoseStatus(form.diagnoseId,constant.DiagnoseStatus.Diagnosed)
#需要給用戶發信和記錄操作日誌
diagnose=Diagnose.getDiagnoseById(form.diagnoseId)
sendMessageAndRecordLog(diagnose,userId)
else:
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
else:
fileUrl=None#這是草稿,不需要生存文檔
diagnose=Diagnose.getDiagnoseById(form.diagnoseId)
if diagnose is None:
return json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False)
report=Report.update(form.reportId,constant.ReportType.Doctor,form.status,fileUrl,form.techDesc,form.imageDesc,form.diagnoseDesc)
recordDiagnoseLog(diagnose,userId)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
示例10: validate
def validate(self):
try:
if self.diagnoseId is None:
return FAILURE
diagnose=Diagnose.getDiagnoseById(self.diagnoseId)
if diagnose is None:
return FAILURE
if diagnose.doctorId and hasattr(diagnose,'doctor') and diagnose.doctor and diagnose.doctor.userId:
self.receiverId=diagnose.doctor.userId
else:
return FAILURE
if diagnose.patientId and hasattr(diagnose,'patient') and diagnose.patient and diagnose.patient.userID:
self.userId=diagnose.patient.userID
else:
return FAILURE
# if self.title is None:
# return FAILURE
if self.content is None or len(self.content)<10:
failure=ResultStatus(FAILURE.status,"输入的内容长度必须大于等于10")
return failure
if self.score is None or self.score == u'':
return FAILURE
else:
self.score=string.atoi(self.score)
except Exception,e:
return FAILURE
示例11: redirectAlipay
def redirectAlipay(alipayHashcode):
alipayUrl=Diagnose.getAlipayUrl(alipayHashcode)
if alipayUrl is None:
return redirect(ERROR_URL)
#return redirect("/pdf")
#print url_for('user_center.generatorPdf',diagnoseName='ccheng')
return redirect(alipayUrl[0])
示例12: getMobileVerifyCode
def getMobileVerifyCode():
try:
from DoctorSpring.util import verify_code,sms_utils
verifyCode= verify_code.generatorVerifyCode()
LOG.info("产生验证码")
session['verifyCode']=verifyCode
telPhoneNo=None
userId=session.get('userId')
diagnoseId=request.args.get('diagnoseId')
diagnose=Diagnose.getDiagnoseById(diagnoseId)
if diagnose and hasattr(diagnose,'patient') and diagnose.patient:
telPhoneNo=diagnose.patient.identityPhone
if telPhoneNo is None and hasattr(diagnose.patient,'user') and diagnose.patient.user:
telPhoneNo=diagnose.patient.user.phone
if telPhoneNo is None:
user=User.getById(userId)
telPhoneNo=user.phone
if telPhoneNo:
smsRc=sms_utils.RandCode()
template_param = {'param1':verifyCode}
smsRc.send_emp_sms(telPhoneNo,smsRc.TEMPLATE_ID_1,json.dumps(template_param))
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
else:
LOG.error("诊断[%s]发送验证码错误"%diagnoseId)
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
except Exception,e:
LOG.error(e.message)
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
示例13: generatorPdf
def generatorPdf(diagnoseId):
diagnose=Diagnose.getDiagnoseById(diagnoseId)
if session.has_key('userId'):
userId=session['userId']
if userId is None:
return redirect('/loginPage')
resHtml = None
if UserRole.checkRole(db_session,userId,constant.RoleId.Patient) and Patient.is_patient_under_user(int(userId),diagnose.patientId):
resHtml = renderHtmlFromDiagnose(diagnose)
if UserRole.checkRole(db_session,userId,constant.RoleId.Admin) and (int(userId) == diagnose.adminId):
resHtml = renderHtmlFromDiagnose(diagnose)
if UserRole.checkRole(db_session,userId,constant.RoleId.Doctor) and (int(userId) == diagnose.doctorId):
resHtml = renderHtmlFromDiagnose(diagnose)
if UserRole.checkRole(db_session,userId,constant.RoleId.HospitalUser) and (int(userId) == diagnose.uploadUserId):
resHtml = renderHtmlFromDiagnose(diagnose)
if resHtml:
return resHtml
else:
return redirect('/error')
示例14: getDiagnoseListByHospitalUser2
def getDiagnoseListByHospitalUser2():
userId=session['userId']
status=request.args.get('status')
if status:
import string
status=string.atoi(status)
startDateStr=request.args.get('startDate')
startDate=None
if startDateStr:
startDate=datetime.strptime(startDateStr,"%Y-%m-%d")
else:
startDate=constant.SystemTimeLimiter.startTime
endDateStr=request.args.get('endDate')
endDate=None
if endDateStr:
endDate=datetime.strptime(endDateStr,"%Y-%m-%d")
else:
endDate=constant.SystemTimeLimiter.endTime
patientName=request.args.get('patientName')
pageNo=request.args.get('pageNumber')
pageSize=request.args.get('pageSize')
pager=Pagger(pageNo,pageSize)
diagnoses=Diagnose.getDealedDiagnoseByHospitalUser(db_session,userId,patientName,status,startDate,endDate,pager)
diagnosesDict=dataChangeService.userCenterDiagnoses(diagnoses)
resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,diagnosesDict)
resultDict=resultStatus.__dict__
return json.dumps(resultDict,ensure_ascii=False)
示例15: fetchDiagnoseByAdmin
def fetchDiagnoseByAdmin():
diagnoseId=request.form.get('diagnoseId')
userId=session['userId']
# if diagnoseId is None :
# return json.dumps(rs.PARAM_ERROR.__dict__,ensure_ascii=False)
#
# user=User.getById(userId)
# if user is None:
# return json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False)
#
# from database import db_session
# if UserRole.checkRole(db_session,userId,constant.RoleId.Admin):
# result=Diagnose.addAdminIdAndChangeStatus(diagnoseId,userId)
# #诊断日志
# diagoseLog=DiagnoseLog(userId,diagnoseId,constant.DiagnoseLogAction.FetchDiagnoseAction)
# DiagnoseLog.save(db_session,diagoseLog)
#
# return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
# else:
# return json.dumps(rs.PERMISSION_DENY.__dict__,ensure_ascii=False)
result=Diagnose.addAdminIdAndChangeStatus(diagnoseId,userId)
#诊断日志
if result:
diagoseLog=DiagnoseLog(userId,diagnoseId,constant.DiagnoseLogAction.FetchDiagnoseAction)
DiagnoseLog.save(db_session,diagoseLog)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)