def addDiagnoseComment(): form = CommentsForm(request.form) resultForm = form.validate() if resultForm.status == rs.SUCCESS.status: #session['remember_me'] = form.remember_me.data # login and validate the user... diagnoseComment = Comment(form.userId, form.receiverId, form.diagnoseId, form.content) db_session.add(diagnoseComment) db_session.commit() db_session.flush() score = constant.DiagnoseScore[form.score] diagnose = Diagnose.getDiagnoseById(form.diagnoseId) diagnose.score = form.score Diagnose.save(diagnose) #为医生添加一些冗余字段 if hasattr(diagnose, 'doctor'): doctor = diagnose.doctor if score != 0: if doctor.goodFeedbackCount: doctor.goodFeedbackCount += 1 else: doctor.goodFeedbackCount = 1 if doctor.feedbackCount: doctor.feedbackCount += 1 else: doctor.feedbackCount = 1 Doctor.save(doctor) #flash('成功添加诊断评论') return jsonify(rs.SUCCESS.__dict__) return jsonify(rs.FAILURE.__dict__)
def updateAcountInfo(): type = request.form.get('type') if type: type = string.atoi(type) #医生:1 病人:2 else: type = 2 userId = None if session.has_key('userId'): userId = session['userId'] if userId is None: return redirect(LOGIN_URL) form = UserUpdateForm(request.form) paraRs = form.validate() if rs.SUCCESS.status == paraRs.status: User.update(userId, form.name, form.account, form.mobile, form.address, form.email, form.identityCode, form.yibaoCard) if type == 1: doctor = Doctor(userId) doctor.identityPhone = form.identityPhone doctor.username = form.name hospitalId = Doctor.update(doctor) # if hospitalId: # hospital=Hospital(form.hospitalName) # hospital.id=hospitalId # Hospital.updateHospital(hospital) return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False) return json.dumps(rs.FAILURE.__dict__, ensure_ascii=False)
def addDiagnoseComment(): form = CommentsForm(request.form) resultForm=form.validate() if resultForm.status==rs.SUCCESS.status: #session['remember_me'] = form.remember_me.data # login and validate the user... diagnoseComment=Comment(form.userId,form.receiverId,form.diagnoseId,form.content) db_session.add(diagnoseComment) db_session.commit() db_session.flush() score=constant.DiagnoseScore[form.score] diagnose=Diagnose.getDiagnoseById(form.diagnoseId) diagnose.score=form.score Diagnose.save(diagnose) #为医生添加一些冗余字段 if hasattr(diagnose,'doctor'): doctor=diagnose.doctor if score!=0: if doctor.goodFeedbackCount: doctor.goodFeedbackCount+=1 else: doctor.goodFeedbackCount=1 if doctor.feedbackCount: doctor.feedbackCount+=1 else: doctor.feedbackCount=1 Doctor.save(doctor) #flash('成功添加诊断评论') return jsonify(rs.SUCCESS.__dict__) return jsonify(rs.FAILURE.__dict__)
def updateAcountInfo(): type=request.args.get('type') if type: type=string.atoi(type) #医生:1 病人:2 else: type=2 userId=None if session.has_key('userId'): userId=session['userId'] if userId is None: return redirect(LOGIN_URL) form=UserUpdateForm(request.form) paraRs=form.validate() if rs.SUCCESS.status==paraRs.status: User.update(userId,form.name,form.account,form.mobile,form.address,form.email,form.identityCode,form.yibaoCard) if type==1: doctor=Doctor(userId) doctor.identityPhone=form.identityPhone hospitalId=Doctor.update(doctor) if hospitalId: hospital=Hospital(form.hospitalName) hospital.id=hospitalId Hospital.updateHospital(hospital) return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False) return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
def doctor_list_json(): form = DoctorList(request) form_result = form.validate() if form_result.status == rs.SUCCESS.status: pager = Pagger(form.pageNumber, form.pageSize) pager.count = Doctor.get_doctor_count(form.hospitalId, form.sectionId, form.doctorname, pager) doctors = Doctor.get_doctor_list(form.hospitalId, form.sectionId, form.doctorname, pager) if doctors is None or len(doctors) < 1: return jsonify(rs.SUCCESS.__dict__, ensure_ascii=False) doctorsDict = dataChangeService.get_doctors_dict(doctors, form.pageNumber, pager.count/pager.pageSize+1) resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, doctorsDict) return jsonify(resultStatus.__dict__, ensure_ascii=False) return jsonify(FAILURE)
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)
def setConsultsResult(consutsDict, userId=0): if consutsDict is None: return for consutDict in consutsDict: type=consutDict.get('type') if type==1: if consutDict.get('doctorId'): doctor=Doctor.getById(consutDict.get('doctorId')) if doctor: consutDict['doctorName']=doctor.username consutDict['doctorTitle']=doctor.title if hasattr(doctor,'user') and doctor.user and doctor.user.imagePath: consutDict['avartarUrl']= doctor.user.imagePath consutDict["statusText"] = getStatusText(consutDict.get("status"), UserRole.checkRole(db_session,userId,constant.RoleId.Doctor)) if type==0: if consutDict.get('userId'): user=User.getById(consutDict.get('userId')) if user: consutDict['userName']=user.name consutDict['avartarUrl']=user.imagePath consutDict["statusText"] = getStatusText(consutDict.get("status"), UserRole.checkRole(db_session,userId,constant.RoleId.Doctor)) consutDict['amount']=consutDict.get('count')
def setConsultsResult(consutsDict, userId=0): if consutsDict is None: return for consutDict in consutsDict: type = consutDict.get('type') if type == 1: if consutDict.get('doctorId'): doctor = Doctor.getById(consutDict.get('doctorId')) if doctor: consutDict['doctorName'] = doctor.username consutDict['doctorTitle'] = doctor.title if hasattr( doctor, 'user') and doctor.user and doctor.user.imagePath: consutDict['avartarUrl'] = doctor.user.imagePath consutDict["statusText"] = getStatusText( consutDict.get("status"), UserRole.checkRole(db_session, userId, constant.RoleId.Doctor)) if type == 0: if consutDict.get('userId'): user = User.getById(consutDict.get('userId')) if user: consutDict['userName'] = user.name consutDict['avartarUrl'] = user.imagePath consutDict["statusText"] = getStatusText( consutDict.get("status"), UserRole.checkRole(db_session, userId, constant.RoleId.Doctor)) consutDict['amount'] = consutDict.get('count')
def doctorStatusChange(): try: userid=request.form.get('userId') status=request.form.get('status') if status: status=string.atoi(status) else: status=constant.ModelStatus.Normal doctor=Doctor() doctor.userId=userid doctor.status=status Doctor.update(doctor) return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False) except Exception,e: LOG.error(e.message) return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
def doctor_list_json(): form = DoctorList(request) form_result = form.validate() if form_result.status == rs.SUCCESS.status: pager = Pagger(form.pageNumber, form.pageSize) pager.count = Doctor.get_doctor_count(form.hospitalId, form.sectionId, form.doctorname, pager) doctors = Doctor.get_doctor_list(form.hospitalId, form.sectionId, form.doctorname, pager) if doctors is None or len(doctors) < 1: return jsonify(rs.SUCCESS.__dict__, ensure_ascii=False) doctorsDict = dataChangeService.get_doctors_dict( doctors, form.pageNumber, pager.count / pager.pageSize + 1) resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, doctorsDict) return jsonify(resultStatus.__dict__, ensure_ascii=False) return jsonify(FAILURE)
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 getAccountInfo(userDict): if userDict is None: return doctor=Doctor.getByUserId(userDict.get('id')) if doctor: if doctor.identityPhone: userDict['identityPhone']=doctor.identityPhone if doctor.hospital and doctor.hospital.name: userDict['hospitalName']=doctor.hospital.name return userDict return None
def updateDoctorInfo(): form = DoctorUpdateForm(request.form) doctor = Doctor(form.userId) doctor.departmentId = form.department doctor.hospitalId = form.hospital doctor.status = form.status doctor.title = form.title Doctor.update(doctor) doctor = Doctor.getByUserId(form.userId) if doctor: for skill in form.skills: doctorsKill = Doctor2Skill(doctor.id, skill) Doctor2Skill.save(doctorsKill) User.update(form.userId, status=constant.ModelStatus.Normal) result = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, None) return json.dumps(result.__dict__, ensure_ascii=False)
def addThankNote(): form = ThanksNoteForm(request.form) formResult=form.validate() userId=session['userId'] if userId is None: json.dumps(rs.NO_LOGIN.__dict__,ensure_ascii=False) userId=string.atoi(userId) if formResult.status==rs.SUCCESS.status: thanksNote=ThanksNote(userId,form.receiver,form.title,form.content) ThanksNote.save(db_session,thanksNote) doctor=Doctor.getByUserId(userId) if doctor: if doctor.thankNoteCount: doctor.thankNoteCount+=1 else: doctor.thankNoteCount=1 Doctor.save(doctor) return json.dumps(formResult.__dict__,ensure_ascii=False) return json.dumps(formResult.__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 getAccountInfo(userDict): if userDict is None: return doctor = Doctor.getByUserId(userDict.get('id')) if doctor: if doctor.identityPhone: userDict['identityPhone'] = doctor.identityPhone if doctor.hospital and doctor.hospital.name: userDict['hospitalName'] = doctor.hospital.name return userDict return None
def doctorListByDraft(): try: pageNo=request.args.get('pageNumber') pageSize=request.args.get('pageSize') pager=Pagger(pageNo,pageSize) doctors=Doctor.getUserListByStatus(pager) doctorsDict=dataChangeService.get_doctors_dict(doctors) result=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,doctorsDict) return json.dumps(result.__dict__,ensure_ascii=False) except Exception,e: LOG.error(e.message) return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
def register_doctor(): form = RegisterFormDoctor(request.form) form_result = form.validate() if form_result.status == rs.SUCCESS.status: new_user = User(form.real_name, form.username, form.password) new_user.email = form.email new_user.phone = form.cellphone new_user.type = UserStatus.doctor new_user.status = ModelStatus.Draft User.save(new_user) new_doctor = Doctor(new_user.id) new_doctor.username = form.real_name new_doctor.identityPhone = form.identity_phone Doctor.save(new_doctor) new_doctor2skill = Doctor2Skill(new_doctor.id, 1) Doctor2Skill.save(new_doctor2skill) new_userrole = UserRole(new_user.id, RoleId.Doctor) UserRole.save(new_userrole) return jsonify(form_result.__dict__)
def test_addHospitalUser(self): new_user_1 = User('医院用户',"44444444444", "123456") new_user_1.email = "*****@*****.**" new_user_1.phone = "44444444444" new_user_1.name = "医院用户" new_user_1.type = UserStatus.doctor User.save(new_user_1) new_doctor_1 = Doctor(new_user_1.id) new_doctor_1.username = "******" new_doctor_1.hospitalId = 1 new_doctor_1.status = 0 new_doctor_1.type = DoctorType.HospitalUser Doctor.save(new_doctor_1) new_userrole = UserRole(new_user_1.id, RoleId.HospitalUser) UserRole.save(new_userrole)
def addThankNote(): form = ThanksNoteForm(request.form) formResult = form.validate() userId = session.get('userId') #userId='5' if userId is None: json.dumps(rs.NO_LOGIN.__dict__, ensure_ascii=False) userId = string.atoi(userId) if formResult.status == rs.SUCCESS.status: thanksNote = ThanksNote(userId, form.receiver, form.title, form.content) ThanksNote.save(db_session, thanksNote) doctor = Doctor.getByUserId(userId) if doctor: if doctor.thankNoteCount: doctor.thankNoteCount += 1 else: doctor.thankNoteCount = 1 Doctor.save(doctor) return json.dumps(formResult.__dict__, ensure_ascii=False) return json.dumps(formResult.__dict__, ensure_ascii=False)
def updateDoctorInfo(): form=DoctorUpdateForm(request.form) doctor=Doctor(form.userId) doctor.departmentId=form.department doctor.hospitalId=form.hospital doctor.status=form.status doctor.title=form.title Doctor.update(doctor) doctor=Doctor.getByUserId(form.userId) if doctor: for skill in form.skills: doctorsKill=Doctor2Skill(doctor.id,skill) Doctor2Skill.save(doctorsKill) User.update(form.userId,status=constant.ModelStatus.Normal) result=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,None) return json.dumps(result.__dict__,ensure_ascii=False)
def doctorListByDraft(): try: pageNo = request.args.get('pageNumber') pageSize = request.args.get('pageSize') pager = Pagger(pageNo, pageSize) doctors = Doctor.getUserListByStatus(pager) doctorsDict = dataChangeService.get_doctors_dict(doctors) data = {} data['amount'] = 0 if doctorsDict: data['amount'] = len(doctorsDict.get('doctor')) data['list'] = doctorsDict.get('doctor') result = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, data) return json.dumps(result.__dict__, ensure_ascii=False) except Exception, e: LOG.error(e.message) return json.dumps(rs.FAILURE.__dict__, ensure_ascii=False)
def setDiagnoseCommentsDetailInfo(diagnoseCommentsDict): if diagnoseCommentsDict is None or len(diagnoseCommentsDict) < 1: return for diagnoseComment in diagnoseCommentsDict: if diagnoseComment.has_key('observer'): observer = diagnoseComment.get('observer') user = User.getById(observer) if user: diagnoseComment['avatar'] = user.imagePath diagnoseComment['senderName'] = user.name if diagnoseComment.has_key('receiver'): receiver = diagnoseComment.get('receiver') user = User.getById(receiver) if user: #diagnoseComment['receiverName']=user.name doctor = Doctor.getByUserId(receiver) if doctor and hasattr(doctor, "hospital") and doctor.hospital: diagnoseComment['doctorUserId'] = receiver diagnoseComment['hospitalId'] = doctor.hospitalId diagnoseComment['hospitalName'] = doctor.hospital.name diagnoseComment['receiverName'] = doctor.username if diagnoseComment.has_key('diagnoseId'): diagnose = Diagnose.getDiagnoseById( diagnoseComment.get('diagnoseId')) if diagnose: if diagnose.score: diagnoseComment['scoreName'] = constant.DiagnoseScore[ diagnose.score] # if diagnose.hospitalId and hasattr(diagnose,'hospital') and diagnose.hospital and diagnose.hospita.name: # diagnoseComment['hospitalId']= diagnose.hospitalId # diagnoseComment['hospitalName']=diagnose.hospital.name if hasattr(diagnose, "pathology") and diagnose.pathology: pathology = diagnose.pathology if hasattr(pathology, "pathologyPostions" ) and pathology.pathologyPostions: pathologyPositons = pathology.pathologyPostions if pathologyPositons and len(pathologyPositons) > 0: positions = u'' for pathologyPositon in pathologyPositons: position = pathologyPositon.position positions += (u' ' + position.name) diagnoseComment['positionName'] = positions
def setConsultsResult(consutsDict): if consutsDict is None: return for consutDict in consutsDict: type=consutDict.get('type') if type==1: if consutDict.get('doctorId'): doctor=Doctor.getById(consutDict.get('doctorId')) if doctor: consutDict['doctorName']=doctor.username consutDict['doctorTitle']=doctor.title if hasattr(doctor,'user') and doctor.user and doctor.user.imagePath: consutDict['avartarUrl']= doctor.user.imagePath if type==0: if consutDict.get('userId'): user=User.getById(consutDict.get('userId')) if user: consutDict['userName']=user.name consutDict['avartarUrl']=user.imagePath
def getDiagnoseListByDoctor(): userId = session['userId'] # user=User.getById(userId) # if user is None: # return json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False) # #权限查看 # if UserRole.checkRole(db_session,userId,constant.RoleId.Admin): # return json.dumps(rs.PERMISSION_DENY.__dict__,ensure_ascii=False) doctor = Doctor.getByUserId(userId) if doctor: status = request.args.get('type') if status: import string status = string.atoi(status) startDateStr = request.args.get('startDate') startDate = None if startDateStr: startDate = datetime.strptime(startDateStr, "%Y-%m-%d") else: startDate = constant.SystemTimeLimiter.startTime endDateStr = request.args.get('endDate') endDate = None if endDateStr: endDate = datetime.strptime(endDateStr, "%Y-%m-%d") else: endDate = constant.SystemTimeLimiter.endTime pageNo = request.args.get('pageNo') pageSize = request.args.get('pageSize') pager = Pagger(pageNo, pageSize) diagnoses = Diagnose.getDiagnosesByDoctorId(db_session, doctor.id, pager, status, startDate, endDate) diagnosesDict = dataChangeService.userCenterDiagnoses(diagnoses) resultStatus = rs.ResultStatus(rs.SUCCESS.status, rs.SUCCESS.msg, diagnosesDict) resultDict = resultStatus.__dict__ return json.dumps(resultDict, ensure_ascii=False) return json.dumps(rs.FAILURE.__dict__, ensure_ascii=False)
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)
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)
def setDiagnoseCommentsDetailInfo(diagnoseCommentsDict): if diagnoseCommentsDict is None or len(diagnoseCommentsDict)<1: return for diagnoseComment in diagnoseCommentsDict: if diagnoseComment.has_key('observer'): observer=diagnoseComment.get('observer') user=User.getById(observer) if user: diagnoseComment['avatar']=user.imagePath diagnoseComment['senderName']=user.name if diagnoseComment.has_key('receiver'): receiver=diagnoseComment.get('receiver') user=User.getById(receiver) if user: #diagnoseComment['receiverName']=user.name doctor=Doctor.getByUserId(receiver) if doctor and hasattr(doctor,"hospital") and doctor.hospital : diagnoseComment['doctorUserId']=receiver diagnoseComment['hospitalId']= doctor.hospitalId diagnoseComment['hospitalName']=doctor.hospital.name diagnoseComment['receiverName']=doctor.username if diagnoseComment.has_key('diagnoseId'): diagnose=Diagnose.getDiagnoseById(diagnoseComment.get('diagnoseId')) if diagnose: if diagnose.score: diagnoseComment['scoreName']=constant.DiagnoseScore[diagnose.score] # if diagnose.hospitalId and hasattr(diagnose,'hospital') and diagnose.hospital and diagnose.hospita.name: # diagnoseComment['hospitalId']= diagnose.hospitalId # diagnoseComment['hospitalName']=diagnose.hospital.name if hasattr(diagnose,"pathology") and diagnose.pathology: pathology=diagnose.pathology if hasattr(pathology,"pathologyPostions") and pathology.pathologyPostions: pathologyPositons=pathology.pathologyPostions if pathologyPositons and len(pathologyPositons)>0: positions=u'' for pathologyPositon in pathologyPositons: position=pathologyPositon.position positions+=(u' '+position.name) diagnoseComment['positionName']=positions
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)
def doctorStatusChange(): try: userid = request.form.get('userId') status = request.form.get('status') if status: status = string.atoi(status) else: status = constant.ModelStatus.Normal doctor = Doctor() doctor.userId = userid doctor.status = status Doctor.update(doctor) return json.dumps(rs.SUCCESS.__dict__, ensure_ascii=False) except Exception, e: LOG.error(e.message) return json.dumps(rs.FAILURE.__dict__, ensure_ascii=False)
def getDiagnoseListByDoctor(): userId=session['userId'] # user=User.getById(userId) # if user is None: # return json.dumps(rs.NO_DATA.__dict__,ensure_ascii=False) # #权限查看 # if UserRole.checkRole(db_session,userId,constant.RoleId.Admin): # return json.dumps(rs.PERMISSION_DENY.__dict__,ensure_ascii=False) doctor=Doctor.getByUserId(userId) if doctor: status=request.args.get('type') if status: import string status=string.atoi(status) startDateStr=request.args.get('startDate') startDate=None if startDateStr: startDate=datetime.strptime(startDateStr,"%Y-%m-%d") else: startDate=constant.SystemTimeLimiter.startTime endDateStr=request.args.get('endDate') endDate=None if endDateStr: endDate=datetime.strptime(endDateStr,"%Y-%m-%d") else: endDate=constant.SystemTimeLimiter.endTime pageNo=request.args.get('pageNo') pageSize=request.args.get('pageSize') pager=Pagger(pageNo,pageSize) diagnoses=Diagnose.getDiagnosesByDoctorId(db_session,doctor.id,pager,status,startDate,endDate) diagnosesDict=dataChangeService.userCenterDiagnoses(diagnoses) resultStatus=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,diagnosesDict) resultDict=resultStatus.__dict__ return json.dumps(resultDict,ensure_ascii=False) return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
def test_addDoctor(self): new_user_1 = User('印弘',"11111111111", "123456") new_user_1.email = "*****@*****.**" new_user_1.phone = "111111111111" new_user_1.type = UserStatus.doctor User.save(new_user_1) new_doctor_1 = Doctor(new_user_1.id) new_doctor_1.identityPhone = "029-12345567" new_doctor_1.username = "******" new_doctor_1.diagnoseCount = 10 new_doctor_1.feedbackCount = 5 new_doctor_1.goodFeedbackCount = 5 new_doctor_1.hospitalId = 1 new_doctor_1.departmentId = 1 new_doctor_1.title = "主任医师" new_doctor_1.status = 0 Doctor.save(new_doctor_1) new_doctor2skill_1_1 = Doctor2Skill(new_doctor_1.id,1) Doctor2Skill.save(new_doctor2skill_1_1) new_userrole = UserRole(new_user_1.id, RoleId.Doctor) UserRole.save(new_userrole) new_user_2 = User('宦怡',"22222222222", "123456") new_user_2.email = "*****@*****.**" new_user_2.phone = "22222222222" new_user_2.type = UserStatus.doctor User.save(new_user_2) new_doctor_2 = Doctor(new_user_2.id) new_doctor_2.identityPhone = "029-12345567" new_doctor_2.username = "******" new_doctor_2.diagnoseCount = 8 new_doctor_2.feedbackCount = 3 new_doctor_2.hospitalId = 1 new_doctor_2.departmentId = 1 new_doctor_2.title = "主任医师" new_doctor_2.status = 0 new_doctor_2.goodFeedbackCount = 2 Doctor.save(new_doctor_2) new_doctor2skill_1_2 = Doctor2Skill(new_doctor_2.id,2) Doctor2Skill.save(new_doctor2skill_1_2) new_userrole2 = UserRole(new_user_2.id, RoleId.Doctor) UserRole.save(new_userrole2) new_user_3 = User('张劲松',"33333333333", "123456") new_user_3.email = "*****@*****.**" new_user_3.phone = "33333333333" new_user_3.type = UserStatus.doctor User.save(new_user_3) new_doctor_3 = Doctor(new_user_3.id) new_doctor_3.identityPhone = "029-12345567" new_doctor_3.username = "******" new_doctor_3.diagnoseCount = 9 new_doctor_3.feedbackCount = 4 new_doctor_3.hospitalId = 1 new_doctor_3.departmentId = 1 new_doctor_3.title = "主任医师" new_doctor_3.status = 0 new_doctor_3.goodFeedbackCount = 3 Doctor.save(new_doctor_3) new_doctor2skill_1_3 = Doctor2Skill(new_doctor_3.id,3) Doctor2Skill.save(new_doctor2skill_1_3) new_userrole3 = UserRole(new_user_3.id, RoleId.Doctor) UserRole.save(new_userrole3) dp=DoctorProfile() dp.type=DoctorProfileType.Intro dp.description='从事影像诊断多年,对普通放射、CT以及血管造影的影像诊断有丰富的经验,能够综合各种诊断手段进行诊断。对磁共振的影像诊断有丰富的经验,尤其侧重神经系统疑难疾病的诊断,采用磁共振波谱等多项先进技术,对神经系统肿瘤,肌萎缩性侧索硬化、癫痫以及先天性发育异常、变性疾病等神经系统疾病进行诊断及预后评估,有独到的诊断特色。与神经外科合作,开展肿瘤术前功能定位定向,确保了手术的安全性以及有效性;与身心科合作,开展了精神疾病诊断及临床研究工作。' dp.userId= new_user_1.id DoctorProfile.save(dp) dp=DoctorProfile() dp.type=DoctorProfileType.Resume dp.userId= new_user_1.id dp.description='印弘, 西京医院放射科主任,教授,主任医师,博士,硕士研究生导师。 毕业于第四军医大学。先后在新加坡国立神经科学研究所及美国加州大学旧金山分校作为访问学者工作。承担或参加北京市自然科学基金,新加坡国家医学基金,国家十一五科技支撑项目等多项科研基金,任职期间发表学术论文20余篇,其中SCI 5篇。' DoctorProfile.save(dp) dp=DoctorProfile() dp.type=DoctorProfileType.Award dp.userId= new_user_1.id dp.description='担任国家自然科学基金委主办杂志《自然》杂志以及《实用放射学杂志》特约审稿专家' DoctorProfile.save(dp) dp=DoctorProfile() dp.type=DoctorProfileType.Other dp.userId= new_user_1.id dp.description='陕西省影像协会会长' DoctorProfile.save(dp) dp2=DoctorProfile() dp2.type=DoctorProfileType.Intro dp2.description='主要从事CT、MRI诊断及相关基础研究。90年代初在国内率先开展CT 影像后处理研究,在3D CE MRA、CTA成像,耳部HRCT、HRMRI影像及影像解剖基础研究,泌尿系疾患CT、MRI成像及前列腺癌的分子影像学方面做了较多的工作,并获得省及国家自然科学基金资助。' dp2.userId= new_user_2.id DoctorProfile.save(dp2) dp2=DoctorProfile() dp2.type=DoctorProfileType.Resume dp2.userId= new_user_2.id dp2.description='宦怡,主任医师,教授,博士生导师。先后共发表论文70余篇,主编副主编专著2部,参编的专著6部。承担国家自然科学基金、陕西省自然科学基金课题各1项,参与国家自然科学基金2项,国家“九五”科技公关攻关课题1项,军队青年基金课题1项。' DoctorProfile.save(dp2) dp2=DoctorProfile() dp2.type=DoctorProfileType.Award dp2.userId= new_user_2.id dp2.description='军队医疗成果二等奖1项,三等奖5项' DoctorProfile.save(dp2) dp3=DoctorProfile() dp3.type=DoctorProfileType.Intro dp3.description='长期坚持临床一线工作,历经放射科X线诊断组、CT组和磁共振组等部门工作,熟练掌握CT、MRI影像诊断。每年承担医疗系和口腔系5年制本科学员、8年制学员等的大课教学工作,发表教学论文4篇;指导进修生多人;参与指导硕士研究生及博士生多名。多次参加全国及省放射学会的专题讲座。' dp3.userId= new_user_3.id DoctorProfile.save(dp3) dp3=DoctorProfile() dp3.type=DoctorProfileType.Resume dp3.userId= new_user_3.id dp3.description='张劲松,男,副主任医师、副教授。1994年本科毕业于第四军医大学临床医学系(6年制本科),1997年获第四军医大学影像医学硕士学位,2005年获第四军医大学影像医学博士学位。2008年赴美国南加州大学放射科进修学习半年。' DoctorProfile.save(dp3) dp3=DoctorProfile() dp3.type=DoctorProfileType.Award dp3.userId= new_user_3.id dp3.description='获得省科技进步一等奖1项,全军医疗成果二等奖2项,全军医疗成果三等奖6项' DoctorProfile.save(dp3)
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 test_addSuperUser(self): user=User('zhoufan','13426026573','123456') user.sex=0 user.status=0 user.email='*****@*****.**' user.address='四川省 通江县' user.phone = '13426026573' user.type = UserStatus.doctor user.name = "张西" User.save(user) patient=Patient() patient.gender=0 patient.Name='zf' patient.status=0 patient.userID=user.id Patient.save(patient) new_userrole = UserRole(user.id, RoleId.Patient) UserRole.save(new_userrole) new_doctor_1 = Doctor(user.id) new_doctor_1.identityPhone = "029-12345567" new_doctor_1.username = "******" new_doctor_1.diagnoseCount = 10 new_doctor_1.feedbackCount = 5 new_doctor_1.goodFeedbackCount = 5 new_doctor_1.hospitalId = 1 new_doctor_1.departmentId = 1 new_doctor_1.title = "副主任医师" new_doctor_1.status = 0 Doctor.save(new_doctor_1) new_doctor2skill_1_1 = Doctor2Skill(new_doctor_1.id,1) Doctor2Skill.save(new_doctor2skill_1_1) new_userrole1 = UserRole(user.id, RoleId.Doctor) UserRole.save(new_userrole1) new_userrole2 = UserRole(user.id, RoleId.Admin) UserRole.save(new_userrole2)
def test_addDoctor(self): new_user_1 = User('印弘',"1111111111", "123456") new_user_1.email = "*****@*****.**" new_user_1.phone = "111111111111" new_user_1.type = UserStatus.doctor new_user_1.imagePath = config.AVATAR_PREFIX+'avatar/yinhong-xj.png' User.save(new_user_1) new_doctor_1 = Doctor(new_user_1.id) new_doctor_1.identityPhone = "029-12345567" new_doctor_1.username = "******" new_doctor_1.diagnoseCount = 10 new_doctor_1.feedbackCount = 5 new_doctor_1.goodFeedbackCount = 5 new_doctor_1.hospitalId = 1 new_doctor_1.departmentId = 1 new_doctor_1.title = "主任医师" new_doctor_1.status = 0 Doctor.save(new_doctor_1) new_doctor2skill_1_1 = Doctor2Skill(new_doctor_1.id,1) Doctor2Skill.save(new_doctor2skill_1_1) new_userrole = UserRole(new_user_1.id, RoleId.Doctor) UserRole.save(new_userrole) new_user_2 = User('宦怡',"22222222222", "123456") new_user_2.email = "*****@*****.**" new_user_2.phone = "22222222222" new_user_2.imagePath = config.AVATAR_PREFIX+'avatar/huanyi-xj.jpg' new_user_2.type = UserStatus.doctor User.save(new_user_2) new_doctor_2 = Doctor(new_user_2.id) new_doctor_2.identityPhone = "029-12345567" new_doctor_2.username = "******" new_doctor_2.diagnoseCount = 8 new_doctor_2.feedbackCount = 3 new_doctor_2.hospitalId = 1 new_doctor_2.departmentId = 1 new_doctor_2.title = "主任医师" new_doctor_2.status = 0 new_doctor_2.goodFeedbackCount = 2 Doctor.save(new_doctor_2) new_doctor2skill_1_2 = Doctor2Skill(new_doctor_2.id,2) Doctor2Skill.save(new_doctor2skill_1_2) new_userrole2 = UserRole(new_user_2.id, RoleId.Doctor) UserRole.save(new_userrole2) new_user_3 = User('张劲松',"33333333333", "123456") new_user_3.email = "*****@*****.**" new_user_3.phone = "33333333333" new_user_3.type = UserStatus.doctor new_user_3.imagePath = config.AVATAR_PREFIX+'avatar/zhangjinsong-xj.jpg' User.save(new_user_3) new_doctor_3 = Doctor(new_user_3.id) new_doctor_3.identityPhone = "029-12345567" new_doctor_3.username = "******" new_doctor_3.diagnoseCount = 9 new_doctor_3.feedbackCount = 4 new_doctor_3.hospitalId = 1 new_doctor_3.departmentId = 1 new_doctor_3.title = "副主任医师" new_doctor_3.status = 0 new_doctor_3.goodFeedbackCount = 3 Doctor.save(new_doctor_3) new_doctor2skill_1_3 = Doctor2Skill(new_doctor_3.id,3) Doctor2Skill.save(new_doctor2skill_1_3) new_userrole3 = UserRole(new_user_3.id, RoleId.Doctor) UserRole.save(new_userrole3) #doctor 4 new_user_4 = User('孙立军',"88888888888", "123456") new_user_4.email = "*****@*****.**" new_user_4.phone = "88888888888" new_user_4.type = UserStatus.doctor new_user_4.imagePath = config.AVATAR_PREFIX+'avatar/sunlijun-xj.jpg' User.save(new_user_4) new_doctor_4 = Doctor(new_user_4.id) new_doctor_4.identityPhone = "029-12345567" new_doctor_4.username = "******" new_doctor_4.diagnoseCount = 9 new_doctor_4.feedbackCount = 4 new_doctor_4.hospitalId = 1 new_doctor_4.departmentId = 1 new_doctor_4.title = "主任医师" new_doctor_4.status = 0 new_doctor_4.goodFeedbackCount = 3 Doctor.save(new_doctor_4) new_doctor2skill_1_4 = Doctor2Skill(new_doctor_4.id,3) Doctor2Skill.save(new_doctor2skill_1_4) new_userrole4 = UserRole(new_user_4.id, RoleId.Doctor) UserRole.save(new_userrole4) #doctor 5 new_user_5 = User('魏光全',"99999999999", "123456") new_user_5.email = "*****@*****.**" new_user_5.phone = "88888888888" new_user_5.type = UserStatus.doctor new_user_5.imagePath = config.AVATAR_PREFIX+'avatar/weiguangquan-xj.jpg' User.save(new_user_5) new_doctor_5 = Doctor(new_user_5.id) new_doctor_5.identityPhone = "029-12345567" new_doctor_5.username = "******" new_doctor_5.diagnoseCount = 9 new_doctor_5.feedbackCount = 4 new_doctor_5.hospitalId = 1 new_doctor_5.departmentId = 1 new_doctor_5.title = "副主任医师" new_doctor_5.status = 0 new_doctor_5.goodFeedbackCount = 3 Doctor.save(new_doctor_5) new_doctor2skill_1_5 = Doctor2Skill(new_doctor_5.id,3) Doctor2Skill.save(new_doctor2skill_1_5) new_userrole5 = UserRole(new_user_5.id, RoleId.Doctor) UserRole.save(new_userrole5) #doctor 6 new_user_6 = User('郑敏文',"00000000000", "123456") new_user_6.email = "*****@*****.**" new_user_6.phone = "00000000000" new_user_6.type = UserStatus.doctor new_user_6.imagePath = config.AVATAR_PREFIX+'avatar/zhengminwen-xj.jpg' User.save(new_user_6) new_doctor_6 = Doctor(new_user_6.id) new_doctor_6.identityPhone = "029-12345567" new_doctor_6.username = "******" new_doctor_6.diagnoseCount = 9 new_doctor_6.feedbackCount = 4 new_doctor_6.hospitalId = 1 new_doctor_6.departmentId = 1 new_doctor_6.title = "副主任医师" new_doctor_6.status = 0 new_doctor_6.goodFeedbackCount = 3 Doctor.save(new_doctor_6) new_doctor2skill_1_6 = Doctor2Skill(new_doctor_6.id,3) Doctor2Skill.save(new_doctor2skill_1_6) new_userrole6 = UserRole(new_user_6.id, RoleId.Doctor) UserRole.save(new_userrole6) dp=DoctorProfile() dp.type=DoctorProfileType.Intro dp.description='从事影像诊断多年,对普通放射、CT以及血管造影的影像诊断有丰富的经验,能够综合各种诊断手段进行诊断。对磁共振的影像诊断有丰富的经验,尤其侧重神经系统疑难疾病的诊断,采用磁共振波谱等多项先进技术,对神经系统肿瘤,肌萎缩性侧索硬化、癫痫以及先天性发育异常、变性疾病等神经系统疾病进行诊断及预后评估,有独到的诊断特色。与神经外科合作,开展肿瘤术前功能定位定向,确保了手术的安全性以及有效性;与身心科合作,开展了精神疾病诊断及临床研究工作。' dp.userId= new_user_1.id DoctorProfile.save(dp) dp=DoctorProfile() dp.type=DoctorProfileType.Resume dp.userId= new_user_1.id dp.description='印弘, 西京医院放射科主任,教授,主任医师,博士,硕士研究生导师。 毕业于第四军医大学。先后在新加坡国立神经科学研究所及美国加州大学旧金山分校作为访问学者工作。承担或参加北京市自然科学基金,新加坡国家医学基金,国家十一五科技支撑项目等多项科研基金,任职期间发表学术论文20余篇,其中SCI 5篇。' DoctorProfile.save(dp) dp=DoctorProfile() dp.type=DoctorProfileType.Award dp.userId= new_user_1.id dp.description='担任国家自然科学基金委主办杂志《自然》杂志以及《实用放射学杂志》特约审稿专家' DoctorProfile.save(dp) # dp=DoctorProfile() # dp.type=DoctorProfileType.Other # dp.userId= new_user_1.id # dp.description='陕西省影像协会会长' # DoctorProfile.save(dp) dp2=DoctorProfile() dp2.type=DoctorProfileType.Intro dp2.description='主要从事CT、MRI诊断及相关基础研究。90年代初在国内率先开展CT 影像后处理研究,在3D CE MRA、CTA成像,耳部HRCT、HRMRI影像及影像解剖基础研究,泌尿系疾患CT、MRI成像及前列腺癌的分子影像学方面做了较多的工作,并获得省及国家自然科学基金资助。' dp2.userId= new_user_2.id DoctorProfile.save(dp2) dp2=DoctorProfile() dp2.type=DoctorProfileType.Resume dp2.userId= new_user_2.id dp2.description='宦怡,主任医师,教授,博士生导师。先后共发表论文70余篇,主编副主编专著2部,参编的专著6部。承担国家自然科学基金、陕西省自然科学基金课题各1项,参与国家自然科学基金2项,国家“九五”科技公关攻关课题1项,军队青年基金课题1项。' DoctorProfile.save(dp2) dp2=DoctorProfile() dp2.type=DoctorProfileType.Award dp2.userId= new_user_2.id dp2.description='军队医疗成果二等奖1项,三等奖5项' DoctorProfile.save(dp2) dp3=DoctorProfile() dp3.type=DoctorProfileType.Intro dp3.description='长期坚持临床一线工作,历经放射科X线诊断组、CT组和磁共振组等部门工作,熟练掌握CT、MRI影像诊断。每年承担医疗系和口腔系5年制本科学员、8年制学员等的大课教学工作,发表教学论文4篇;指导进修生多人;参与指导硕士研究生及博士生多名。多次参加全国及省放射学会的专题讲座。' dp3.userId= new_user_3.id DoctorProfile.save(dp3) dp3=DoctorProfile() dp3.type=DoctorProfileType.Resume dp3.userId= new_user_3.id dp3.description='张劲松,男,副主任医师、副教授。1994年本科毕业于第四军医大学临床医学系(6年制本科),1997年获第四军医大学影像医学硕士学位,2005年获第四军医大学影像医学博士学位。2008年赴美国南加州大学放射科进修学习半年。' DoctorProfile.save(dp3) dp3=DoctorProfile() dp3.type=DoctorProfileType.Award dp3.userId= new_user_3.id dp3.description='获得省科技进步一等奖1项,全军医疗成果二等奖2项,全军医疗成果三等奖6项' DoctorProfile.save(dp3) #doctor 4 dp4=DoctorProfile() dp4.type=DoctorProfileType.Intro dp4.description='以第一作者或通讯作者发表论文近100余篇,其中2篇被SCI收录。主要研究方向为①微创与介入放射学以及心血管疾病影像诊断;②心肌缺血与梗死后促血管新生分子治疗学。' dp4.userId= new_user_4.id DoctorProfile.save(dp4) dp4=DoctorProfile() dp4.type=DoctorProfileType.Resume dp4.userId= new_user_4.id dp4.description='孙立军,男,1960年6月03日出生。博士,主任医师,教授。1983年毕业于第四军医大学空医系本科,1986~1989年攻读影像学硕士学位, 1992~1995年攻读影像学博士学位' DoctorProfile.save(dp4) dp4=DoctorProfile() dp4.type=DoctorProfileType.Award dp4.userId= new_user_4.id dp4.description='2006年度陕西省科技进步二等奖(第二名),2008年度军队医疗成果二等奖(第四名),2011年陕西省科技进步二等奖(第三名)' DoctorProfile.save(dp4) #doctor 5 dp5=DoctorProfile() dp5.type=DoctorProfileType.Intro dp5.description='主要研究方向:分子影像学。以第一作者发表文章48篇,其中7篇被SCI收录,最高影响因子8.3.参编专著3部。主持国家自然科学基金2项,参与(第二作者) 国家自然科学基金7项,其中包括NSFC重大项目:肿瘤分子影像基础研究.参与“973”子课题1项。参编专著3。' dp5.userId= new_user_5.id DoctorProfile.save(dp5) dp5=DoctorProfile() dp5.type=DoctorProfileType.Resume dp5.userId= new_user_5.id dp5.description='魏光全,男,副教授,副主任医师,硕士研究生导师' DoctorProfile.save(dp5) dp5=DoctorProfile() dp5.type=DoctorProfileType.Award dp5.userId= new_user_5.id dp5.description='中国人民解放军总后勤部特殊岗位津贴获得者(2005);第四军医大学学术新人获得者(2005)' DoctorProfile.save(dp5) #doctor 6 dp6=DoctorProfile() dp6.type=DoctorProfileType.Intro dp6.description='主要研究方向为心血管疾病影像诊断,在西北地区最早开展对冠心病等各种心血管疾病的CT诊断,积累了丰富的临床经验。发表论文60余篇,SCI收录6篇。参编专著3部。' dp6.userId= new_user_6.id DoctorProfile.save(dp6) dp6=DoctorProfile() dp6.type=DoctorProfileType.Resume dp6.userId= new_user_6.id dp6.description='郑敏文,女,第四军医大学西京医院放射科副主任。博士学历,副教授,副主任医师,硕士研究生导师' DoctorProfile.save(dp6) dp6=DoctorProfile() dp6.type=DoctorProfileType.Award dp6.userId= new_user_6.id dp6.description='获军队医疗成果二等奖2项,省级科技进步二等奖2项' DoctorProfile.save(dp6)
def test_add_doctor(self): new_location_1 = Location("西安_1") Skill.save(new_location_1) new_location_2 = Location("西安_2") Skill.save(new_location_2) new_location_3 = Location("西安_3") Skill.save(new_location_3) new_skill_1 = Skill("头部") Skill.save(new_skill_1) new_skill_2 = Skill("颈部") Skill.save(new_skill_2) new_skill_3 = Skill("胸部") Skill.save(new_skill_3) new_skill_1 = Position("头部") Skill.save(new_skill_1) new_skill_2 = Position("颈部") Skill.save(new_skill_2) new_skill_3 = Position("胸部") Skill.save(new_skill_3) new_hospital = Hospital("西22安西京医院", "地址——西22安西京医院", "描述-西22安西京医院", "22") Hospital.save(new_hospital) new_department_1 = Department("影像科") Skill.save(new_department_1) new_department_2 = Department("内科") Skill.save(new_department_2) new_department_3 = Department("外科") Skill.save(new_department_3) new_user_1 = User("18511134676", "123456") new_user_1.email = "*****@*****.**" new_user_1.phone = "18511134676" new_user_1.type = UserStatus.doctor User.save(new_user_1) new_doctor_1 = Doctor(new_user_1.id) new_doctor_1.identityPhone = "010-12345567" new_doctor_1.username = "******" new_doctor_1.diagnoseCount = 777 new_doctor_1.feedbackCount = 888 new_doctor_1.hospitalId = new_hospital.id new_doctor_1.departmentId = new_department_1.id new_doctor_1.title = "副主任医师1" Doctor.save(new_doctor_1) new_doctor2skill_1_1 = Doctor2Skill(new_doctor_1.id, new_skill_1.id) Doctor2Skill.save(new_doctor2skill_1_1) new_doctor2skill_1_2 = Doctor2Skill(new_doctor_1.id, new_skill_3.id) Doctor2Skill.save(new_doctor2skill_1_2) new_userrole = UserRole(new_user_1.id, RoleId.Doctor) UserRole.save(new_userrole) new_user_2 = User("18511122567", "123456") new_user_2.email = "*****@*****.**" new_user_2.phone = "18511122567" new_user_2.type = UserStatus.doctor User.save(new_user_2) new_doctor_2 = Doctor(new_user_2.id) new_doctor_2.identityPhone = "010-12345667" new_doctor_2.username = "******" new_doctor_2.diagnoseCount = 666 new_doctor_2.feedbackCount = 777 new_doctor_2.hospitalId = new_hospital.id new_doctor_2.departmentId = new_department_2.id new_doctor_2.title = "副主任医师2" Doctor.save(new_doctor_2) new_doctor2skill_2_1 = Doctor2Skill(new_doctor_2.id, new_skill_2.id) Doctor2Skill.save(new_doctor2skill_2_1) new_doctor2skill_2_2 = Doctor2Skill(new_doctor_2.id, new_skill_3.id) Doctor2Skill.save(new_doctor2skill_2_2) new_userrole = UserRole(new_user_2.id, RoleId.Doctor) UserRole.save(new_userrole) new_user_3 = User("18511142567", "123456") new_user_3.email = "*****@*****.**" new_user_3.phone = "18511142567" new_user_3.type = UserStatus.doctor User.save(new_user_3) new_doctor_3 = Doctor(new_user_3.id) new_doctor_3.identityPhone = "020-12346678" new_doctor_3.username = "******" new_doctor_3.hospitalId = new_hospital.id new_doctor_3.departmentId = new_department_3.id new_doctor_3.title = "副主任医师2" new_doctor_3.diagnoseCount = 999 new_doctor_3.feedbackCount = 1000 Doctor.save(new_doctor_3) new_doctor2skill_3_1 = Doctor2Skill(new_doctor_3.id, new_skill_1.id) Doctor2Skill.save(new_doctor2skill_3_1) new_doctor2skill_3_2 = Doctor2Skill(new_doctor_3.id, new_skill_2.id) Doctor2Skill.save(new_doctor2skill_3_2) new_userrole = UserRole(new_user_3.id, RoleId.Doctor) UserRole.save(new_userrole) new_user_1 = User("18511114676", "123456") new_user_1.email = "*****@*****.**" new_user_1.phone = "18511234676" new_user_1.type = UserStatus.doctor User.save(new_user_1) new_doctor_1 = Doctor(new_user_1.id) new_doctor_1.identityPhone = "020-12345567" new_doctor_1.username = "******" new_doctor_1.diagnoseCount = 775 new_doctor_1.feedbackCount = 788 new_doctor_1.hospitalId = new_hospital.id new_doctor_1.departmentId = new_department_1.id new_doctor_1.title = "副主任医师2" Doctor.save(new_doctor_1) new_doctor2skill_1_1 = Doctor2Skill(new_doctor_1.id, new_skill_1.id) Doctor2Skill.save(new_doctor2skill_1_1) new_doctor2skill_1_2 = Doctor2Skill(new_doctor_1.id, new_skill_3.id) Doctor2Skill.save(new_doctor2skill_1_2) new_userrole = UserRole(new_user_1.id, RoleId.Doctor) UserRole.save(new_userrole) new_user_1 = User("18511114676", "123456") new_user_1.email = "*****@*****.**" new_user_1.phone = "18511234676" new_user_1.type = UserStatus.doctor User.save(new_user_1) new_doctor_1 = Doctor(new_user_1.id) new_doctor_1.identityPhone = "020-12345567" new_doctor_1.username = "******" new_doctor_1.diagnoseCount = 775 new_doctor_1.feedbackCount = 788 new_doctor_1.hospitalId = new_hospital.id new_doctor_1.departmentId = new_department_1.id new_doctor_1.title = "副主任医师2" Doctor.save(new_doctor_1) new_doctor2skill_1_1 = Doctor2Skill(new_doctor_1.id, new_skill_1.id) Doctor2Skill.save(new_doctor2skill_1_1) new_doctor2skill_1_2 = Doctor2Skill(new_doctor_1.id, new_skill_3.id) Doctor2Skill.save(new_doctor2skill_1_2) new_userrole = UserRole(new_user_1.id, RoleId.Doctor) UserRole.save(new_userrole) new_user_1 = User("18511114676", "123456") new_user_1.email = "*****@*****.**" new_user_1.phone = "18511234676" new_user_1.type = UserStatus.doctor User.save(new_user_1) new_doctor_1 = Doctor(new_user_1.id) new_doctor_1.identityPhone = "020-12345567" new_doctor_1.username = "******" new_doctor_1.diagnoseCount = 775 new_doctor_1.feedbackCount = 788 new_doctor_1.hospitalId = new_hospital.id new_doctor_1.departmentId = new_department_1.id new_doctor_1.title = "副主任医师2" Doctor.save(new_doctor_1) new_doctor2skill_1_1 = Doctor2Skill(new_doctor_1.id, new_skill_1.id) Doctor2Skill.save(new_doctor2skill_1_1) new_doctor2skill_1_2 = Doctor2Skill(new_doctor_1.id, new_skill_3.id) Doctor2Skill.save(new_doctor2skill_1_2) new_userrole = UserRole(new_user_1.id, RoleId.Doctor) UserRole.save(new_userrole) new_user_1 = User("18511114676", "123456") new_user_1.email = "*****@*****.**" new_user_1.phone = "18511234676" new_user_1.type = UserStatus.doctor User.save(new_user_1) new_doctor_1 = Doctor(new_user_1.id) new_doctor_1.identityPhone = "020-12345567" new_doctor_1.username = "******" new_doctor_1.diagnoseCount = 775 new_doctor_1.feedbackCount = 788 new_doctor_1.hospitalId = new_hospital.id new_doctor_1.departmentId = new_department_1.id new_doctor_1.title = "副主任医师2" Doctor.save(new_doctor_1) new_doctor2skill_1_1 = Doctor2Skill(new_doctor_1.id, new_skill_1.id) Doctor2Skill.save(new_doctor2skill_1_1) new_doctor2skill_1_2 = Doctor2Skill(new_doctor_1.id, new_skill_3.id) Doctor2Skill.save(new_doctor2skill_1_2) new_userrole = UserRole(new_user_1.id, RoleId.Doctor) UserRole.save(new_userrole) new_user_1 = User("18511114676", "123456") new_user_1.email = "*****@*****.**" new_user_1.phone = "18511234676" new_user_1.type = UserStatus.doctor User.save(new_user_1) new_doctor_1 = Doctor(new_user_1.id) new_doctor_1.identityPhone = "020-12345567" new_doctor_1.username = "******" new_doctor_1.diagnoseCount = 775 new_doctor_1.feedbackCount = 788 new_doctor_1.hospitalId = new_hospital.id new_doctor_1.departmentId = new_department_1.id new_doctor_1.title = "副主任医师2" Doctor.save(new_doctor_1) new_doctor2skill_1_1 = Doctor2Skill(new_doctor_1.id, new_skill_1.id) Doctor2Skill.save(new_doctor2skill_1_1) new_doctor2skill_1_2 = Doctor2Skill(new_doctor_1.id, new_skill_3.id) Doctor2Skill.save(new_doctor2skill_1_2) new_userrole = UserRole(new_user_1.id, RoleId.Doctor) UserRole.save(new_userrole)
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)