Exemplo n.º 1
0
def getThanksNotes(userid):
    #status=request.args.get('status')

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

    thanksNotes=ThanksNote.getThanksNoteByReceiver(db_session,userid)
    if thanksNotes is None or len(thanksNotes)<1:
        return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
    thanksNotesDict=object2dict.objects2dicts(thanksNotes)
    dataChangeService.setThanksNoteDetail(thanksNotesDict)
    resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,thanksNotesDict)
    resultDict=resultStatus.__dict__
    return json.dumps(resultDict,ensure_ascii=False)
Exemplo n.º 2
0
def getThanksNotes(userid):
    #status=request.args.get('status')

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

    thanksNotes = ThanksNote.getThanksNoteByReceiver(db_session, userid)
    if thanksNotes is None or len(thanksNotes) < 1:
        return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False)
    thanksNotesDict = object2dict.objects2dicts(thanksNotes)
    dataChangeService.setThanksNoteDetail(thanksNotesDict)
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg,
                                   thanksNotesDict)
    resultDict = resultStatus.__dict__
    return json.dumps(resultDict, ensure_ascii=False)
Exemplo n.º 3
0
def getThanksNotesByDraft():
    #status=request.args.get('status')

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

    thanksNotes = ThanksNote.getThankNoteByDraft(pager)
    if thanksNotes is None or len(thanksNotes) < 1:
        return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False)
    thanksNotesDict = object2dict.objects2dicts(thanksNotes)
    dataChangeService.setThanksNoteDetail(thanksNotesDict)
    data = {}
    data['amount'] = 0
    if thanksNotesDict:
        data['amount'] = len(thanksNotesDict)
    data['list'] = thanksNotesDict
    resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, data)
    resultDict = resultStatus.__dict__
    return json.dumps(resultDict, ensure_ascii=False)
Exemplo n.º 4
0
def getThanksNotesByDraft():
    #status=request.args.get('status')

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

    thanksNotes=ThanksNote.getThankNoteByDraft(pager)
    if thanksNotes is None or len(thanksNotes)<1:
        return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
    thanksNotesDict=object2dict.objects2dicts(thanksNotes)
    dataChangeService.setThanksNoteDetail(thanksNotesDict)
    data={}
    data['amount']=0
    if thanksNotesDict:
        data['amount']=len(thanksNotesDict)
    data['list']=thanksNotesDict
    resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,data)
    resultDict=resultStatus.__dict__
    return json.dumps(resultDict,ensure_ascii=False)
Exemplo n.º 5
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)
Exemplo n.º 6
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)