Ejemplo n.º 1
0
def homepage():

    resultData = {}
    pager = Pagger(1, 6)
    doctors = Doctor.get_doctor_list(0, 0, "", pager)
    doctorsList = dataChangeService.get_doctors_dict(doctors)
    resultData['doctorlist'] = doctorsList
    if len(doctorsList['doctor']) > 0:
        resultData['doctor'] = doctorsList['doctor'][0]
    diagnoseComments = Comment.getRecentComments()
    if diagnoseComments and len(diagnoseComments) > 0:
        diagnoseCommentsDict = object2dict.objects2dicts_2(diagnoseComments)
        dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
        resultData['comments'] = diagnoseCommentsDict
    else:
        resultData['comments'] = None

    resultData['ishomepage'] = True
    if session.has_key('userId'):
        userId = session['userId']
        messageCount = Message.getMessageCountByReceiver(userId)
        resultData['messageCount'] = messageCount
        if UserRole.checkRole(db_session, userId, constant.RoleId.Patient):
            resultData['isPatient'] = True

    return render_template("home.html", data=resultData)
Ejemplo n.º 2
0
def endterDoctorHome():
    userId = session['userId']
    doctor = Doctor.getByUserId(userId)

    if doctor is None:
        return redirect(ERROR_URL)

    resultDate = {}
    messageCount = Message.getMessageCountByReceiver(userId)
    resultDate['messageCount'] = messageCount

    diagnoseCount = Diagnose.getNewDiagnoseCountByDoctorId(doctor.id)
    resultDate['diagnoseCount'] = diagnoseCount

    resultDate['doctor'] = doctor
    pager = Pagger(1, 20)
    diagnoses = Diagnose.getDiagnosesByDoctorId(db_session, doctor.id, pager)
    diagnoseDict = dataChangeService.userCenterDiagnoses(diagnoses)
    resultDate['diagnoses'] = diagnoseDict
    return render_template("doctorHome.html", data=resultDate)
Ejemplo n.º 3
0
def endterPatientHome():
    userId=session['userId']
    user=User.getById(userId)

    if user is None:
        return redirect(ERROR_URL)

    resultDate={}
    messageCount=Message.getMessageCountByReceiver(userId)
    resultDate['messageCount']=messageCount

    diagnoseCount=Diagnose.getNewDiagnoseCountByUserId(userId)
    resultDate['diagnoseCount']=diagnoseCount

    resultDate['user']=user
    #pager=Pagger(1,20)
    # diagnoses=Diagnose.getDiagnosesByDoctorId(db_session,doctor.id,pager)
    # diagnoseDict=dataChangeService.userCenterDiagnoses(diagnoses)
    # resultDate['diagnoses']=diagnoseDict
    return render_template("patientHome.html",data=resultDate)
Ejemplo n.º 4
0
def homepage():

    resultData={}
    pager = Pagger(1, 6)
    doctors = Doctor.get_doctor_list(0, 0, "", pager)
    doctorsList = dataChangeService.get_doctors_dict(doctors)
    resultData['doctorlist'] = doctorsList
    if len(doctorsList['doctor']) > 0:
        resultData['doctor'] = doctorsList['doctor'][0]
    diagnoseComments=Comment.getRecentComments()
    if diagnoseComments  and  len(diagnoseComments)>0:
        diagnoseCommentsDict=object2dict.objects2dicts_2(diagnoseComments)
        dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
        resultData['comments']=diagnoseCommentsDict
    else:
        resultData['comments']=None
    if session.has_key('userId'):
        userId=session['userId']
        messageCount=Message.getMessageCountByReceiver(userId)
        resultData['messageCount']=messageCount
    return render_template("home.html", result=resultData)
Ejemplo n.º 5
0
def endterPatientHome():
    if session.has_key('userId'):
        userId = session['userId']
        user = User.getById(userId)

        if user is None:
            return redirect(ERROR_URL)

        resultDate = {}
        messageCount = Message.getMessageCountByReceiver(userId)
        resultDate['messageCount'] = messageCount

        diagnoseCount = Diagnose.getNewDiagnoseCountByUserId(userId)
        resultDate['diagnoseCount'] = diagnoseCount

        resultDate['user'] = user
        #pager=Pagger(1,20)
        # diagnoses=Diagnose.getDiagnosesByDoctorId(db_session,doctor.id,pager)
        # diagnoseDict=dataChangeService.userCenterDiagnoses(diagnoses)
        # resultDate['diagnoses']=diagnoseDict
        return render_template("patientHome.html", data=resultDate)
    else:
        return redirect(LOGIN_URL)