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


Python Diagnose.getNewDiagnoseByStatus方法代码示例

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


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

示例1: applyDiagnose

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

示例2: applyDiagnoseForm

# 需要导入模块: from DoctorSpring.models import Diagnose [as 别名]
# 或者: from DoctorSpring.models.Diagnose import getNewDiagnoseByStatus [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.getNewDiagnoseByStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。