当前位置: 首页>>代码示例>>Python>>正文


Python Diagnose.save方法代码示例

本文整理汇总了Python中DoctorSpring.models.Diagnose.save方法的典型用法代码示例。如果您正苦于以下问题:Python Diagnose.save方法的具体用法?Python Diagnose.save怎么用?Python Diagnose.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DoctorSpring.models.Diagnose的用法示例。


在下文中一共展示了Diagnose.save方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AlipayCallbackUrl

# 需要导入模块: from DoctorSpring.models import Diagnose [as 别名]
# 或者: from DoctorSpring.models.Diagnose import save [as 别名]
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)
开发者ID:LichuanLu,项目名称:blueberry,代码行数:33,代码来源:diagnose.py

示例2: rollbackDiagnose

# 需要导入模块: from DoctorSpring.models import Diagnose [as 别名]
# 或者: from DoctorSpring.models.Diagnose import save [as 别名]
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)
开发者ID:LichuanLu,项目名称:blueberry,代码行数:35,代码来源:diagnose.py

示例3: evaluateDiagnose

# 需要导入模块: from DoctorSpring.models import Diagnose [as 别名]
# 或者: from DoctorSpring.models.Diagnose import save [as 别名]
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)
开发者ID:LichuanLu,项目名称:blueberry,代码行数:29,代码来源:diagnose.py

示例4: addDiagnoseComment

# 需要导入模块: from DoctorSpring.models import Diagnose [as 别名]
# 或者: from DoctorSpring.models.Diagnose import save [as 别名]
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__)
开发者ID:LichuanLu,项目名称:redberry,代码行数:32,代码来源:message_comment.py

示例5: addOrUpdateReport

# 需要导入模块: from DoctorSpring.models import Diagnose [as 别名]
# 或者: from DoctorSpring.models.Diagnose import save [as 别名]
def addOrUpdateReport():

    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.Admin) == False:
        return  json.dumps(rs.PERMISSION_DENY.__dict__,ensure_ascii=False)

    form =  ReportForm(request.form)
    formResult=form.validate()
    if formResult.status==rs.SUCCESS.status:
        diagnose=Diagnose.getDiagnoseById(form.diagnoseId)
        if diagnose is None:
            return  json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False)
        #session['remember_me'] = form.remember_me.data
        # login and validate the user...
        report = None
        if form.reportId:
            report=Report.getReportById(form.reportId)
            if report.type==constant.ReportType.Doctor:
                return  json.dumps(rs.PERMISSION_DENY.__dict__,ensure_ascii=False)
            Report.update(form.reportId,None,form.status,None,form.techDesc,form.imageDesc,form.diagnoseDesc)
        else:
            report=Report(form.techDesc,form.imageDesc,form.diagnoseDesc,form.fileUrl,ReportType.Admin,form.status)
            Report.save(report)

            diagnose.reportId=report.id
            Diagnose.save(diagnose)
        #flash('成功添加诊断评论')
        if form.status and form.status == constant.ReportStatus.Commited:
            diagnose=Diagnose.getDiagnoseById(form.diagnoseId)
            if diagnose:
                Diagnose.changeDiagnoseStatus(diagnose.id,constant.DiagnoseStatus.NeedDiagnose)
            if form.reportId is None and report:
                form.reportId = report.id
            Report.update(form.reportId,constant.ReportType.Doctor,status=constant.ReportStatus.Draft)
            if diagnose and hasattr(diagnose,'doctor'):
                doctor=diagnose.doctor
                if doctor and doctor.userId:
                    content=dataChangeService.getDoctorNeedDiagnoseMessageContent(diagnose,doctor)

                    #诊断通知
                    message=Message(constant.DefaultSystemAdminUserId,doctor.userId,'诊断通知',content,constant.MessageType.Diagnose)
                    Message.save(message)

                    #诊断日志
                    diagoseLog=DiagnoseLog(userId,form.diagnoseId,constant.DiagnoseLogAction.FetchDiagnoseEndAction)
                    DiagnoseLog.save(db_session,diagoseLog)

            return json.dumps(formResult.__dict__,ensure_ascii=False)
    return json.dumps(formResult.__dict__,ensure_ascii=False)
开发者ID:LichuanLu,项目名称:blueberry,代码行数:57,代码来源:diagnose.py

示例6: rollbackDiagnose

# 需要导入模块: from DoctorSpring.models import Diagnose [as 别名]
# 或者: from DoctorSpring.models.Diagnose import save [as 别名]
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)
开发者ID:LichuanLu,项目名称:redberry,代码行数:56,代码来源:diagnose.py

示例7: AlipayCallbackUrl

# 需要导入模块: from DoctorSpring.models import Diagnose [as 别名]
# 或者: from DoctorSpring.models.Diagnose import save [as 别名]
def AlipayCallbackUrl():

    params=AlipayCallBackInfo(request.args)
    if params.diagnoseSeriesNumber is None:
        LOG.error("支付回调出错,无法拿到diagnoseSeriesNumber")
        return redirect(ERROR_URL)
    if (not params.trade_no) or (not params.out_trade_no) or (not params.trade_status):
        LOG.error("支付回调出错,tradeNo")
        return redirect(ERROR_URL)

    diagnose=Diagnose.getDiagnoseByDiagnoseSeriesNo(params.diagnoseSeriesNumber)
    if diagnose is None or (not hasattr(diagnose,"patient")) or diagnose.patient.userID is None:
         LOG.error("支付回调出错,无法拿到诊断[diagnoseSeriesNumber%s]"%params.diagnoseSeriesNumber)
    #跳过验证,以后再测试,必须传入notify_id
    # verfyParams={}
    # verfyParams['out_trade_no']=params.out_trade_no
    # verfyParams['trade_status']='TRADE_SUCCESS'
    # verfyParams['trade_no']=params.trade_no
    # verfyParams['sign']= params.sign
    # veryResult=alipay.notify_verify(request.args)
    # if not veryResult:
    #     LOG.error("支付交易出错,无法拿到诊断[diagnoseSeriesNumber%s]"%params.diagnoseSeriesNumber)
    userId= diagnose.patient.userID
    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)
开发者ID:LichuanLu,项目名称:redberry,代码行数:49,代码来源:diagnose.py

示例8: cancleDiagnose

# 需要导入模块: from DoctorSpring.models import Diagnose [as 别名]
# 或者: from DoctorSpring.models.Diagnose import save [as 别名]
def cancleDiagnose(diagnoseId):
    userId=session['userId']
    if userId is None:
        return json.dumps(rs.NO_LOGIN.__dict__,ensure_ascii=False)
    userId=string.atoi(userId)
    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) or (hasattr(diagnose,'uploadUser') and diagnose.uploadUserId and  diagnose.uploadUserId==userId):
         diagnose.status=constant.DiagnoseStatus.Del
         Diagnose.save(diagnose)

         diagoseLog=DiagnoseLog(userId,diagnoseId,constant.DiagnoseLogAction.CancleDiagnose)
         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)
开发者ID:LichuanLu,项目名称:blueberry,代码行数:19,代码来源:diagnose.py

示例9: applyDiagnoseForm

# 需要导入模块: from DoctorSpring.models import Diagnose [as 别名]
# 或者: from DoctorSpring.models.Diagnose import save [as 别名]
def applyDiagnoseForm(formid):
    if (int(formid) == 1) :
        form = DiagnoseForm3(request.form)
        form_result = form.validate()
        if form_result.status == rs.SUCCESS.status:
            if(form.diagnoseId):
                new_diagnose = Diagnose.getDiagnoseById(form.diagnoseId)
            else:
                new_diagnose = Diagnose.getNewDiagnoseByStatus(DiagnoseStatus.Draft, session['userId'])
            if(new_diagnose is None):
                new_diagnose = Diagnose()
                new_diagnose.status = DiagnoseStatus.Draft

            new_diagnose.doctorId = form.doctorId
            new_diagnose.uploadUserId = session['userId']

            Diagnose.save(new_diagnose)
            form_result.data = {'formId': 2, 'diagnoseId': new_diagnose.id}
        return jsonify(form_result.__dict__)
    elif (int(formid) == 2) :
        form = DiagnoseForm1(request.form)
        form_result = form.validate()
        if form_result.status == rs.SUCCESS.status:
            if form.diagnoseId is not None:
                new_diagnose = Diagnose.getDiagnoseById(form.diagnoseId)
            else:
                new_diagnose = Diagnose.getNewDiagnoseByStatus(DiagnoseStatus.Draft, int(session['userId']))
            if(new_diagnose is not None):
                # 去拿没有draft的用户
                if(form.exist):
                    new_patient = Patient.get_patient_by_id(form.patientid)
                else:
                    new_patient = Patient.get_patient_draft(new_diagnose.patientId)
                if new_patient is None:
                    new_patient = Patient()
                    new_patient.type = PatientStatus.diagnose
                    new_patient.userID = session['userId']
                    new_patient.realname = form.patientname
                    new_patient.gender = form.patientsex
                    new_patient.birthDate = datetime.strptime(form.birthdate, "%Y-%m-%d")
                    new_patient.identityCode = form.identitynumber
                    new_patient.locationId = form.locationId
                    new_patient.identityPhone = form.phonenumber
                    new_patient.status = ModelStatus.Draft
                    # new_patient.locationId = form.location
                    Patient.save(new_patient)
                new_diagnose.patientId = new_patient.id
                Diagnose.save(new_diagnose)

                # Hospital User 注册用户
                if(form.isHospitalUser):
                    new_user = User(form.phonenumber, random.sample('zyxwvutsrqponmlkjihgfedcba1234567890',6), False)
                    new_user.type = UserStatus.patent
                    new_user.status = ModelStatus.Draft
                    User.save(new_user)
                    new_patient.userID = new_user.id
                    Patient.save(new_patient)
                    new_userrole = UserRole(new_user.id, RoleId.Patient)
                    UserRole.save(new_userrole)

                form_result.data = {'formId': 3, }
            else:
                form_result = ResultStatus(FAILURE.status, "找不到第一步草稿")
        return jsonify(form_result.__dict__)
    elif (int(formid) == 3):
        form = DiagnoseForm2(request.form)
        form_result = form.validate()
        if form_result.status == rs.SUCCESS.status:

            if form.diagnoseId is not None:
                new_diagnose = Diagnose.getDiagnoseById(form.diagnoseId)
            else:
                new_diagnose = Diagnose.getNewDiagnoseByStatus(DiagnoseStatus.Draft, int(session['userId']))

            if new_diagnose is not None:

                if form.exist:
                    new_pathology = Pathology.getById(form.pathologyId)
                elif new_diagnose.pathologyId:
                    new_pathology = Pathology.getById(new_diagnose.pathologyId)
                else:
                    new_pathology = Pathology.getByPatientStatus(session['userId'], ModelStatus.Draft)

                if new_pathology is None:
                    new_pathology = Pathology(new_diagnose.patientId)

                new_pathology.diagnoseMethod = form.dicomtype
                new_pathology.status = ModelStatus.Draft
                new_pathology.save(new_pathology)

                PathologyPostion.deleteByPathologyId(new_pathology.id)
                for position in form.patientlocation:
                    new_position_id = PathologyPostion(new_pathology.id, position)
                    PathologyPostion.save(new_position_id)

                File.cleanDirtyFile(form.fileurl, new_pathology.id, FileType.Dicom)
                for fileurl in form.fileurl:
                    new_file = File.getFilebyId(int(fileurl))
                    new_file.pathologyId = new_pathology.id
                    File.save(new_file)
#.........这里部分代码省略.........
开发者ID:houzx910,项目名称:blueberry,代码行数:103,代码来源:front.py


注:本文中的DoctorSpring.models.Diagnose.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。