예제 #1
0
파일: front.py 프로젝트: LichuanLu/redberry
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)
예제 #2
0
def diagnoseCommentsByReceiver(receiverId):

    pageNo=request.args.get('pageNo')
    pageSize=request.args.get('pageSize')
    pager=constant.Pagger(pageNo,pageSize)

    diagnoseComments=Comment.getCommentByReceiver(receiverId,constant.ModelStatus.Normal,constant.CommentType.DiagnoseComment,pager)
    if diagnoseComments is None or len(diagnoseComments)<1:
        return jsonify(rs.SUCCESS.__dict__)

    diagnoseCommentsDict=object2dict.objects2dicts(diagnoseComments)
    dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
    resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,diagnoseCommentsDict)
    resultDict=resultStatus.__dict__
    return jsonify(resultDict)
예제 #3
0
def diagnoseCommentsByReceiver(receiverId):

    pageNo = request.args.get('pageNo')
    pageSize = request.args.get('pageSize')
    pager = constant.Pagger(pageNo, pageSize)

    diagnoseComments = Comment.getCommentByReceiver(
        receiverId, constant.ModelStatus.Normal,
        constant.CommentType.DiagnoseComment, pager)
    if diagnoseComments is None or len(diagnoseComments) < 1:
        return jsonify(rs.SUCCESS.__dict__)

    diagnoseCommentsDict = object2dict.objects2dicts(diagnoseComments)
    dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                   diagnoseCommentsDict)
    resultDict = resultStatus.__dict__
    return jsonify(resultDict)
예제 #4
0
def diagnoseCommentsByDraft():

    pageNo=request.args.get('pageNo')
    pageSize=request.args.get('pageSize')
    pager=constant.Pagger(pageNo,pageSize)

    diagnoseComments=Comment.getCommentsByDraft(pager)
    if diagnoseComments is None or len(diagnoseComments)<1:
        return jsonify(rs.SUCCESS.__dict__)

    diagnoseCommentsDict=object2dict.objects2dicts(diagnoseComments)
    dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
    data={}
    data['amount']=0
    if diagnoseCommentsDict:
        data['amount']=len(diagnoseCommentsDict)
    data['list']=diagnoseCommentsDict
    resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,data)
    resultDict=resultStatus.__dict__
    return jsonify(resultDict)
예제 #5
0
def diagnoseCommentsByDraft():

    pageNo = request.args.get('pageNo')
    pageSize = request.args.get('pageSize')
    pager = constant.Pagger(pageNo, pageSize)

    diagnoseComments = Comment.getCommentsByDraft(pager)
    if diagnoseComments is None or len(diagnoseComments) < 1:
        return jsonify(rs.SUCCESS.__dict__)

    diagnoseCommentsDict = object2dict.objects2dicts(diagnoseComments)
    dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
    data = {}
    data['amount'] = 0
    if diagnoseCommentsDict:
        data['amount'] = len(diagnoseCommentsDict)
    data['list'] = diagnoseCommentsDict
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, data)
    resultDict = resultStatus.__dict__
    return jsonify(resultDict)
예제 #6
0
파일: front.py 프로젝트: houzx910/blueberry
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)
예제 #7
0
def endterDoctorSite(userId):

    #user=User.getById(userId)
    doctor = Doctor.getByUserId(userId)

    if doctor is None:
        return redirect(ERROR_URL)

    if hasattr(doctor, 'user') != True:
        return redirect(ERROR_URL)

    resultDate = {}
    userFavortiesCount = UserFavorites.getFavortiesCountByDoctorId(doctor.id)
    resultDate['userFavortiesCount'] = userFavortiesCount

    diagnoseCount = Diagnose.getDiagnoseCountByDoctorId(db_session, doctor.id)
    resultDate['diagnoseCount'] = diagnoseCount

    goodDiagnoseCount = Diagnose.getDiagnoseCountByDoctorId(
        db_session, doctor.id, 1)  #good
    goodDiagnoseCount += Diagnose.getDiagnoseCountByDoctorId(
        db_session, doctor.id, 2)
    resultDate['goodDiagnoseCount'] = goodDiagnoseCount

    resultDate['doctor'] = dataChangeService.get_doctor(doctor)

    thanksNoteCount = ThanksNote.getThanksNoteCountByReceiver(
        db_session, userId)
    resultDate['thanksNoteCount'] = thanksNoteCount

    diagnoseCommentCount = Comment.getCountByReceiver(userId)
    resultDate['diagnoseCommentCount'] = diagnoseCommentCount

    if session.has_key('userId'):
        loginUserId = session.get('userId')
        if loginUserId:
            loginUserId = string.atoi(loginUserId)
            userfavor = UserFavorites.getUerFavortiesByNormalStatus(
                db_session, loginUserId, constant.UserFavoritesType.Doctor,
                doctor.id)
            if userfavor:
                resultDate['userFavortiesId'] = userfavor.id

    pager = constant.Pagger(1, 10)

    diagnoseComments = Comment.getCommentByReceiver(
        userId, constant.ModelStatus.Normal,
        constant.CommentType.DiagnoseComment, pager)
    if diagnoseComments and len(diagnoseComments) > 0:
        diagnoseCommentsDict = object2dict.objects2dicts(diagnoseComments)
        dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
        resultDate['comments'] = diagnoseCommentsDict
    else:
        resultDate['comments'] = None

    thanksNotes = ThanksNote.getThanksNoteByReceiver(db_session, userId)
    if thanksNotes and len(thanksNotes) > 0:
        thanksNotesDict = object2dict.objects2dicts(thanksNotes)
        dataChangeService.setThanksNoteDetail(thanksNotesDict)
        resultDate['thanksNotes'] = thanksNotesDict

    intros = DoctorProfile.getDoctorProfiles(userId,
                                             constant.DoctorProfileType.Intro)
    resultDate['intros'] = object2dict.objects2dicts(intros)

    resumes = DoctorProfile.getDoctorProfiles(
        userId, constant.DoctorProfileType.Resume)
    resultDate['resumes'] = object2dict.objects2dicts(resumes)

    awards = DoctorProfile.getDoctorProfiles(userId,
                                             constant.DoctorProfileType.Award)
    resultDate['awards'] = object2dict.objects2dicts(awards)

    others = DoctorProfile.getDoctorProfiles(userId,
                                             constant.DoctorProfileType.Other)
    resultDate['others'] = object2dict.objects2dicts(others)

    return render_template("doctorSite.html", data=resultDate)
예제 #8
0
def endterDoctorSite(userId):

    #user=User.getById(userId)
    doctor=Doctor.getByUserId(userId)

    if  doctor is None:
        return redirect(ERROR_URL)

    if  hasattr(doctor,'user') !=True:
        return redirect(ERROR_URL)

    resultDate={}
    userFavortiesCount=UserFavorites.getFavortiesCountByDoctorId(doctor.id)
    resultDate['userFavortiesCount']=userFavortiesCount

    diagnoseCount=Diagnose.getDiagnoseCountByDoctorId(db_session,doctor.id)
    resultDate['diagnoseCount']=diagnoseCount

    goodDiagnoseCount=Diagnose.getDiagnoseCountByDoctorId(db_session,doctor.id,1)#good
    goodDiagnoseCount+=Diagnose.getDiagnoseCountByDoctorId(db_session,doctor.id,2)
    resultDate['goodDiagnoseCount']=goodDiagnoseCount

    resultDate['doctor']=dataChangeService.get_doctor(doctor)

    thanksNoteCount=ThanksNote.getThanksNoteCountByReceiver(db_session,userId)
    resultDate['thanksNoteCount']=thanksNoteCount

    diagnoseCommentCount=Comment.getCountByReceiver(userId)
    resultDate['diagnoseCommentCount']=diagnoseCommentCount

    if session.has_key('userId'):
        loginUserId=session.get('userId')
        if loginUserId:
            loginUserId=string.atoi(loginUserId)
            userfavor=UserFavorites.getUerFavortiesByNormalStatus(db_session,loginUserId,constant.UserFavoritesType.Doctor,doctor.id)
            if userfavor:
                resultDate['userFavortiesId']=userfavor.id





    pager=constant.Pagger(1,10)

    diagnoseComments=Comment.getCommentByReceiver(userId,constant.ModelStatus.Normal,constant.CommentType.DiagnoseComment,pager)
    if diagnoseComments  and  len(diagnoseComments)>0:
        diagnoseCommentsDict=object2dict.objects2dicts(diagnoseComments)
        dataChangeService.setDiagnoseCommentsDetailInfo(diagnoseCommentsDict)
        resultDate['comments']=diagnoseCommentsDict
    else:
        resultDate['comments']=None


    thanksNotes=ThanksNote.getThanksNoteByReceiver(db_session,userId)
    if thanksNotes  and  len(thanksNotes)>0:
        thanksNotesDict=object2dict.objects2dicts(thanksNotes)
        dataChangeService.setThanksNoteDetail(thanksNotesDict)
        resultDate['thanksNotes']=thanksNotesDict

    intros=DoctorProfile.getDoctorProfiles(userId,constant.DoctorProfileType.Intro)
    resultDate['intros']=object2dict.objects2dicts(intros)

    resumes=DoctorProfile.getDoctorProfiles(userId,constant.DoctorProfileType.Resume)
    resultDate['resumes']=object2dict.objects2dicts(resumes)

    awards=DoctorProfile.getDoctorProfiles(userId,constant.DoctorProfileType.Award)
    resultDate['awards']=object2dict.objects2dicts(awards)

    others=DoctorProfile.getDoctorProfiles(userId,constant.DoctorProfileType.Other)
    resultDate['others']=object2dict.objects2dicts(others)

    return render_template("doctorSite.html",data=resultDate)