def doctor_rec(): doctor = None if 'doctorId' in request.args.keys(): doctorId = request.args['doctorId'] doctor = Doctor.get_doctor(doctorId,"") elif 'diagnoseId' in request.args.keys(): diagnoseId = int(request.args['diagnoseId']) diagnose = Diagnose.getDiagnoseById(diagnoseId) if diagnose is not None: doctor = diagnose.doctor else: doctor = Doctor.get_doctor(0, True) if doctor is None: return jsonify(rs.SUCCESS.__dict__, ensure_ascii=False) doctors_dict = dataChangeService.get_doctor(doctor) resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, doctors_dict) return jsonify(resultStatus.__dict__, ensure_ascii=False)
def doctor_rec(): doctor = None if 'doctorId' in request.args.keys(): doctorId = request.args['doctorId'] doctor = Doctor.get_doctor(doctorId, "") elif 'diagnoseId' in request.args.keys(): diagnoseId = int(request.args['diagnoseId']) diagnose = Diagnose.getDiagnoseById(diagnoseId) if diagnose is not None: doctor = diagnose.doctor else: doctor = Doctor.get_doctor(0, True) if doctor is None: return jsonify(rs.SUCCESS.__dict__, ensure_ascii=False) doctors_dict = dataChangeService.get_doctor(doctor) resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, doctors_dict) return jsonify(resultStatus.__dict__, ensure_ascii=False)
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)
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)