Ver código fonte

关注医生接口完善、获取获取处方信息、取药地址

mengkang 4 anos atrás
pai
commit
40386a1365
15 arquivos alterados com 660 adições e 20 exclusões
  1. 14 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorPatientDao.java
  2. 227 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 81 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  4. 7 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  5. 90 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/useragent/BaseUserAgent.java
  6. 2 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BaseDoctorPatientFollowDao.java
  7. 74 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorPatientDO.java
  8. 13 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  9. 33 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorVO.java
  10. 33 0
      common/common-util/src/main/java/com/yihu/jw/util/common/LatitudeUtils.java
  11. 7 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/sync/BaseSyncDataService.java
  12. 7 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  13. 3 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  14. 32 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  15. 37 4
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java

+ 14 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorPatientDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.doctor.dao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorPatientDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/6/1
 */
public interface BaseDoctorPatientDao extends PagingAndSortingRepository<BaseDoctorPatientDO, String>, JpaSpecificationExecutor<BaseDoctorPatientDO> {
}

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

@ -5,10 +5,13 @@ 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.dao.BaseDoctorPatientDao;
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;
import com.yihu.jw.entity.base.doctor.BaseDoctorPatientDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorVo;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
@ -41,6 +44,7 @@ import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.useragent.BaseUserAgent;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
@ -49,6 +53,7 @@ import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.hospital.archive.ArchiveVO;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
@ -56,7 +61,10 @@ import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.WebserviceUtil;
@ -187,6 +195,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private PrescriptionEmrDao prescriptionEmrDao;
    @Autowired
    private WlyyConsultAdviceDao wlyyConsultAdviceDao;
    @Autowired
    private BaseDoctorPatientDao baseDoctorPatientDao;
    @Autowired
    private BaseUserAgent userAgent;
    @Value("${demo.flag}")
@ -2944,9 +2957,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
//            //协同门诊量
//            Integer coordinationCout = outpatientDao.countByDoctorAndStatusAndOutpatientType(doctor,"2","2");
//            rs.put("coordinationCout",coordinationCout);
            //医生关注
            List<BaseDoctorPatientFollowDO> doctorPatientFollowDOS = baseOrgPatientDao.findByDoctor(doctor);
            if (doctorPatientFollowDOS!=null&&doctorPatientFollowDOS.size()>0){
                rs.put("attention","1");
            }else {
                rs.put("attention","0");
            }
    
            //专家咨询
            String zjCountsql = "SELECT id AS \"id\" FROM wlyy_consult_team WHERE doctor='"+doctor+"' AND (type=1 OR type=15)";
            List<Map<String,Object>> zjList = jdbcTemplate.queryForList(zjCountsql);
@ -3575,7 +3594,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<Map<String,Object>> findDoctorByHospitalAndDiseaseAndDept(String iswork,String patientid,String orgCode, String dept,
                                                                          String diseaseKey, String doctorNameKey,
                                                                          String jobTitleNameKey, String outpatientType,
                                                                          String keyName, String workingTime, String consultStatus,String chargType,String consutlSort,Integer page,Integer pagesize) {
                                                                          String keyName, String workingTime, String consultStatus,String chargType,String consutlSort,String isAttention,Integer page,Integer pagesize) {
      /*  if(page >=1){
            page --;
@ -3599,14 +3618,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " d.outpatient_type AS \"outpatientType\"," +
                " a.total AS \"consultTotal\"," +
                " h.org_name AS \"orgName\"," +
                " follow.patient AS \"followid\"," +
                " h.org_code AS \"orgCode\"" +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id "+
                " Left join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient='"+patientid+"'"+
                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 2 GROUP BY doctor ) a on a.doctor = d.id ";
        if (isAttention.equalsIgnoreCase("1")){
            sql+="Left join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='"+patientid+"' ";
        }
        if (isAttention.equalsIgnoreCase("0")) {
            sql += "Left join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient !='" + patientid + "' ";
        }
        if(StringUtils.isNotBlank(diseaseKey)){
            sql+=" left join wlyy_doctor_special_disease sp on d.id = sp.doctor_code ";
        }
@ -5675,7 +5698,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    
    /**
     * 保存排班规则
     * @param workRoleJsons
     * @param advicesJson
     * @return
     */
    public Boolean sendOutPatientSuggest(String advicesJson){
@ -5692,4 +5715,203 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<WlyyConsultAdvice> getConsultSuggest(String consultcode) {
        return wlyyConsultAdviceDao.getByConsult(consultcode);
    }
    /**
     * 关注医生
     * @param doctorId
     * @return
     */
//    public Envelop attentionDoctor(String doctorId){
//        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctorId);
//        if (doctorDO==null){
//            return Envelop.getError("医生不存在");
//        }
//        BaseDoctorPatientDO doctorPatientDO = new BaseDoctorPatientDO();
//        doctorPatientDO.setDoctorCode(doctorId);
//        doctorPatientDO.setDoctorName(doctorDO.getName());
//        String uid = userAgent.getUID();
//        BasePatientDO patientDO = basePatientDao.findById(uid);
//        if (patientDO==null){
//            return ObjEnvelop.getError("患者不存在");
//        }
//        doctorPatientDO.setPatientCode(uid);
//        doctorPatientDO.setPatientName(patientDO.getName());
//        doctorPatientDO.setStatus(1);
//        baseDoctorPatientDao.save(doctorPatientDO);
//        return ObjEnvelop.getSuccess("关注成功");
//    }
    /**
     *查询患者关注的医生
     * @param keyWord
     * @param outPatient
     * @param jobTitleCode
     * @param shift
     * @param page
     * @param pagesize
     * @return
     */
//    public PageEnvelop findAllAttentionDoctor(String keyWord, Integer outPatient, String jobTitleCode, Integer shift, Integer page, Integer pagesize) {
//        StringBuffer sql = new StringBuffer("SELECT DISTINCT\n" +
//                "\tc.*, e.org_name,\n" +
//                "\te.dept_name,\n" +
//                "\tIFNULL(k.disease_name,NULL)\n" +
//                "\tdisease_name\n" +
//                "FROM\n" +
//                "\tbase_doctor c\n" +
//                "RIGHT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\tdoctor_code\n" +
//                "\tFROM\n" +
//                "\t\tbase_doctor_paitent\n" +
//                "\tWHERE\n" + " patient_code = '"+userAgent.getUID()+"'\n" +
//                " ) d ON c.id = d.doctor_code\n" +
//                "LEFT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\t*\n" +
//                "\tFROM\n" +
//                "\t\twlyy_doctor_special_disease\n" +
//                ") k ON k.doctor_code = c.id\n" +
//                "LEFT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\t*\n" +
//                "\tFROM\n" +
//                "\t\tbase_doctor_hospital\n" +
//                ") e ON e.doctor_code = c.id");
//        StringBuffer countSql = new StringBuffer("SELECT DISTINCT\n" +
//                "\tc.*, e.org_name,\n" +
//                "\te.dept_name,\n" +
//                "\tk.disease_name\n" +
//                "FROM\n" +
//                "\tbase_doctor c\n" +
//                "RIGHT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\tdoctor_code\n" +
//                "\tFROM\n" +
//                "\t\tbase_doctor_paitent\n" +
//                "\tWHERE\n" + " patient_code = '"+userAgent.getUID()+"'\n" +
//                " ) d ON c.id = d.doctor_code\n" +
//                "LEFT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\t*\n" +
//                "\tFROM\n" +
//                "\t\twlyy_doctor_special_disease\n" +
//                ") k ON k.doctor_code = c.id\n" +
//                "LEFT JOIN (\n" +
//                "\tSELECT\n" +
//                "\t\t*\n" +
//                "\tFROM\n" +
//                "\t\tbase_doctor_hospital\n" +
//                ") e ON e.doctor_code = c.id");
//
//        if (shift==1){
//            sql.append(" JOIN (\n" +
//                    "\tSELECT\n" +
//                    "\t\t*\n" +
//                    "\tFROM\n" +
//                    "\t\tbase_doctor_hospital\n" +
//                    "\tWHERE\n" +
//                    "\t\tdept_name = '发热门诊'\n" +
//                    ") h ON h.doctor_code = c.id ");
//            countSql.append(" JOIN (\n" +
//                    "\tSELECT\n" +
//                    "\t\t*\n" +
//                    "\tFROM\n" +
//                    "\t\tbase_doctor_hospital\n" +
//                    "\tWHERE\n" +
//                    "\t\tdept_name = '发热门诊'\n" +
//                    ") h ON h.doctor_code = c.id ");
//        }
//        if (StringUtils.isNotEmpty(jobTitleCode)){
//            sql.append(" AND c.job_title_code =").append(jobTitleCode);
//            countSql.append(" AND c.job_title_code =").append(jobTitleCode);
//        }
//        if (outPatient==1){
//            sql.append(" JOIN (\n" +
//                    "\tSELECT DISTINCT\n" +
//                    "\t\t*\n" +
//                    "\tFROM\n" +
//                    "\t\twlyy_doctor_work_time\n" +
//                    "\tGROUP BY\n" +
//                    "\t\tdoctor\n" +
//                    ") f ON f.doctor = c.id");
//            countSql.append(" JOIN (\n" +
//                    "\tSELECT DISTINCT\n" +
//                    "\t\t*\n" +
//                    "\tFROM\n" +
//                    "\t\twlyy_doctor_work_time\n" +
//                    "\tGROUP BY\n" +
//                    "\t\tdoctor\n" +
//                    ") f ON f.doctor = c.id");
//        }
//        if(StringUtils.isNotEmpty(keyWord)){
//            sql.append(" WHERE\n" +
//                    "\t(\n" +
//                    " c.`name` LIKE  '%"+keyWord+"%'" +
//                    " OR e.dept_name LIKE '%"+keyWord+"%' " +
//                    " OR e.org_name LIKE  '%"+keyWord+"%'" +
//                    " OR c.expertise LIKE  '%"+keyWord+"%'" +
//                    " OR c.introduce LIKE  '%"+keyWord+"%'" +
//                    " OR k.disease_name LIKE  '%"+keyWord+"%'" +
//                    ") ");
//            countSql.append(" WHERE\n" +
//                    "\t(\n" +
//                    " c.`name` LIKE  '%"+keyWord+"%'" +
//                    " OR e.dept_name LIKE '%"+keyWord+"%' " +
//                    " OR e.org_name LIKE  '%"+keyWord+"%'" +
//                    " OR c.expertise LIKE  '%"+keyWord+"%'" +
//                    " OR c.introduce LIKE  '%"+keyWord+"%'" +
//                    " OR k.disease_name LIKE  '%"+keyWord+"%'" +
//                    ") ");
//        }
//        countSql.append(" GROUP BY c.id");
//        List<Map<String, Object>> countList = jdbcTemplate.queryForList(countSql.toString());
//        long count=countList.size();
//
//        sql.append(" ORDER BY C.update_time LIMIT ").append((page-1)*pagesize).append(",").append(pagesize);
//
//        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql.toString());
//        List<BaseDoctorVO> list = new ArrayList<>();
//
//        mapList.forEach(one->{
//            String json = com.alibaba.fastjson.JSONObject.toJSONString(one);
//            BaseDoctorDO doctorDO = com.alibaba.fastjson.JSONObject.parseObject(json, BaseDoctorDO.class);
//            BaseDoctorVO doctorVO = convertToModel(doctorDO, BaseDoctorVO.class);
//            if (one.get("org_name")!=null&&StringUtils.isNotEmpty(one.get("org_name").toString())){
//                doctorVO.setHospital(one.get("org_name").toString());
//            }
//            if(one.get("dept_name")!=null&&StringUtils.isNotEmpty(one.get("dept_name").toString())){
//                ArrayList<String> deptList = new ArrayList<>();
//                deptList.add(one.get("dept_name").toString());
//                doctorVO.setDepartment(deptList);
//            }
//            if (one.get("disease_name")!=null&&StringUtils.isNotEmpty(one.get("disease_name").toString())){
//                ArrayList<String> disList = new ArrayList<>();
//                disList.add(one.get("disease_name").toString());
//                doctorVO.setDisease(disList);
//            }
//
//            if (list!=null&&list.size()>0){
//                list.forEach(tow->{
//                    if (doctorVO.getId().equalsIgnoreCase(tow.getId())){
//                        if (tow.getDepartment()!=null&&StringUtils.isNotEmpty(tow.getDepartment().get(0))){
//                            doctorVO.getDepartment().add(tow.getDepartment().get(0));
//                        }
//                        if (tow.getDisease()!=null&&StringUtils.isNotEmpty(tow.getDisease().get(0))){
//                            doctorVO.getDisease().add(tow.getDisease().get(0));
//                        }
//                        list.remove(tow);
//                    }
//                });
//            }
//
//            list.add(doctorVO);
//        });
//
//
//
//        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,pagesize,count);
//    }
}

+ 81 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
@ -26,6 +27,7 @@ import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.useragent.BaseUserAgent;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
@ -33,6 +35,10 @@ import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
@ -42,6 +48,7 @@ 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.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.lang.Boolean;
@ -83,6 +90,9 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    private BasePatientWechatDao patientWechatDao;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private BaseUserAgent userAgent;
    @Value("${demo.flag}")
@ -517,5 +527,76 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        return array;
    }
    /**
     * 查询患者所有处方信息
     * @param page
     * @param size
     * @return
     */
    public PageEnvelop findPatientAllPrescription(String keyName,String status,Integer page, Integer size) {
        String uid = userAgent.getUID();
        StringBuffer sql = new StringBuffer("select a.* from wlyy_prescription a,wlyy_prescription_info b where a.patient_code ='");
        StringBuffer countSql = new StringBuffer("select COUNT(a.id) count from wlyy_prescription a,wlyy_prescription_info b  where a.patient_code ='");
        sql.append(uid).append("' and a.status >= 0 AND a.id = b.prescription_id");
        countSql.append(uid).append("' and a.status >= 0 AND a.id = b.prescription_id ");
        if (StringUtils.isNotEmpty(keyName)){
            sql.append(" AND (" +
                    " a.doctor_name LIKE '%"+keyName+"%' " +
                    " OR a.dept_name LIKE'%"+keyName+"%' " +
                    " OR a.hospital_name LIKE '%"+keyName+"%' " +
                    " OR b.drug_name LIKE '%"+keyName+"%' " +
                    " OR a.real_order LIKE '%"+keyName+"%' " +
                    ")");
            countSql.append(" AND (" +
                    " a.doctor_name LIKE '%"+keyName+"%' " +
                    " OR a.dept_name LIKE'%"+keyName+"%' " +
                    " OR a.hospital_name LIKE '%"+keyName+"%' " +
                    " OR b.drug_name LIKE '%"+keyName+"%' " +
                    " OR a.real_order LIKE '%"+keyName+"%' " +
                    ")");
        }
        if (StringUtils.isNotEmpty(status)){
            sql.append(" AND a.`status`=").append(status);
            countSql.append(" AND a.`status`=").append(status);
        }
        sql.append(" order by a.prescribe_time limit ").append((page-1)*size).append(",").append(size);
        List<WlyyPrescriptionDO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionDO.class));
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
        long count = Long.parseLong(mapList.get(0).get("count").toString());
        logger.info("sql="+sql.toString());
        logger.info("countSql="+countSql.toString());
        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find,list,page,size,count);
    }
    /**
     * 查询取药地址
     * @param outpatientId
     * @param longitude
     * @param dimension
     * @return
     */
    public MixEnvelop findDrugAddress(String outpatientId, String longitude, String dimension) {
        String sql="SELECT\n" +
                "\ta.*\n" +
                "FROM\n" +
                "\tbase_org a\n" +
                "LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tc.*\n" +
                "\tFROM\n" +
                "\t\twlyy_prescription_expressage c\n" +
                "\tWHERE\n" +
                " c.outpatient_id = '"+outpatientId+"'" +
                " ) d ON a.`code` = d.hospital_code";
        BaseOrgDO baseOrgDO = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BaseOrgDO.class)).get(0);
        Map<String, String> rs = new HashMap<>();
        rs.put("hospital",baseOrgDO.getName());
        rs.put("address",baseOrgDO.getAddress());
        String distance = LatitudeUtils.getDistance(longitude, dimension, baseOrgDO.getLongitude(), baseOrgDO.getLatitude());
        rs.put("distance",distance);
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find,rs);
    }
}

+ 7 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -1753,7 +1753,10 @@ public class EntranceService {
            JSONArray jsonObjectMgsInfo = (JSONArray) jsonObject.get("MsgInfo");
            if (null != jsonObjectMgsInfo) {
                for (Object object : jsonObjectMgsInfo) {
                    net.sf.json.JSONObject jsonArraySub = (net.sf.json.JSONObject) object;
                    JSONArray jsonArray = JSONArray.fromObject(object);
                    net.sf.json.JSONObject jsonArraySub = jsonArray.getJSONObject(0);
//                    net.sf.json.JSONObject jsonArraySub = (net.sf.json.JSONObject) object;
                    jsonObjectMgsInfo = (JSONArray) jsonArraySub.get("body");
                    if (jsonObjectMgsInfo instanceof JSONArray) {
                        for (Object objectSub : jsonObjectMgsInfo) {
@ -2313,7 +2316,9 @@ public class EntranceService {
            JSONArray jsonObjectMgsInfo = (JSONArray) jsonObject.get("MsgInfo");
            if (null != jsonObjectMgsInfo) {
                for (Object object : jsonObjectMgsInfo) {
                    net.sf.json.JSONObject jsonArraySub = (net.sf.json.JSONObject) object;
                    JSONArray jsonArray = JSONArray.fromObject(object);
                    net.sf.json.JSONObject jsonArraySub = jsonArray.getJSONObject(0);
//                    net.sf.json.JSONObject jsonArraySub = (net.sf.json.JSONObject) object;
                    jsonObjectMgsInfo = (JSONArray) jsonArraySub.get("body");
                    if (jsonObjectMgsInfo instanceof JSONArray) {
                        for (Object objectSub : jsonObjectMgsInfo) {

+ 90 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/useragent/BaseUserAgent.java

@ -0,0 +1,90 @@
package com.yihu.jw.hospital.prescription.service.useragent;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
 * 用户头部信息获取
 * Created by Trick on 2018/10/30.
 */
@Component
public class BaseUserAgent {
    /**
     * 获取当前登录人ID
     * @return
     */
    public String getUID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("uid");
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取登录人姓名
     * @return
     */
    public String getUNAME(){
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            String info = json.getString("uname");
            String uname = java.net.URLDecoder.decode(info,"UTF-8");
            return uname;
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取角色ID
     * @return
     */
    public String getROLEID() {
        try {
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = JSON.parseObject(userAgent);
            return json.getString("roleid");
        } catch (Exception e) {
            return null;
        }
    }
    public JSONObject getUserAgent(){
        try{
            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            String userAgent = request.getHeader("userAgent");
            JSONObject user = JSON.parseObject(userAgent);
            return user;
        }catch (Exception e){
            return null;
        }
    }
}

+ 2 - 0
business/base-service/src/main/java/com/yihu/jw/patient/dao/BaseDoctorPatientFollowDao.java

@ -13,4 +13,6 @@ import java.util.List;
public interface BaseDoctorPatientFollowDao extends PagingAndSortingRepository<BaseDoctorPatientFollowDO, String>, JpaSpecificationExecutor<BaseDoctorPatientFollowDO> {
	
	List<BaseDoctorPatientFollowDO> findByDoctorAndPatient(String doctor, String patient);
	List<BaseDoctorPatientFollowDO> findByDoctor(String doctorId);
}

+ 74 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorPatientDO.java

@ -0,0 +1,74 @@
package com.yihu.jw.entity.base.doctor;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/6/1
 */
@Entity
@Table(name = "base_doctor_paitent")
public class BaseDoctorPatientDO extends UuidIdentityEntityWithOperator {
    @Column(name = "doctor_code")
    private String doctorCode;//医生ID
    @Column(name = "doctor_name")
    private String doctorName;//医生名称
    @Column(name = "patient_code")
    private String patientCode;//居民ID
    @Column(name = "patient_name")
    private String patientName;//居民名称
    @Column(name = "status")
    private Integer status;//关注状态 1:关注  0:取消关注
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 13 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -66,6 +66,14 @@ public class BaseHospitalRequestMapping {
         * 查询患者就诊卡
         */
        public static final String prescriptionPay = "/prescriptionPay";
        /**
         * 查询患者所有处方信息
         */
        public static final String findPatientAllPrescription = "/findPatientAllPrescription";
        /**
         * 查看取药地址
         */
        public static final String findDrugAddress = "/findDrugAddress";
        /**
@ -412,6 +420,11 @@ public class BaseHospitalRequestMapping {
        public static final String findEmrByPrescriptionId="/findEmrByPrescriptionId";
        /*
        关注医生信息
         */
        public static final String attentionDoctor="/attentionDoctor";
        public static final String findAllAttentionDoctor="/findAllAttentionDoctor";
    }

+ 33 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorVO.java

@ -5,6 +5,7 @@ import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.List;
/**
@ -185,6 +186,15 @@ public class BaseDoctorVO extends UuidIdentityVOWithOperator {
	 */
	@ApiModelProperty(value = "作废标识,1正常,0作废", example = "1")
    private String del;
//新增字段 实体类没有新增 shw
    @ApiModelProperty("医生归属医院")
    private String hospital;
    @ApiModelProperty("医生疾病门诊")
    private List<String> disease;
    @ApiModelProperty("医生归属科室")
    private List<String> department;
    public String getPassword() {
        return password;
@ -376,4 +386,27 @@ public class BaseDoctorVO extends UuidIdentityVOWithOperator {
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public List<String> getDisease() {
        return disease;
    }
    public void setDisease(List<String> disease) {
        this.disease = disease;
    }
    public List<String> getDepartment() {
        return department;
    }
    public void setDepartment(List<String> department) {
        this.department = department;
    }
}

+ 33 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/LatitudeUtils.java

@ -21,6 +21,12 @@ public class LatitudeUtils {
     */
    public static final String ak = "wm9Cih17l010vL91nOfTbu8M";
    private static double EARTH_RADIUS = 6378.137;
    private static double rad(double lat1) {
        return lat1 * Math.PI / 180.0;
    }
@ -71,6 +77,33 @@ public class LatitudeUtils {
        return null;
    }
    /**
     * 根据两个位置的经纬度,来计算两地的距离(单位为KM)
     * 参数为String类型
     * @param lat1Str 用户经度
     * @param lng1Str 用户纬度
     * @param lat2Str 商家经度
     * @param lng2Str 商家纬度
     * @return
     */
    public static String getDistance(String lat1Str, String lng1Str, String lat2Str, String lng2Str) {
        double lat1 = Double.parseDouble(lat1Str);
        double lng1 = Double.parseDouble(lng1Str);
        double lat2 = Double.parseDouble(lat2Str);
        double lng2 = Double.parseDouble(lng2Str);
        double patm = 2;
        double radLat1 = rad(lat1);
        double radLat2 = rad(lat2);
        double difference = radLat1 - radLat2;
        double mdifference = rad(lng1) - rad(lng2);
        double distance = patm * Math.asin(Math.sqrt(Math.pow(Math.sin(difference / patm), patm)
                + Math.cos(radLat1) * Math.cos(radLat2)
                * Math.pow(Math.sin(mdifference / patm), patm)));
        distance = distance * EARTH_RADIUS;
        String distanceStr = String.valueOf(distance);
        return distanceStr;
    }
//    public static void main(String args[]){
//        try {
//            Map<String, String> json = LatitudeUtils.getGeocoderLatitude("浦东区张杨路1725号");

+ 7 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/sync/BaseSyncDataService.java

@ -96,7 +96,6 @@ public class BaseSyncDataService extends BaseJpaService<BaseSyncDataDO, BaseSync
        syncDataDO.setUpdateTime(DateUtil.getNowDate());
        syncDataDO.setStyle(1);
        try {
            //眼科中心
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                logger.info("======================眼科中心同步开始========================");
@ -180,6 +179,13 @@ public class BaseSyncDataService extends BaseJpaService<BaseSyncDataDO, BaseSync
                    logger.info("======================同步科室简介信息失败========================");
                }
                Integer integer1 = entranceService.syncDoctorInfo();
                if (integer1==200){
                    logger.info("======================同步单个医生信息成功========================");
                }else {
                    logger.info("======================同步单个医生信息失败========================");
                }
                if (syncMS02003==200&&syncBS16010==200&&syncBS16011==200&&integer1==200){
                    syncDataDO.setSyncResult("同步成功");
                    logger.info("======================中山医院信息同步成功========================");

+ 7 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -323,6 +323,10 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	                                                @RequestParam(value = "chargType", required = false,defaultValue = "")String chargType,
                                                   @ApiParam(name = "consutlSort", value = "咨询量排序")
                                                   @RequestParam(value = "consutlSort", required = true,defaultValue = "DESC")String consutlSort,
													@ApiParam(name = "isAttention", value = "是否关注")
													@RequestParam(value = "isAttention", required = false)String isAttention,
	                                                 @ApiParam(name = "page", value = "第几页")
	                                                     @RequestParam(value = "page",required = false) Integer page,
	                                                 @ApiParam(name = "pagesize", value = "分页大小")
@ -334,7 +338,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
				orgCode,dept,
				diseaseKey,doctorNameKey,
				jobTitleNameKey,outpatientType,
				keyName,workingTime,consultStatus,chargType,consutlSort,page,pagesize));
				keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize));
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.Prescription.findHotDeptAndDiseaseDict)
@ -678,9 +682,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@PostMapping(value = BaseHospitalRequestMapping.Prescription.followOrgByPatient)
	@ApiOperation(value = "居民关注医院", notes = "居民关注医院")
	public Envelop followOrgByPatient(
			@ApiParam(name = "patientid", value = "发送者id", defaultValue = "")
			@ApiParam(name = "patientid", value = "居民ID", defaultValue = "")
			@RequestParam(value = "patientid", required = true) String patientid,
			@ApiParam(name = "orgid", value = "发送者姓名", defaultValue = "")
			@ApiParam(name = "orgid", value = "医生ID", defaultValue = "")
			@RequestParam(value = "orgid", required = true) String orgid,
			@ApiParam(name = "type", value = "1关注 0取消关注", defaultValue = "")
			@RequestParam(value = "type", required = true) String type

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

@ -114,6 +114,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                                             @RequestParam(value = "chargType", required = false,defaultValue = "")String chargType,
                                                             @ApiParam(name = "consutlSort", value = "咨询量排序")
                                                             @RequestParam(value = "consutlSort", required = true,defaultValue = "DESC")String consutlSort,
                                                             @ApiParam(name = "isAttention", value = "是否关注 1:关注 0:不关注 不传:查所有")
                                                                 @RequestParam(value = "isAttention", required = false)String isAttention,
                                                             @ApiParam(name = "page", value = "第几页")
                                                             @RequestParam(value = "page",required = false) Integer page,
                                                             @ApiParam(name = "pagesize", value = "分页大小")
@ -125,7 +127,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                orgCode,dept,
                diseaseKey,doctorNameKey,
                jobTitleNameKey,outpatientType,
                keyName,workingTime,consultStatus,chargType,consutlSort,page,pagesize));
                keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize));
    }

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

@ -19,10 +19,7 @@ import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
@ -1441,5 +1438,36 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
//    @GetMapping(value= BaseHospitalRequestMapping.Prescription.attentionDoctor)
//    @ApiOperation("患者关注医生信息")
//    public Envelop attentionDoctor(
//            @ApiParam(name = "doctorId", value = "doctorId", required = true)
//            @RequestParam(required = true)String doctorId) throws Exception {
//        try {
//            return prescriptionService.attentionDoctor(doctorId);
//        } catch (Exception e) {
//            return ObjEnvelop.getError(e.getMessage());
//        }
//    }
//    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findAllAttentionDoctor)
//    @ApiOperation(value = "查询所有关注医生", notes = "查询所有关注医生")
//    public PageEnvelop findAllAttentionDoctor(@ApiParam(name = "keyWord", value = "关键字")
//                                         @RequestParam(value = "keyWord", required = false)String keyWord,
//                                              @ApiParam(name = "outPatient", value = "发热门诊",defaultValue = "0")
//                                         @RequestParam(value = "outPatient", required = false)Integer outPatient,
//                                              @ApiParam(name = "jobTitleCode", value = "医生职称")
//                                         @RequestParam(value = "jobTitleCode", required = false)String jobTitleCode,
//                                              @ApiParam(name = "shift", value = "排班",defaultValue = "0")
//                                         @RequestParam(value = "shift", required = false)Integer shift,
//                                              @ApiParam(name = "page", value = "第几页",defaultValue = "1")
//                                         @RequestParam(value = "page",required = false) Integer page,
//                                              @ApiParam(name = "pagesize", value = "分页大小",defaultValue = "10")
//                                         @RequestParam(value = "pagesize",required = false) Integer pagesize) {
//        return prescriptionService.findAllAttentionDoctor(keyWord,outPatient,jobTitleCode,shift,page,pagesize);
//    }
    
}

+ 37 - 4
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java

@ -15,10 +15,7 @@ import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.*;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
@ -240,6 +237,42 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientAllPrescription)
    @ApiOperation(value = "查询患者所有处方信息", notes = "查询患者所有处方信息")
    public PageEnvelop findPatientAllPrescription(@ApiParam(name = "keyName", value = "搜索关键字")
                                                      @RequestParam(value = "keyName", required = false)String keyName,
                                                  @ApiParam(name = "status", value = "状态")
                                                      @RequestParam(value = "status", required = false)String status,
                                                  @ApiParam(name = "page", value = "第几页")
                                                      @RequestParam(value = "page",required = false) Integer page,
                                                  @ApiParam(name = "size", value = "页面大小")
                                                      @RequestParam(value = "size",required = false) Integer size)throws Exception {
        try {
            return prescriptionService.findPatientAllPrescription(keyName,status,page,size);
        } catch (Exception e) {
            return PageEnvelop.getError(e.getMessage(),-1);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDrugAddress)
    @ApiOperation(value = "查看取药地址", notes = "查看取药地址")
    public MixEnvelop findDrugAddress(@ApiParam(name = "outpatientId", value = "关联门诊code")
                                                  @RequestParam(value = "outpatientId", required = true)String outpatientId,
                                                  @ApiParam(name = "longitude", value = "经度")
                                                  @RequestParam(value = "longitude",required = true) String longitude,
                                                  @ApiParam(name = "dimension", value = "维度")
                                                  @RequestParam(value = "dimension",required = true) String dimension)throws Exception {
        try {
            return prescriptionService.findDrugAddress(outpatientId,longitude,dimension);
        } catch (Exception e) {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getICD10)
    @ApiOperation(value = "获取ICD10诊断编码", notes = "获取ICD10诊断编码")
    public ListEnvelop getICD10(@ApiParam(name = "pyKey", value = "拼音关键字")