Selaa lähdekoodia

改造医生主页接口 baseinfoCount
改成获取关注人数 医生评分和医生咨询量

chenweida 7 vuotta sitten
vanhempi
commit
740e7a0017

+ 41 - 0
common/common-rest-model/src/main/java/com.yihu.wlyy/rest/other/DoctorHomePage.java

@ -0,0 +1,41 @@
package com.yihu.wlyy.rest.other;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by Administrator on 2018/4/8 0008.
 */
@ApiModel("医生首页")
public class DoctorHomePage {
    @ApiModelProperty("医生关注数目")
    private Integer concernCount;
    @ApiModelProperty("医生评价分数")
    private Double doctorScore;
    @ApiModelProperty("医生总咨询数目")
    private Integer doctoConsult;
    public Integer getConcernCount() {
        return concernCount;
    }
    public void setConcernCount(Integer concernCount) {
        this.concernCount = concernCount;
    }
    public Double getDoctorScore() {
        return doctorScore;
    }
    public void setDoctorScore(Double doctorScore) {
        this.doctorScore = doctorScore;
    }
    public Integer getDoctoConsult() {
        return doctoConsult;
    }
    public void setDoctoConsult(Integer doctoConsult) {
        this.doctoConsult = doctoConsult;
    }
}

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/concern/ConcernDao.java

@ -40,4 +40,7 @@ public interface ConcernDao extends
    @Query(" from  ConcernDO c where  c.status=1  and  c.patient=?1  and  c.concernDoctorCode=?2")
    ConcernDO findByPatientAndDoctor(String patientCode, String doctorCode);
    @Query("select count(id) from  ConcernDO  where   status=1  and  concernDoctorCode=?1")
    Integer countPatientsByDoctorCode(String doctorCode);
}

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultTeamDao.java

@ -301,4 +301,8 @@ public interface ConsultTeamDao extends PagingAndSortingRepository<ConsultTeam,
	//按时间、类型、咨询时间统计居民咨询数量
	@Query("SELECT COUNT(1) FROM ConsultTeam a WHERE a.patient = ?1 AND a.type = ?2 AND a.czrq >= ?3 AND a.czrq <= ?4 AND a.status = 1 AND a.del = '1' ")
	int countRemainConsult(String patient, int type, Date begin,Date end);
	//查询医生的关注数
	@Query("SELECT COUNT(id) FROM ConsultTeam a WHERE  doctor=?1 and a.del='1' ")
	Integer countByDoctor(String doctorCode);
}

+ 13 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/concern/ConcernService.java

@ -140,8 +140,10 @@ public class ConcernService extends BaseService {
        return doctors;
    }
    /**
     * 获取患者关注医生
     * 获取医生的患者
     *
     * @param doctorCode
     * @return
@ -151,5 +153,15 @@ public class ConcernService extends BaseService {
        List<Patient> patients = concernDao.listPatientsByDoctorCode(doctorCode);
        return patients;
    }
    /**
     * 获取医生的患者数目
     *
     * @param doctorCode
     * @return
     */
    public Integer countPatientsByDoctorCode(String doctorCode) {
        Integer patients = concernDao.countPatientsByDoctorCode(doctorCode);
        return patients;
    }
}

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -2780,4 +2780,7 @@ public class ConsultTeamService extends ConsultService {
        return json;
    }
    public Integer countByDoctor(String doctorCode) {
        return consultTeamDao.countByDoctor(doctorCode);
    }
}

+ 143 - 133
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -13,8 +13,11 @@ import com.yihu.wlyy.entity.patient.SocialSecurityInfo;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
import com.yihu.wlyy.repository.doctor.SignPatientLabelDao;
import com.yihu.wlyy.repository.patient.SocialSecurityInfoDao;
import com.yihu.wlyy.rest.model.common.SimpleResult;
import com.yihu.wlyy.rest.other.DoctorHomePage;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.account.PatientInfoService;
import com.yihu.wlyy.service.app.concern.ConcernService;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.consult.DoctorCommentService;
import com.yihu.wlyy.service.app.hospital.HospitalDeptService;
@ -26,9 +29,7 @@ import com.yihu.wlyy.service.common.account.RoleService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.*;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -94,12 +95,14 @@ public class DoctorController extends BaseController {
    private CommonUtil CommonUtil;
    @Autowired
    private RSAUtils rsaUtils;
    @Autowired
    private ConcernService concernService;
    @ApiOperation("获取当前登录医生的角色")
    @RequestMapping(value = "doctorRole",method =RequestMethod.GET)
    @RequestMapping(value = "doctorRole", method = RequestMethod.GET)
    @ResponseBody
    public String doctorRole(){
        try{
    public String doctorRole() {
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            Map<String, Object> map = new HashMap<>();
            map.put("id", doctor.getId());
@ -114,21 +117,21 @@ public class DoctorController extends BaseController {
            List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(doctor.getCode());
            map.put("userRole", roleMap);
            //医生当前登录的角色
            List<Map<String, Object>> list = doctorInfoService.getDoctorManagerRole(doctor.getCode(),"Manage_Article_Authentication");
            if(roleMap.size()>0){
            List<Map<String, Object>> list = doctorInfoService.getDoctorManagerRole(doctor.getCode(), "Manage_Article_Authentication");
            if (roleMap.size() > 0) {
                for(Map<String, String> one:roleMap){
                    if("1".equals(one.get("isManage"))){
                for (Map<String, String> one : roleMap) {
                    if ("1".equals(one.get("isManage"))) {
                        map.put("currentUserRole", one);
                        continue;
                    }
                }
                if(list.size()>0&&!org.springframework.util.StringUtils.isEmpty(list.get(0).get("code"))){
                if (list.size() > 0 && !org.springframework.util.StringUtils.isEmpty(list.get(0).get("code"))) {
                    map.put("doctorAuthOperate", "1");
                }else{
                } else {
                    map.put("doctorAuthOperate", "0");
                }
            }else{
            } else {
//                Map<String, String> one = new HashMap<>();
//                one.put("isManage","0");
//                one.put("code", doctor.getHospital());
@ -139,26 +142,26 @@ public class DoctorController extends BaseController {
//                map.put("currentUserRole", one);
                Map<String, String> one = new HashMap<>();
                one.put("isManage","0");
                one.put("isManage", "0");
                one.put("code", doctor.getHospital());
                one.put("name", doctor.getHospitalName());
                one.put("areas", "");
                one.put("level","4");
                one.put("level", "4");
                if(list.size()>0&&!org.springframework.util.StringUtils.isEmpty(list.get(0).get("code"))){
                if (list.size() > 0 && !org.springframework.util.StringUtils.isEmpty(list.get(0).get("code"))) {
                    one.put("authOperate", "1");
                }else{
                } else {
                    one.put("authOperate", "0");
                }
                map.put("currentUserRole", one);
            }
            if ("10" .equals(doctor.getLevel()) && roleMap.size() == 0) {
            if ("10".equals(doctor.getLevel()) && roleMap.size() == 0) {
                return error(-1, "该用户没有管理员权限");
            }
            return write(200, "登录成功", "data", map);
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"查询失败");
            return error(-1, "查询失败");
        }
    }
@ -170,7 +173,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("社区医院下医生列表查询接口 没分页")
    @RequestMapping(value = "getDoctorsByhospitalNoPage",method =RequestMethod.POST)
    @RequestMapping(value = "getDoctorsByhospitalNoPage", method = RequestMethod.POST)
    @ResponseBody
    public String getDoctorsByhospitalNoPage(
            @RequestParam(required = false) String hospital,
@ -223,7 +226,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("社区医院下医生列表查询接口 有分页")
    @RequestMapping(value = "getDoctorsByhospital",method ={RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "getDoctorsByhospital", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public String getDoctorsByhospital(
            @RequestParam(required = false) String hospital, //医院code
@ -279,7 +282,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("社区医院列表查询接口")
    @RequestMapping(value = "hospitals",method ={RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "hospitals", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public String hospitals(
            int type,
@ -338,7 +341,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("查询存在医生的医院列表")
    @RequestMapping(value = "hospitals_list",method =RequestMethod.POST)
    @RequestMapping(value = "hospitals_list", method = RequestMethod.POST)
    @ResponseBody
    public String hospitalL(@RequestParam(required = true) int type,
                            @RequestParam(required = false) String province,
@ -354,7 +357,7 @@ public class DoctorController extends BaseController {
            page = page >= 1 ? page - 1 : 0;
            List<Hospital> hos = hospitalService.getHospitals(type, province, city, town, key,null, page, pagesize);
            List<Hospital> hos = hospitalService.getHospitals(type, province, city, town, key, null, page, pagesize);
            return write(200, "查询成功", "data", hos);
        } catch (Exception e) {
@ -373,7 +376,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("查询某个医院存在医生科室列表")
    @RequestMapping(value = "/dept_list",method =RequestMethod.POST)
    @RequestMapping(value = "/dept_list", method = RequestMethod.POST)
    @ResponseBody
    public String deptList(@RequestParam(required = true) String hospital,
                           @RequestParam(required = false) String key,
@ -406,7 +409,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("根据科室查询当前在工作医生")
    @RequestMapping(value = "/doctors_list",method =RequestMethod.POST)
    @RequestMapping(value = "/doctors_list", method = RequestMethod.POST)
    @ResponseBody
    public String findWorkingDoctorByDept(@RequestParam(required = false) String dept,
                                          @RequestParam(required = false) String hospital,
@ -436,7 +439,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("根据机构查找科室")
    @RequestMapping(value = "findDeptByHsoptail",method =RequestMethod.POST)
    @RequestMapping(value = "findDeptByHsoptail", method = RequestMethod.POST)
    @ResponseBody
    public String findDeptByHsoptail(
            String hospital,
@ -477,7 +480,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("根据科室查找医生")
    @RequestMapping(value = "findDoctorByDept",method =RequestMethod.POST)
    @RequestMapping(value = "findDoctorByDept", method = RequestMethod.POST)
    @ResponseBody
    public String findDoctorByDept(
            @RequestParam(required = false) String dept,
@ -533,7 +536,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("名医列表")
    @RequestMapping(value = "findFamousDoctor",method =RequestMethod.POST)
    @RequestMapping(value = "findFamousDoctor", method = RequestMethod.POST)
    @ResponseBody
    public String findFamousDoctor(
            @RequestParam(required = false) String key,
@ -586,7 +589,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("退出登录")
    @RequestMapping(value = "loginout",method =RequestMethod.POST)
    @RequestMapping(value = "loginout", method = RequestMethod.POST)
    @ResponseBody
    public String loginout() {
        try {
@ -604,7 +607,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("医生基本信息查询接口")
    @RequestMapping(value = "baseinfo",method ={RequestMethod.POST,RequestMethod.GET})
    @RequestMapping(value = "baseinfo", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public String baseinfo(
            @RequestParam(required = false) String code) {
@ -687,22 +690,26 @@ public class DoctorController extends BaseController {
     *
     * @return
     */
    @ApiOperation("医生基本信息查询接口")
    @RequestMapping(value = "baseinfoCount",method =RequestMethod.POST)
    @ApiOperation(value="医生首页 获取关注人数,医生的评分,医生咨询量", response =  DoctorHomePage.class)
    @RequestMapping(value = "baseinfoCount", method = RequestMethod.POST)
    @ResponseBody
    public String baseinfoCount(
            String doctorType) {
           @ApiParam(required = false,name = "doctorType",value = "医生类别") @RequestParam(required = false) String doctorType) {
        try {
            Doctor temp = doctorInfoService.findDoctorByCode(getUID());
            if (temp != null) {
                JSONObject json = new JSONObject();
                int count = familyContractService.countAmountSigned(getUID());
                // 审核总数
                json.put("signed_amount", count);
                //关注人数
                int concernCount = concernService.countPatientsByDoctorCode(getUID());
                json.put("concernCount", concernCount);
                int count1 = familyContractService.countAmountUnsign(getUID());
                // 等审核总数
                json.put("unsign_amount", count1);
                //医生的评分
                json.put("doctorScore", temp.getEvaluateScore());
                // 医生咨询量
                Integer doctoConsult = consultTeamService.countByDoctor(getUID());
                json.put("doctoConsult", doctoConsult);
                return write(200, "医生信息查询成功!", "data", json);
            } else {
                return error(-1, "医生信息查询失败!");
@ -725,7 +732,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("患者基本信息保存")
    @RequestMapping(value = "save",method =RequestMethod.POST)
    @RequestMapping(value = "save", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String save(
@ -816,7 +823,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("患者评价查询接口")
    @RequestMapping(value = "comments",method =RequestMethod.POST)
    @RequestMapping(value = "comments", method = RequestMethod.POST)
    @ResponseBody
    public String comments(Integer id, Integer pagesize) {
        try {
@ -861,7 +868,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("根据类别获取医院列表")
    @RequestMapping(value = "/hospital_list",method =RequestMethod.POST)
    @RequestMapping(value = "/hospital_list", method = RequestMethod.POST)
    @ResponseBody
    public String getHospitalList(
            @RequestParam(required = true) Integer type,
@ -921,7 +928,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("根据类别获取医院列表")
    @RequestMapping(value = "/hospital_list_type",method =RequestMethod.POST)
    @RequestMapping(value = "/hospital_list_type", method = RequestMethod.POST)
    @ResponseBody
    public String getHospitalList(
            @RequestParam(required = true) int doctorType,
@ -987,7 +994,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("根据医院标识获取医生信息")
    @RequestMapping(value = "/doctor_list",method =RequestMethod.POST)
    @RequestMapping(value = "/doctor_list", method = RequestMethod.POST)
    @ResponseBody
    public String getDoctorByHospital(
            @RequestParam(required = true) String hospital,
@ -996,7 +1003,7 @@ public class DoctorController extends BaseController {
            @RequestParam(required = true) Integer pageSize) {
        try {
            Page<Doctor> doctorList = doctorInfoService.getDoctorListByHospital(query, hospital, page, pageSize,2);
            Page<Doctor> doctorList = doctorInfoService.getDoctorListByHospital(query, hospital, page, pageSize, 2);
            JSONArray array = new JSONArray();
            if (doctorList != null) {
                for (Doctor doctor : doctorList) {
@ -1043,7 +1050,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("登录患者获取三师信息")
    @RequestMapping(value = "teachers",method =RequestMethod.POST)
    @RequestMapping(value = "teachers", method = RequestMethod.POST)
    @ResponseBody
    public String teachers(String patient) {
        try {
@ -1099,7 +1106,7 @@ public class DoctorController extends BaseController {
     * @param type 医生类别 1专科医生,2全科医生,3健康管理师
     * @return
     */
    @RequestMapping(value = "/doctor_combobox",method =RequestMethod.POST)
    @RequestMapping(value = "/doctor_combobox", method = RequestMethod.POST)
    @ResponseBody
    public String getDoctorCombobxByHospital(
            @RequestParam(required = true) String hospital,
@ -1158,7 +1165,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("专科医生列表")
    @RequestMapping(value = "/doctor_1_list",method =RequestMethod.POST)
    @RequestMapping(value = "/doctor_1_list", method = RequestMethod.POST)
    @ResponseBody
    public String doctor_1_list(
            @RequestParam(required = false) String name,
@ -1167,7 +1174,7 @@ public class DoctorController extends BaseController {
            @RequestParam(required = true) Integer pageSize) {
        try {
            Page<Doctor> doctorList = doctorInfoService.getDoctorListByHospital(name, null, page, pageSize,1);
            Page<Doctor> doctorList = doctorInfoService.getDoctorListByHospital(name, null, page, pageSize, 1);
            JSONArray array = new JSONArray();
            if (doctorList != null) {
                for (Doctor doctor : doctorList) {
@ -1214,7 +1221,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("把专科医生拉到团队里面")
    @RequestMapping(value = "/doctor_1_Toteam",method =RequestMethod.POST)
    @RequestMapping(value = "/doctor_1_Toteam", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String doctor_1_Toteam(
@ -1242,7 +1249,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("根据病人ID查找团队里面的全科医生")
    @RequestMapping(value = "/getDoctor2ByParient",method =RequestMethod.POST)
    @RequestMapping(value = "/getDoctor2ByParient", method = RequestMethod.POST)
    @ResponseBody
    public String getDoctor2ByParient(
            @RequestParam(required = true) String parientCode,
@ -1279,7 +1286,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("根据病人ID查找所有的专科医生,如果团队有专科医生那么专科医生拍第一个")
    @RequestMapping(value = "/getDoctor1ByParient",method =RequestMethod.POST)
    @RequestMapping(value = "/getDoctor1ByParient", method = RequestMethod.POST)
    @ResponseBody
    public String getDoctor1ByParient(
            @RequestParam(required = true) String consultCode,
@ -1317,7 +1324,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("验证患者的名字,身份证和医保卡")
    @RequestMapping(value = "/validatePatient",method =RequestMethod.POST)
    @RequestMapping(value = "/validatePatient", method = RequestMethod.POST)
    @ResponseBody
    public String validatePatient(
            @RequestParam(required = true) String name,
@ -1364,6 +1371,7 @@ public class DoctorController extends BaseController {
            return error(-1, "查询失败!");
        }
    }
    /**
     * 根据身份证号
     *
@ -1371,7 +1379,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("根据身份证号")
    @RequestMapping(value = "/patient_cardno",method =RequestMethod.POST)
    @RequestMapping(value = "/patient_cardno", method = RequestMethod.POST)
    @ResponseBody
    public String getPatientCardNo(String idcard) {
        try {
@ -1401,7 +1409,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("根据level查找机构下的类别医生")
    @RequestMapping(value = "/findDoctorByLevelAndHospital",method =RequestMethod.POST)
    @RequestMapping(value = "/findDoctorByLevelAndHospital", method = RequestMethod.POST)
    @ResponseBody
    public String findDoctorByLevelAndHospital(String hospital, Integer level) {
        try {
@ -1430,7 +1438,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("更新身份证号")
    @RequestMapping(value = "/idcard_update",method =RequestMethod.POST)
    @RequestMapping(value = "/idcard_update", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String updateIdcard(String idcard) {
@ -1457,7 +1465,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("更新医生性别")
    @RequestMapping(value = "/sex_update",method =RequestMethod.POST)
    @RequestMapping(value = "/sex_update", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String updateSex(int sex) {
@ -1480,7 +1488,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("更新医生介绍")
    @RequestMapping(value = "/introduce_update",method =RequestMethod.POST)
    @RequestMapping(value = "/introduce_update", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String updateIntroduce(String introduce) {
@ -1506,7 +1514,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("更新医生专长")
    @RequestMapping(value = "/expertise_update",method =RequestMethod.POST)
    @RequestMapping(value = "/expertise_update", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String updateExpertise(String expertise) {
@ -1533,7 +1541,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("设置给医生名医")
    @RequestMapping(value = "/setFamous",method =RequestMethod.POST)
    @RequestMapping(value = "/setFamous", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String setFamous(String doctorCode, Integer status) {
@ -1555,7 +1563,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("转换团队中的健康管理师")
    @RequestMapping(value = "/updateTeamHealthDoctors",method =RequestMethod.POST)
    @RequestMapping(value = "/updateTeamHealthDoctors", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String updateTeamHealthDoctors(String newDoctorCode,
@ -1612,7 +1620,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("转换团队中的全科医生")
    @RequestMapping(value = "/updateTeamDoctors",method =RequestMethod.POST)
    @RequestMapping(value = "/updateTeamDoctors", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String updateTeamDoctors(String newDoctorCode,
@ -1691,7 +1699,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("手机号是否注册")
    @RequestMapping(value="/is_mobile_register",method =RequestMethod.POST)
    @RequestMapping(value = "/is_mobile_register", method = RequestMethod.POST)
    @ResponseBody
    public String isMobileRegister(String mobile) {
        try {
@ -1750,7 +1758,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("当前医生是否与居民签约")
    @RequestMapping(value = "/is_patient_signed",method =RequestMethod.GET)
    @RequestMapping(value = "/is_patient_signed", method = RequestMethod.GET)
    @ResponseBody
    public String isPatientSign(String patient) {
        try {
@ -1773,7 +1781,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("心跳接口")
    @RequestMapping(value = "/islive",method =RequestMethod.POST)
    @RequestMapping(value = "/islive", method = RequestMethod.POST)
    @ResponseBody
    public String islive() {
        try {
@ -1796,7 +1804,7 @@ public class DoctorController extends BaseController {
     * @return
     */
    @ApiOperation("分配及转移健管师")
    @RequestMapping(value = "/allotOrMoveHealth",method =RequestMethod.POST)
    @RequestMapping(value = "/allotOrMoveHealth", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String allotOrMoveHealth(
@ -1813,49 +1821,49 @@ public class DoctorController extends BaseController {
            if (StringUtils.isNotEmpty(patients)) {
                String result = updateTeamHealthDoctors(newDoctorCode, oldDoctorCode, patients, null);
                return result;
            } else if(StringUtils.isNotEmpty(group)){
            } else if (StringUtils.isNotEmpty(group)) {
//            按条件获取居民
                patients = "";
                if (StringUtils.isEmpty(teamId)||StringUtils.isEmpty(typeId)||sendCount==null){
                if (StringUtils.isEmpty(teamId) || StringUtils.isEmpty(typeId) || sendCount == null) {
                    return write(-1, "参数不能为空!");
                }
                JSONObject list = familyContractService.findNoHealthSignFamilyHealth(null, typeId, null, teamCode);
                List<SignPatientLabel> s = labelDao.findByLabelTypeAndStatusAndTeamCode(typeId, 1, teamCode);
                for (SignPatientLabel label :s) {
                for (SignPatientLabel label : s) {
//                    String labelName = label.getLabelCode();
                    String labelName = label.getLabelName();
                    if (labelName.equals(group)){
                    if (labelName.equals(group)) {
                        JSONArray jsonArray = list.getJSONArray(labelName);
                        for (int i=0;i<sendCount;i++){
                        for (int i = 0; i < sendCount; i++) {
                            JSONObject jsonObject = jsonArray.getJSONObject(i);
                            String  patient = jsonObject.get("code").toString();
                            String patient = jsonObject.get("code").toString();
//                转移时需要剔除处于咨询状态的居民
                            if (StringUtils.isNotEmpty(oldDoctorCode)){
                            if (StringUtils.isNotEmpty(oldDoctorCode)) {
                                ConsultTeam consultTeam = consultTeamService.getConsultByPatientAndDoctor(patient, oldDoctorCode);
                                if (consultTeam == null) {
//                                   不是咨询状态
                                    patients+=(patient+",");
                                    patients += (patient + ",");
                                }
                            }else {
                                patients+=(patient+",");
                            } else {
                                patients += (patient + ",");
                            }
                        }
                    }
                }
                patients =  patients.substring(0,patients.length()-1);
                patients = patients.substring(0, patients.length() - 1);
                String result = updateTeamHealthDoctors(newDoctorCode, oldDoctorCode, patients, null);
                return result;
            }else {
            } else {
                List<SignFamily> signFamily = familyContractService.findNoHealthSignFamilyNum(teamCode);
                patients = "";
                if (StringUtils.isEmpty(teamId)||StringUtils.isEmpty(typeId)||sendCount==null){
                if (StringUtils.isEmpty(teamId) || StringUtils.isEmpty(typeId) || sendCount == null) {
                    return write(-1, "参数不能为空!");
                }
                for (SignFamily patient:signFamily) {
                for (SignFamily patient : signFamily) {
                    String code = patient.getPatient();
                    patients+=(code+",");
                    patients += (code + ",");
                }
                patients =  patients.substring(0,patients.length()-1);
                patients = patients.substring(0, patients.length() - 1);
                String result = updateTeamHealthDoctors(newDoctorCode, oldDoctorCode, patients, null);
                return result;
            }
@ -1924,13 +1932,13 @@ public class DoctorController extends BaseController {
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/getAuthenticationCAOvertime", method = RequestMethod.GET)
    public String getAuthenticationCAOvertime(){
    public String getAuthenticationCAOvertime() {
        try {
//            Doctor doctor = doctorInfoService.findDoctorByCode(getRepUID());
            JSONObject data = doctorInfoService.getCAPastDue(getUID(),new JSONObject());
            JSONObject data = doctorInfoService.getCAPastDue(getUID(), new JSONObject());
            return write(200, "获取信息成功!", "data", data);
        }catch (Exception e) {
        } catch (Exception e) {
            error(e);
            return error(-1, "获取信息失败!");
        }
@ -1942,12 +1950,12 @@ public class DoctorController extends BaseController {
    @ApiOperation("判断是否在线上安装证书")
    @ResponseBody
    @RequestMapping(value = "/isAuthentication", method = RequestMethod.GET)
    public String isAuthentication(){
    public String isAuthentication() {
        try {
            //0de6a26a62dd11e69faffa163e8aee56
            JSONObject data = doctorInfoService.isAuthentication(getUID());
            return write(200, "获取信息成功!", "data", data);
        }catch (Exception e) {
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
@ -1959,16 +1967,16 @@ public class DoctorController extends BaseController {
    @ResponseBody
    @RequestMapping(value = "/updateAuthenticationPassword", method = RequestMethod.POST)
    public String updateAuthenticationPassword(
            @RequestParam(value = "strOldCalledPasswd",required = true) String strOldCalledPasswd,
            @RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
            @RequestParam(value = "strOldCalledPasswd", required = true) String strOldCalledPasswd,
            @RequestParam(value = "strNewCalledPasswd", required = true) String strNewCalledPasswd) {
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd,getUID());//hxmD201703150222
            if(b){
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(), strOldCalledPasswd, strNewCalledPasswd, getUID());//hxmD201703150222
            if (b) {
                return write(200, "修改密码成功!", "data", b);
            }
            return error(-1, "修改密码失败!");
        }catch (Exception e) {
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
@ -1981,17 +1989,17 @@ public class DoctorController extends BaseController {
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/installAuthenticationPassword", method = RequestMethod.POST)
    public String installAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
    public String installAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd", required = true) String strNewCalledPasswd) {
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            String strOldCalledPasswd = StringUtils.isNotEmpty(doctor.getCheckPassword())?doctor.getCheckPassword():Base64Utils.encryptBASE64("11111111");
            String strOldCalledPasswd = StringUtils.isNotEmpty(doctor.getCheckPassword()) ? doctor.getCheckPassword() : Base64Utils.encryptBASE64("11111111");
            strOldCalledPasswd = Base64Utils.decryptBASE64(strOldCalledPasswd);
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),strOldCalledPasswd,strNewCalledPasswd,getUID());
            if(b){
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(), strOldCalledPasswd, strNewCalledPasswd, getUID());
            if (b) {
                return write(200, "设置密码成功!", "data", b);
            }
            return error(-1, "设置密码失败!");
        }catch (Exception e) {
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
@ -2005,15 +2013,15 @@ public class DoctorController extends BaseController {
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/resetAuthenticationPassword", method = RequestMethod.POST)
    public String resetAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd",required = true) String strNewCalledPasswd){
    public String resetAuthenticationPassword(@RequestParam(value = "strNewCalledPasswd", required = true) String strNewCalledPasswd) {
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(),Base64Utils.decryptBASE64(doctor.getCheckPassword()),strNewCalledPasswd,getUID());
            if(b){
            boolean b = doctorInfoService.updateAuthenticationPassword(doctor.getIdcard(), Base64Utils.decryptBASE64(doctor.getCheckPassword()), strNewCalledPasswd, getUID());
            if (b) {
                return write(200, "重置密码成功!", "data", b);
            }
            return error(-1, "重置密码失败!");
        }catch (Exception e) {
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
@ -2028,19 +2036,19 @@ public class DoctorController extends BaseController {
    @ResponseBody
    @RequestMapping(value = "/requestRealNameSoftCertAndSign", method = RequestMethod.POST)
    public String requestRealNameSoftCertAndSign(
            @ApiParam(required = true, name = "strRealNameSoftCertCalledPasswd", value = "证书被调用保护口令") @RequestParam(value = "strRealNameSoftCertCalledPasswd",required = true) String strRealNameSoftCertCalledPasswd,
            @ApiParam(required = true, name = "strOriginalData", value = "原文") @RequestParam(value = "strOriginalData",required = true) String strOriginalData,
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode",required = true) String prescriptionCode){
            @ApiParam(required = true, name = "strRealNameSoftCertCalledPasswd", value = "证书被调用保护口令") @RequestParam(value = "strRealNameSoftCertCalledPasswd", required = true) String strRealNameSoftCertCalledPasswd,
            @ApiParam(required = true, name = "strOriginalData", value = "原文") @RequestParam(value = "strOriginalData", required = true) String strOriginalData,
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) {
        try {
            Doctor doctor = doctorInfoService.findDoctorByCode(getUID());
//            JSONObject obj = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,srcBusinessStreamNO);
            JSONObject jsonObject = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(),strRealNameSoftCertCalledPasswd,strOriginalData,prescriptionCode);
            JSONObject jsonObject = doctorInfoService.requestRealNameSoftCertAndSign(doctor.getIdcard(), strRealNameSoftCertCalledPasswd, strOriginalData, prescriptionCode);
//            if(b){
            return write(200, "获取信息成功!", "data", jsonObject);
//            }
//            return error(-1, "认证失败!");
        }catch (Exception e) {
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
@ -2048,6 +2056,7 @@ public class DoctorController extends BaseController {
    /**
     * 校验医师输入的CA证书是否正确
     *
     * @return
     */
    @ObserverRequired
@ -2055,12 +2064,12 @@ public class DoctorController extends BaseController {
    @RequestMapping(value = "/checkCertificate", method = RequestMethod.GET)
    @ApiOperation("校验医师输入的身份证是否正确")
    public String checkCertificate(
            @ApiParam(required = true, name = "certificateNum", value = "证书编号") @RequestParam(value = "certificateNum",required = true) String certificateNum){
            @ApiParam(required = true, name = "certificateNum", value = "证书编号") @RequestParam(value = "certificateNum", required = true) String certificateNum) {
        try {
            boolean b = doctorInfoService.checkCertificate(getUID(),certificateNum);
            boolean b = doctorInfoService.checkCertificate(getUID(), certificateNum);
            return write(200, "获取信息成功!", "data", b);
        }catch (Exception e) {
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
@ -2074,47 +2083,48 @@ public class DoctorController extends BaseController {
    @ResponseBody
    @RequestMapping(value = "/verifySignOnMultiServer", method = RequestMethod.GET)
    public String verifySignOnMultiServer(
            @ApiParam(required = true, name = "strSignData", value = "签名值") @RequestParam(value = "strSignData",required = true) String strSignData,
            @ApiParam(required = true, name = "strCertData", value = "证书主体数据") @RequestParam(value = "strCertData",required = true) String strCertData,
            @ApiParam(required = true, name = "strOriginalData", value = "原文数据") @RequestParam(value = "strOriginalData",required = true) String strOriginalData){
            try {
                boolean bl = doctorInfoService.verifySignOnMultiServer(strSignData,strCertData,strOriginalData,getUID());
                return write(200, "获取信息成功!", "data", bl);
            }catch (Exception e) {
                error(e);
                return error(-1, e.getMessage());
            }
            @ApiParam(required = true, name = "strSignData", value = "签名值") @RequestParam(value = "strSignData", required = true) String strSignData,
            @ApiParam(required = true, name = "strCertData", value = "证书主体数据") @RequestParam(value = "strCertData", required = true) String strCertData,
            @ApiParam(required = true, name = "strOriginalData", value = "原文数据") @RequestParam(value = "strOriginalData", required = true) String strOriginalData) {
        try {
            boolean bl = doctorInfoService.verifySignOnMultiServer(strSignData, strCertData, strOriginalData, getUID());
            return write(200, "获取信息成功!", "data", bl);
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    @ApiOperation("取消认证")
    @ObserverRequired
    @ResponseBody
    @RequestMapping(value = "/cancelAuthentication", method = RequestMethod.GET)
    public String cancelAuthentication(){
    public String cancelAuthentication() {
        try {
            if(doctorInfoService.cancelAuthentication(getUID())){
            if (doctorInfoService.cancelAuthentication(getUID())) {
                return write(200, "取消认证成功!");
            }else{
            } else {
                return error(-1, "取消认证失败!");
            }
        }catch (Exception e) {
        } catch (Exception e) {
            error(e);
            return error(-1, "取消认证失败!");
        }
    }
    /**
     * 每日推送需要授权角色的功能 用后台管理系统的功能
     * 获取医生在后台管理系统的角色
     * {
     *     data:[
     *          {
     *          "url":"",
     *          "code":""
     *          }
     *     ]
     * data:[
     * {
     * "url":"",
     * "code":""
     * }
     * ]
     * }
     *
     * @return
@ -2129,7 +2139,7 @@ public class DoctorController extends BaseController {
            if (org.springframework.util.StringUtils.isEmpty(code)) {
                code = super.getUID();
            }
            List<Map<String, Object>> returnData = doctorInfoService.getDoctorManagerRole(code,authenCode);
            List<Map<String, Object>> returnData = doctorInfoService.getDoctorManagerRole(code, authenCode);
            return write(200, "获取成功", "data", returnData);
        } catch (Exception e) {
            error(e);