瀏覽代碼

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangzhinan 5 年之前
父節點
當前提交
a0245d51e5
共有 33 個文件被更改,包括 1215 次插入559 次删除
  1. 8 1
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorRoleDao.java
  2. 355 3
      business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java
  3. 396 395
      business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorService.java
  4. 49 7
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  5. 41 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  6. 4 4
      business/base-service/src/main/java/com/yihu/jw/org/dao/BaseOrgDao.java
  7. 1 1
      business/base-service/src/main/java/com/yihu/jw/org/service/BaseOrgInfoService.java
  8. 37 37
      business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java
  9. 2 2
      business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java
  10. 14 5
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java
  11. 5 5
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/org/BaseOrgVO.java
  12. 6 0
      server/svr-authentication/pom.xml
  13. 26 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  14. 44 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/FileUploadService.java
  15. 56 10
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthYlzConfigService.java
  16. 8 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/RegisterService.java
  17. 20 1
      server/svr-authentication/src/main/resources/application.yml
  18. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/activemq/MessageManager.java
  19. 30 30
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleDao.java
  20. 8 1
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleInfoDao.java
  21. 1 19
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleInfoService.java
  22. 2 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleService.java
  23. 0 10
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  24. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDOReader.java
  25. 1 3
      svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamMemberService.java
  26. 13 3
      svr/svr-base/src/main/resources/application.yml
  27. 1 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/file_upload/FileUploadEndpoint.java
  28. 11 1
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  29. 2 6
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/config/DoctorServiceEndPoint.java
  30. 7 5
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  31. 23 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  32. 5 2
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistScreenResultController.java
  33. 37 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistScreenResultService.java

+ 8 - 1
business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorRoleDao.java

@ -1,10 +1,13 @@
package com.yihu.jw.doctor.dao;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Set;
/**
@ -20,7 +23,11 @@ import java.util.List;
 * @since 1.
 */
public interface BaseDoctorRoleDao extends PagingAndSortingRepository<BaseDoctorRoleDO, Integer>, JpaSpecificationExecutor<BaseDoctorRoleDO>  {
    
    List<BaseDoctorRoleDO> findByRoleCode(String roleCode);
    @Query("select id from BaseDoctorRoleDO where doctorCode = ?1")
    Set<Object> findIdListByDoctorCode(String doctorCode);
    List<BaseDoctorRoleDO> findByDoctorCode(String doctorCode);
}

+ 355 - 3
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java

@ -1,19 +1,371 @@
package com.yihu.jw.doctor.service;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.DoctorSpecialDiseaseDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.DoctorSpecialDiseaseDo;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;
@Service
public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoctorDao> {
    private static Logger logger = LoggerFactory.getLogger(BaseDoctorInfoService.class);
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private DoctorSpecialDiseaseDao specialDiseaseDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    /**
     * 查询医生信息分页列表.
     * @param city
     * @param hospital
     * @param status
     * @param name
     * @param page
     * @param pageSize
     */
    public Envelop queryList(String city, String hospital, String status, String name, String type, String typeCode, String dept, int page, int pageSize){
        Map<String,Object> params = new HashedMap();
        String sqlTotal ="SELECT " +
                " COUNT(1) AS \"total\" " +
                " FROM " +
                " base_doctor a " +
                " JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
                " LEFT JOIN (SELECT * FROM wlyy_charge_dict t WHERE t.dept_type_code ='6') e ON a.charge_type = e.charge_type " +
                " LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
                " WHERE " +
                " 1 = 1";
        if (StringUtils.isNotBlank(city)){
            sqlTotal += " AND a.city_name =:city";
            params.put("city",city);
        }
        if (StringUtils.isNotBlank(hospital)){
            sqlTotal += " AND b.org_code =:hospital";
            params.put("hospital",hospital);
        }
        if (StringUtils.isNotBlank(status)){
            sqlTotal += " AND a.del =:status";
            params.put("status",status);
        }
        if (StringUtils.isNotBlank(name)){
            name = "%"+name+"%";
            sqlTotal += " AND (a.name like:name or b.dept_name like:name)";
            params.put("name",name);
        }
        if (StringUtils.isNotBlank(type)){
            type = "%"+type+"%";
            sqlTotal += " AND a.outpatient_type like:type";
            params.put("type",type);
        }
        if(StringUtils.isNotBlank(typeCode)){
            sqlTotal += " AND e.dept_type_code =:typeCode";
            params.put("typeCode",typeCode);
        }
        if(StringUtils.isNotBlank(dept)){
            sqlTotal += " AND b.dept_code =:dept";
            params.put("dept",dept);
        }
        Long count = 0L;
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlTotal,params);
        if(count!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        }
        String sql ="SELECT " +
                " a.id AS \"id\", " +
                " a.NAME AS \"name\", " +
                " a.introduce AS \"introduce\", " +
                " a.expertise AS \"expertise\", " +
                " a.outpatient_type AS \"outpatientType\", " +
                " a.del AS \"del\", " +
                " b.dept_name AS \"deptName\", " +
                " e.req_fee AS \"money\" " +
                " FROM " +
                " base_doctor a " +
                " JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
                " LEFT JOIN (SELECT * FROM wlyy_charge_dict t WHERE t.dept_type_code ='6') e ON a.charge_type = e.charge_type " +
                " LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
                " WHERE 1=1";
        if (StringUtils.isNotBlank(city)){
            sql += " AND a.city_name =:city";
        }
        if (StringUtils.isNotBlank(hospital)){
            sql += " AND b.org_code =:hospital";
        }
        if (StringUtils.isNotBlank(status)){
            sql += " AND a.del =:status";
        }
        if (StringUtils.isNotBlank(name)){
            sql += " AND (a.name like:name or b.dept_name like:name)";
        }
        if (StringUtils.isNotBlank(type)){
            sql += " AND a.outpatient_type like:type";
        }
        if(StringUtils.isNotBlank(typeCode)){
            sql += " AND e.dept_type_code =:typeCode";
        }
        if(StringUtils.isNotBlank(dept)){
            sql += " AND b.dept_code =:dept";
        }
        logger.info("queryList sql:"+sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pageSize);
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, pageSize, count);
    }
    /**
     * 根据医生ID,获取医生基础信息
     * @param doctorId
     * @return
     */
    public Object queryById(String doctorId,String typeCode) {
        Map<String,Object> params = new HashedMap();
        String sql ="SELECT " +
                " a.NAME AS \"name\", " +
                " a.job_title_name AS \"jobTitleName\", " +
                " a.introduce AS \"introduce\", " +
                " a.expertise AS \"expertise\", " +
                " a.photo AS \"photo\", " +
                " a.outpatient_type AS \"outpatientType\", " +
                " b.dept_name AS \"deptName\", " +
                " b.org_name AS \"orgName\", " +
                " c.mapping_code AS \"jobNumber\", " +
                " d.disease_name AS \"diseaseName\", " +
                " d.disease_code AS \"diseaseCode\", " +
                " e.req_fee AS \"money\" " +
                " FROM " +
                " base_doctor a " +
                " LEFT JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
                " LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
                " LEFT JOIN wlyy_doctor_special_disease d ON a.id = d.doctor_code " +
                " LEFT JOIN wlyy_charge_dict e ON a.charge_type = e.charge_type " +
                " WHERE 1=1 ";
        if(StringUtils.isNotBlank(doctorId)){
            sql+=" AND a.id =:id";
            params.put("id",doctorId);
        }
        if(StringUtils.isNotBlank(typeCode)){
            sql+=" AND e.dept_type_code =:typeCode";
            params.put("typeCode",typeCode);
        }
        logger.info("queryById sql:"+sql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params);
        StringBuilder disease = new StringBuilder();
        StringBuilder code = new StringBuilder();
        if (null != list && list.size() > 0){
            if (list.size() == 1){
                return  list.get(0);
            }else {
                for (int i=0;i<list.size();i++){
                    if (i == 0 ){
                        disease.append(list.get(i).get("diseaseName"));
                        code.append(list.get(i).get("diseaseCode"));
                    }else {
                        disease.append(","+list.get(i).get("diseaseName"));
                        code.append(","+list.get(i).get("diseaseCode"));
                    }
                }
                list.get(0).put("diseaseName",disease);
                list.get(0).put("diseaseCode",code);
                return  list.get(0);
            }
        }
        return null;
    }
    public Boolean updateList(JSONArray jsonArray){
        if(jsonArray!=null&&jsonArray.size()>0){
            for(int i=0;i<jsonArray.size();i++){
                JSONObject doctor = jsonArray.getJSONObject(i);
                try {
                    updateInfo(doctor);
                }catch (Exception e){
                    logger.info("update doctor error:"+e.toString());
                }
            }
        }
        return true;
    }
    /**
     * 修改医生服务配置
     * @param jsonObject
     */
    public Boolean update(JSONObject jsonObject)throws Exception{
        //取出数据
        String doctorId = jsonObject.get("doctorId").toString();
        String introduce = jsonObject.get("introduce").toString();
        String expertise = jsonObject.get("expertise").toString();
        String photo = jsonObject.get("photo").toString();
        String outpatientType = jsonObject.get("outpatientType").toString();
        String newSpecialDisease = jsonObject.get("specialDisease").toString();
        String newSpecialDiseaseCode = jsonObject.get("specialDiseaseCode").toString();
        baseDoctorDao.update(doctorId,introduce,expertise,photo,outpatientType);
        //删除医生旧专病门诊,保存新专病门诊
        Map<String,Object> params = new HashedMap();
        String sqlTotal ="SELECT " +
                " COUNT(1) AS \"total\" " +
                " FROM " +
                " wlyy_doctor_special_disease a " +
                " WHERE " +
                " 1 = 1";
        sqlTotal += " AND a.doctor_code =:doctorId";
        params.put("doctorId",doctorId);
        Long count = 0L;
        List<Map<String, Object>> total = hibenateUtils.createSQLQuery(sqlTotal, params);
        //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
        count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        if (count > 0){
            specialDiseaseDao.deleteByDoctorCode(doctorId);
        }
        if(StringUtils.isNotBlank(newSpecialDisease) && StringUtils.isNotBlank(newSpecialDiseaseCode)){
            String[] split = newSpecialDisease.split(",");
            String[] splitCode = newSpecialDiseaseCode.split(",");
            specialDiseaseDao.deleteByDoctorCode(doctorId);
            for (int i=0;i<split.length;i++ ){
                DoctorSpecialDiseaseDo specialDiseaseDo = new DoctorSpecialDiseaseDo();
                specialDiseaseDo.setDoctorCode(doctorId);
                specialDiseaseDo.setDiseaseName(split[i]);
                specialDiseaseDo.setDiseaseCode(splitCode[i]);
                specialDiseaseDao.save(specialDiseaseDo);
            }
        }
        return true;
    }
    public Boolean updateInfo(JSONObject jsonObject)throws Exception{
        //取出数据
        String doctorId = jsonObject.get("doctorId").toString();
        String outpatientType = jsonObject.get("outpatientType").toString();
        logger.info("doctor:"+doctorId+" outpatientType:"+outpatientType);
        BaseDoctorDO doctorDO = baseDoctorDao.findOne(doctorId);
        doctorDO.setOutpatientType(outpatientType);
        baseDoctorDao.save(doctorDO);
        return true;
    }
    /**
     * 修改医生状态
     * @param doctorId
     * @param status
     */
    public void updateStatus(String doctorId,String status)throws Exception{
        baseDoctorDao.updateStatus(doctorId,status);
    }
    public Boolean updateDoctorPw(String id,String pw,String orgPw){
        BaseDoctorDO doctorDO = baseDoctorDao.findOne(id);
        String orgPwMd5 = MD5.md5Hex(orgPw + "{" + doctorDO.getSalt() + "}");
        if(!orgPwMd5.equals(doctorDO.getPassword())){
            return false;
        }
        //认证信息设置
        String salt = randomString(5);
        doctorDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
        doctorDO.setSalt(salt);
        baseDoctorDao.save(doctorDO);
        //设置更新时间
        saveDoctorPwlimitDate(id);
        return true;
    }
    public String randomString(int length) {
        String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuffer buffer = new StringBuffer();
        Random random = new Random();
        for(int i = 0; i < length; ++i) {
            int pos = random.nextInt(str.length());
            buffer.append(str.charAt(pos));
        }
        return buffer.toString();
    }
    public com.alibaba.fastjson.JSONObject findDoctorPwlimitDate(String doctor){
        String key = "hlwyy:authPw:doctor:" + doctor;
        String authPw = redisTemplate.opsForValue().get(key);
        com.alibaba.fastjson.JSONObject valueJson = null;
        if(StringUtils.isNotBlank(authPw)){
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("pwOverDue");
            String code[] = wlyyHospitalSysDictDO.getDictCode().split(",");
            Integer maxDateInt = Integer.parseInt(code[0]);
            Integer remainDateInt = Integer.parseInt(code[1]);
            valueJson = JSON.parseObject(authPw);
            Long updateTimeLong = valueJson.getLong("updateTime");
            Date updateTime = new Date();
            updateTime.setTime(updateTimeLong);
            Date maxDate = DateUtil.getPreDays(updateTime,maxDateInt);
            Long betweenDate = (maxDate.getTime() - new Date().getTime())/(60*60*24*1000);
            valueJson.put("betweenDate",betweenDate);
            if(betweenDate<remainDateInt){
                valueJson.put("remaind",true);
            }else {
                valueJson.put("remaind",false);
            }
        }else {
            valueJson = new com.alibaba.fastjson.JSONObject();
            valueJson.put("isChanged",false);
        }
        return valueJson;
    }
    // 基于医生ID,获取医生基础信息
    public BaseDoctorDO getDoctorByCode(String id) {
        return baseDoctorDao.findById(id);
    public boolean saveDoctorPwlimitDate(String doctor){
        String key = "hlwyy:authPw:doctor:" + doctor;
        com.alibaba.fastjson.JSONObject valueJson = new com.alibaba.fastjson.JSONObject();
        valueJson.put("updateTime",new Date().getTime());
        valueJson.put("isChanged",true);
        redisTemplate.opsForValue().set(key,valueJson.toJSONString());
        return true;
    }
}

+ 396 - 395
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorService.java

@ -1,398 +1,399 @@
package com.yihu.jw.doctor.service;
import com.alibaba.fastjson.JSON;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.DoctorSpecialDiseaseDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.DoctorSpecialDiseaseDo;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Random;
@Service
public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDao> {
    private static Logger logger = LoggerFactory.getLogger(BaseDoctorService.class);
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private DoctorSpecialDiseaseDao specialDiseaseDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    /**
     * 查询医生信息分页列表.
     * @param city
     * @param hospital
     * @param status
     * @param name
     * @param page
     * @param pageSize
     */
    public Envelop queryList(String city, String hospital, String status, String name, String type,String typeCode,String dept, int page, int pageSize){
        Map<String,Object> params = new HashedMap();
        String sqlTotal ="SELECT " +
                " COUNT(1) AS \"total\" " +
                " FROM " +
                " base_doctor a " +
                " JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
                " LEFT JOIN (SELECT * FROM wlyy_charge_dict t WHERE t.dept_type_code ='6') e ON a.charge_type = e.charge_type " +
                " LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
                " WHERE " +
                " 1 = 1";
        if (StringUtils.isNotBlank(city)){
            sqlTotal += " AND a.city_name =:city";
            params.put("city",city);
        }
        if (StringUtils.isNotBlank(hospital)){
            sqlTotal += " AND b.org_code =:hospital";
            params.put("hospital",hospital);
        }
        if (StringUtils.isNotBlank(status)){
            sqlTotal += " AND a.del =:status";
            params.put("status",status);
        }
        if (StringUtils.isNotBlank(name)){
            name = "%"+name+"%";
            sqlTotal += " AND (a.name like:name or b.dept_name like:name)";
            params.put("name",name);
        }
        if (StringUtils.isNotBlank(type)){
            type = "%"+type+"%";
            sqlTotal += " AND a.outpatient_type like:type";
            params.put("type",type);
        }
        if(StringUtils.isNotBlank(typeCode)){
            sqlTotal += " AND e.dept_type_code =:typeCode";
            params.put("typeCode",typeCode);
        }
        if(StringUtils.isNotBlank(dept)){
            sqlTotal += " AND b.dept_code =:dept";
            params.put("dept",dept);
        }
        Long count = 0L;
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlTotal,params);
        if(count!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        }
        String sql ="SELECT " +
                " a.id AS \"id\", " +
                " a.NAME AS \"name\", " +
                " a.introduce AS \"introduce\", " +
                " a.expertise AS \"expertise\", " +
                " a.outpatient_type AS \"outpatientType\", " +
                " a.del AS \"del\", " +
                " b.dept_name AS \"deptName\", " +
                " e.req_fee AS \"money\" " +
                " FROM " +
                " base_doctor a " +
                " JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
                " LEFT JOIN (SELECT * FROM wlyy_charge_dict t WHERE t.dept_type_code ='6') e ON a.charge_type = e.charge_type " +
                " LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
                " WHERE 1=1";
        if (StringUtils.isNotBlank(city)){
            sql += " AND a.city_name =:city";
        }
        if (StringUtils.isNotBlank(hospital)){
            sql += " AND b.org_code =:hospital";
        }
        if (StringUtils.isNotBlank(status)){
            sql += " AND a.del =:status";
        }
        if (StringUtils.isNotBlank(name)){
            sql += " AND (a.name like:name or b.dept_name like:name)";
        }
        if (StringUtils.isNotBlank(type)){
            sql += " AND a.outpatient_type like:type";
        }
        if(StringUtils.isNotBlank(typeCode)){
            sql += " AND e.dept_type_code =:typeCode";
        }
        if(StringUtils.isNotBlank(dept)){
            sql += " AND b.dept_code =:dept";
        }
        logger.info("queryList sql:"+sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pageSize);
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, pageSize, count);
    }
    /**
     * 根据医生ID,获取医生基础信息
     * @param doctorId
     * @return
     */
    public Object queryById(String doctorId,String typeCode) {
        Map<String,Object> params = new HashedMap();
        String sql ="SELECT " +
                " a.NAME AS \"name\", " +
                " a.job_title_name AS \"jobTitleName\", " +
                " a.introduce AS \"introduce\", " +
                " a.expertise AS \"expertise\", " +
                " a.photo AS \"photo\", " +
                " a.outpatient_type AS \"outpatientType\", " +
                " b.dept_name AS \"deptName\", " +
                " b.org_name AS \"orgName\", " +
                " c.mapping_code AS \"jobNumber\", " +
                " d.disease_name AS \"diseaseName\", " +
                " d.disease_code AS \"diseaseCode\", " +
                " e.req_fee AS \"money\" " +
                " FROM " +
                " base_doctor a " +
                " LEFT JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
                " LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
                " LEFT JOIN wlyy_doctor_special_disease d ON a.id = d.doctor_code " +
                " LEFT JOIN wlyy_charge_dict e ON a.charge_type = e.charge_type " +
                " WHERE 1=1 ";
        if(StringUtils.isNotBlank(doctorId)){
            sql+=" AND a.id =:id";
            params.put("id",doctorId);
        }
        if(StringUtils.isNotBlank(typeCode)){
            sql+=" AND e.dept_type_code =:typeCode";
            params.put("typeCode",typeCode);
        }
        logger.info("queryById sql:"+sql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params);
        StringBuilder disease = new StringBuilder();
        StringBuilder code = new StringBuilder();
        if (null != list && list.size() > 0){
            if (list.size() == 1){
                return  list.get(0);
            }else {
                for (int i=0;i<list.size();i++){
                    if (i == 0 ){
                        disease.append(list.get(i).get("diseaseName"));
                        code.append(list.get(i).get("diseaseCode"));
                    }else {
                        disease.append(","+list.get(i).get("diseaseName"));
                        code.append(","+list.get(i).get("diseaseCode"));
                    }
                }
                list.get(0).put("diseaseName",disease);
                list.get(0).put("diseaseCode",code);
                return  list.get(0);
            }
        }
        return null;
    }
    public Boolean updateList(JSONArray jsonArray){
        if(jsonArray!=null&&jsonArray.size()>0){
            for(int i=0;i<jsonArray.size();i++){
                JSONObject doctor = jsonArray.getJSONObject(i);
                try {
                    updateInfo(doctor);
                }catch (Exception e){
                    logger.info("update doctor error:"+e.toString());
                }
            }
        }
        return true;
    }
    /**
     * 修改医生服务配置
     * @param jsonObject
     */
    public Boolean update(JSONObject jsonObject)throws Exception{
        //取出数据
        String doctorId = jsonObject.get("doctorId").toString();
        String introduce = jsonObject.get("introduce").toString();
        String expertise = jsonObject.get("expertise").toString();
        String photo = jsonObject.get("photo").toString();
        String outpatientType = jsonObject.get("outpatientType").toString();
        String newSpecialDisease = jsonObject.get("specialDisease").toString();
        String newSpecialDiseaseCode = jsonObject.get("specialDiseaseCode").toString();
        baseDoctorDao.update(doctorId,introduce,expertise,photo,outpatientType);
        //删除医生旧专病门诊,保存新专病门诊
        Map<String,Object> params = new HashedMap();
        String sqlTotal ="SELECT " +
                " COUNT(1) AS \"total\" " +
                " FROM " +
                " wlyy_doctor_special_disease a " +
                " WHERE " +
                " 1 = 1";
        sqlTotal += " AND a.doctor_code =:doctorId";
        params.put("doctorId",doctorId);
        Long count = 0L;
        List<Map<String, Object>> total = hibenateUtils.createSQLQuery(sqlTotal, params);
        //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
        count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        if (count > 0){
            specialDiseaseDao.deleteByDoctorCode(doctorId);
        }
        if(StringUtils.isNotBlank(newSpecialDisease) && StringUtils.isNotBlank(newSpecialDiseaseCode)){
            String[] split = newSpecialDisease.split(",");
            String[] splitCode = newSpecialDiseaseCode.split(",");
            specialDiseaseDao.deleteByDoctorCode(doctorId);
            for (int i=0;i<split.length;i++ ){
                DoctorSpecialDiseaseDo specialDiseaseDo = new DoctorSpecialDiseaseDo();
                specialDiseaseDo.setDoctorCode(doctorId);
                specialDiseaseDo.setDiseaseName(split[i]);
                specialDiseaseDo.setDiseaseCode(splitCode[i]);
                specialDiseaseDao.save(specialDiseaseDo);
            }
        }
        return true;
    }
    public Boolean updateInfo(JSONObject jsonObject)throws Exception{
        //取出数据
        String doctorId = jsonObject.get("doctorId").toString();
        String outpatientType = jsonObject.get("outpatientType").toString();
        logger.info("doctor:"+doctorId+" outpatientType:"+outpatientType);
        BaseDoctorDO doctorDO = baseDoctorDao.findOne(doctorId);
        doctorDO.setOutpatientType(outpatientType);
        baseDoctorDao.save(doctorDO);
        return true;
    }
    /**
     * 修改医生状态
     * @param doctorId
     * @param status
     */
    public void updateStatus(String doctorId,String status)throws Exception{
        baseDoctorDao.updateStatus(doctorId,status);
    }
    public Boolean updateDoctorPw(String id,String pw,String orgPw){
        BaseDoctorDO doctorDO = baseDoctorDao.findOne(id);
        String orgPwMd5 = MD5.md5Hex(orgPw + "{" + doctorDO.getSalt() + "}");
        if(!orgPwMd5.equals(doctorDO.getPassword())){
            return false;
        }
        //认证信息设置
        String salt = randomString(5);
        doctorDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
        doctorDO.setSalt(salt);
        baseDoctorDao.save(doctorDO);
        //设置更新时间
        saveDoctorPwlimitDate(id);
        return true;
    }
    public String randomString(int length) {
        String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuffer buffer = new StringBuffer();
        Random random = new Random();
        for(int i = 0; i < length; ++i) {
            int pos = random.nextInt(str.length());
            buffer.append(str.charAt(pos));
        }
        return buffer.toString();
    }
    public com.alibaba.fastjson.JSONObject findDoctorPwlimitDate(String doctor){
        String key = "hlwyy:authPw:doctor:" + doctor;
        String authPw = redisTemplate.opsForValue().get(key);
        com.alibaba.fastjson.JSONObject valueJson = null;
        if(StringUtils.isNotBlank(authPw)){
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("pwOverDue");
            String code[] = wlyyHospitalSysDictDO.getDictCode().split(",");
            Integer maxDateInt = Integer.parseInt(code[0]);
            Integer remainDateInt = Integer.parseInt(code[1]);
            valueJson = JSON.parseObject(authPw);
            Long updateTimeLong = valueJson.getLong("updateTime");
            Date updateTime = new Date();
            updateTime.setTime(updateTimeLong);
            Date maxDate = DateUtil.getPreDays(updateTime,maxDateInt);
            Long betweenDate = (maxDate.getTime() - new Date().getTime())/(60*60*24*1000);
            valueJson.put("betweenDate",betweenDate);
            if(betweenDate<remainDateInt){
                valueJson.put("remaind",true);
            }else {
                valueJson.put("remaind",false);
            }
        }else {
            valueJson = new com.alibaba.fastjson.JSONObject();
            valueJson.put("isChanged",false);
        }
        return valueJson;
    }
    public boolean saveDoctorPwlimitDate(String doctor){
        String key = "hlwyy:authPw:doctor:" + doctor;
        com.alibaba.fastjson.JSONObject valueJson = new com.alibaba.fastjson.JSONObject();
        valueJson.put("updateTime",new Date().getTime());
        valueJson.put("isChanged",true);
        redisTemplate.opsForValue().set(key,valueJson.toJSONString());
        return true;
    }
//    public static void main(String ag[]){
//        long betweenDate = (DateUtil.strToDate("2020-04-11","yyyy-MM-dd").getTime() - new Date().getTime())/(60*60*24*1000);
//        System.out.println(betweenDate);
//package com.yihu.jw.doctor.service;
//
//import com.alibaba.fastjson.JSON;
//import com.yihu.jw.doctor.dao.BaseDoctorDao;
//import com.yihu.jw.doctor.dao.DoctorSpecialDiseaseDao;
//import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
//import com.yihu.jw.entity.base.doctor.DoctorSpecialDiseaseDo;
//import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
//import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
//import com.yihu.jw.restmodel.web.Envelop;
//import com.yihu.jw.restmodel.web.MixEnvelop;
//import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
//import com.yihu.jw.util.date.DateUtil;
//import com.yihu.jw.utils.hibernate.HibenateUtils;
//import com.yihu.mysql.query.BaseJpaService;
//import com.yihu.utils.security.MD5;
//import net.sf.json.JSONArray;
//import net.sf.json.JSONObject;
//import org.apache.commons.collections.map.HashedMap;
//import org.apache.commons.lang3.StringUtils;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.StringRedisTemplate;
//import org.springframework.jdbc.core.JdbcTemplate;
//import org.springframework.stereotype.Service;
//
//import java.util.Date;
//import java.util.List;
//import java.util.Map;
//import java.util.Random;
//
//@Service
//public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDao> {
//
//    private static Logger logger = LoggerFactory.getLogger(BaseDoctorService.class);
//
//
//    @Autowired
//    private BaseDoctorDao baseDoctorDao;
//    @Autowired
//    private DoctorSpecialDiseaseDao specialDiseaseDao;
//    @Autowired
//    private JdbcTemplate jdbcTemplate;
//    @Autowired
//    private HibenateUtils hibenateUtils;
//    @Autowired
//    private StringRedisTemplate redisTemplate;
//    @Autowired
//    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
//
//
//    /**
//     * 查询医生信息分页列表.
//     * @param city
//     * @param hospital
//     * @param status
//     * @param name
//     * @param page
//     * @param pageSize
//     */
//    public Envelop queryList(String city, String hospital, String status, String name, String type,String typeCode,String dept, int page, int pageSize){
//        Map<String,Object> params = new HashedMap();
//        String sqlTotal ="SELECT " +
//                " COUNT(1) AS \"total\" " +
//                " FROM " +
//                " base_doctor a " +
//                " JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
//                " LEFT JOIN (SELECT * FROM wlyy_charge_dict t WHERE t.dept_type_code ='6') e ON a.charge_type = e.charge_type " +
//                " LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
//                " WHERE " +
//                " 1 = 1";
//        if (StringUtils.isNotBlank(city)){
//            sqlTotal += " AND a.city_name =:city";
//            params.put("city",city);
//        }
//        if (StringUtils.isNotBlank(hospital)){
//            sqlTotal += " AND b.org_code =:hospital";
//            params.put("hospital",hospital);
//        }
//        if (StringUtils.isNotBlank(status)){
//            sqlTotal += " AND a.del =:status";
//            params.put("status",status);
//        }
//        if (StringUtils.isNotBlank(name)){
//            name = "%"+name+"%";
//            sqlTotal += " AND (a.name like:name or b.dept_name like:name)";
//            params.put("name",name);
//        }
//        if (StringUtils.isNotBlank(type)){
//            type = "%"+type+"%";
//            sqlTotal += " AND a.outpatient_type like:type";
//            params.put("type",type);
//        }
//        if(StringUtils.isNotBlank(typeCode)){
//            sqlTotal += " AND e.dept_type_code =:typeCode";
//            params.put("typeCode",typeCode);
//        }
//        if(StringUtils.isNotBlank(dept)){
//            sqlTotal += " AND b.dept_code =:dept";
//            params.put("dept",dept);
//        }
//
//        Long count = 0L;
//        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlTotal,params);
//        if(count!=null){
//            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
//            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
//        }
//        String sql ="SELECT " +
//                " a.id AS \"id\", " +
//                " a.NAME AS \"name\", " +
//                " a.introduce AS \"introduce\", " +
//                " a.expertise AS \"expertise\", " +
//                " a.outpatient_type AS \"outpatientType\", " +
//                " a.del AS \"del\", " +
//                " b.dept_name AS \"deptName\", " +
//                " e.req_fee AS \"money\" " +
//                " FROM " +
//                " base_doctor a " +
//                " JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
//                " LEFT JOIN (SELECT * FROM wlyy_charge_dict t WHERE t.dept_type_code ='6') e ON a.charge_type = e.charge_type " +
//                " LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
//                " WHERE 1=1";
//        if (StringUtils.isNotBlank(city)){
//            sql += " AND a.city_name =:city";
//        }
//        if (StringUtils.isNotBlank(hospital)){
//            sql += " AND b.org_code =:hospital";
//        }
//        if (StringUtils.isNotBlank(status)){
//            sql += " AND a.del =:status";
//        }
//        if (StringUtils.isNotBlank(name)){
//            sql += " AND (a.name like:name or b.dept_name like:name)";
//        }
//        if (StringUtils.isNotBlank(type)){
//            sql += " AND a.outpatient_type like:type";
//        }
//        if(StringUtils.isNotBlank(typeCode)){
//            sql += " AND e.dept_type_code =:typeCode";
//        }
//        if(StringUtils.isNotBlank(dept)){
//            sql += " AND b.dept_code =:dept";
//        }
//
//        logger.info("queryList sql:"+sql);
//
//        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params,page,pageSize);
//
//        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, pageSize, count);
//    }
//    public static void main(String ag[]){
//        String str = "[ " +
//                "{ " +
//                "\"title\":\"Java 开发\", " +
//                "\"edition\":3, " +
//                "\"author\":[\"smith\",\"张三\",\"李四\"] " +
//                "}, " +
//                "{ " +
//                "\"title\":\"Web 开发\", " +
//                "\"edition\":3, " +
//                "\"author\":[\"Allen\",\"王五\",\"赵六\"] " +
//                "} " +
//                "]";
//        JSONArray json = JSONArray.fromObject(str);
//        for(int i=0;i<json.size();i++){
//            JSONObject doctor = json.getJSONObject(i);
//            doctor.getString("doctor");
//
//    /**
//     * 根据医生ID,获取医生基础信息
//     * @param doctorId
//     * @return
//     */
//    public Object queryById(String doctorId,String typeCode) {
//        Map<String,Object> params = new HashedMap();
//        String sql ="SELECT " +
//                " a.NAME AS \"name\", " +
//                " a.job_title_name AS \"jobTitleName\", " +
//                " a.introduce AS \"introduce\", " +
//                " a.expertise AS \"expertise\", " +
//                " a.photo AS \"photo\", " +
//                " a.outpatient_type AS \"outpatientType\", " +
//                " b.dept_name AS \"deptName\", " +
//                " b.org_name AS \"orgName\", " +
//                " c.mapping_code AS \"jobNumber\", " +
//                " d.disease_name AS \"diseaseName\", " +
//                " d.disease_code AS \"diseaseCode\", " +
//                " e.req_fee AS \"money\" " +
//                " FROM " +
//                " base_doctor a " +
//                " LEFT JOIN base_doctor_hospital b ON a.id = b.doctor_code " +
//                " LEFT JOIN base_doctor_mapping c ON a.id = c.doctor " +
//                " LEFT JOIN wlyy_doctor_special_disease d ON a.id = d.doctor_code " +
//                " LEFT JOIN wlyy_charge_dict e ON a.charge_type = e.charge_type " +
//                " WHERE 1=1 ";
//        if(StringUtils.isNotBlank(doctorId)){
//            sql+=" AND a.id =:id";
//            params.put("id",doctorId);
//        }
//        if(StringUtils.isNotBlank(typeCode)){
//            sql+=" AND e.dept_type_code =:typeCode";
//            params.put("typeCode",typeCode);
//        }
//
//        logger.info("queryById sql:"+sql);
//
//        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params);
//        StringBuilder disease = new StringBuilder();
//        StringBuilder code = new StringBuilder();
//        if (null != list && list.size() > 0){
//            if (list.size() == 1){
//                return  list.get(0);
//            }else {
//                for (int i=0;i<list.size();i++){
//                    if (i == 0 ){
//                        disease.append(list.get(i).get("diseaseName"));
//                        code.append(list.get(i).get("diseaseCode"));
//                    }else {
//                        disease.append(","+list.get(i).get("diseaseName"));
//                        code.append(","+list.get(i).get("diseaseCode"));
//                    }
//                }
//                list.get(0).put("diseaseName",disease);
//                list.get(0).put("diseaseCode",code);
//                return  list.get(0);
//            }
//        }
//
//        return null;
//    }
//
//    public Boolean updateList(JSONArray jsonArray){
//        if(jsonArray!=null&&jsonArray.size()>0){
//            for(int i=0;i<jsonArray.size();i++){
//                JSONObject doctor = jsonArray.getJSONObject(i);
//                try {
//                    updateInfo(doctor);
//                }catch (Exception e){
//                    logger.info("update doctor error:"+e.toString());
//                }
//            }
//        }
//        return true;
//    }
//
//    /**
//     * 修改医生服务配置
//     * @param jsonObject
//     */
//    public Boolean update(JSONObject jsonObject)throws Exception{
//        //取出数据
//        String doctorId = jsonObject.get("doctorId").toString();
//        String introduce = jsonObject.get("introduce").toString();
//        String expertise = jsonObject.get("expertise").toString();
//        String photo = jsonObject.get("photo").toString();
//        String outpatientType = jsonObject.get("outpatientType").toString();
//        String newSpecialDisease = jsonObject.get("specialDisease").toString();
//        String newSpecialDiseaseCode = jsonObject.get("specialDiseaseCode").toString();
//        baseDoctorDao.update(doctorId,introduce,expertise,photo,outpatientType);
//        //删除医生旧专病门诊,保存新专病门诊
//        Map<String,Object> params = new HashedMap();
//        String sqlTotal ="SELECT " +
//                " COUNT(1) AS \"total\" " +
//                " FROM " +
//                " wlyy_doctor_special_disease a " +
//                " WHERE " +
//                " 1 = 1";
//        sqlTotal += " AND a.doctor_code =:doctorId";
//        params.put("doctorId",doctorId);
//        Long count = 0L;
//        List<Map<String, Object>> total = hibenateUtils.createSQLQuery(sqlTotal, params);
//        //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
//        count = hibenateUtils.objTransformLong(total.get(0).get("total"));
//        if (count > 0){
//            specialDiseaseDao.deleteByDoctorCode(doctorId);
//        }
//        if(StringUtils.isNotBlank(newSpecialDisease) && StringUtils.isNotBlank(newSpecialDiseaseCode)){
//            String[] split = newSpecialDisease.split(",");
//            String[] splitCode = newSpecialDiseaseCode.split(",");
//            specialDiseaseDao.deleteByDoctorCode(doctorId);
//            for (int i=0;i<split.length;i++ ){
//                DoctorSpecialDiseaseDo specialDiseaseDo = new DoctorSpecialDiseaseDo();
//                specialDiseaseDo.setDoctorCode(doctorId);
//                specialDiseaseDo.setDiseaseName(split[i]);
//                specialDiseaseDo.setDiseaseCode(splitCode[i]);
//                specialDiseaseDao.save(specialDiseaseDo);
//            }
//        }
//
//        return true;
//    }
//
//    public Boolean updateInfo(JSONObject jsonObject)throws Exception{
//        //取出数据
//        String doctorId = jsonObject.get("doctorId").toString();
//        String outpatientType = jsonObject.get("outpatientType").toString();
//        logger.info("doctor:"+doctorId+" outpatientType:"+outpatientType);
//        BaseDoctorDO doctorDO = baseDoctorDao.findOne(doctorId);
//        doctorDO.setOutpatientType(outpatientType);
//        baseDoctorDao.save(doctorDO);
//        return true;
//    }
//
//
//    /**
//     * 修改医生状态
//     * @param doctorId
//     * @param status
//     */
//    public void updateStatus(String doctorId,String status)throws Exception{
//        baseDoctorDao.updateStatus(doctorId,status);
//    }
//
//    public Boolean updateDoctorPw(String id,String pw,String orgPw){
//        BaseDoctorDO doctorDO = baseDoctorDao.findOne(id);
//
//        String orgPwMd5 = MD5.md5Hex(orgPw + "{" + doctorDO.getSalt() + "}");
//        if(!orgPwMd5.equals(doctorDO.getPassword())){
//            return false;
//        }
//        //认证信息设置
//        String salt = randomString(5);
//        doctorDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
//        doctorDO.setSalt(salt);
//
//        baseDoctorDao.save(doctorDO);
//
//        //设置更新时间
//        saveDoctorPwlimitDate(id);
//
//        return true;
//    }
//
//    public String randomString(int length) {
//        String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
//        StringBuffer buffer = new StringBuffer();
//        Random random = new Random();
//
//        for(int i = 0; i < length; ++i) {
//            int pos = random.nextInt(str.length());
//            buffer.append(str.charAt(pos));
//        }
//
//        return buffer.toString();
//    }
//
//    public com.alibaba.fastjson.JSONObject findDoctorPwlimitDate(String doctor){
//        String key = "hlwyy:authPw:doctor:" + doctor;
//        String authPw = redisTemplate.opsForValue().get(key);
//        com.alibaba.fastjson.JSONObject valueJson = null;
//        if(StringUtils.isNotBlank(authPw)){
//
//            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("pwOverDue");
//            String code[] = wlyyHospitalSysDictDO.getDictCode().split(",");
//            Integer maxDateInt = Integer.parseInt(code[0]);
//            Integer remainDateInt = Integer.parseInt(code[1]);
//
//            valueJson = JSON.parseObject(authPw);
//            Long updateTimeLong = valueJson.getLong("updateTime");
//            Date updateTime = new Date();
//            updateTime.setTime(updateTimeLong);
//            Date maxDate = DateUtil.getPreDays(updateTime,maxDateInt);
//
//            Long betweenDate = (maxDate.getTime() - new Date().getTime())/(60*60*24*1000);
//            valueJson.put("betweenDate",betweenDate);
//            if(betweenDate<remainDateInt){
//                valueJson.put("remaind",true);
//            }else {
//                valueJson.put("remaind",false);
//            }
//        }else {
//            valueJson = new com.alibaba.fastjson.JSONObject();
//            valueJson.put("isChanged",false);
//        }
//        return valueJson;
//    }
//
//    public boolean saveDoctorPwlimitDate(String doctor){
//        String key = "hlwyy:authPw:doctor:" + doctor;
//        com.alibaba.fastjson.JSONObject valueJson = new com.alibaba.fastjson.JSONObject();
//        valueJson.put("updateTime",new Date().getTime());
//        valueJson.put("isChanged",true);
//        redisTemplate.opsForValue().set(key,valueJson.toJSONString());
//        return true;
//    }
}
//
//
//
//
////    public static void main(String ag[]){
////        long betweenDate = (DateUtil.strToDate("2020-04-11","yyyy-MM-dd").getTime() - new Date().getTime())/(60*60*24*1000);
////        System.out.println(betweenDate);
////    }
//
////    public static void main(String ag[]){
////        String str = "[ " +
////                "{ " +
////                "\"title\":\"Java 开发\", " +
////                "\"edition\":3, " +
////                "\"author\":[\"smith\",\"张三\",\"李四\"] " +
////                "}, " +
////                "{ " +
////                "\"title\":\"Web 开发\", " +
////                "\"edition\":3, " +
////                "\"author\":[\"Allen\",\"王五\",\"赵六\"] " +
////                "} " +
////                "]";
////        JSONArray json = JSONArray.fromObject(str);
////        for(int i=0;i<json.size();i++){
////            JSONObject doctor = json.getJSONObject(i);
////            doctor.getString("doctor");
////        }
////    }
//}

+ 49 - 7
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.service.BaseDoctorService;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
@ -22,7 +22,6 @@ import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
@ -54,11 +53,8 @@ import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.PinYinUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wlyy.wlyyhttp.WlyyHttpService;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.EhcHandler;
@ -166,7 +162,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private WlyyHospitalWorkRuleDao wlyyHospitalWorkRuleDao;
    @Autowired
    private BaseDoctorService baseDoctorService;
    private BaseDoctorInfoService baseDoctorService;
    @Value("${demo.flag}")
@ -1171,7 +1167,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param size
     * @return
     */
    public MixEnvelop findDoctorWithMouthWork(String orgCode, String dept, String chargeType, String date, String nameKey, Integer page, Integer size) {
    public MixEnvelop findDoctorWithMouthWork(String orgCode, String dept, String chargeType, String date, String nameKey,String iswork, Integer page, Integer size) {
        String totalSql = "SELECT " +
                " count(1) AS total " +
@ -1199,6 +1195,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(nameKey)) {
            totalSql += " AND d.name like '%" + nameKey + "%' ";
        }
        //过滤排班
        if(StringUtils.isNotBlank(iswork)){
            if("1".equals(iswork)){
                totalSql +=" AND d.id IN ( " +
                        " SELECT DISTINCT " +
                        " t.doctor " +
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        " )";
            }else{
                totalSql +=" AND d.id NOT IN ( " +
                        " SELECT DISTINCT " +
                        " t.doctor " +
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        " )";
            }
        }
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
        Long count = 0L;
@ -1240,6 +1259,29 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(nameKey)) {
            sql += " AND d.name like '%" + nameKey + "%' ";
        }
        //过滤排班
        if(StringUtils.isNotBlank(iswork)){
            if("1".equals(iswork)){
                sql +=" AND d.id IN ( " +
                        " SELECT DISTINCT " +
                        " t.doctor " +
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        " )";
            }else{
                sql +=" AND d.id NOT IN ( " +
                        " SELECT DISTINCT " +
                        " t.doctor " +
                        " FROM " +
                        "  wlyy_doctor_work_time t " +
                        " WHERE " +
                        "  t.date LIKE '%"+date+"%' " +
                        " )";
            }
        }
        sql += " LIMIT " + (page - 1) * size + "," + size + "";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        if (list != null && list.size() > 0) {

+ 41 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -514,6 +514,47 @@ public class XzzxEntranceService {
        }
    }
    public String sendXCXMes(String wxId,String patient,String cardNo,String first,String noticeContent,String remark,String miniProgramPagepath,String miniProgramAppId){
        JSONObject params = new JSONObject();
        params.put("transType","sms.hospital.notice");
        params.put("merchId","3501000014");
        params.put("miniProgramPagepath",miniProgramPagepath);
        params.put("miniProgramAppId",miniProgramAppId);
        JSONObject p = new JSONObject();
        String openId = "";
        if(StringUtils.isNotBlank(patient)){
            List<BasePatientWechatDo> paientWechatDos = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patient);
            if(paientWechatDos!=null&&paientWechatDos.size()>0){
                openId = paientWechatDos.get(0).getOpenid();
                p.put("openId",openId);
            }
        }else {
            p.put("cardNo",cardNo);
        }
        p.put("first",first);
        p.put("noticeTime", DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
        p.put("noticeContent",noticeContent);
        p.put("remark",remark);
        params.put("param",p);
        logger.info("params :"+params.toString());
        if(StringUtils.isNotBlank(openId)||StringUtils.isNotBlank(cardNo)){
            String rs = HttpUtil.sendPost(sendMessageUrl,params.toJSONString());
            logger.info("rs :"+rs);
            JSONObject rsJson = JSON.parseObject(rs);
            String resCode = rsJson.getString("resCode");
            if("000".equals(resCode)){
                return "1";
            }
            return "0";
        }else {
            return "-1";
        }
    }
//=====================微信模板消息推送接口================================
}

+ 4 - 4
business/base-service/src/main/java/com/yihu/jw/org/dao/BaseOrgDao.java

@ -16,7 +16,7 @@ import java.util.Map;
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 * litaohong 	1.0  		2018年08月31日
 *
 * </pre>
 * @since
@ -46,15 +46,15 @@ public interface BaseOrgDao extends PagingAndSortingRepository<BaseOrgDO, String
    List<BaseOrgDO> findByCityCode(String cityCode);
    List<BaseOrgDO> findByCityCodeAndLevel(String cityCode,Integer level);
    List<BaseOrgDO> findByCityCodeAndOrgLevel(String cityCode,Integer level);
    List<BaseOrgDO> findByDel(String del);
    @Query(value="select b.* from base_org b where b.del=?1  and b.name like ?2 ORDER BY sort DESC",nativeQuery = true)
    List<BaseOrgDO> findByDelAndName(String del,String name);
    
    @Query(value="select b.* from base_org b where b.level= ?1 and b.del=?2  and b.name like ?3 ORDER BY sort DESC",nativeQuery = true)
    @Query(value="select b.* from base_org b where b.org_level= ?1 and b.del=?2  and b.name like ?3 ORDER BY sort DESC",nativeQuery = true)
    List<BaseOrgDO> findByLevelAndName(Integer level,String del,String name);
    
    @Query(value="select b.* from base_org b where b.level= ?1 and b.del=?2 ORDER BY sort DESC",nativeQuery = true)
    @Query(value="select b.* from base_org b where b.org_level= ?1 and b.del=?2 ORDER BY sort DESC",nativeQuery = true)
    List<BaseOrgDO> findByLevelAndDel(Integer level,String del);
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/org/service/BaseOrgInfoService.java

@ -18,7 +18,7 @@ public class BaseOrgInfoService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    // 基于市,获取医院列表信息
    public List<BaseOrgDO> getOrgByCity(String cityCode,Integer level) {
        if(level!=null){
            return baseOrgDao.findByCityCodeAndLevel(cityCode,level);
            return baseOrgDao.findByCityCodeAndOrgLevel(cityCode,level);
        }
        return baseOrgDao.findByCityCode(cityCode);
    }

+ 37 - 37
business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java

@ -469,48 +469,48 @@ public class EnterpriseService {
//
//    }
    public static void main(String args[])throws Exception{
        String corpsecret = "Uo-QnbYthpUC0tZt--l71n3QEafT3g2oH_j4mLjCokU";
        String corpid = "ww4bf28f7a26e67fee";
        String result = HttpUtil.sendGet("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid="+corpid+"&corpsecret="+corpsecret);
        JSONObject json = JSONObject.parseObject(result);
        String token = json.getString("access_token");
//        String url = "https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token="+token;
//    public static void main(String args[])throws Exception{
//
//        String rs = HttpUtil.sendGet(url);
//        String corpsecret = "Uo-QnbYthpUC0tZt--l71n3QEafT3g2oH_j4mLjCokU";
//
//        JSONObject r = JSONObject.parseObject(rs);
//        String corpid = "ww4bf28f7a26e67fee";
//
//        JSONArray depts = r.getJSONArray("department");
//        String result = HttpUtil.sendGet("https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid="+corpid+"&corpsecret="+corpsecret);
//
//        String deptStr ="";
//        JSONObject json = JSONObject.parseObject(result);
//
//        if(depts!=null&&depts.size()>0){
//            for(int i=0;i<depts.size();i++){
//                JSONObject dept = (JSONObject) depts.get(i);
//                deptStr+=dept.getString("id")+"|";
//            }
//           deptStr = deptStr.substring(0,deptStr.length()-1);
//        }
//        System.out.println("deptStr"+deptStr);
        String userUrl ="https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token="+token+"&department_id=20&fetch_child=FETCH_CHILD";
        String users = HttpUtil.sendGet(userUrl);
        JSONObject us = JSONObject.parseObject(users);
        JSONArray list = us.getJSONArray("userlist");
        System.out.println("list"+list.size());
    }
//        String token = json.getString("access_token");
//
////        String url = "https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token="+token;
////
////        String rs = HttpUtil.sendGet(url);
////
////        JSONObject r = JSONObject.parseObject(rs);
////
////        JSONArray depts = r.getJSONArray("department");
////
////        String deptStr ="";
////
////        if(depts!=null&&depts.size()>0){
////            for(int i=0;i<depts.size();i++){
////                JSONObject dept = (JSONObject) depts.get(i);
////                deptStr+=dept.getString("id")+"|";
////            }
////           deptStr = deptStr.substring(0,deptStr.length()-1);
////        }
////        System.out.println("deptStr"+deptStr);
//
//        String userUrl ="https://qyapi.weixin.qq.com/cgi-bin/user/list?access_token="+token+"&department_id=20&fetch_child=FETCH_CHILD";
//
//        String users = HttpUtil.sendGet(userUrl);
//
//        JSONObject us = JSONObject.parseObject(users);
//
//        JSONArray list = us.getJSONArray("userlist");
//
//        System.out.println("list"+list.size());
//
//    }
}

+ 2 - 2
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -392,7 +392,7 @@ public class WlyyBusinessService {
                        org.setCityName(h.getString("cityName"));
                        org.setTownCode(h.getString("town"));
                        org.setTownName(h.getString("townName"));
                        org.setLevel(h.getInteger("level"));
                        org.setOrgLevel(h.getInteger("level"));
                        org.setType("1");
                        org.setWinNo("-1");
                        org.setDel("1");
@ -407,7 +407,7 @@ public class WlyyBusinessService {
                        org.setCityName(h.getString("cityName"));
                        org.setTownCode(h.getString("town"));
                        org.setTownName(h.getString("townName"));
                        org.setLevel(h.getInteger("level"));
                        org.setOrgLevel(h.getInteger("level"));
                        baseOrgDao.save(org);
                        updateCount++;
                    }

+ 14 - 5
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java

@ -154,7 +154,7 @@ public class BaseOrgDO extends UuidIdentityEntityWithOperator {
    /**
     * 1.等級醫院,2.社區醫院
     */
    private Integer level;
    private Integer orgLevel;
    /**
     * 机构分部号,每个机构都不一样,例如中山医院:6总部7金榜8夏禾 默认1
@ -395,13 +395,22 @@ public class BaseOrgDO extends UuidIdentityEntityWithOperator {
        this.del = del;
    }
//    @Column(name = "org_level")
//    public Integer getLevel() {
//        return level;
//    }
//
//    public void setLevel(Integer level) {
//        this.level = level;
//    }
    @Column(name = "org_level")
    public Integer getLevel() {
        return level;
    public Integer getOrgLevel() {
        return orgLevel;
    }
    public void setLevel(Integer level) {
        this.level = level;
    public void setOrgLevel(Integer orgLevel) {
        this.orgLevel = orgLevel;
    }
    @Column(name = "win_no")

+ 5 - 5
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/org/BaseOrgVO.java

@ -150,7 +150,7 @@ public class BaseOrgVO extends UuidIdentityVOWithOperator {
     * 31三级特等 32三级甲等 33三级乙等 34三级丙级
     */
    @ApiModelProperty(value = "11一级甲等 12一级乙等 13一级丙等二级甲等 22二级乙等 23二级丙等31三级特等 32三级甲等 33三级乙等 34三级丙级", example = "1")
    private Integer level;
    private Integer orgLevel;
    @ApiModelProperty(value = "机构分部号,每个机构都不一样,例如中山医院:6总部7金榜8夏禾", example = "1")
    private String winNo;
@ -301,12 +301,12 @@ public class BaseOrgVO extends UuidIdentityVOWithOperator {
        return depts;
    }
    public Integer getLevel() {
        return level;
    public Integer getOrgLevel() {
        return orgLevel;
    }
    public void setLevel(Integer level) {
        this.level = level;
    public void setOrgLevel(Integer orgLevel) {
        this.orgLevel = orgLevel;
    }
    public void setDepts(List<DictHospitalDeptVO> depts) {

+ 6 - 0
server/svr-authentication/pom.xml

@ -176,6 +176,12 @@
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.3</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <!--<version>RELEASE</version>-->
        </dependency>
    </dependencies>
    <build>

+ 26 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -483,6 +483,17 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        throw new IllegalStateException("验证码发送失败!");
    }
    @RequestMapping(value = "/oauth/sendCaptcha", method = RequestMethod.GET)
    public ResponseEntity<Oauth2Envelop<Captcha>> sendCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
        String wxId = parameters.get("wxId");
        if("xm_ykyy_wx".equals(wxId)){
           return sendYKCaptcha(parameters);
        }else if("xm_zsyy_wx".equals(wxId)){
           return sendZSCaptcha(parameters);
        }
        throw new IllegalStateException("验证码发送失败");
    }
    //眼科医院短信验证码
    @RequestMapping(value = "/oauth/sendYKCaptcha", method = RequestMethod.GET)
    public ResponseEntity<Oauth2Envelop<Captcha>> sendYKCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
@ -1327,5 +1338,20 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        return ObjEnvelop.getError("手机号未注册!");
    }
    @RequestMapping(value = "/oauth/updateDoctorMoble", method = RequestMethod.POST)
    public Envelop updateDoctorMoble(String id,String mobile,String client_id,String captcha){
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
            //验证码正确
        } else {
            return ObjEnvelop.getError("验证码错误!");
        }
        String rs = registerService.updateDoctorMoble(id,mobile);
        if("ok".equals(rs)){
            return ObjEnvelop.getSuccess("修改成功!");
        }
        return ObjEnvelop.getError("手机号未注册!");
    }
}

+ 44 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/FileUploadService.java

@ -5,14 +5,24 @@ import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.exception.business.file_upload.*;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.csource.common.MyException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
@ -188,5 +198,39 @@ public class FileUploadService {
        return uploadVO;
    }
    public String request(String remote_url, MultipartFile file, String type) {
        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
        String result = "";
        try {
            String fileName = file.getOriginalFilename();
            HttpPost httpPost = new HttpPost(remote_url);
            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
            builder.addBinaryBody("file", file.getInputStream(), ContentType.MULTIPART_FORM_DATA, fileName);// 文件流
            builder.addTextBody("filename", fileName);// 类似浏览器表单提交,对应input的name和value
            if (!org.springframework.util.StringUtils.isEmpty(type)) {
                builder.addTextBody("type", type); //发送类型
            }
            HttpEntity entity = builder.build();
            httpPost.setEntity(entity);
            HttpResponse response = httpClient.execute(httpPost);// 执行提交
            HttpEntity responseEntity = response.getEntity();
            if (responseEntity != null) {
                // 将响应内容转换为字符串
                result = EntityUtils.toString(responseEntity, Charset.forName("UTF-8"));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                httpClient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return result;
    }
}

+ 56 - 10
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthYlzConfigService.java

@ -1,6 +1,8 @@
package com.yihu.jw.security.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.restmodel.iot.common.UploadVO;
@ -20,8 +22,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Encoder;
import java.io.InputStream;
@ -47,6 +51,15 @@ public class OauthYlzConfigService {
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @Value("${testPattern.sign}")
    private String isClose;
    @Value("${testPattern.remote_inner_url}")
    private String remote_inner_url;
    @Autowired
    private ObjectMapper objectMapper;
    public Map<String,Object> getOauthQRCode(){
        try {
            OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("ylz_config");
@ -63,26 +76,54 @@ public class OauthYlzConfigService {
            bizContent.put("out_authorize_no", no);
            bizContent.put("out_authorize_time", DateUtils.getOutTradeTime());
            e.setBiz_content(JSON.toJSONString(bizContent));
            String param = com.alibaba.fastjson.JSONObject.toJSONString(e);
            logger.info("TransRequest :"+param);
            EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl(), oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey());
            TransResponse re = ehcHandler.execute(e);
            String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
            logger.info("TransResponse:"+rs);
            logger.info("TransResponse :"+rs);
            com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
            com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");
            InputStream qrcode = QrcodeUtil.createQrcode(biz.getString("ehealth_authurl"),300,"jpg");
            logger.info("fastdfs_file_url:"+fastdfs_file_url);
            UploadVO uploadVO = fileUploadService.uploadStream(qrcode,"qrcode.jpg",fastdfs_file_url);
            Map<String,Object> map = new HashedMap();
            map.put("fileName",uploadVO.getFileName());
            map.put("fileType",uploadVO.getFileType());
            map.put("fullUrl",uploadVO.getFullUrl());
            map.put("fullUri",uploadVO.getFullUri());
            map.put("out_authorize_no",no);
            logger.info("fileUploadService:"+map.toString());
            if(isClose.equals("2")){
                //内网上传
                MultipartFile file = new MockMultipartFile("qrcode.jpg","qrcode.jpg","qrcode.jpg",qrcode);
                String rsJson = fileUploadService.request(remote_inner_url,file,null);
                logger.info("内网上传"+rsJson);
                JSONObject uploadJson = JSON.parseObject(rsJson);
                UploadVO uploadVO = objectMapper.readValue(uploadJson.getJSONObject("obj").toJSONString(),UploadVO.class);
                map.put("fileName",uploadVO.getFileName());
                map.put("fileType",uploadVO.getFileType());
                map.put("fullUrl",uploadVO.getFullUrl());
                map.put("fullUri",uploadVO.getFullUri());
                map.put("out_authorize_no",no);
                logger.info("fileUploadService:"+map.toString());
            }else {
                // 得到文件的完整名称  xxx.txt
                logger.info("fastdfs_file_url:"+fastdfs_file_url);
                UploadVO uploadVO = fileUploadService.uploadStream(qrcode,"qrcode.jpg",fastdfs_file_url);
                map = new HashedMap();
                map.put("fileName",uploadVO.getFileName());
                map.put("fileType",uploadVO.getFileType());
                map.put("fullUrl",uploadVO.getFullUrl());
                map.put("fullUri",uploadVO.getFullUri());
                map.put("out_authorize_no",no);
                logger.info("fileUploadService:"+map.toString());
            }
            return map;
        } catch (Exception var5) {
            logger.info("获取电子健康卡图片异常");
            var5.printStackTrace();
        }
@ -92,7 +133,7 @@ public class OauthYlzConfigService {
    public Map<String,Object> getOauthQRCodeImg(){
        try {
            logger.info("getOauthQRCodeImg dao1:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
            OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("ylz_config");
            OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findOne("ylz_config1");
            logger.info("getOauthQRCodeImg dao2:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
            TransRequest e = new TransRequest();
            e.setMethod("ehc.ehealthcard.authurl");
@ -107,10 +148,15 @@ public class OauthYlzConfigService {
            bizContent.put("out_authorize_no", no);
            bizContent.put("out_authorize_time", DateUtils.getOutTradeTime());
            e.setBiz_content(JSON.toJSONString(bizContent));
            String param = com.alibaba.fastjson.JSONObject.toJSONString(e);
            logger.info("TransRequest :"+param);
            EhcHandler ehcHandler = new EhcHandler(oauthYlzConfigDO.getUrl(), oauthYlzConfigDO.getAppId(), oauthYlzConfigDO.getTermId(), oauthYlzConfigDO.getAppKey());
            TransResponse re = ehcHandler.execute(e);
            String rs = com.alibaba.fastjson.JSONObject.toJSONString(re);
            logger.info("TransResponse:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS")+" "+rs);
            com.alibaba.fastjson.JSONObject json = (com.alibaba.fastjson.JSONObject) com.alibaba.fastjson.JSONObject.parse(rs);
            com.alibaba.fastjson.JSONObject biz = json.getJSONObject("biz_content");

+ 8 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/RegisterService.java

@ -151,6 +151,14 @@ public class RegisterService {
        return "ok";
    }
    public String updateDoctorMoble(String id,String mobile){
        BaseDoctorDO doctorDO = baseDoctorDao.findOne(id);
        //认证信息设置
        doctorDO.setMobile(mobile);
        baseDoctorDao.save(doctorDO);
        return "ok";
    }
    public String randomString(int length) {
        String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuffer buffer = new StringBuffer();

+ 20 - 1
server/svr-authentication/src/main/resources/application.yml

@ -64,6 +64,10 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
spring:
  profiles: jwtest
@ -83,6 +87,10 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
spring:
  profiles: jwprod
@ -102,6 +110,10 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://192.0.33.26:22122
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
## 心脏中心外网
spring:
@ -122,7 +134,10 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.16.100.240:22122
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 2
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
## 卫计委
spring:
@ -143,3 +158,7 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://192.168.103.159:22122
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 1
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/activemq/MessageManager.java

@ -16,7 +16,7 @@ import java.util.regex.Pattern;
/**
 * Component - ActiveMQ消息订阅初始化
 * Created by progr1mmer on 2018/8/30.
 * Created by progr1mmer on 2018/8/30
 */
@Component
public class MessageManager {

+ 30 - 30
svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleDao.java

@ -1,30 +1,30 @@
package com.yihu.jw.base.dao.doctor;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Set;
/**
 * 
 * 医生与业务模块角色关联信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月25日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseDoctorRoleDao extends PagingAndSortingRepository<BaseDoctorRoleDO, Integer>, JpaSpecificationExecutor<BaseDoctorRoleDO>  {
    @Query("select id from BaseDoctorRoleDO where doctorCode = ?1")
    Set<Object> findIdListByDoctorCode(String doctorCode);
    List<BaseDoctorRoleDO> findByDoctorCode(String doctorCode);
}
//package com.yihu.jw.base.dao.doctor;
//
//import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.jpa.repository.Query;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
//import java.util.List;
//import java.util.Set;
//
//
///**
// *
// * 医生与业务模块角色关联信息 数据库访问层
// *
// * @version
// * <pre>
// * Author	Version		Date		Changes
// * litaohong 	1.0  		2018年10月25日 	Created
// *
// * </pre>
// * @since 1.
// */
//public interface BaseDoctorRoleDao extends PagingAndSortingRepository<BaseDoctorRoleDO, Integer>, JpaSpecificationExecutor<BaseDoctorRoleDO>  {
//
//    @Query("select id from BaseDoctorRoleDO where doctorCode = ?1")
//    Set<Object> findIdListByDoctorCode(String doctorCode);
//
//    List<BaseDoctorRoleDO> findByDoctorCode(String doctorCode);
//}

+ 8 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/dao/doctor/BaseDoctorRoleInfoDao.java

@ -1,9 +1,14 @@
package com.yihu.jw.base.dao.doctor;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Set;
/**
 * 
@ -21,7 +26,9 @@ public interface BaseDoctorRoleInfoDao extends PagingAndSortingRepository<BaseDo
    BaseDoctorRoleInfoDO findBySaasidAndName(String saasId,String name);
    BaseDoctorRoleInfoDO findByCode(String code);
    boolean existsByCode(String code);
    BaseDoctorRoleInfoDO findByCode(String code);
}

+ 1 - 19
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleInfoService.java

@ -5,36 +5,18 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.contant.CommonContant;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
import com.yihu.jw.base.dao.doctor.BaseModuleRoleDao;
import com.yihu.jw.base.dao.role.BaseRoleMenuDao;
import com.yihu.jw.base.dao.role.RoleDao;
import com.yihu.jw.base.dao.saas.SaasDao;
import com.yihu.jw.base.dao.user.UserDao;
import com.yihu.jw.base.service.module.SaasModuleService;
import com.yihu.jw.base.service.org.BaseOrgSaasService;
import com.yihu.jw.base.service.org.BaseOrgUserService;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.service.org.OrgTreeService;
import com.yihu.jw.base.service.role.BaseRoleMenuService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleInfoDO;
import com.yihu.jw.entity.base.doctor.BaseModuleRoleDO;
import com.yihu.jw.entity.base.module.ModuleDO;
import com.yihu.jw.entity.base.module.SaasModuleDO;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
import com.yihu.jw.entity.base.role.RoleDO;
import com.yihu.jw.entity.base.saas.SaasDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.restmodel.base.module.ModuleVO;
import com.yihu.jw.restmodel.base.module.SaasModuleVO;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

+ 2 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorRoleService.java

@ -1,6 +1,7 @@
package com.yihu.jw.base.service.doctor;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;

+ 0 - 10
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -4,10 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.dict.DictJobTitleDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
import com.yihu.jw.base.service.dict.DictDoctorDutyService;
import com.yihu.jw.base.service.dict.DictHospitalDeptService;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.service.org.OrgTreeService;
@ -36,7 +33,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.*;
/**
@ -85,12 +81,6 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    @Autowired
    private DictDoctorDutyService dictDoctorDutyService;
    @Autowired
    private DictHospitalDeptService dictHospitalDeptService;
    @Autowired
    private BaseDoctorRoleDao doctorRoleDao;
    @Autowired
    private BaseDoctorRoleInfoDao doctorRoleInfoDao;
    /**

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/excelImport/BaseDoctorExcelDOReader.java

@ -6,6 +6,7 @@ import com.yihu.jw.base.dao.doctor.BaseDoctorRoleInfoDao;
import com.yihu.jw.base.endpoint.common.excel.AExcelReader;
import com.yihu.jw.dict.dao.DictDoctorDutyDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.org.dao.BaseOrgDao;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;

+ 1 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/service/team/BaseTeamMemberService.java

@ -1,13 +1,11 @@
package com.yihu.jw.base.service.team;
import com.yihu.jw.base.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.base.dao.team.BaseTeamMemberDao;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.team.BaseTeamMemberDO;
import java.util.ArrayList;
import java.util.HashSet;

+ 13 - 3
svr/svr-base/src/main/resources/application.yml

@ -111,7 +111,10 @@ hospital:
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
wlyy:
  url: http://ehr.yihu.com/wlyy/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040
---
spring:
  profiles: jwtest
@ -147,7 +150,10 @@ hospital:
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
wlyy:
  url: http://ehr.yihu.com/wlyy/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040
---
spring:
  profiles: jwprod
@ -180,4 +186,8 @@ hospital:
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
  TargetSysCode: S01
wlyy:
  url: http://ehr.yihu.com/wlyy/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040

+ 1 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/file_upload/FileUploadEndpoint.java

@ -61,6 +61,7 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
        UploadVO uploadVO = new UploadVO();
        // 得到文件的完整名称  xxx.txt
        String originalFilename = file.getOriginalFilename();
        InputStream inputStream = file.getInputStream();
        uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);

+ 11 - 1
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -32,7 +32,7 @@ spring:
      min-idle: 5  # 连接池中的最小空闲连接
fast-dfs:
  tracker-server: 172.26.0.110:22122 #服务器地址
#  tracker-server: 172.26.0.110:22122 #服务器地址
  connect-timeout: 2 #链接超时时间
  network-timeout: 30
  charset: ISO8859-1 #编码
@ -86,6 +86,8 @@ im:
  data_base_name: im_internet_hospital
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
@ -116,6 +118,8 @@ im:
  data_base_name: im_internet_hospital
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
@ -143,6 +147,8 @@ im:
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.0.33.26:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
@ -179,6 +185,8 @@ im:
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.0.33.26:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
@ -209,6 +217,8 @@ im:
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.168.103.159:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0

+ 2 - 6
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/config/DoctorServiceEndPoint.java

@ -1,7 +1,6 @@
package com.yihu.jw.hospital.endpoint.config;
import com.yihu.jw.doctor.service.BaseDoctorService;
import com.yihu.jw.entity.base.doctor.BaseDoctorVo;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
@ -13,9 +12,6 @@ import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 * @author zmk
 * @vsrsion 1.0
@ -27,7 +23,7 @@ import java.util.Map;
public class DoctorServiceEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseDoctorService baseDoctorService;
    private BaseDoctorInfoService baseDoctorService;

+ 7 - 5
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -2,7 +2,7 @@ package com.yihu.jw.hospital.endpoint.patient;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dict.service.BaseDictJobTitleService;
import com.yihu.jw.doctor.service.BaseDoctorService;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.dict.DictJobTitleDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
@ -33,7 +33,7 @@ import java.util.Map;
/**
 * @author zmk
 * 患者不用登陆访问居民PC端控制类
 * Created at 2019/12/25
 * Created at 2019/12/25。
 */
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.PatientNoLogin.PREFIX)
@ -52,13 +52,15 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseDictJobTitleService baseDictJobTitleService;
    @Autowired
    private BaseDoctorService baseDoctorService;
    private BaseDoctorInfoService baseDoctorService;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
    public ListEnvelop findDoctorByHospitalAndDiseaseAndDept(@ApiParam(name = "orgCode", value = "机构code")
    public ListEnvelop findDoctorByHospitalAndDiseaseAndDept(@ApiParam(name = "iswork", value = "是否过滤排班,1是")
                                                             @RequestParam(value = "iswork", required = true)String iswork,
                                                             @ApiParam(name = "orgCode", value = "机构code")
                                                             @RequestParam(value = "orgCode", required = true,defaultValue = "350211A1002")String orgCode,
                                                             @ApiParam(name = "dept", value = "部门code")
                                                             @RequestParam(value = "dept", required = false)String dept,
@ -87,7 +89,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    ) throws Exception{
        logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
        return success(prescriptionService.findDoctorByHospitalAndDiseaseAndDept(null,null,
        return success(prescriptionService.findDoctorByHospitalAndDiseaseAndDept(iswork,null,
                orgCode,dept,
                diseaseKey,doctorNameKey,
                jobTitleNameKey,outpatientType,

+ 23 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -481,12 +481,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "chargeType", required = false)String chargeType,
                                         @ApiParam(name = "nameKey", value = "名字关键字")
                                         @RequestParam(value = "nameKey", required = false)String nameKey,
                                         @ApiParam(name = "iswork", value = "不传全部,1.当月已经排班,2.当月未排班")
                                         @RequestParam(value = "iswork", required = false)String iswork,
                                         @ApiParam(name = "page", value = "第几页")
                                         @RequestParam(value = "page", required = true)Integer page,
                                         @ApiParam(name = "size", value = "每页大小")
                                         @RequestParam(value = "size", required = true)Integer size) {
        return success(prescriptionService.findDoctorWithMouthWork(orgCode,dept,chargeType,date,nameKey,page,size));
        return success(prescriptionService.findDoctorWithMouthWork(orgCode,dept,chargeType,date,nameKey,iswork,page,size));
    }
@ -618,7 +620,26 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                           @RequestParam(value = "redirectUrl", required = true)String redirectUrl) {
        return success(xzzxEntranceService.sendMes(wxId,patient,cardNo,first,noticeContent,remark,redirectUrl));
    }
    @PostMapping(value = "/sendXCXMes")
    @ApiOperation(value = "心脏模板消息推送小程序跳转", notes = "心脏模板消息推送小程序跳转")
    public Envelop sendXCXMes(@ApiParam(name = "wxId", value = "wxId")
                           @RequestParam(value = "wxId", required = true)String wxId,
                           @ApiParam(name = "patient", value = "居民ID")
                           @RequestParam(value = "patient", required = false)String patient,
                           @ApiParam(name = "cardNo", value = "卡号")
                           @RequestParam(value = "cardNo", required = false)String cardNo,
                           @ApiParam(name = "first", value = "头部")
                           @RequestParam(value = "first", required = true)String first,
                           @ApiParam(name = "noticeContent", value = "内容")
                           @RequestParam(value = "noticeContent", required = true)String noticeContent,
                           @ApiParam(name = "remark", value = "备注")
                           @RequestParam(value = "remark", required = true)String remark,
                           @ApiParam(name = "redirectUrl", value = "跳转链接")
                           @RequestParam(value = "redirectUrl", required = true)String miniProgramPagepath,
                           @ApiParam(name = "miniProgramAppId", value = "APPID")
                           @RequestParam(value = "miniProgramAppId", required = true)String miniProgramAppId  ) {
        return success(xzzxEntranceService.sendXCXMes( wxId, patient, cardNo, first, noticeContent, remark, miniProgramPagepath, miniProgramAppId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientInfo)
    @ApiOperation(value = "获取居民信息接口", notes = "获取居民信息接口")

+ 5 - 2
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/SpecialistScreenResultController.java

@ -35,9 +35,12 @@ public class SpecialistScreenResultController extends EnvelopRestEndpoint {
    public MixEnvelop<SurveyScreenResultVo, SurveyScreenResultVo> createSpecialistPatientRelation(@ApiParam(name = "doctor", value = "专科医生ID")@RequestParam(value = "doctor")String doctor,
                                                                            @ApiParam(value = "当前页")@RequestParam(value = "pageNo") int pageNo,
                                                                            @ApiParam(value = "显示记录数")@RequestParam(value = "pageSize") int pageSize,
                                                                            @ApiParam(value = "1已跟踪 2已预约 3已接诊 4待处理")@RequestParam(value = "type",required = false) int type){
                                                                            @ApiParam(value = "搜索居民的姓名或身份证") @RequestParam(value = "patientName", required = false) String patientName,
                                                                            @ApiParam(value = "1已跟踪 2已预约 3已接诊 4待处理")@RequestParam(value = "type",required = false) Integer type,
                                                                            @ApiParam(value = "是否高危预警(0否 1是)") @RequestParam(value = "isDanger", required = false) String isDanger,
                                                                            @ApiParam(value = "疾病类型") @RequestParam(value = "diseaseType", required = false) String diseaseType){
        try {
            return specialistScreenResultService.getScreenList(doctor,type,pageNo,pageSize);
            return specialistScreenResultService.getScreenList(doctor,type,pageNo,pageSize,patientName, isDanger, diseaseType);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());

File diff suppressed because it is too large
+ 37 - 4
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/SpecialistScreenResultService.java