Browse Source

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

# Conflicts:
#	business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
wangzhinan 4 years ago
parent
commit
2c6be18618
16 changed files with 822 additions and 71 deletions
  1. 14 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorPatientDao.java
  2. 306 43
      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. 45 5
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  8. 74 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorPatientDO.java
  9. 17 5
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  10. 33 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/doctor/BaseDoctorVO.java
  11. 33 0
      common/common-util/src/main/java/com/yihu/jw/util/common/LatitudeUtils.java
  12. 7 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/sync/BaseSyncDataService.java
  13. 38 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  14. 3 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  15. 35 7
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  16. 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> {
}

+ 306 - 43
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;
@ -43,6 +46,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;
@ -52,6 +56,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;
@ -59,7 +64,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.StringUtil;
@ -195,6 +203,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private PrescriptionEmrDao prescriptionEmrDao;
    @Autowired
    private WlyyConsultAdviceDao wlyyConsultAdviceDao;
    @Autowired
    private BaseDoctorPatientDao baseDoctorPatientDao;
    @Autowired
    private BaseUserAgent userAgent;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
@ -2043,7 +2056,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                result.put("mes", "诊断完成");
                return result;
            }else if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                Double price =  prescription.getDrugFee();
                Double price = 0.01;
                businessOrderService.recharge(prescription.getId(),"处方收费","4","处方收费",prescription.getPatientCode(),prescription.getPatientName(),prescription.getDoctor(),price);
                //上传his开方
                //sendHisDiagnosis(jsonData, outpatientDO, prescription)
@ -2998,9 +3011,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);
@ -3678,7 +3697,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 --;
@ -3702,14 +3721,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 ("1".equalsIgnoreCase(isAttention)){
            sql+=" join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='"+patientid+"' ";
        }
        if ("0".equalsIgnoreCase(isAttention)) {
            sql += " 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 ";
        }
@ -4051,43 +4074,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc,Integer sex,String townCode,String townName,String committeeCode,String committeeName,String address,String photo,String mobile){
    public Map<String,Object> updatePatientInfo(String patient,String name,String idcard,String ssc,Integer sex,String townCode,String townName,String committeeCode,String committeeName,String address){
        Map<String,Object> rs = new HashedMap();
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        if (StringUtils.isNoneBlank(name)){
            basePatientDO.setName(name);
        }
        if (StringUtils.isNoneBlank(idcard)){
            basePatientDO.setIdcard(idcard);
        }
        if (sex!=null){
            basePatientDO.setSex(sex);
        }
        if (StringUtils.isNoneBlank(townCode)){
            basePatientDO.setTownCode(townCode);
        }
        if (StringUtils.isNoneBlank(townName)){
            basePatientDO.setTownName(townName);
        }
        if (StringUtils.isNoneBlank(committeeCode)){
            basePatientDO.setCommitteeCode(committeeCode);
        }
        if (StringUtils.isNoneBlank(committeeName)){
            basePatientDO.setCommitteeName(committeeName);
        }
        if (StringUtils.isNoneBlank(address)){
            basePatientDO.setAddress(address);
        }
        if (StringUtils.isNoneBlank(photo)){
            basePatientDO.setPhoto(photo);
        }
        if (StringUtils.isNoneBlank(mobile)){
            basePatientDO.setMobile(mobile);
        }
        basePatientDO.setName(name);
        basePatientDO.setIdcard(idcard);
        basePatientDO.setSex(sex);
        basePatientDO.setTownCode(townCode);
        basePatientDO.setTownName(townName);
        basePatientDO.setCommitteeCode(committeeCode);
        basePatientDO.setCommitteeName(committeeName);
        basePatientDO.setAddress(address);
        basePatientDO = basePatientDao.save(basePatientDO);
        if (patientMedicareCardDO!=null){
            patientMedicareCardDO.setCode(ssc);
@ -4652,9 +4650,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if("1".equals(outpatient.getType())){
                    systemMessageDO.setTitle("图文复诊");
                    systemMessageDO.setType("1");
                    saveInquirySystemMessage(outpatient);
                }else {
                    systemMessageDO.setTitle("视频复诊");
                    systemMessageDO.setTitle("视频复诊预约成功");
                    systemMessageDO.setType("2");
                    saveInquirySystemMessage(outpatient);
                }
            }
            systemMessageDO.setReceiver(outpatient.getDoctor());
@ -4669,6 +4669,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
            data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
            data.put("question",outpatient.getDescription());
            String msg="您的视频复诊已预约成功。\n" +
                    "预计"+outpatient.getDoctorName()+"医生将于"+outpatient.getRegisterDate()+" 与您进行视频咨询。请留意系统消息或微信公众号消息。咨询开始时,医生将邀请您进行视频通话,请您关注消息提醒,及时接受医生视频邀请。";
            data.put("msg",msg);
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
@ -4680,6 +4683,39 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return systemMessageDO;
    }
    public void saveInquirySystemMessage(WlyyOutpatientDO outpatient){
        SystemMessageDO systemMessageDO = new SystemMessageDO();
        String msg="";
        if("1".equals(outpatient.getType())){
            msg=outpatient.getPatientName()+",您好!您有一个图文复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
        }else {
            msg=outpatient.getPatientName()+",您好!您有一个视频复诊订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
        }
        systemMessageDO.setTitle("线上问诊支付提醒");
        systemMessageDO.setType("11");
        systemMessageDO.setSender(outpatient.getDoctor());
        systemMessageDO.setSenderName(outpatient.getDoctorName());
        systemMessageDO.setRelationCode(outpatient.getId());
        systemMessageDO.setReceiver(outpatient.getPatient());
        systemMessageDO.setReceiverName(outpatient.getPatientName());
        JSONObject data = new JSONObject();
        try {
            data.put("name",outpatient.getPatientName());
            data.put("age",IdCardUtil.getAgeForIdcard(outpatient.getIdcard()));
            data.put("gender",IdCardUtil.getSexForIdcard_new(outpatient.getIdcard()));
            data.put("question",outpatient.getDescription());
            data.put("msg",msg);
            systemMessageDO.setData(data.toString());
            systemMessageService.saveMessage(systemMessageDO);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 指定门诊医生医生
     * @param outpatientJson
@ -5612,11 +5648,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (status==2){
            /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
            logger.info("开始====="+wlyyPrescriptionDO.getCheckStatus());
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                try {
                    List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId,1);
                    List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId,1);
                    WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
                    DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                    //his处方拼接开方条件
@ -5625,7 +5661,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        //设置his药品查询条件
                        setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, info, outpatientDO.getIcd10());
                    }
                    for (WlyyInspectionDO ins:inspectionDOS){
                        //设置his药品查询条件
                        setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
@ -5655,6 +5690,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patientCode,"1");
                        ylzPayService.msgPush("01",patientMedicareCardDO.getCode(),"01",patientDO.getMobile(),"03",userNo,userName,idcard,realerOrder,applyDepaName,applyDoctorName,recipeTime,free,"1");
                    }
                    sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
                } catch (Exception e) {
                    e.printStackTrace();
                }
@ -5663,6 +5700,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyPrescriptionDO.setCheckStatus(2);
            wlyyPrescriptionDO.setCheckReason(reason);
            wlyyPrescriptionDO.setStatus(20);
            //发送系统消息 处方支付提醒
            SystemMessageDO messageDO = new SystemMessageDO();
            messageDO.setType("6");
            messageDO.setTitle("处方支付提醒");
            messageDO.setSender(outpatientDO.getDoctor());
            messageDO.setSenderName(outpatientDO.getDoctorName());
            messageDO.setRelationCode(outpatientDO.getId());
            messageDO.setReceiver(outpatientDO.getPatient());
            messageDO.setReceiverName(outpatientDO.getPatientName());
            try {
                JSONObject data = new JSONObject();
                data.put("name",outpatientDO.getPatientName());
                data.put("age", IdCardUtil.getAgeForIdcard(outpatientDO.getIdcard()));
                data.put("gender",IdCardUtil.getSexForIdcard_new(outpatientDO.getIdcard()));
                data.put("question","");
                String msg=outpatientDO.getPatientName()+",您好!医生已为您开具处方,请及时支付。如您已支付请忽略本条信息。";
                data.put("msg",msg);
                messageDO.setData(data.toString());
                systemMessageService.saveMessage(messageDO);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }else{
            wlyyPrescriptionDO.setCheckStatus(status);
            wlyyPrescriptionDO.setCheckReason(reason);
@ -5672,6 +5734,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (status==2||status==1){
            sendCheckMessage(status,wlyyPrescriptionDO,operate,operateName);
        }
        return prescriptionCheckDO;
    }
@ -5929,7 +5993,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     * 保存排班规则
     * @param
     * @param advicesJson
     * @return
     */
    public Boolean sendOutPatientSuggest(String advicesJson){
@ -6020,4 +6084,203 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     * 关注医生
     * @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}")
@ -519,5 +529,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

@ -1772,7 +1772,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) {
@ -2332,7 +2335,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);
}

+ 45 - 5
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -18,12 +18,15 @@ import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.im.dao.ConsultDao;
@ -162,6 +165,9 @@ public class ImService {
	@Autowired
	private HibenateUtils hibenateUtils;
	@Autowired
	private SystemMessageService systemMessageService;
	
	@Value("${wechat.id}")
	private String wxId;
@ -1343,9 +1349,45 @@ public class ImService {
//		returnJson = imUtil.sendIM(consultTeam.getDoctor(), consultTeam.getPatient(), "28", evalueContent.toString());
//		String response = imUtil.sendTopicIM(consultTeam.getDoctor(), doctor.getName(), consult, "28", evalueContent.toString(),null);
//		String response = imUtil.sendImMsg(consultTeam.getDoctor(), doctor.getName(), session_id, "28", evalueContent.toString(),null);
		
		
		
		//保存系统消息服务评价
		SystemMessageDO messageDO = new SystemMessageDO();
		messageDO.setType("10");
		messageDO.setTitle("服务评价");
		messageDO.setSender(doctor.getId());
		messageDO.setSenderName(doctor.getName());
		messageDO.setReceiver(patient.getId());
		messageDO.setReceiverName(patient.getName());
		net.sf.json.JSONObject data = new net.sf.json.JSONObject();
		data.put("name",patient.getName());
		data.put("age",IdCardUtil.getAgeForIdcard(patient.getIdcard()));
		data.put("gender",patient.getSex().toString());
		data.put("question",consultTeam.getSymptoms());
		if (cons.getType()!=null&&1==cons.getType()){
			String msg =patient.getName()+ ",您好!您有1条图文咨询已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
		}
		if (cons.getType()!=null&&9==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条图文复诊已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
		}
		if (cons.getType()!=null&&16==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条视频复诊已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
		}
		if (cons.getType()!=null&&17==cons.getType()){
			String msg=patient.getName()+ ",您好!您有1条视频咨询已结束,请及时对咨询医生进行评价。";
			data.put("msg",msg);
		}
		messageDO.setData(data.toString());
		try {
			systemMessageService.saveMessage(messageDO);
		} catch (Exception e) {
			e.printStackTrace();
		}
		String endName = "";
		String endId = "";
		JSONObject obj = new JSONObject();
@ -1374,8 +1416,6 @@ public class ImService {
		if (obj.getInteger("status") == -1) {
			throw new RuntimeException(String.valueOf(obj.get("message")));
		}
		
		
//		//推送给IM文字消息
//		if (endType == 1) {

+ 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;
    }
}

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

@ -43,6 +43,10 @@ public class BaseHospitalRequestMapping {
         * 获取门诊记录
         */
        public static final String findOutpatientList = "/findOutpatientList";
        /**
         * 修改居民信息
         */
        public static final String updatePatientInfo = "/updatePatientInfo";
        /**
         * 查询单条门诊记录接口
@ -66,6 +70,14 @@ public class BaseHospitalRequestMapping {
         * 查询患者就诊卡
         */
        public static final String prescriptionPay = "/prescriptionPay";
        /**
         * 查询患者所有处方信息
         */
        public static final String findPatientAllPrescription = "/findPatientAllPrescription";
        /**
         * 查看取药地址
         */
        public static final String findDrugAddress = "/findDrugAddress";
        /**
@ -237,11 +249,6 @@ public class BaseHospitalRequestMapping {
         */
        public static final String findPatientInfo = "/findPatientInfo";
        /**
         * 获取居民基础信息
         */
        public static final String updatePatientInfo = "/updatePatientInfo";
        /**
         * 保存医生在线排班
         */
@ -417,6 +424,11 @@ public class BaseHospitalRequestMapping {
        public static final String findEmrByPrescriptionId="/findEmrByPrescriptionId";
        /*
        关注医生信息
         */
        public static final String attentionDoctor="/attentionDoctor";
        public static final String findAllAttentionDoctor="/findAllAttentionDoctor";
        public static final String findHisEmr="/findHisEmr";

+ 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("======================中山医院信息同步成功========================");

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

@ -10,6 +10,7 @@ import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.service.ImService;
@ -88,6 +89,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Autowired
	private BusinessOrderService businessOrderService;
	@Autowired
	private SystemMessageService systemMessageService;
	
	@Value("${fastDFS.fastdfs_file_url}")
	private String fastdfs_file_url;
@ -323,6 +327,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 +342,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)
@ -401,6 +409,33 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
//			res = re.getInteger("status");
//			dts = re.containsKey("doctor")?re.getJSONArray("doctor"):null;
			//线上问诊支付提醒
			if (type==17||type==1){
				SystemMessageDO systemMessageDO = new SystemMessageDO();
				systemMessageDO.setTitle("线上问诊支付提醒");
				systemMessageDO.setType("11");
				systemMessageDO.setSender(re.getString("doctor"));
				systemMessageDO.setSenderName(re.getString("doctorName"));
				systemMessageDO.setRelationCode(re.getString("sessiond_id"));
				systemMessageDO.setReceiver(re.getString("patient"));
				systemMessageDO.setReceiverName(re.getString("patientName"));
				net.sf.json.JSONObject data = new net.sf.json.JSONObject();
				data.put("name",re.getString("patientName"));
				data.put("age", IdCardUtil.getAgeForIdcard(re.getString("patient_idcard")));
				data.put("gender",IdCardUtil.getSexForIdcard_new(re.getString("patient_idcard")));
				data.put("question",symptoms);
				String msg= "";
				if (type==17){
					msg=re.getString("patientName")+",您好!您有一个视频咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
				}else {
					msg=re.getString("patientName")+",您好!您有一个图文咨询订单待支付,请及时支付。点击完成支付,如您已支付请忽略本条信息。";
				}
				data.put("msg",msg);
				systemMessageDO.setData(data.toString());
				systemMessageService.saveMessage(systemMessageDO);
			}
			//发送系统消息
			SystemMessageDO systemMessageDO = new SystemMessageDO();
			systemMessageDO.setTitle("新增专家咨询");
@ -681,9 +716,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

@ -130,6 +130,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 = "分页大小")
@ -141,7 +143,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));
    }

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

@ -23,10 +23,7 @@ import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
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;
@ -91,7 +88,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    
    @Value("${demo.flag}")
    private boolean demoFlag;
    
@ -722,7 +719,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(prescriptionService.updatePatientInfo(patient,name,idcard,ssc,sex,town,townName,committeeCode,committeeName,address,photo,mobile));
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorOnlineWork)
    @ApiOperation(value = "保存在线排班", notes = "保存在线排班")
    public Envelop saveDoctorOnlineWork(@ApiParam(name = "onlineWorkJson", value = "保存在线排班json")
@ -1510,6 +1507,37 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    }
//    @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);
//    }
    /**
     * 查询his电子病历
     * @param registerSn
@ -1550,5 +1578,5 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    
}

+ 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 = "拼音关键字")