浏览代码

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

yeshijie 4 年之前
父节点
当前提交
a13ae1ca45
共有 47 个文件被更改,包括 2181 次插入139 次删除
  1. 1 1
      business/base-service/src/main/java/com/yihu/jw/dict/dao/PrivateDictDao.java
  2. 3 2
      business/base-service/src/main/java/com/yihu/jw/dict/service/PrivateDictService.java
  3. 3 0
      business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java
  4. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/httplog/service/WlyyHttpLogService.java
  5. 37 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/SystemMessageService.java
  6. 6 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java
  7. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java
  8. 456 24
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  9. 4 2
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  10. 16 13
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  11. 14 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientGroupDao.java
  12. 18 0
      business/base-service/src/main/java/com/yihu/jw/patient/dao/BasePatientGroupDictDao.java
  13. 183 0
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientGroupDictService.java
  14. 311 12
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  15. 2 5
      business/base-service/src/main/java/com/yihu/jw/wechat/service/BaseSensitiveFilterWordsService.java
  16. 7 7
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  17. 4 2
      business/base-service/src/mqConfig/mqdata/BS15018.json
  18. 135 21
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  19. 11 1
      common/common-entity/sql记录
  20. 9 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java
  21. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageItemDO.java
  22. 25 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  23. 67 0
      common/common-entity/src/main/java/com/yihu/jw/entity/patient/BasePatientGroupDO.java
  24. 69 0
      common/common-entity/src/main/java/com/yihu/jw/entity/patient/BasePatientGroupDictDO.java
  25. 13 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  26. 2 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  27. 19 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/common/UploadVO.java
  28. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java
  29. 17 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/servicePackage/ServicePackageItemEndpoint.java
  30. 3 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  31. 7 6
      svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServicePackageItemService.java
  32. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java
  33. 1 1
      svr/svr-base/src/main/resources/bootstrap.yml
  34. 118 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorServiceEndPoint.java
  35. 12 12
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/DeviceController.java
  36. 6 0
      svr/svr-internet-hospital-job/pom.xml
  37. 158 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/RemindDoctorService.java
  38. 77 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/RemindDoctorJob.java
  39. 9 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  40. 158 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/account/PatientEndpoint.java
  41. 35 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  42. 3 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dict/PrivateDictEndpoint.java
  43. 18 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/file_upload/FileUploadEndpoint.java
  44. 80 7
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  45. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  46. 39 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java
  47. 8 5
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/wechat/WeiXinEventProcess.java

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/dict/dao/PrivateDictDao.java

@ -14,5 +14,5 @@ public interface PrivateDictDao extends PagingAndSortingRepository<PrivateDictDO
    @Query("from PrivateDictDO t where t.isDel = 1")
    List<PrivateDictDO> findALL();
    @Query("from PrivateDictDO t where t.dictCode= ?1 and t.isDel = 1")
    List<PrivateDictDO> findoneByCode(String dictCode);
    List<PrivateDictDO> findByDictCodeAndIsDel(String dictCode);
}

+ 3 - 2
business/base-service/src/main/java/com/yihu/jw/dict/service/PrivateDictService.java

@ -23,11 +23,12 @@ public class PrivateDictService extends BaseJpaService<PrivateDictDO, PrivateDic
    private HibenateUtils hibenateUtils;
    //查找隐私策略
    public List<PrivateDictDO> findByHospitalCodeAndDictCode(String dictCode){
        if (StringUtils.isNotBlank(dictCode)){
        return privateDictDao.findByDictCodeAndIsDel(dictCode);
        /*if (StringUtils.isNotBlank(dictCode)){
            return privateDictDao.findoneByCode(dictCode);
        }else {
            return privateDictDao.findALL();
        }
        }*/
    }
    //添加隐私策略
    public MixEnvelop addPrivateDict(String id,String dictCode,String dictName, String dictValue,String hospitalCode,String hospitalName,String imgUrl){

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java

@ -518,6 +518,9 @@ public class FileUploadService {
        inputStream = conn.getInputStream();
        return inputStream;
    }
    public void deleteFile(String groupName,String fileName) throws  Exception{
        fastDFSHelper.delete(groupName,fileName);
    }
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/httplog/service/WlyyHttpLogService.java

@ -64,7 +64,7 @@ public class WlyyHttpLogService  extends BaseJpaService<WlyyHttpLogDO, WlyyHttpL
        sql+=" a.name as \"patientName\"," +
                "b.name as \"doctorName\"" +
                " from wlyy_http_log t left join base_patient a on t.patient = a.id " +
                " left join base_doctor b on t.doctor = b.id where 1=1 and (t.code like '%Check%' or t.name = '合理用药审核接口')";
                " left join base_doctor b on t.doctor = b.id where 1=1 and ( t.name = '合理用药审核接口'  or t.code like '%Check%')";
        if (StringUtils.isNotBlank(startTime)){
            if("xm_ykyy_wx".equals(wxId)){
                if (flag){

+ 37 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/SystemMessageService.java

@ -10,8 +10,10 @@ import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
@ -21,6 +23,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author zmk
@ -43,6 +47,8 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
    private YkyySMSService ykyySMSService;
    @Value("${wechat.id}")
    private String wechatId;
    @Autowired
    private HibenateUtils hibenateUtils;
    /**
@ -149,6 +155,37 @@ public class SystemMessageService extends BaseJpaService<SystemMessageDO,SystemM
        return msg;
    }
    /*private MixEnvelop findOutPatientMessage(String reciver ,Integer page ,Integer pageSize){
        String sql = "select b.id as \"id\"," +
                " b.content as \"content\"," +
                "b.saas_id as \"saasId\"," +
                "b.is_read as \"isRead\"," +
                "b.type as \"type\"," +
                "b.sender as \"sender\"," +
                "b.sender_name as \"senderName\"," +
                "b.receiver as \"receiver\"," +
                "b.receiver_name as \"receiverName\"," +
                "b.relation_type as \"relationType\"," +
                "b.relation_code as \"relationCode\"," +
                "b.relation_name as \"relationName\"," +
                "b.status as \"status\"," +
                "b.del as \"del\"," +
                "b.create_user as \"createUser\"," +
                "b.create_user_name as \"createUserName\"," +
                "b.create_time as \"createTime\"," +
                "b.update_user as \"updateUser\"," +
                "b.update_user_name as \"updateUserName\"," +
                "b.update_time as \"updateTime\" " +
                " from wlyy_outpatient t left join base_user_message b " +
                " on t.id = b.relation_code " +
                " where b.del=1 ";
        if (StringUtils.isNoneBlank(reciver)){
            sql+=" and b.reciver = '"+reciver+"'";
        }
        sql+=" and t.status = '0' order by b.create_time asc ";
        String sqlAppend = sql+" and t.status != '0' order by b.create_time desc";
        List<Map<String,Object>> listfront = hi
    }*/
}

+ 6 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java

@ -89,5 +89,11 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    @Query("from WlyyOutpatientDO a where a.consumer = ?1 and a.status=1 and a.payStatus =1 order by a.createTime desc")
    List<WlyyOutpatientDO> findWlyyOutpatientDO(String patient);
    @Query("from WlyyOutpatientDO a where a.status=0 and a.payStatus =1 order by a.createTime desc")
    List<WlyyOutpatientDO> findDoctorRemindMessage();
    @Query("from WlyyOutpatientDO a where a.status = 0 and a.payStatus =1 and a.doctor=?1 and a.outpatientType =?2 and a.patient=?3")
    List<WlyyOutpatientDO> findByDoctorAndOutpatientType(String doctor,String outpatientType,String patient);
}

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java

@ -576,7 +576,7 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
            for (WlyyPrescriptionExpressageLogDO pushlog: pushSFLogs) {
                //判断是否有已收件的路由节点
                if("80".equals(pushlog.getOpCode())||"8000".equals(pushlog.getOpCode())){
                if("80".equals(pushlog.getOpCode())||"8000".equals(pushlog.getOpCode())||"130".equals(pushlog.getOpCode())){
                    isContainEndRoutInfo = true;
                }

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

@ -32,6 +32,7 @@ import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.base.sms.SmsTemplateDO;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
@ -148,6 +149,8 @@ import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
 * Created by Trick on 2019/5/17.
@ -308,7 +311,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private BaseJpushTemplateDao baseJpushTemplateDao;
    @Autowired
    HikariDataSource dataSource;
    @Autowired
    private BaseSensitiveDao baseSensitiveDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -3703,7 +3707,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return rs.size();
    }
    @Transactional(readOnly = true)
    public Map<String, Object> findDoctorInfo(String doctor, String withWork,String patient) {
        BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
        Map<String, Object> rs = new HashedMap();
@ -3934,6 +3938,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }
                }*/
                List<com.alibaba.fastjson.JSONArray> waitinglist = new ArrayList<>();
                List<BaseSensitiveDO> listSensitive = (List<BaseSensitiveDO>) baseSensitiveDao.findAll();
                if (scoreList != null && scoreList.size() > 0) {
                    List<String> stringList = new ArrayList<>();
                    for (Map<String, Object> scorepatient : scoreList) {
@ -3947,7 +3952,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        }
                        String content = (String)scorepatient.get("content");
                        if (StringUtils.isNotEmpty(content)){
                            String replace = baseSensitiveFilterWordsService.filterSensitiveWords(content);
                            String replace = baseSensitiveFilterWordsService.filterSensitiveWords(content,listSensitive);
                            scorepatient.put("content",replace);
                        }
@ -5677,6 +5682,331 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            pagesize = 10;
        }*/
        testHikar();
        long statr = new Date().getTime();
        String sql = "SELECT " +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
                " d.name AS \"name\", " +
                " d.expertise AS \"expertise\"," +
                " d.introduce AS \"introduce\"," +
                " d.job_title_code AS \"jobTitleCode\", " +
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " h.dept_name AS \"deptName\"," +
                " dw.workTotal AS \"workTotal\","+
                " d.consult_status AS \"consultStatus\"," +
                " d.outpatient_type AS \"outpatientType\"," +
                " a.total AS \"consultTotal\"," +
                " d.twfz_charge_type AS \"TWFZ_CHARGE_TYPE\"," +
                " d.spfz_charge_type AS \"SPFZ_CHARGE_TYPE\"," +
                " d.spzx_charge_type AS \"SPZX_CHARGE_TYPE\"," +
                " d.xtfz_charge_type AS \"XTFZ_CHARGE_TYPE\"," +
                " d.twzx_charge_type AS \"TWZX_CHARGE_TYPE\"," +
                " d.jyzx_charge_type AS \"JYZX_CHARGE_TYPE\"," +
                " h.org_name AS \"orgName\"," +
                " h.org_code AS \"orgCode\" " ;
        if(StringUtils.isNoneBlank(patientid)){
            sql+=" , follow.id AS \"followid\" " ;
        }
        sql+=" FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 3 GROUP BY doctor ) a on a.doctor = d.id ";
        Map<String, Object> params = new HashedMap();
        Date date = new Date();
        sql+="LEFT JOIN (SELECT  COUNT(t1.doctor) as workTotal, t1.doctor FROM  wlyy_doctor_work_time t1   WHERE   " +
                "t1.start_time <=:startTime  AND t1.end_time >=:endTime GROUP BY t1.doctor) dw ON dw.doctor=d.id ";
        sql+="LEFT JOIN (\n" +
                "\tSELECT\n" +
                "\t\tAVG(a.score) AS score,\n" +
                "\t\tb.doctor AS doctor\n" +
                "\tFROM\n" +
                "\t\tbase_evaluate a,\n" +
                "\t\tbase_evaluate_score b\n" +
                "\tWHERE\n" +
                "\t\ta.relation_code = b.id\n" +
                "\tGROUP BY\n" +
                "\t\tb.doctor\n" +
                ") evaluate ON evaluate.doctor = d.id";
        params.put("startTime", date);
        params.put("endTime", date);
        if(StringUtils.isNoneBlank(patientid)){
            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.isEmpty(isAttention)) {
                sql += " LEFT  JOIN base_doctor_patient_follow follow ON follow.patient='" + patientid + "' AND follow.doctor = d.id ";
            }
        }
        if (StringUtils.isNotBlank(diseaseKey)) {
            sql += " left join wlyy_doctor_special_disease sp on d.id = sp.doctor_code ";
        }
        if (StringUtils.isNotBlank(workingTime)) {
            sql += " JOIN wlyy_doctor_work_time wk on wk.doctor = d.id ";
        }
        sql += " WHERE  1=1 and h.del = '1' ";
        if (StringUtils.isNotBlank(chargType)) {
            if ("all".equals(chargType)) {
                //不过滤
            } else {
                sql += " AND d.charge_type = :chargType";
                params.put("chargType", chargType);
            }
        }
        List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDOS  = wlyyHospitalSysDictDao.findByDictCode("isDoctorWork");
        boolean isNeedDoctorWord = true;
        if(wlyyHospitalSysDictDOS!=null&&wlyyHospitalSysDictDOS.size()>0){
            for(WlyyHospitalSysDictDO wlyyHospitalSysDictDO:wlyyHospitalSysDictDOS){
                if (!"1".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
                    isNeedDoctorWord = false;
                    break;
                }
            }
        }
        if (StringUtils.isNotBlank(iswork) && "1".equals(iswork)&&isNeedDoctorWord) {
            logger.info("iswork:" + iswork);
            sql += " AND (" +
                    " EXISTS ( " +
                    " SELECT " +
                    "  1 " +
                    " FROM " +
                    "  wlyy_doctor_work_time t " +
                    " WHERE " +
                    "  t.doctor = d.id " +
                    " AND t.start_time <=:startTime" +
                    " AND t.end_time >=:endTime" +
                    " ) OR " +
                    " d.consult_status = '1') ";
            params.put("startTime", date);
            params.put("endTime", date);
        }
        if (StringUtils.isNotBlank(orgCode)) {
            sql += " AND  h.org_code =:orgCode";
            params.put("orgCode", orgCode);
        }
        if (StringUtils.isNotBlank(diseaseKey)) {
            sql += " AND sp.disease_name like :diseaseKey";
            params.put("diseaseKey", "%" + diseaseKey + "%");
        }
        if (StringUtils.isNotBlank(doctorNameKey)) {
            sql += " AND d.name like :doctorNameKey";
            params.put("doctorNameKey", "%" + doctorNameKey + "%");
        }
        if (StringUtils.isNotBlank(dept)) {
            sql += " AND h.dept_code =:dept ";
            params.put("dept", dept);
        }
        if (StringUtils.isNotBlank(jobTitleNameKey)) {
            sql += " AND d.job_title_name  = :jobTitleNameKey ";
            params.put("jobTitleNameKey", jobTitleNameKey);
        }
        if (StringUtils.isNotBlank(outpatientType)) {
            if (outpatientType.contains("or")) {
                String[] outpatientTypeArray = outpatientType.split("or");
                sql += " AND ( ";
                for (int i = 0; i < outpatientTypeArray.length; i++) {
                    sql += " d.outpatient_type like'%" + outpatientTypeArray[i] + "%'";
                    if (i != outpatientTypeArray.length - 1) {
                        sql += " or ";
                    }
                }
                sql += " ) ";
            } else {
                sql += " AND d.outpatient_type like'%" + outpatientType + "%'";
            }
        } else {
            sql += " AND d.outpatient_type is not null ";
        }
        if (StringUtils.isNotBlank(keyName)) {
            sql += " AND (h.dept_name like '%" + keyName + "%' or d.name like '%" + keyName + "%' or d.expertise like '%" + keyName + "%' )";
        }
        if (StringUtils.isNotBlank(workingTime)) {
            sql += " AND wk.work_date = :workingTime ";
            params.put("workingTime", workingTime);
        }
        if (StringUtils.isNotBlank(consultStatus)) {
            sql += " AND d.consult_status = :consultStatus ";
            params.put("consultStatus", consultStatus);
        }
        if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            if (flag){
                sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort;
            }else{
                sql += " and d.del='1' order by d.consult_status desc nulls last ,evaluate.score desc nulls last ,a.total " + consutlSort;
                sql+=" NULLS LAST,\n" +
                        "\tD.id DESC";
            }
        }else {
            sql += " and d.del='1' order by d.consult_status DESC ,evaluate.score desc,a.total " + consutlSort;
        }
        String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t";
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize);
        List<WlyyHospitalSysDictDO> doctorFrontList = wlyyHospitalSysDictDao.findByDictNameOrderBySort("doctorFrontList",orgCode);
        List<Map<String,Object>> frontDoctor = new ArrayList<>();
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            sql= sql.replace("AS \"id\"","AS \"ID\"");
        }
        String sqlCharge = "SELECT t.id as \"id\",\n" +
                "\tm.req_fee as \"twfzFee\",\n" +
                "\ta.req_fee as \"spfzFee\",\n" +
                "\tb.req_fee as \"spzxFee\",\n" +
                "\tv.req_fee as \"twzxFee\",\n" +
                "\tg.req_fee as \"jyzxFee\",\n" +
                "\td.req_fee as \"xtzxFee\"\n" +
                "FROM\n" +
                "\t  ("+sql+")  t \n" +
                "LEFT JOIN wlyy_charge_dict m ON t.twfz_charge_type = m.charge_type\n" +
                "LEFT JOIN wlyy_charge_dict a ON t.spfz_charge_type = a.charge_type\n" +
                "LEFT JOIN wlyy_charge_dict b ON t.spzx_charge_type = b.charge_type\n" +
                "LEFT JOIN wlyy_charge_dict v ON t.twzx_charge_type = v.charge_type\n" +
                "LEFT JOIN wlyy_charge_dict d ON t.xtfz_charge_type = d.charge_type\n" +
                " LEFT JOIN wlyy_charge_dict g ON t.jyzx_charge_type = g.charge_type\n"+
                " where t.id is not null ";
        List<Map<String,Object>> chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge, params);
        //查询医生各项评价平均分
        String sqlscore = "select t.doctor as \"id\" ,sum(t.score)/3 as\"score\" from ("+
                "SELECT " +
                "AVG(a.score) AS \"score\"," +
                "a.score_type AS \"score_type\"," +
                "b.doctor as \"doctor\" " +
                "FROM ("+sql+") m , base_evaluate a,base_evaluate_score b " +
                "WHERE " +
                " m.id = b.doctor and " +
                "a.relation_code=b.id " +
                "GROUP BY a.score_type,b.doctor ORDER BY  a.score_type ASC ) t GROUP BY  t.doctor";
        List<Map<String, Object>> listscore = hibenateUtils.createSQLQuery(sqlscore, params);
        /*list.stream().forEach(e->{
            if (null==e.get("consultStatus")){
                e.put("consultStatus",0);
            }
            if (null==e.get("workTotal")){
                e.put("workTotal",0);
            }
        });
        list.stream().sorted(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("workTotal"))).reversed().thenComparing(Comparator.comparing((Map<String, Object> h) -> ((String) h.get("consultStatus")))).reversed());*/
        List<Map<String,Object>>  resultList = new ArrayList<>();
        resultList.addAll(list) ;
        for (Map<String,Object> map:list){
            String doctor = map.get("id").toString();
            /*List<Map<String,Object>> chargeDictDOLists = new ArrayList<>();
            if(null!=map.get("chargeType")){
                String chargeType = map.get("chargeType").toString();
                if (chargeType.contains(",")){
                    chargeType = chargeType.replace(",","','");
                }
                String sqlCharge = "select charge_type as \"chargeType\",charge_name as \"chargeName\"," +
                        "req_fee  as \"reqFee\",zj_fee  as \"zjFee\",xt_fee  as \"xtFee\",dept_type_code as \"deptTypeCode\" " +
                        " from wlyy_charge_dict where 1=1";
                sqlCharge+=" and charge_type in ( '"+chargeType+"')";
                if (StringUtils.isNoneBlank(deptTyepCode)){
                    sqlCharge+=" and dept_type_code in ( '"+deptTyepCode+"')";
                }
                chargeDictDOLists =  hibenateUtils.createSQLQuery(sqlCharge);
            }
            map.put("chargeTypeList",chargeDictDOLists);*/
            List<Map<String,Object>> doctorChargeDictDOLists = new ArrayList<>();
            for (Map<String ,Object> chargMap:chargeDictDOLists){
                if(doctor.equalsIgnoreCase(chargMap.get("id").toString())){
                    doctorChargeDictDOLists.add(chargMap);
                }
            }
            map.put("chargeTypeList",doctorChargeDictDOLists);
            Double doctorScore = new Double("0");
            if (listscore != null && listscore.size() > 0) {
                for (Map<String, Object> _listscore : listscore) {
                    if (_listscore.get("id").toString().equalsIgnoreCase(doctor)){
                        doctorScore = Double.parseDouble(_listscore.get("score").toString());
                    }
                }
            }
            map.put("doctorScore", doctorScore);
            if (doctorFrontList!=null&&doctorFrontList.size()>0){
                for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:doctorFrontList){
                    if(doctor.equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                        map.put("doctorFrontSort",wlyyHospitalSysDictDO.getSort());
                        logger.info("doctorFrontSort"+wlyyHospitalSysDictDO.getSort());
                        logger.info("doctorId"+wlyyHospitalSysDictDO.getDictCode());
                        frontDoctor.add(map);
                        resultList.remove(map);
                    }
                }
            }
        }
        List<Map<String, Object>> listCount = hibenateUtils.createSQLQuery(sqlCount, params);
        Long count = 0L;
        if(listCount!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(listCount.get(0).get("total"));
        }
        if (frontDoctor!=null&&frontDoctor.size()>0){
            frontDoctor.sort(Comparator.comparing((Map<String, Object> h) -> ((Integer) h.get("doctorFrontSort"))));
            logger.info("size"+frontDoctor.size());
            for (Map<String, Object> map:resultList){
                logger.info("id  =="+map.get("id").toString());
                frontDoctor.add(map);
            }
        }
        logger.info("findDoctorByHospitalAndDiseaseAndDept end:" + DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss:SSS"));
        logger.info("sql:" + sql);
        MixEnvelop envelop =new MixEnvelop();
        envelop.setDetailModelList(frontDoctor);
        envelop.setTotalCount(count.intValue());
        envelop.setPageSize(pagesize);
        envelop.setCurrPage(page);
        System.out.println("new"+(new Date().getTime()-statr));
        return envelop;
    }
    /**
     * 根据疾病名称,热门部门查询医生
     *
     * @param orgCode         机构码
     * @param dept            部门CODE
     * @param diseaseKey      疾病名称
     * @param jobTitleNameKey
     * @param outpatientType
     * @param keyName
     * @param workingTime
     * @param consutlSort
     * @return
     */
    @Transactional(readOnly = true)
    public MixEnvelop findDoctorByHospitalAndDiseaseAndDept2(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, String isAttention, Integer page, Integer pagesize) {
      /*  if(page >=1){
            page --;
        if (pagesize <= 0) {
            pagesize = 10;
        }*/
        long statr = new Date().getTime();
        String sql = "SELECT " +
                " d.id AS \"id\", " +
                " d.photo AS \"photo\", " +
@ -5968,6 +6298,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        envelop.setTotalCount(count.intValue());
        envelop.setPageSize(pagesize);
        envelop.setCurrPage(page);
        System.out.println("old"+(new Date().getTime()-statr));
        return envelop;
    }
    /**
@ -6836,6 +7167,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            wlyyHttpLogDO.setCreateTime(new Date());
            wlyyHttpLogDao.save(wlyyHttpLogDO);
        }
        if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)&&StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
            String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+wlyyOutpatientDO.getId();
            sendZsMsgFlow("OL_PAY_SUCCESS",wlyyOutpatientDO.getId(),"",msgUrl,"已支付问诊费");
        }
    }
@ -7119,31 +7454,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "AND outpatient.doctor='" + doctor + "' " +
                "AND outpatient.pay_status = 1 " +
                "AND outpatient.outpatient_type= '" + outpatient_type + "'  ";
        if ("1".equals(outpatient_type)||"3".equals(outpatient_type)) {//复诊
            sql = sql + " AND outpatient.type= '" + type + "' ";
            if ("2".equals(type)) {//视频复诊才需要判断时间,
        if (!"xm_ihealth_wx".contains(wxId)){
            if ("1".equals(outpatient_type)||"3".equals(outpatient_type)) {//复诊
                sql = sql + " AND outpatient.type= '" + type + "' ";
                if ("2".equals(type)) {//视频复诊才需要判断时间,
                    if ("xm_ykyy_wx".equals(wxId)) {
                        if (flag){
                            sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                        }else {
                            sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                        }
                    } else {
                        sql = sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
                    }
                }
            } else if ("2".equals(outpatient_type)) {
                //协同门诊也需要判断时间
                if ("xm_ykyy_wx".equals(wxId)) {
                    if (flag){
                        sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                    }else {
                        sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                    }
                } else {
                    sql = sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
                }
            }
        } else if ("2".equals(outpatient_type)) {
            //协同门诊也需要判断时间
            if ("xm_ykyy_wx".equals(wxId)) {
                if (flag){
                    sql += " AND outpatient.register_date is not null and outpatient.register_date >= str_to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }else {
                    sql += " AND outpatient.register_date is not null and outpatient.register_date >= to_date('" + DateUtil.dateToStrShort(new Date()) + " 00:00:00','YYYY-MM-DD HH24:MI:SS')";
                }
            } else {
                sql = sql + " AND outpatient.register_date is not null AND  outpatient.register_date >= '" + DateUtil.dateToStrShort(new Date()) + " 00:00:00' ";
            }
        }
        logger.info("接口名称:doctorReviewConsultCount-->sql="+sql);
        List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
@ -10078,6 +10415,46 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    }
                }
            }
            if("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                /*prescriptionDao.updateCheckStatus(prescriptionId,2,reason,20);*/
                logger.info("作废处方开始" + prescriptionDO.getCheckStatus());
                WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
                DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
                List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId, 1);
                List<WlyyPrescriptionDiagnosisDO> prescriptionDiagnosisDOS = prescriptionDiagnosisDao.findByPrescriptionId(prescriptionId,1);
                List<WlyyPrescriptionExpressageDO> expressageDOS = prescriptionExpressageDao.findByOutpatientId(outpatientDO.getId());
                com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
                for (WlyyPrescriptionInfoDO info : infoDOS) {
                    //设置his药品查询条件
                    setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, outpatientDO.getIcd10());
                }
                for (WlyyInspectionDO ins : inspectionDOS) {
                    //设置his药品查询条件
                    setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, outpatientDO.getIcd10());
                }
                if (expressageDOS!=null&&expressageDOS.size()!=0){
                    WlyyPrescriptionExpressageDO prescriptionExpressageDO = expressageDOS.get(0);
                    if (prescriptionExpressageDO!=null&&prescriptionExpressageDO.getOneselfPickupFlg()==0){
                        for (int i=0;i<jsonData.size();i++){
                            com.alibaba.fastjson.JSONObject object = jsonData.getJSONObject(i);
                            object.put("selfDelivered",0);
                        }
                    }else if (prescriptionExpressageDO!=null&&prescriptionExpressageDO.getOneselfPickupFlg()==1){
                        for (int i=0;i<jsonData.size();i++){
                            com.alibaba.fastjson.JSONObject object = jsonData.getJSONObject(i);
                            object.put("selfDelivered",1);
                        }
                    }
                }
                try {
                    net.sf.json.JSONObject jsonObject = entranceService.BS10112(jsonData.toJSONString(), demoFlag);
                }catch (Exception e){
                    e.printStackTrace();
                    return "删除失败";
                }
            }
            prescriptionDO.setStatus(-1);
            prescriptionDO.setCheckStatus(4);
            prescriptionDO.setCheckReason("已删除");
@ -11789,17 +12166,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                                .build())
                        .build())
                .build();
        if (extras.get("outpatientId")!=null){
        }
        try {
            PushResult result = jPushClient.sendPush(payload);
            logger.info("极光推送返回日志==="+result);
            WlyyHttpLogDO httpLogDO = new WlyyHttpLogDO();
            httpLogDO.setCode("JPUSH");
            httpLogDO.setCreateTime(new Date());
            /*httpLogDO.setRequest(jsonObject.toJSONString());
            httpLogDO.setResponse(result);*/
            httpLogDO.setRequest(extras==null?"":extras.toString());
            httpLogDO.setResponse(result==null?"":result.toString());
            wlyyHttpLogDao.save(httpLogDO);
            logger.info("Got result - " + result);
        } catch (APIConnectionException e) {
@ -12010,6 +12384,52 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            jsonObject.put("type",32);
            jsonObject.put("id",prescriptionId);
            jsonObject.put("outpatientId",wlyyOutpatientDO.getId());
        }else if("remind_doctor_pickup".equalsIgnoreCase(templateCode)){//接诊下消息提醒
            BaseJpushTemplateDO baseJpushTemplateDO = baseJpushTemplateDao.findByCode(templateCode);
            if(baseJpushTemplateDO!=null){
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文复诊").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文复诊接诊提醒");
                    jsonObject.put("type",51);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("1".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频复诊").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    content+= "视频复诊预约时间为:"+wlyyOutpatientDO.getRegisterDate();
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频复诊接诊提醒");
                    jsonObject.put("type",52);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"1".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","图文咨询").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","图文咨询接诊提醒");
                    jsonObject.put("type",58);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"2".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","视频咨询").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","视频咨询接诊提醒");
                    content+= "视频咨询预约时间为:"+wlyyOutpatientDO.getRegisterDate();
                    jsonObject.put("type",57);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("2".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","协同复诊").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","协同复诊接诊提醒");
                    jsonObject.put("type",53);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }else if ("3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())&&"3".equalsIgnoreCase(wlyyOutpatientDO.getType())){
                    content = baseJpushTemplateDO.getPushContent().replace("{{咨询类型}}","家医咨询").replace("{{患者姓名}}",wlyyOutpatientDO.getPatientName());
                    title=baseJpushTemplateDO.getPushHeader().replace("{{咨询类型}}","家医咨询接诊提醒");
                    jsonObject.put("type",55);
                    jsonObject.put("patientName",wlyyOutpatientDO.getPatientName());
                }
                String sex = IdCardUtil.getSexNameForIdcard_new(wlyyOutpatientDO.getIdcard());
                Integer age = IdCardUtil.getAgeForIdcard(wlyyOutpatientDO.getIdcard());
                Long createTime = wlyyOutpatientDO.getCreateTime().getTime();
                Long nowTime = new Date().getTime();
                Long minusts = TimeUnit.MILLISECONDS.toMinutes(nowTime - createTime);
                content = content.replace("{{性别年龄}}",sex+age+"岁").replace("{{等待时间}}",minusts.toString());
            }
            userId = wlyyOutpatientDO.getDoctor();
            jsonObject.put("id",wlyyOutpatientDO.getId());
            isDoctor="1";
        }
        return jPushMessage(isDoctor,userId,content,title,jsonObject);
@ -12172,5 +12592,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
    }
    public String findDomainUrlInDict(){
        try {
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("domainUrl");
            if (wlyyHospitalSysDictDO!=null){
                return wlyyHospitalSysDictDO.getDictValue();
            }else {
                return "";
            }
        }catch (Exception e){
            e.printStackTrace();
            return "";
        }
    }
}

+ 4 - 2
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -1016,12 +1016,14 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
            sql =  sql +  "  and  a.id =:keyId ";
            params.put("keyId",keyId);
        }
        logger.info("sql===="+sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
        logger.info("count===="+list.size());
        total = list.size();
        for(int i=0; i<list.size(); i++) {
            logger.info("进入循环"+list.get(i));
            Map<String,Object> info = list.get(i);
            JSONObject jb = new JSONObject();
            Boolean errorFlag = false;
@ -1589,7 +1591,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                "WHERE\n" +
                "\ta.id = b.consult\n" +
                "AND a.symptoms IS NOT NULL AND b.status=1 " +
                " and c.doctor not in ('402803816babc778016babd0dee21112')";
                " and c.id not in ('402803816babc778016babd0dee21112')";
        if(StringUtils.isNotBlank(startDate)){
            wlzxSql =  wlzxSql + "  and a.czrq >=:startDate ";

+ 16 - 13
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -280,12 +280,13 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }
        businessOrderDO.setUploadStatus(0);
        businessOrderDO.setPayType(1);
        String baseUrl = prescriptionService.findDomainUrlInDict();
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/yk/consult/record?consultCode="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/yk/consult/record?consultCode="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setAppCallbackUrl(baseUrl+"/ims-app-web/#/yk/consult/record?consultCode="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setPcCallbackUrl(baseUrl+"/ims-web/#/yk/consult/record?consultCode="+businessOrderDO.getRelationCode()+"&verifyCode=");
        }else {
            businessOrderDO.setAppCallbackUrl("https://intel.yanketong.com/ims-app-web/#/yk/consult/record?outpatientId="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setPcCallbackUrl("https://intel.yanketong.com/ims-web/#/yk/consult/record?outpatientId="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setAppCallbackUrl(baseUrl+"/ims-app-web/#/yk/consult/record?outpatientId="+businessOrderDO.getRelationCode()+"&verifyCode=");
            businessOrderDO.setPcCallbackUrl(baseUrl+"/ims-web/#/yk/consult/record?outpatientId="+businessOrderDO.getRelationCode()+"&verifyCode=");
        }
        List<WlyyHospitalSysDictDO> hospitalSysDictDOS = hospitalSysDictDao.findByDictName("WX_MONEY");
        if (businessOrderDO!=null&&businessOrderDO.getPayPrice()==null){
@ -1349,6 +1350,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
     */
    public BusinessOrderDO updatePayStatus(String orderNo) throws Exception {
        logger.info("入参:"+orderNo);
        String baseUrl = prescriptionService.findDomainUrlInDict();
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByOrderNo(orderNo);
        WlyyHospitalSysDictDO changeMethod = hospitalSysDictDao.findById("consultPay");
        String changeflag="0";
@ -1397,7 +1399,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
                }else if(wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                    String url="https://intel.yanketong.com/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",outpatientDO.getDoctor(),title,msg,url);
                }else if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                    String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
@ -1419,7 +1421,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
           wlyyOutpatientDO.setPayStatus(1);
           WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
           try {
               if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
               if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)&&StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
                   String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+wlyyOutpatientDO.getId();
                   prescriptionService.sendZsMsgFlow("OL_PAY_SUCCESS",wlyyOutpatientDO.getId(),"",msgUrl,"已支付问诊费");
               }
@ -1457,7 +1459,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                       String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                   enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
               }else if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                   String url="https://intel.yanketong.com/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                   String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                   enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",outpatientDO.getDoctor(),title,msg,url);
               }else if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                   String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
@ -1495,6 +1497,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
     */
    public BusinessOrderDO updatePayStatusByRelation(String relationCode,String wxId) throws Exception {
        logger.info("入参:"+relationCode);
        String baseUrl = prescriptionService.findDomainUrlInDict();
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(relationCode);
        WlyyHospitalSysDictDO changeMethod = hospitalSysDictDao.findById("consultPay");
        String changeflag="0";
@ -1504,7 +1507,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        if (businessOrderDO==null){
            throw new Exception("查不到订单!");
        }
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")&&0==businessOrderDO.getStatus()){
            if ("0".equalsIgnoreCase(changeflag)){
                ConsultDo consultDo = consultOrderDao.findOne(businessOrderDO.getRelationCode());
                consultDo.setPayStatus(1);
@ -1544,17 +1547,17 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                        String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                        enterpriseService.sendTWMesByDoctor("xm_xzzx_wx",outpatientDO.getDoctor(),title,msg,url);
                    }else if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
                        String url="https://intel.yanketong.com/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                        String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                        enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",outpatientDO.getDoctor(),title,msg,url);
                    }
                    if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                    if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)&&StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
                        String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+wlyyOutpatientDO.getId();
                        prescriptionService.sendZsMsgFlow("OL_PAY_SUCCESS",wlyyOutpatientDO.getId(),"",msgUrl,"已支付问诊费");
                    }
                    System.out.println("发送企业模板消息成功");
                }
            }
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")&&0==businessOrderDO.getStatus()){
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
            wlyyOutpatientDO.setPayStatus(1);
            WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
@ -1590,10 +1593,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                    String url="https://ih.xmheart.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("xm_xzzx_wx",outpatientDO.getDoctor(),title,msg,url);
                }else if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
                    String url="https://intel.yanketong.com/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                    enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",outpatientDO.getDoctor(),title,msg,url);
                }
                if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
                if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)&&StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())){
                    String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+wlyyOutpatientDO.getId();
                    prescriptionService.sendZsMsgFlow("OL_PAY_SUCCESS",wlyyOutpatientDO.getId(),"",msgUrl,"已支付问诊费");
                }

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

@ -0,0 +1,14 @@
package com.yihu.jw.patient.dao;
import com.yihu.jw.entity.patient.BasePatientGroupDO;
import com.yihu.jw.entity.patient.BasePatientGroupDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BasePatientGroupDao extends PagingAndSortingRepository<BasePatientGroupDO, String>, JpaSpecificationExecutor<BasePatientGroupDO> {
    @Query("from BasePatientGroupDO t where t.doctor=?1 and t.patient=?2 and t.groupId=?3")
    BasePatientGroupDO findOneGroupByDoctorAndPatientAndGroupId(String doctor,String patient,String groupId);
    @Query("select count(1) from BasePatientGroupDO t where t.doctor=?1  and t.groupId=?2")
    int getCountByDoctor(String doctor,String dictId);
}

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

@ -0,0 +1,18 @@
package com.yihu.jw.patient.dao;
import com.yihu.jw.entity.patient.BasePatientGroupDictDO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface BasePatientGroupDictDao extends PagingAndSortingRepository<BasePatientGroupDictDO, String>, JpaSpecificationExecutor<BasePatientGroupDictDO> {
    Page<BasePatientGroupDictDO> findByCreateUserAndDel(String doctor,String del, Pageable pageable);
    @Query("select count(id) from BasePatientGroupDictDO where createUser=?1 and del='1'")
    int findByDoctorCount(String doctor);
}

+ 183 - 0
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientGroupDictService.java

@ -0,0 +1,183 @@
package com.yihu.jw.patient.service;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.patient.BasePatientGroupDO;
import com.yihu.jw.entity.patient.BasePatientGroupDictDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientGroupDao;
import com.yihu.jw.patient.dao.BasePatientGroupDictDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class BasePatientGroupDictService <T, R extends CrudRepository> extends BaseJpaService<BasePatientGroupDictDO, BasePatientGroupDictDao> {
    @Autowired
    private BasePatientGroupDao basePatientGroupDao;
    @Autowired
    private BasePatientGroupDictDao basePatientGroupDictDao;
    @Autowired
    private BaseDoctorDao basedoctorDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    //创建/修改分组
    public BasePatientGroupDictDO createPatientGroupDict(String dictId,String doctor,String groupCode,String groupName){
        BaseDoctorDO baseDoctorDO = basedoctorDao.findById(doctor);
        BasePatientGroupDictDO basePatientGroupDictDO=null;
        if (StringUtils.isNotBlank(dictId)){
            basePatientGroupDictDO = basePatientGroupDictDao.findOne(dictId);
        }else {
            basePatientGroupDictDO = new BasePatientGroupDictDO();
        }
        if (baseDoctorDO!=null){
            basePatientGroupDictDO.setCreateUser(doctor);
            basePatientGroupDictDO.setCreateUserName(baseDoctorDO.getName());
        }
        basePatientGroupDictDO.setDel("1");
        basePatientGroupDictDO.setCreateTime(new Date());
        basePatientGroupDictDO.setGroupCode(groupCode);
        basePatientGroupDictDO.setGroupName(groupName);
       return basePatientGroupDictDao.save(basePatientGroupDictDO);
    }
    //删除分组
    public BasePatientGroupDictDO delPatientGroupDict(String dictId,String del){
        BasePatientGroupDictDO  basePatientGroupDictDO = basePatientGroupDictDao.findOne(dictId);
        basePatientGroupDictDO.setDel(del);
        return basePatientGroupDictDao.save(basePatientGroupDictDO);
    }
    public MixEnvelop findByDoctor(String doctor,String groupName,Integer page,Integer pageSize){
        Page<BasePatientGroupDictDO> list= basePatientGroupDictDao.findByCreateUserAndDel(doctor,"1",new PageRequest(page-1,pageSize));
        int listCount= basePatientGroupDictDao.findByDoctorCount(doctor);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page+1);
        mixEnvelop.setDetailModelList(list.getContent());
        mixEnvelop.setTotalCount(listCount);
        return mixEnvelop;
    }
    /**
     * 创建分页对象
     * @param page
     * @param size
     * @param sorts
     * @return
     */
    public Pageable creatPage(Integer page, Integer size, String sorts){
        PageRequest pageRequest = null;
        if(null == page || page <= 0){
            page = defaultPage;
        }
        if(null == size || size <= 0){
            size = defaultSize;
        }
        if(!org.apache.commons.lang3.StringUtils.isEmpty(sorts)){
            pageRequest = new PageRequest(page,size,createSort(sorts));
        }else{
            pageRequest = new PageRequest(page,size);
        }
        return pageRequest;
    }
    //将患者移动到指定分组中
    public void movePatientToGroup(String groupId,String patient,String doctor) throws Exception{
        BasePatientGroupDO basePatientGroupDO= basePatientGroupDao.findOneGroupByDoctorAndPatientAndGroupId(doctor,patient,groupId);
        if (basePatientGroupDO==null){
            basePatientGroupDO = new BasePatientGroupDO();
            basePatientGroupDO.setCreateTime(new Date());
            BasePatientDO basePatientDO = basePatientDao.findById(patient);
            if (basePatientDO!=null){
                basePatientGroupDO.setPatient(patient);
                basePatientGroupDO.setPatientName(basePatientDO.getName());
            }
            BaseDoctorDO baseDoctorDO = basedoctorDao.findById(doctor);
            if (baseDoctorDO!=null){
                basePatientGroupDO.setDoctor(doctor);
                basePatientGroupDO.setDoctorName(baseDoctorDO.getName());
            }
            basePatientGroupDO.setGroupId(groupId);
            basePatientGroupDao.save(basePatientGroupDO);
        }else {
            throw  new Exception("该患者已存在该分组中");
        }
    }
    //将患者从指定分组中删除
    public void delPatientGroup(String id) throws Exception{
        BasePatientGroupDO basePatientGroupDO= basePatientGroupDao.findOne(id);
        if (basePatientGroupDO!=null){
            basePatientGroupDao.delete(id);
        }else {
            throw  new Exception("该记录已删除");
        }
    }
    //查询患者分组
    public MixEnvelop findPatientGroup(String patientName,String doctor,String dictId,Integer page,Integer pageSize){
        String sql = "select t.id as \"id\"," +
                "  t.group_id as \"groupId\"," +
                "  t.patient as \"patient\"," +
                "  t.patient_name as \"patientName\"," +
                "  t.doctor as \"doctor\"," +
                "  b.idcard as \"idcard\"," +
                "  t.create_time as \"createTime\"" +
                " from base_patient_group t left join base_patient b " +
                " on t.patient = b.id where b.del = '1'";
        String sqlCount ="select count(1) as \"total\"" +
                " from base_patient_group t left join base_patient b " +
                " on t.patient = b.id where b.del = '1'";
        if (StringUtils.isNoneBlank(patientName)){
            sql +=" and b.name like '%"+patientName+"%'";
            sqlCount +=" and b.name like '%"+patientName+"%'";
        }
        if (StringUtils.isNoneBlank(doctor)){
            sql +=" and t.doctor ='"+doctor+"'";
            sqlCount +=" and t.doctor ='"+doctor+"'";
        }
        if (StringUtils.isNoneBlank(dictId)){
            sql +=" and t.group_id ='"+dictId+"'";
            sqlCount +=" and t.group_id ='"+dictId+"'";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql ,page,pageSize);
        List<Map<String,Object>> rstotal = hibenateUtils.createSQLQuery(sqlCount);
        Long count = 0L;
        if (rstotal != null && rstotal.size() > 0) {
            count = Long.parseLong(rstotal.get(0).get("total").toString());
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setTotalCount(count.intValue());
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setDetailModelList(list);
        return mixEnvelop;
    }
    //查询分组患者数量
    public List<Map<String,Object>> findPatientGroupNum(String doctor,String dictIds){
        List<Map<String,Object>> list = new ArrayList<>();
        if (StringUtils.isNoneBlank(dictIds)){
            String[] dictIdGroup = dictIds.split(",");
            for (int i=0;i<dictIdGroup.length;i++){
                int count = basePatientGroupDao.getCountByDoctor(doctor,dictIdGroup[i]);
                Map map = new HashMap();
                map.put(dictIdGroup[i],count);
                list.add(map);
            }
        }
        return list;
    }
}

+ 311 - 12
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -2,30 +2,52 @@ package com.yihu.jw.patient.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.hospital.prescription.WlyyInspectionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.dao.WlyyInspectionDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientGroupDao;
import com.yihu.jw.patient.dao.BasePatientGroupDictDao;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.restmodel.hospital.prescription.WlyyInspectionVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
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.base.BaseRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
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.data.repository.CrudRepository;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
 * 
@ -41,6 +63,7 @@ import java.util.Set;
 */
@Service
public class BasePatientService<T, R extends CrudRepository> extends BaseJpaService<BasePatientDO, BasePatientDao> {
    private static final Logger logger = LoggerFactory.getLogger(BasePatientService.class);
    @Autowired
    private BasePatientDao basePatientDao;
@ -59,7 +82,22 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
    private YkyyService ykyyService;
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
    private OutpatientDao outpatientDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${wechat.flag}")
    private boolean flag;
    @Autowired
    private WlyyInspectionDao wlyyInspectionDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private BasePatientGroupDao basePatientGroupDao;
    @Autowired
    private BasePatientGroupDictDao basePatientGroupDictDao;
    /**
     * 居民id
     * @param patientId
@ -74,21 +112,28 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
     * @param patientId
     * @return
     */
    public String getPatientById(String patientId) throws Exception{
        JSONObject result = new JSONObject();
    public Map getPatientById(String patientId) throws Exception{
        Map result = new HashMap();
        if(StringUtils.isEmpty(patientId)){
            result.put("result","parameter patientId is null");
            return result.toString();
            return result;
        }
        List<BasePatientDO> patientDOList = this.findByField("id",patientId);
        BasePatientDO basePatientDO = basePatientDao.findById(patientId);
        /*List<BasePatientDO> patientDOList = this.findByField("id",patientId);
        if(CollectionUtils.isEmpty(patientDOList)){
            result.put("result","not exist patient for id:"+patientId);
            return result.toString();
        }
        result.put("patient",patientDOList.get(0));
        }*/
        result.put("patient", basePatientDO);
        List<PatientMedicareCardDO> cards = basePatientMedicardCardService.findPatientCardByCode(patientId);
        if (cards==null||cards.size()==0){
            System.out.println("new一个list");
            PatientMedicareCardDO patientMedicareCardDO = new PatientMedicareCardDO();
            cards.add(patientMedicareCardDO);
        }
        result.put("medicareCard",cards);
        return result.toJSONString();
        return result;
    }
@ -263,6 +308,18 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
            basePatientDO1.setTownName(basePatientDO.getTownName());
            basePatientDO1.setCityName(basePatientDO.getCityName());
            basePatientDO1.setMobile(basePatientDO.getMobile());
            basePatientDO1.setRemark(basePatientDO.getRemark());
            basePatientDO1.setLiveCityCode(basePatientDO.getLiveCityCode());
            basePatientDO1.setLiveCityName(basePatientDO.getLiveCityName());
            basePatientDO1.setLiveProvinceCode(basePatientDO.getLiveProvinceCode());
            basePatientDO1.setLiveProvinceName(basePatientDO.getLiveProvinceName());
            basePatientDO1.setLiveStreetCode(basePatientDO.getLiveStreetCode());
            basePatientDO1.setLiveStreetName(basePatientDO.getLiveStreetName());
            basePatientDO1.setLiveTownCode(basePatientDO.getLiveTownCode());
            basePatientDO1.setLiveTownName(basePatientDO.getLiveTownName());
            basePatientDO1.setAddress(basePatientDO.getAddress());
            basePatientDO1.setCommitteeCode(basePatientDO.getCommitteeCode());
            basePatientDO1.setCommitteeName(basePatientDO.getCommitteeName());
            // 保存修改的居民信息
            this.save(basePatientDO1);
        }
@ -272,6 +329,7 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
        for (Object obj : patientMedicareCards) {
            PatientMedicareCardDO card = objectMapper.readValue(obj.toString(), PatientMedicareCardDO.class);
            card.setPatientCode(basePatientDO.getId());
            card.setDel("1");
            if(cardIdList.contains(card.getId())){
                cardIdList.remove(card.getId());
            }
@ -342,5 +400,246 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
        saveDoctorPwlimitDate(id);*/
        return true;
    }
    public Map<String,Object> getPatientCountByDoctor(String doctor,String patient) throws  Exception{
        List<WlyyOutpatientDO> fzList = outpatientDao.findByDoctorAndOutpatientType(doctor,"1",patient);
        List<WlyyOutpatientDO> xtList = outpatientDao.findByDoctorAndOutpatientType(doctor,"2",patient);
        List<WlyyOutpatientDO> zxList = outpatientDao.findByDoctorAndOutpatientType(doctor,"3",patient);
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("fzNum",fzList==null?0:fzList.size());
        resultMap.put("xtNum",xtList==null?0:xtList.size());
        resultMap.put("zxNum",zxList==null?0:zxList.size());
        return resultMap;
    }
    //查询电子病历
        public MixEnvelop findEmrByPatientId(String patient,String doctor,Integer page ,Integer pageSize){
        String sql ="select e.id as \"id\"," +
                " e.prescription_id as \"prescriptionId\"," +
                " e.complaint as \"complaint\"," +
                " e.medical_history as \"medicalHistory\"," +
                " e.past_history as \"pastHistory\"," +
                " e.physical_examination as \"physicalExamination\"," +
                " e.assist_examination as \"assistExamination\"," +
                " p.doctor_name as \"doctorName\"," +
                " p.doctor as \"doctor\"," +
                " e.popular_history as \"popularHistory\"," +
                " e.special_history as \"specialHistory\"," +
                " e.create_time as \"createTime\"," +
                " e.allergic_history as \"allergicHistory\"" +
                " from wlyy_prescription_emr e " +
                " left join  wlyy_prescription p on e.prescription_id = p.id" +
                " where p.status >= 20";
        if (StringUtils.isNoneBlank(patient)){
            sql+=" and p.patient_code ='"+patient+"'";
        }
        if (StringUtils.isNoneBlank(doctor)){
            sql+=" and p.doctor ='"+doctor+"'";
        }
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setTotalCount(list==null?0:list.size());
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setDetailModelList(list);
        return mixEnvelop;
    }
    //查询电子病历
   /* public MixEnvelop findPrescriptionByPatientAndDoctor(String patient,String doctor,Integer page ,Integer pageSize){
        String sql ="select p.id as \"id\"," +
                " p.outpatient_id as \"outpatient_id\"," +
                " p.real_order as \"real_order\"," +
                " p.origin_real_order as \"origin_real_order\"," +
                " p.adm_no as \"adm_no\"," +
                " p.origin_adm_no as \"origin_adm_no\"," +
                " p.serial_no as \"serial_no\"," +
                " p.origin_serial_no as \"origin_serial_no\"," +
                " p.type as \"type\"," +
                " p.patient_code as \"patient_code\"," +
                " p.patient_name as \"patient_name\"," +
                " p.status as \"status\"," +
                " p.mk_fail_reason as \"mk_fail_reason\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.idcard as \"idcard\"," +
                " p.ssc as \"ssc\"" +
                " from wlyy_prescription p " +
                " where p.status >= 20";
        if (StringUtils.isNoneBlank(patient)){
            sql+=" and p.patient_code ='"+patient+"'";
        }
        if (StringUtils.isNoneBlank(doctor)){
            sql+=" and p.doctor ='"+doctor+"'";
        }
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setTotalCount(list==null?0:list.size());
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setDetailModelList(list);
        return mixEnvelop;
    }*/
    /**
     * 查询患者所有处方信息
     *
     * @param page
     * @param size
     * @return
     */
    public PageEnvelop findPatientAllPrescription(String doctor,String keyName, String status, Integer page, Integer size,String patient,String isSelectDrug) {
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if (patientDO==null){
            return PageEnvelop.getError("找不到该患者",-1);
        }
        StringBuffer sql = new StringBuffer(" SELECT DISTINCT b.*, c.oneself_pickup_flg,f.job_title_code,f.job_title_name  FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        StringBuffer countSql = new StringBuffer("select COUNT(DISTINCT b.id) count FROM (SELECT a.* FROM wlyy_prescription a left join wlyy_outpatient o ON o.id=a.outpatient_id  WHERE o.consumer = '");
        sql.append(patient).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        countSql.append(patient).append("') b  LEFT JOIN wlyy_prescription_expressage c ON c.outpatient_id = b.outpatient_id LEFT JOIN base_doctor f ON b.doctor=f.id  ");
        if (StringUtils.isNoneBlank(isSelectDrug)){
            if("0".equalsIgnoreCase(isSelectDrug)){
                sql.append(" left join wlyy_inspection m on b.outpatient_id =m.outpatient_id");
                countSql.append(" left join wlyy_inspection m on b.outpatient_id =m.outpatient_id");
            }
            if ("1".equalsIgnoreCase(isSelectDrug)){
                sql.append(" left join wlyy_prescription_info m on b.id =m.prescription_id");
                countSql.append(" left join wlyy_prescription_info m on b.id =m.prescription_id");
            }
        }
        if (StringUtils.isNotEmpty(status)) {
            status = status.substring(1, status.length() - 1);
            if (StringUtils.isNoneBlank(isSelectDrug)){
                if("0".equalsIgnoreCase(isSelectDrug)){
                    sql.append(" where b.status IN( 9,").append(status).append(")");
                    countSql.append(" where b.status IN( 9,").append(status).append(")");
                }else {
                    sql.append(" where b.status IN(").append(status).append(")");
                    countSql.append(" where b.status IN(").append(status).append(")");
                }
            }else{
                sql.append(" where b.status IN(").append(status).append(")");
                countSql.append(" where b.status IN(").append(status).append(")");
            }
        } else {
            sql.append("  where b.status IN(20,21,30,31,32,100,101)");
            countSql.append(" where b.status IN(20,21,30,31,32,100,101) ");
        }
        if (StringUtils.isNoneBlank(isSelectDrug)){
            if("0".equalsIgnoreCase(isSelectDrug)){
                sql.append(" and m.del =1 ");
                countSql.append(" and m.del =1 ");
            }
            if ("1".equalsIgnoreCase(isSelectDrug)){
                sql.append(" and m.del =1");
                countSql.append(" and m.del =1");
            }
        }
        if (StringUtils.isNotEmpty(keyName)) {
            sql.append(" and (" +
                    " b.doctor_name LIKE '%" + keyName + "%' " +
                    " OR b.dept_name LIKE'%" + keyName + "%' " +
                    " OR b.hospital_name LIKE '%" + keyName + "%' " +
                    " OR d.drug_name LIKE '%" + keyName + "%' " +
                    " OR b.real_order LIKE '%" + keyName + "%' " +
                    ")");
            countSql.append(" and (" +
                    " b.doctor_name LIKE '%" + keyName + "%' " +
                    " OR b.dept_name LIKE'%" + keyName + "%' " +
                    " OR b.hospital_name LIKE '%" + keyName + "%' " +
                    " OR d.drug_name LIKE '%" + keyName + "%' " +
                    " OR b.real_order LIKE '%" + keyName + "%' " +
                    ")");
        }
        if (StringUtils.isNotEmpty(doctor)) {
            sql.append(" and  b.doctor ='" +doctor+"'");
            countSql.append(" and  b.doctor ='" +doctor+"'");
        }
        sql.append(" order by b.prescribe_time DESC ");
        List<WlyyPrescriptionVO> list = null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
            String oracleSql = "SELECT\n" +
                    "\t*\n" +
                    "FROM\n" +
                    "\t(\n" +
                    "\t\tSELECT\n" +
                    "\t\t\tA .*\n" +
                    "\t\tFROM\n" +
                    "\t\t\t(";
            oracleSql += sql.toString();
            oracleSql += "\t\t\t) A\n" +
                    "\t\tWHERE\n" +
                    "  ROWNUM <=" + page * size +
                    "\t) \n" +
                    "WHERE\n" +
                    "\tROWNUM >= " + (page - 1) * size;
            if (flag){
                sql.append("  limit ").append((page - 1) * size).append(",").append(size);
                logger.info("MySql=" + sql.toString());
                list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
            }else {
                logger.info("oracleSql=" + oracleSql);
                list = jdbcTemplate.query(oracleSql, new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
            }
        } else {
//            sql+=" LIMIT  " + (page - 1) * size + "," + size + "";
            sql.append("  limit ").append((page - 1) * size).append(",").append(size);
            logger.info("MySql=" + sql.toString());
            list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        }
        for (WlyyPrescriptionVO singlePre:list){
            List<WlyyPrescriptionInfoDO> infoDOs = prescriptionInfoDao.findByPrescriptionId(singlePre.getId(),1);
            logger.info("singlePreId===="+singlePre.getId());
            logger.info("infoDOs"+infoDOs);
            List<WlyyPrescriptionInfoVO> infoVOS = new ArrayList<>();
            convertToModels(infoDOs, infoVOS, WlyyPrescriptionInfoVO.class);
            logger.info("infoVOS"+infoVOS);
            singlePre.setInfoVOs(infoVOS);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(singlePre.getId(),1);
            List<WlyyInspectionVO> inspectionVOS = new ArrayList<>();
            convertToModels(inspectionDOS, inspectionVOS, WlyyInspectionVO.class);
            //BeanUtils.copyProperties(inspectionDOS,inspectionVOS);
            singlePre.setInspectionVOs(inspectionVOS);
        }
//        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(WlyyPrescriptionVO.class));
        logger.info("countSql=" + countSql.toString());
        List<Map<String, Object>> mapList = jdbcTemplate.queryForList(countSql.toString());
        long count = Long.parseLong(mapList.get(0).get("count").toString());
        return PageEnvelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find, list, page, size, count);
    }
    public Map<String,Object>  findPatientInfoById(String patientId,String doctor){
        String sql = "select b.id as \"id\"," +
                "  b.group_code as \"groupCode\"," +
                "  b.group_name as \"groupName\"" +
                "  from base_patient_group t " +
                " left join base_patient_group_dict b on t.group_id = b.id" +
                " where b.del = '1' and t.patient ='"+patientId+"' and t.doctor ='"+doctor+"'";
        sql+=" group by b.id,b.group_code,b.group_name";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        String patientSql= "select t.id as \"id\"," +
                " t.name as \"name\"," +
                " t.idcard as \"idcard\"," +
                " t.disease as \"disease\"" +
                "  from base_patient t where t.del = '1' and t.id='"+patientId+"'";
        List<Map<String,Object>> patientInfo = hibenateUtils.createSQLQuery(patientSql);
        if (patientInfo!=null&&patientInfo.size()>0){
            Map<String,Object> patient = patientInfo.get(0);
            String sex = IdCardUtil.getSexForIdcard_new(patient.get("idcard").toString());
            Integer age = IdCardUtil.getAgeForIdcard(patient.get("idcard").toString());
            patient.put("sex",sex);
            patient.put("age",age);
            patient.put("groupList",list);
            return patient;
        }
        return null;
    }
}

+ 2 - 5
business/base-service/src/main/java/com/yihu/jw/wechat/service/BaseSensitiveFilterWordsService.java

@ -19,8 +19,6 @@ import java.util.*;
@Service
public class BaseSensitiveFilterWordsService extends BaseJpaService<BaseSensitiveDO, BaseSensitiveDao> {
    @Autowired
    private BaseSensitiveDao baseSensitiveDao;
    @Autowired
@ -34,14 +32,13 @@ public class BaseSensitiveFilterWordsService extends BaseJpaService<BaseSensitiv
     * @param txt
     * @return
     */
    public String filterSensitiveWords(String txt){
        List<BaseSensitiveDO> list = (List<BaseSensitiveDO>) baseSensitiveDao.findAll();
    public String filterSensitiveWords(String txt, List<BaseSensitiveDO> list){
        HashSet<String> set = new HashSet<>();
        for (BaseSensitiveDO one : list) {
            set.add(one.getSensitiveWord());
        }
        SensitivewordFilter filter = new SensitivewordFilter(set);
        Set<String> words = filter.getSensitiveWord(txt, 1);
        /*Set<String> words = filter.getSensitiveWord(txt, 1);*/
        String replaceTxt = filter.replaceSensitiveWord(txt, 1, "***");
        return replaceTxt;
    }

+ 7 - 7
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -617,15 +617,15 @@ public class WxTemplateService {
                        config.setUrl(url);
                        weixinMessagePushUtils.putWxMsg(wxAccessTokenService.getWxAccessTokenById(wechatId).getAccessToken(),basePatientWechatDo.getOpenid(),config);
                }
                List<WlyyOutpatientDO> list = outpatientDao.findWlyyOutpatientDO(basePatientDO.getId());
                if (list!=null&&list.size()>0){
                    WlyyOutpatientDO wlyyOutpatientDO = list.get(0);
                    wlyyOutpatientDO.setConsumer(basePatientDO.getId());
                    wlyyOutpatientDO.setDoctorName(senderName);
                    prescriptionService.wxTempalteJPush("consult_remind",wlyyOutpatientDO,null,"","","","");
                }
            }
            List<WlyyOutpatientDO> list = outpatientDao.findWlyyOutpatientDO(basePatientDO.getId());
            if (list!=null&&list.size()>0){
                WlyyOutpatientDO wlyyOutpatientDO = list.get(0);
                wlyyOutpatientDO.setConsumer(basePatientDO.getId());
                wlyyOutpatientDO.setDoctorName(senderName);
                prescriptionService.wxTempalteJPush("consult_remind",wlyyOutpatientDO,null,"","","","");
            }
        }else{
            throw new Exception("接收者ID错误,无法找到该账号");

+ 4 - 2
business/base-service/src/mqConfig/mqdata/BS15018.json

@ -7,7 +7,8 @@
		"OP_DATE": "2011-09-27 15:35:57",
		"CARD_TYPE": "2",
		"CARD_TYPE_NAME": "社保卡",
		"social_no": "350211198411053024"
		"social_no": "350211198411053024",
			"name":"白海灵"
		},
	{
		"PAT_NO": "P5616242-0",
@ -16,6 +17,7 @@
		"OP_DATE": "2014-07-25 08:46:40",
		"CARD_TYPE": "2",
		"CARD_TYPE_NAME": "社保卡",
		"social_no": "350211198411053024"
		"social_no": "350211198411053024",
		"name":"白海灵"
	}]
}

+ 135 - 21
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -4385,15 +4385,17 @@ public class ImService {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else{}*/
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
			if (!"xm_ihealth_wx".equalsIgnoreCase(wxId)){
				if("xm_ykyy_wx".equals(wxId)){
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}else {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}
				}else {
					sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else {
				sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
			}
			sql =sql +" AND op.type in ('1','2') AND op.outpatient_type = 3 ";
			sql =sql +" ORDER BY op.create_time DESC";
@ -4446,27 +4448,31 @@ public class ImService {
			}else if("16".equals(type)){
				//视频复诊
				sql =sql +"AND op.type=2 AND op.outpatient_type=1 ";
				if("xm_ykyy_wx".equals(wxId)){
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
				if (!"xm_ihealth_wx".equalsIgnoreCase(wxId)){
					if("xm_ykyy_wx".equals(wxId)){
						if (flag){
							sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
						}else {
							sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
						}
					}else {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
						sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
					}
				}else {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else if("12".equals(type)){
				//视频复诊
				sql =sql +"AND op.outpatient_type=2";
				if("xm_ykyy_wx".equals(wxId)){
					if (flag){
						sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
					}else  {
						sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
				if (!"xm_ihealth_wx".equalsIgnoreCase(wxId)){
					if("xm_ykyy_wx".equals(wxId)){
						if (flag){
							sql +=" and op.register_date >= str_to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
						}else  {
							sql +=" and op.register_date >= to_date('"+DateUtil.dateToStrShort(new Date())+" 00:00:00','YYYY-MM-DD HH24:MI:SS')";
						}
					}else {
						sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
					}
				}else {
					sql +=" AND  op.register_date >= '"+DateUtil.dateToStrShort(new Date())+" 00:00:00' ";
				}
			}else{}
@ -4483,4 +4489,112 @@ public class ImService {
		}
		return mapList;
	}
	/**
	 * 查询医生所有的咨询记录
	 * @param doctor 医生标识
	 * @param type 咨询会话类型 : 0 全部
	 * @param pagesize 分页大小
	 * @return
	 */
	@Transactional(readOnly = true)
	public List<Map<String,Object>>  findRecordByDoctor(String doctor,
																  String type, String patientIdCard,String patientName,
																  int page,int pagesize) throws Exception {
		String  sql = "select DISTINCT t.id as \"id\"," +
				"  t.name as \"name\"," +
				"  t.idcard as \"idcard\"," +
				"  t.mobile as \"mobile\"," +
				"  op.doctor as \"doctor\"," +
				"  op.doctor_name as \"doctorName\"," +
				"  op.outpatient_type as \"outpatientType\"" +
				" from base_patient t left join wlyy_outpatient op " +
				" on t.id = op.patient where t.del ='1' and op.status!= -1";
		if (org.apache.commons.lang3.StringUtils.isNoneBlank(doctor)){
			sql+=" and op.doctor = '"+doctor+"'";
		}
		if (org.apache.commons.lang3.StringUtils.isNoneBlank(patientIdCard)){
			sql+=" and t.idcard like '%"+patientIdCard+"%'";
		}
		if (org.apache.commons.lang3.StringUtils.isNoneBlank(patientName)){
			sql+=" and t.name like '%"+patientName+"%'";
		}
		//咨询类型
		if(!StringUtils.isEmpty(type)){
			if (type.equalsIgnoreCase("1")){
				sql +=" AND  op.outpatient_type = 1";
			}else if (type.equalsIgnoreCase("2")){
				sql +=" AND op.outpatient_type = 2";
			}else if (type.equalsIgnoreCase("3")){
				sql +=" AND  op.outpatient_type = 3";
			}else {
				sql +=" AND op.outpatient_type in (1,2,3) ";
			}
		}
		sql+=" order by op.create_time  ";
		logger.info("findRecordByDoctorSQL==="+sql);
		List<Map<String,Object>>  list = hibenateUtils.createSQLQuery(sql,page,pagesize);
		for (Map<String,Object> map:list){
			if (map.get("idcard")!=null){
				String idcard = map.get("idcard").toString();
				Integer age = IdCardUtil.getAgeForIdcard(idcard);
				String sex = IdCardUtil.getSexForIdcard(idcard);
				map.put("patientAge",age);
				map.put("patientSex",sex);
			}
		}
		return list;
	}
	@Transactional(readOnly = true)
	public List<Map<String,Object>>  findRecordCountByDoctor(String doctor,
														String type, String patientIdCard,String patientName) {
		String[] outpatientType = type.split(",");
		List<Map<String,Object>> resultList = new ArrayList<>();
		for (int i=0;i<outpatientType.length;i++){
			String  sql = "select DISTINCT t.id as \"id\"," +
					"  t.name as \"name\"," +
					"  t.idcard as \"idcard\"," +
					"  t.mobile as \"mobile\"," +
					"  op.doctor as \"doctor\"," +
					"  op.doctor_name as \"doctorName\"," +
					"  op.outpatient_type as \"outpatientType\"" +
					" from base_patient t left join wlyy_outpatient op " +
					" on t.id = op.patient where t.del ='1' and op.status!= -1";
			if (org.apache.commons.lang3.StringUtils.isNoneBlank(doctor)){
				sql+=" and op.doctor = '"+doctor+"'";
			}
			if (org.apache.commons.lang3.StringUtils.isNoneBlank(patientIdCard)){
				sql+=" and t.idcard like '%"+patientIdCard+"%'";
			}
			if (org.apache.commons.lang3.StringUtils.isNoneBlank(patientName)){
				sql+=" and t.name like '%"+patientName+"%'";
			}
			//咨询类型
			String mapKey = "";
			Map map = new HashMap();
			if(!StringUtils.isEmpty(outpatientType[i])){
				if (outpatientType[i].equalsIgnoreCase("1")){
					sql +=" AND  op.outpatient_type = 1";
					mapKey="fzNum";
				}else if (outpatientType[i].equalsIgnoreCase("2")){
					sql +=" AND op.outpatient_type = 2";
					mapKey="xtNum";
				}else if (outpatientType[i].equalsIgnoreCase("3")){
					sql +=" AND  op.outpatient_type = 3";
					mapKey="zxNum";
				}else {
					sql +=" AND op.outpatient_type in (1,2,3) ";
					mapKey="zxNum";
				}
				logger.info("findRecordCountByDoctor==="+sql);
				List<Map<String,Object>>  list = hibenateUtils.createSQLQuery(sql);
				map.put(mapKey,list==null?0:list.size());
			}
			resultList.add(map);
		}
		return resultList;
	}
}

+ 11 - 1
common/common-entity/sql记录

@ -386,6 +386,9 @@ CREATE TABLE `base_semoni_doctor_status` (
alter TABLE base.base_security_monitoring_order add COLUMN doctor_confirm_finish_img VARCHAR(3000) DEFAULT NULL COMMENT '医生确认完成照片';
alter TABLE base.base_security_monitoring_order add COLUMN doctor_confirm_finish_time timestamp NULL DEFAULT NULL COMMENT '医生确认完成时间';
-- 2021-04-09 中山消息推送
alter table wlyy_outpatient ADD last_remind_time timestamp ;
alter table wlyy_outpatient ADD remind_doctor  varchar(50) ;
-- 2021-04-10 lb
ALTER table base.base_patient_bed_apply  MODIFY `patient` varchar(50) DEFAULT NULL;
@ -435,4 +438,11 @@ ALTER table base.base_emergency_assistance_order modify COLUMN  `conclusion_img`
ALTER table base.base_emergency_assistance_order add COLUMN `proxy_patient` varchar(50) DEFAULT NULL COMMENT '代理发起工单的居民code,替父母,孩子等发起工单';
ALTER table base.base_emergency_assistance_order add COLUMN `proxy_patient_name` varchar(10) DEFAULT NULL COMMENT '代理发起工单的居民code,替父母,孩子等发起工单';
ALTER table base.base_emergency_assistance_order add COLUMN  `proxy_patient_phone` varchar(15) DEFAULT NULL COMMENT '代理发起工单的居民联系电话';
ALTER table base.base_emergency_assistance_order add COLUMN   `type` tinyint(2) DEFAULT '1' COMMENT '发起类型(1本人发起 2家人待预约 3医生代预约)';
ALTER table base.base_emergency_assistance_order add COLUMN   `type` tinyint(2) DEFAULT '1' COMMENT '发起类型(1本人发起 2家人待预约 3医生代预约)';
-- 2021-04-20 wj
alter table base_doctor add doctor_level tinyint(4) DEFAULT NULL COMMENT '类型 1社区医生,2助老员';
-- 2021-04-29 wj
alter table base_patient ADD disease varchar(50) ;
alter table patient_medicare_card ADD medicare_number varchar(50) ;

+ 9 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/patient/PatientMedicareCardDO.java

@ -78,7 +78,7 @@ public class PatientMedicareCardDO extends IntegerIdentityEntity {
           this.desc = desc;
       }
   }
    private String medicareNumber;
    /**
	 * 卡标识
	 */
@ -123,9 +123,16 @@ public class PatientMedicareCardDO extends IntegerIdentityEntity {
	 * 状态,0-解除绑定,1-绑定中
	 */
	private String del;
    @Column(name = "medicare_number")
    public String getMedicareNumber() {
        return medicareNumber;
    }
    public void setMedicareNumber(String medicareNumber) {
        this.medicareNumber = medicareNumber;
    }
	@Column(name = "code")
    @Column(name = "code")
    public String getCode() {
        return code;
    }

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/servicePackage/ServicePackageItemDO.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.math.BigDecimal;
/**
@ -23,6 +24,7 @@ public class ServicePackageItemDO extends UuidIdentityEntity implements java.io.
    private String orgName;//'机构名称'
    private String introduce;//'服务简介'
    private String del;//是否生效(1 生效,0 失效)
    private String delName;
    private String teamCode;//'服务团队code'
    private String teamName;//'服务团队名称'
    private String createTime;//
@ -143,4 +145,12 @@ public class ServicePackageItemDO extends UuidIdentityEntity implements java.io.
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
    @Transient
    public String getDelName() {
        return delName;
    }
    public void setDelName(String delName) {
        this.delName = delName;
    }
}

+ 25 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -279,6 +279,31 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
     * 云信房间号
     */
    private String channelId;
    /**
     * 是否提醒过医生
     */
    private String remindDoctor;
    /**
     * 上次提醒时间
     */
    private Date lastRemindTime;
    @Column(name = "last_remind_time")
    public Date getLastRemindTime() {
        return lastRemindTime;
    }
    public void setLastRemindTime(Date lastRemindTime) {
        this.lastRemindTime = lastRemindTime;
    }
    @Column(name = "remind_doctor")
    public String getRemindDoctor() {
        return remindDoctor;
    }
    public void setRemindDoctor(String remindDoctor) {
        this.remindDoctor = remindDoctor;
    }
    @Column(name = "charge_type")
    public String getChargeType() {
        return chargeType;

+ 67 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/patient/BasePatientGroupDO.java

@ -0,0 +1,67 @@
package com.yihu.jw.entity.patient;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "base_patient_group")
public class BasePatientGroupDO extends UuidIdentityEntity {
    private String groupId;
    private String patient;
    private String patientName;
    private String doctor;
    private String doctorName;
    private Date createTime;
    @Column(name = "group_id")
    public String getGroupId() {
        return groupId;
    }
    public void setGroupId(String groupId) {
        this.groupId = groupId;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 69 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/patient/BasePatientGroupDictDO.java

@ -0,0 +1,69 @@
package com.yihu.jw.entity.patient;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@Entity
@Table(name = "base_patient_group_dict")
public class BasePatientGroupDictDO extends UuidIdentityEntity {
    private String groupCode;
    private String groupName;
    private String del;
    private Date createTime;
    private String createUser;
    private String createUserName;
    @Column(name = "group_code")
    public String getGroupCode() {
        return groupCode;
    }
    public void setGroupCode(String groupCode) {
        this.groupCode = groupCode;
    }
    @Column(name = "group_name")
    public String getGroupName() {
        return groupName;
    }
    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }
    @Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "create_user")
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name = "create_user_name")
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
}

+ 13 - 1
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -242,6 +242,8 @@ public class BaseRequestMapping {
        public static final String UPLOAD_STREAM_video  = "/upload_stream_video";
        public static final String UPLOAD_STRING  = "/upload_string";
        public static final String UPLOAD_STREAM_ATTACHMENT  = "/upload_stream_attachment";
        public static final String DELETE_FILE = "/DELETE_FILE";
    }
    /**
@ -507,7 +509,17 @@ public class BaseRequestMapping {
        public static final String GetKey = "getKey";
        public static final String Login = "login";
        public static final String updatePatientPw = "/updatePatientPw";
        public static final String getPatientCountByDoctor  = "/getPatientCountByDoctor";
        public static final String getPatientEmrByDoctor  = "/getPatientEmrByDoctor";
        public static final String findPaitentPrescription  = "/findPaitentPrescription";
        public static final String createPatientGroupDict  = "/createPatientGroupDict";
        public static final String deletePatientGroupDict  = "/deletePatientGroupDict";
        public static final String findGroupByDoctor  = "/findGroupByDoctor";
        public static final String movePatientToGroup  = "/movePatientToGroup";
        public static final String delPatientGroup  = "/delPatientGroup";
        public static final String findPatientGroup  = "/findPatientGroup";
        public static final String findPatientGroupNum  = "/findPatientGroupNum";
        public static final String findOnePatientInfo  = "/findOnePatientInfo";
    }
   /**

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

@ -1107,6 +1107,8 @@ public class BaseHospitalRequestMapping {
        public static final String findZlxm = "/findZlxm";
        public static final String findZlxmMx = "/findZlxmMx";
        public static final String getPrevious = "/getPrevious";
        public static final String findRecordByDoctor = "/findRecordByDoctor";
        public static final String findRecordCountByDoctor = "/findRecordCountByDoctor";
    }

+ 19 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/common/UploadVO.java

@ -22,6 +22,25 @@ public class UploadVO implements Serializable{
    @ApiModelProperty("完整的uri(不包含http)")
    private String fullUri; //完整的uri healthArchiveGroup/M00/00/24/rBFuH1XdQC6AP3CDAAzodQCbVVc052.jpg
    private String groupName;
    private String remoteFileName;
    public String getGroupName() {
        return groupName;
    }
    public void setGroupName(String groupName) {
        this.groupName = groupName;
    }
    public String getRemoteFileName() {
        return remoteFileName;
    }
    public void setRemoteFileName(String remoteFileName) {
        this.remoteFileName = remoteFileName;
    }
    public String getFullUrl() {
        return fullUrl;
    }

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java

@ -72,8 +72,8 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
    public Envelop getPatientById(
            @ApiParam(name = "id", value = "居民id")
            @RequestParam(value = "id", required = true) String id) throws Exception {
        String result = basePatientService.getPatientById(id);
        return success(result);
        return success(basePatientService.getPatientById(id));
    }
    @GetMapping(value = "findPatientById")

+ 17 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/servicePackage/ServicePackageItemEndpoint.java

@ -1,9 +1,12 @@
package com.yihu.jw.base.endpoint.servicePackage;
import com.alibaba.fastjson.JSONObject;
import com.netflix.discovery.converters.Auto;
import com.yihu.jw.base.service.servicePackage.ServicePackageItemService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.entity.base.servicePackage.ServicePackageItemDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -12,11 +15,15 @@ import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.codec.binary.Base64;
import org.nlpcn.es4sql.domain.From;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
/**
@ -29,6 +36,8 @@ public class ServicePackageItemEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ServicePackageItemService servicePackageItemService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @PostMapping(value = "create")
    @ApiOperation(value = "创建")
@ -79,6 +88,14 @@ public class ServicePackageItemEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<ServicePackageItemDO> servicePackageItemDOS = servicePackageItemService.search(fields, filters, sorts, page, size);
        for (ServicePackageItemDO servicePackageItemDO:servicePackageItemDOS){
            List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findByDictName("isEffect");
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO1:wlyyHospitalSysDictDO){
                if (servicePackageItemDO.getDel().equalsIgnoreCase(wlyyHospitalSysDictDO1.getDictCode())){
                    servicePackageItemDO.setDelName(wlyyHospitalSysDictDO1.getDictValue());
                }
            }
        }
        int count = (int)servicePackageItemService.getCount(filters);
        return success(servicePackageItemDOS, count, page, size);
    }
@ -95,6 +112,4 @@ public class ServicePackageItemEndpoint extends EnvelopRestEndpoint {
        List<ServicePackageItemDO> servicePackageItemDOS = servicePackageItemService.search(fields, filters, sorts);
        return success(servicePackageItemDOS);
    }
}

+ 3 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -346,7 +346,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        List<Map<String,Object>> list=null;
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
        list = hibenateUtils.createSQLQuery(sql,page,size);
       /* if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            if (flag){
                sql+=" LIMIT  " + (page - 1) * size + "," + size + "";
@ -379,7 +380,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            sql+=" LIMIT  " + (page - 1) * size + "," + size + "";
            Logger.getAnonymousLogger().info("finalCountSql="+sql);
            list = jdbcTemplate.queryForList(sql);
        }
        }*/
        String countSql = " select " +

+ 7 - 6
svr/svr-base/src/main/java/com/yihu/jw/base/service/servicePackage/ServicePackageItemService.java

@ -38,12 +38,7 @@ public class ServicePackageItemService extends BaseJpaService<ServicePackageItem
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
       List<ServicePackageItemDO> itemDOList = servicePackageItemDao.findByTeamCode(itemDO.getTeamCode(),itemDO.getCode());
        if(itemDOList!=null&&itemDOList.size()>0){
            result.put("msg","该服务团队已存在此服务项,请勿重复添加");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        BaseOrgDO baseOrgDO = baseOrgDao.findByCode(itemDO.getOrgCode());
        if (baseOrgDO!=null){
            itemDO.setOrgName(baseOrgDO.getName());
@ -54,6 +49,12 @@ public class ServicePackageItemService extends BaseJpaService<ServicePackageItem
        }
        if(StringUtil.isEmpty(itemDO.getId())){
            //新增
            List<ServicePackageItemDO> itemDOList = servicePackageItemDao.findByTeamCode(itemDO.getTeamCode(),itemDO.getCode());
            if(itemDOList!=null&&itemDOList.size()>0){
                result.put("msg","该服务团队已存在此服务项,请勿重复添加");
                result.put("response", ConstantUtils.FAIL);
                return result;
            }
            itemDO.setPrice(new BigDecimal(0));
            itemDO.setServicePackageId("system");
            itemDO.setCreateTime(DateUtil.getStringDate());

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/user/UserService.java

@ -252,10 +252,10 @@ public class UserService extends BaseJpaService<UserDO, UserDao> {
                " g.street_code AS streetCode, " +
                " g.street_name AS streetName, " +
                " g.name, " +
                " address " +
                " g.address " +
                " FROM " +
                " base_org g " +
                " JOIN base_org_user u ON g.`code` = u.org_code " +
                " JOIN base_org_user u ON g.code = u.org_code " +
                " WHERE  " +
                " u.user_id = '" + id + "'";
        List<Map<String, Object>> org = jdbcTemplate.queryForList(sql);

+ 1 - 1
svr/svr-base/src/main/resources/bootstrap.yml

@ -1,6 +1,6 @@
spring:
  application:
    name: svr-base-ysj
    name: svr-base
  cloud:
    config:
      failFast: true

+ 118 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/doctor/DoctorServiceEndPoint.java

@ -0,0 +1,118 @@
package com.yihu.jw.care.endpoint.doctor;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author zmk
 * @vsrsion 1.0
 * Created at 2019/12/9
 */
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.DoctorSetting.PREFIX)
@Api(tags = "互联网医院后台医生服务配置", description = "互联网医院后台医生服务配置")
public class DoctorServiceEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseDoctorInfoService baseDoctorService;
    @GetMapping(value = BaseHospitalRequestMapping.DoctorSetting.queryList)
    @ApiOperation(value = "获取分页列表")
    public Envelop queryList(
            @ApiParam(name = "city", value = "市区")
            @RequestParam(value = "city", required = false) String city,
            @ApiParam(name = "hospital", value = "机构")
            @RequestParam(value = "hospital", required = false) String hospital,
            @ApiParam(name = "status", value = "状态")
            @RequestParam(value = "status", required = false) String status,
            @ApiParam(name = "name", value = "科室或医生名称")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "type", value = "咨询类型")
            @RequestParam(value = "type", required = false) String type,
            @ApiParam(name = "typeCode", value = "分部,无分部不传")
            @RequestParam(value = "typeCode", required = false)String typeCode,
            @ApiParam(name = "dept", value = "部门")
            @RequestParam(value = "dept", required = false)String dept,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "pageSize", value = "页码", required = true, defaultValue = "10")
            @RequestParam(value = "pageSize") int pageSize) throws Exception {
        return baseDoctorService.queryList(city,hospital,status,name,type,typeCode,dept,page,pageSize);
    }
    @GetMapping(value = BaseHospitalRequestMapping.DoctorSetting.queryById)
    @ApiOperation(value = "根据医生id查询详情")
    public Envelop queryById(
            @ApiParam(name = "doctorId", value = "医生id")
            @RequestParam(value = "doctorId", required = true) String doctorId,
            @ApiParam(name = "typeCode", value = "分部,无不传")
            @RequestParam(value = "typeCode", required = false)String typeCode)throws Exception{
        Object object = baseDoctorService.queryById(doctorId,typeCode);
        if (null != object){
            return success("查询成功",object);
        }
        return failed("查询失败");
    }
    @PostMapping(value = BaseHospitalRequestMapping.DoctorSetting.update)
    @ApiOperation(value = "修改医生服务配置")
    public Envelop update(
            @ApiParam(name = "baseDoctorVo", value = "JSON数据", required = true)
            @RequestParam(value = "baseDoctorVo") String baseDoctorVo)throws Exception{
        JSONObject jsonObject = JSONObject.fromObject(baseDoctorVo);
        Boolean update = baseDoctorService.update(jsonObject);
        if (!update){
            return failed("保存失败,参数不可为空");
        }
        return success("保存成功");
    }
    @PostMapping(value = BaseHospitalRequestMapping.DoctorSetting.updateList)
    @ApiOperation(value = "批量修改医生服务配置")
    public Envelop updateList(
            @ApiParam(name = "baseDoctorVos", value = "JSON数据", required = true)
            @RequestParam(value = "baseDoctorVos") String baseDoctorVos)throws Exception{
        JSONArray jsonArray = JSONArray.fromObject(baseDoctorVos);
        Boolean update = baseDoctorService.updateList(jsonArray);
        return success("保存成功");
    }
    @GetMapping(value = BaseHospitalRequestMapping.DoctorSetting.updateStatus)
    @ApiOperation(value = "修改医生状态")
    public Envelop updateStatus(
            @ApiParam(name = "doctorId", value = "状态")
            @RequestParam(value = "doctorId", required = true) String doctorId,
            @ApiParam(name = "status", value = "状态")
            @RequestParam(value = "status", required = true) String status)throws Exception{
        baseDoctorService.updateStatus(doctorId,status);
        return success("修改成功");
    }
    @PostMapping(value = BaseHospitalRequestMapping.DoctorSetting.updateDoctorPw)
    @ApiOperation(value = "修改医生账号密码")
    public Envelop updateDoctorPw(@ApiParam(name = "id", value = "医生ID")
                                  @RequestParam(value = "id", required = true)String id,
                                  @ApiParam(name = "pw", value = "密码")
                                  @RequestParam(value = "pw", required = true)String pw,
                                  @ApiParam(name = "orgPw", value = "原密码")
                                  @RequestParam(value = "orgPw", required = true)String orgPw)throws Exception{
        return success(baseDoctorService.updateDoctorPw(id,pw,orgPw));
    }
}

+ 12 - 12
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/DeviceController.java

@ -38,7 +38,7 @@ public class DeviceController {
    }
    @ApiOperation("爱牵挂设备sos数据接收")
    @RequestMapping(value = "aqgsos", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.POST)
    @RequestMapping(value = "aqgsos", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String aqgsos(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = false) String imei,
@ -60,7 +60,7 @@ public class DeviceController {
    }
    @ApiOperation("爱牵挂设备开关机数据接收")
    @RequestMapping(value = "aqgSwitch", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.POST)
    @RequestMapping(value = "aqgSwitch", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String aqgSwitch(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = false) String imei,
@ -84,7 +84,7 @@ public class DeviceController {
    }
    @ApiOperation("爱牵挂设备消息通知数据接收")
    @RequestMapping(value = "pushdata", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.GET)
    @RequestMapping(value = "pushdata", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String pushdata(
            @ApiParam(name="type",required = false,value="根据type来定义给用户推送提示  type=1 SOS,type=5 设备低电, 其他类型非本机型所有",defaultValue = "")
            @RequestParam(value = "type",required = false) int type,
@ -108,7 +108,7 @@ public class DeviceController {
    //
    @ApiOperation("柏颐设备位置接收")
    @RequestMapping(value = "byLocation", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.POST)
    @RequestMapping(value = "byLocation", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String byLocation(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = true) String imei,
@ -143,7 +143,7 @@ public class DeviceController {
    @ApiOperation("柏颐心率数据接收")
    @RequestMapping(value = "byHeartRate", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.POST)
    @RequestMapping(value = "byHeartRate", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String byHeartRate(
            @ApiParam(name = "imei", value = "15位设备唯一序号")
            @RequestParam(value = "imei",required = true)String imei,
@ -169,7 +169,7 @@ public class DeviceController {
    }
    @ApiOperation("柏颐血压数据接收")
    @RequestMapping(value = "byBloodPressure", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.POST)
    @RequestMapping(value = "byBloodPressure", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String byBloodPressure(
            @ApiParam(name = "imei", value = "15位设备唯一序号", required = true)
            @RequestParam(value = "imei",required = true)String imei,
@ -197,7 +197,7 @@ public class DeviceController {
    }
    @ApiOperation("柏颐跌倒数据接收")
    @RequestMapping(value = "byFall", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.POST)
    @RequestMapping(value = "byFall", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String byFall(
            @ApiParam(name = "imei", value = "15位设备唯一序号", required = true)
            @RequestParam(value = "imei",required = true)String imei,
@ -227,7 +227,7 @@ public class DeviceController {
    }
    @ApiOperation("柏颐设备sos数据接收")
    @RequestMapping(value = "bySos", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.POST)
    @RequestMapping(value = "bySos", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String bySos(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = true) String imei,
@ -259,7 +259,7 @@ public class DeviceController {
    }
    @ApiOperation("柏颐设备步数接收")
    @RequestMapping(value = "bySteps", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.POST)
    @RequestMapping(value = "bySteps", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String bySteps(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = true) String imei,
@ -281,7 +281,7 @@ public class DeviceController {
    }
    @ApiOperation("柏颐设备睡眠接收")
    @RequestMapping(value = "bySleep", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.POST)
    @RequestMapping(value = "bySleep", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String bySleep(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = true) String imei,
@ -311,7 +311,7 @@ public class DeviceController {
    }
    @ApiOperation("柏颐设备开关机数据接收")
    @RequestMapping(value = "bySwitch", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.POST)
    @RequestMapping(value = "bySwitch", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String bySwitch(
            @ApiParam(name="imei",required = false,value="15位设备唯一序号",defaultValue = "")
            @RequestParam(value = "imei",required = true) String imei,
@ -336,7 +336,7 @@ public class DeviceController {
    }
    @ApiOperation("柏颐设备消息通知数据接收")
    @RequestMapping(value = "byPushData", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = RequestMethod.POST)
    @RequestMapping(value = "byPushData", produces = "application/x-www-form-urlencoded;charset=UTF-8", method = {RequestMethod.POST,RequestMethod.GET})
    public String byPushData(
            @ApiParam(name="type",required = false,value="type=1 SOS,type=2 fall,type=3 new 新成员加入 ,type=4 电子围栏触发, type=5 设备低电,type=6 环境音 ",defaultValue = "")
            @RequestParam(value = "type",required = false) int type,

+ 6 - 0
svr/svr-internet-hospital-job/pom.xml

@ -100,6 +100,12 @@
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>
            <version>2.0.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>

+ 158 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/RemindDoctorService.java

@ -0,0 +1,158 @@
package com.yihu.jw.service.channel;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.message.dao.SystemMessageDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.util.RemindDoctorJob;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.YkyySMSService;
import com.yihu.jw.wechat.enterprise.EnterpriseService;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
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.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Service
public class RemindDoctorService {
    private static final Logger logger = LoggerFactory.getLogger(RemindDoctorService.class);
    @Autowired
    private SystemMessageDao systemMessageDao;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private EnterpriseService enterpriseService;
    @Value("${wechat.id}")
    private String wechatId;
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    public void sendSystemMessage() {
        try {
            List<WlyyOutpatientDO> list = outpatientDao.findDoctorRemindMessage();
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = wlyyHospitalSysDictDao.findById("isCirculation");//是否重复提醒
            List<WlyyHospitalSysDictDO> dictDOS =wlyyHospitalSysDictDao.findByDictNameAndDictCode("RECEPTION_REMINDER","time");
            Long doctorRemindTime =0l;
            if (dictDOS!=null&&dictDOS.size()>0){
                doctorRemindTime = Long.parseLong(dictDOS.get(0).getDictValue());
            }
            String baseUrl = prescriptionService.findDomainUrlInDict();
            String msg = "";
            String sex = "";
            String age="";
            String date = "";
            String title = "";
            int i = 0;
            for (WlyyOutpatientDO wlyyOutpatientDO : list) {
                Long lastRemindTime=wlyyOutpatientDO.getLastRemindTime()==null?wlyyOutpatientDO.getCreateTime().getTime():wlyyOutpatientDO.getLastRemindTime().getTime();
                Long nowTime = new Date().getTime();
                if (StringUtils.isNoneBlank(wlyyOutpatientDO.getDoctor())&&!StringUtils.isNoneBlank(wlyyOutpatientDO.getRemindDoctor())&&(nowTime-lastRemindTime)>doctorRemindTime*1000*60) {
                    logger.info("条件满足开始发送提醒"+wlyyOutpatientDO.getId());
                    sex= IdCardUtil.getSexForIdcard(wlyyOutpatientDO.getIdcard());
                    age = IdCardUtil.getAgeForIdcard(wlyyOutpatientDO.getIdcard())+"";
                    Long createTime = wlyyOutpatientDO.getCreateTime().getTime();
                    Long minusts = TimeUnit.MILLISECONDS.toMinutes(nowTime - createTime);
                    SystemMessageDO systemMessageDO = new SystemMessageDO();
                    if ("2".equals(wlyyOutpatientDO.getOutpatientType())) {
                        systemMessageDO.setTitle("协同门诊接诊消息提醒");
                        systemMessageDO.setType("63");
                    } else if ("3".equals(wlyyOutpatientDO.getOutpatientType())) {//专家咨询
                        //1.图文 2.视频 3家医
                        if ("1".equals(wlyyOutpatientDO.getType())) {
                            systemMessageDO.setTitle("图文咨询接诊消息提醒");
                            systemMessageDO.setType("68");
                            title = "图文咨询消息提醒";
                            msg = wlyyOutpatientDO.getPatientName()+"("+sex+" "+age+"岁)向您发起了图文咨询,已等待"+minusts+"分钟。点击接诊";
                        } else if ("3".equals(wlyyOutpatientDO.getType())) {
                            systemMessageDO.setTitle("家医咨询接诊消息提醒");
                            systemMessageDO.setType("65");
                        } else {
                            systemMessageDO.setTitle("视频咨询接诊消息提醒");
                            systemMessageDO.setType("67");
                            title = "视频咨询接诊消息提醒";
                            date = DateUtil.dateToStrLong(wlyyOutpatientDO.getRegisterDate());
                            msg = wlyyOutpatientDO.getPatientName()+"("+sex+" "+age+"岁)预约了"+date+"的视频咨询,点击查看";
                        }
                    } else if ("1".equals(wlyyOutpatientDO.getOutpatientType())) {//在线复诊
                        //1.图文 2.视频
                        if ("1".equals(wlyyOutpatientDO.getType())) {
                            systemMessageDO.setTitle("图文复诊接诊消息提醒");
                            systemMessageDO.setType("61");
                            title = "图文复诊接诊消息提醒";
                            msg = wlyyOutpatientDO.getPatientName()+"("+sex+" "+age+"岁)向您发起了图文复诊,已等待"+minusts+"分钟。点击接诊";
                        } else {
                            systemMessageDO.setTitle("视频复诊接诊消息提醒");
                            systemMessageDO.setType("62");
                            title = "视频复诊接诊消息提醒";
                            date = DateUtil.dateToStrLong(wlyyOutpatientDO.getRegisterDate());
                            msg = wlyyOutpatientDO.getPatientName()+"("+sex+" "+age+"岁)预约了"+date+"的视频复诊,点击查看";
                        }
                    }
                    JSONObject data = new JSONObject();
                    data.put("name", wlyyOutpatientDO.getPatientName());
                    data.put("age", IdCardUtil.getAgeForIdcard(wlyyOutpatientDO.getIdcard()));
                    data.put("gender", IdCardUtil.getSexForIdcard_new(wlyyOutpatientDO.getIdcard()));
                    data.put("question", wlyyOutpatientDO.getDescription());
                    data.put("msg", systemMessageDO.getTitle());
                    data.put("waitTime",minusts);
                    systemMessageDO.setData(data.toString());
                    systemMessageDO.setReceiver(wlyyOutpatientDO.getDoctor());
                    systemMessageDO.setReceiverName(wlyyOutpatientDO.getDoctorName());
                    systemMessageDO.setRelationCode(wlyyOutpatientDO.getId());
                    systemMessageDO.setSender(wlyyOutpatientDO.getPatient());
                    systemMessageDO.setSenderName(wlyyOutpatientDO.getPatientName());
                    systemMessageDO.setRelationCode(wlyyOutpatientDO.getId());
                    systemMessageDO.setIsRead("0");
                    systemMessageDO.setDel("1");
                    systemMessageDO.setCreateTime(new Date(nowTime+i*1000));
                    systemMessageDao.save(systemMessageDO);
                    //系统消息结束===开始发送企业模板消息
                    if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                        String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+wlyyOutpatientDO.getDescription()+"&type=3&id="+wlyyOutpatientDO.getId();
                        enterpriseService.sendTWMesByDoctor("zsyy",wlyyOutpatientDO.getDoctor(),title,msg,url);
                    }else if(wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                        String url=baseUrl+"/ims-app-web/#/onlineChat/detail?_rs_title="+wlyyOutpatientDO.getDescription()+"&type=3&id="+wlyyOutpatientDO.getId();
                        enterpriseService.sendTWMesByDoctor("xm_ykyy_wx",wlyyOutpatientDO.getDoctor(),title,msg,url);
                    }else if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                        String url=baseUrl+"/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+wlyyOutpatientDO.getDescription()+"&type=3&id="+wlyyOutpatientDO.getId();
                        enterpriseService.sendTWMesByDoctor("xm_xzzx_wx",wlyyOutpatientDO.getDoctor(),title,msg,url);
                    }
                    if (wlyyHospitalSysDictDO!=null){
                        if ("0".equalsIgnoreCase(wlyyHospitalSysDictDO.getDictValue())){
                            wlyyOutpatientDO.setRemindDoctor("0");
                        }
                    }
                    wlyyOutpatientDO.setLastRemindTime(new Date());
                    outpatientDao.save(wlyyOutpatientDO);
                    if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                        prescriptionService.wxTempalteJPush("remind_doctor_pickup",wlyyOutpatientDO,null,"","","","");
                    }
                    i++;
                }
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}

+ 77 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/RemindDoctorJob.java

@ -0,0 +1,77 @@
package com.yihu.jw.util;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.service.channel.PrescriptionStatusUpdateService;
import com.yihu.jw.service.channel.RemindDoctorService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
@Lazy(false)
@Component
@EnableScheduling
public class RemindDoctorJob implements SchedulingConfigurer {
    private static final Logger logger = LoggerFactory.getLogger(RemindDoctorJob.class);
    private static String cron = "0 */1 * * * ?";//"0 0 0 * * ?";0 */5 * * * ?
    public RemindDoctorJob(){
        cron="0 */1 * * * ?";
        System.out.println("初始化时的corn"+cron);
    }
    @Autowired
    private RemindDoctorService remindDoctorService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    public String change(String corIn) {
        if (StringUtils.isNotBlank(corIn)) {
            cron = corIn;
        }
        return cron;
    }
    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        taskRegistrar.addTriggerTask(new Runnable() {
            @Override
            public void run() {
                try {
                    List<WlyyHospitalSysDictDO> dictDOS =wlyyHospitalSysDictDao.findByDictNameAndDictCode("RECEPTION_REMINDER","OPEN");
                    if (dictDOS!=null&&dictDOS.size()>0){
                        if ("1".equalsIgnoreCase(dictDOS.get(0).getDictValue())){//配置中的value值如果为1则表示开启发送提醒功能
                            logger.info("配置开始发送提醒========remindDoctor========");
                            remindDoctorService.sendSystemMessage();
                        }else {
                            logger.info("配置发送提醒关闭");
                        }
                    }else {
                        logger.info("若无配置则发送提醒关闭");
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    logger.error("END===ERROE===remindDoctor,message:"+e.getMessage());
                }
            }
        }, new Trigger() {
            @Override
            public Date nextExecutionTime(TriggerContext triggerContext) {
                // 任务触发,可修改任务的执行周期
                CronTrigger trigger = new CronTrigger(cron);
                System.out.println("remindDoctor,可修改任务的执行周期"+cron);
                Date nextExec = trigger.nextExecutionTime(triggerContext);
                return nextExec;
            }
        });
    }
}

+ 9 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -15,6 +15,7 @@ import com.yihu.jw.job.ykyy.YkyyDataUploadJob;
import com.yihu.jw.repository.job.QuartzJobConfigDao;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.service.channel.PrescriptionStatusUpdateService;
import com.yihu.jw.service.channel.RemindDoctorService;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.util.AutoTimeOutRemind;
import com.yihu.jw.util.OverdueJob;
@ -78,6 +79,8 @@ public class JobController extends BaseController {
    private YkyyPrescriptionService ykyyPrescriptionService;
    @Autowired
    private PrescriptionStatusUpdateService prescriptionStatusUpdateService;
    @Autowired
    private RemindDoctorService remindDoctorService;
    @Autowired
    public JobController(JobService jobService, QuartzHelper quartzHelper) {
@ -729,5 +732,11 @@ public class JobController extends BaseController {
                                @RequestParam(value = "endTime", required = false)String endTime, Integer status, Integer page , Integer pageSize){
        return success(ykyyPrescriptionService.saveVideoFileList(startTime,endTime,status,page,pageSize));
    }
    @RequestMapping(value = "/testRemindDoctor", method = RequestMethod.GET)
    @ApiOperation("测试发送消息")
    public String testRemindDoctor(){
        remindDoctorService.sendSystemMessage();
        return success("发送成功");
    }
}

+ 158 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/account/PatientEndpoint.java

@ -1,7 +1,10 @@
package com.yihu.jw.hospital.endpoint.account;
import com.yihu.jw.patient.service.BasePatientGroupDictService;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.PageEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
@ -18,6 +21,8 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BasePatientService basePatientService;
    @Autowired
    private BasePatientGroupDictService basePatientGroupDictService;
    @GetMapping(value = BaseRequestMapping.BasePatient.getPatientById)
@ -25,8 +30,8 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    public Envelop getPatientById(
            @ApiParam(name = "id", value = "居民id")
            @RequestParam(value = "id", required = true) String id) throws Exception {
        String result = basePatientService.getPatientById(id);
        return success(result);
        return success(basePatientService.getPatientById(id));
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.updatePatientPw)
@ -45,4 +50,155 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.getPatientCountByDoctor)
    @ApiOperation(value = "获取居民候诊数量信息")
    public Envelop getPatientCountByDoctor(
            @ApiParam(name = "doctor", value = "doctor")
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "patient", value = "patient")
            @RequestParam(value = "patient", required = false) String patient) throws Exception {
        return success(basePatientService.getPatientCountByDoctor(doctor,patient));
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.getPatientEmrByDoctor)
    @ApiOperation(value = "获取居民电子病历信息")
    public MixEnvelop getPatientEmrByDoctor(@ApiParam(name = "patient", value = "patient")
                                             @RequestParam(value = "patient", required = false) String patient,
                                            @ApiParam(name = "doctor", value = "doctor")
                                        @RequestParam(value = "doctor", required = false) String doctor,
                                            @ApiParam(name = "page", value = "page")
                                             @RequestParam(value = "page", required = false) Integer page,
                                            @ApiParam(name = "pageSize", value = "pageSize")
                                             @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        return basePatientService.findEmrByPatientId(patient,doctor,page,pageSize);
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.findPaitentPrescription)
    @ApiOperation(value = "查询患者所有处方信息", notes = "查询患者所有处方信息")
    public PageEnvelop findPaitentPrescription(@ApiParam(name = "keyName", value = "搜索关键字")
                                                  @RequestParam(value = "keyName", required = false)String keyName,
                                               @ApiParam(name = "patient", value = "患者id")
                                               @RequestParam(value = "patient", required = false)String patient,
                                               @ApiParam(name = "doctor", value = "医生id")
                                                   @RequestParam(value = "doctor", required = false)String doctor,
                                                  @ApiParam(name = "status[]", value = "状态")
                                                  @RequestParam(value = "status[]", required = false)String status,
                                                  @ApiParam(name = "isSelectDrug", value = "1查询处方药品1是0查询检查")
                                                  @RequestParam(value = "isSelectDrug", required = false)String isSelectDrug,
                                                  @ApiParam(name = "page", value = "第几页")
                                                  @RequestParam(value = "page",required = false,defaultValue = "1") Integer page,
                                                  @ApiParam(name = "size", value = "页面大小")
                                                  @RequestParam(value = "size",required = false,defaultValue = "10") Integer size)throws Exception {
        try {
            return basePatientService.findPatientAllPrescription(doctor,keyName,status,page,size,patient,isSelectDrug);
        } catch (Exception e) {
            return PageEnvelop.getError(e.getMessage(),-1);
        }
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.createPatientGroupDict)
    @ApiOperation(value = "创建分组")
    public Envelop createPatientGroupDict(@ApiParam(name = "groupId", value = "groupId")
                                            @RequestParam(value = "groupId", required = false) String groupId,
                                            @ApiParam(name = "doctor", value = "doctor")
                                            @RequestParam(value = "doctor", required = false) String doctor,
                                            @ApiParam(name = "groupCode", value = "groupCode")
                                            @RequestParam(value = "groupCode", required = false) String groupCode,
                                            @ApiParam(name = "groupName", value = "groupName")
                                            @RequestParam(value = "groupName", required = false) String groupName) throws Exception {
        return success(basePatientGroupDictService.createPatientGroupDict(groupId,doctor,groupCode,groupName));
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.deletePatientGroupDict)
    @ApiOperation(value = "删除分组")
    public Envelop deletePatientGroupDict(@ApiParam(name = "groupId", value = "groupId")
                                          @RequestParam(value = "groupId", required = false) String groupId,
                                          @ApiParam(name = "del", value = "del")
                                          @RequestParam(value = "del", required = false) String del) throws Exception {
        return success(basePatientGroupDictService.delPatientGroupDict(groupId,del));
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.findGroupByDoctor)
    @ApiOperation(value = "查询词典")
    public MixEnvelop findByDoctor(@ApiParam(name = "doctor", value = "doctor")
                                          @RequestParam(value = "doctor", required = false) String doctor,
                                          @ApiParam(name = "groupName", value = "groupName")
                                          @RequestParam(value = "groupName", required = false) String groupName,
                                @ApiParam(name = "page", value = "page")
                                    @RequestParam(value = "page", required = false) Integer page,
                                @ApiParam(name = "pageSize", value = "pageSize")
                                    @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        return basePatientGroupDictService.findByDoctor(doctor,groupName,page,pageSize);
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.movePatientToGroup)
    @ApiOperation(value = "将患者移动到指定分组中")
    public Envelop movePatientToGroup(@ApiParam(name = "groupId", value = "groupId")
                                   @RequestParam(value = "groupId", required = false) String groupId,
                                   @ApiParam(name = "patient", value = "patient")
                                   @RequestParam(value = "patient", required = false) String patient,
                                   @ApiParam(name = "doctor", value = "doctor")
                                   @RequestParam(value = "doctor", required = false) String doctor)  {
        try {
            basePatientGroupDictService.movePatientToGroup(groupId,patient,doctor);
            return Envelop.getSuccess("操作成功");
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.delPatientGroup)
    @ApiOperation(value = "删除组中患者")
    public Envelop delPatientGroup(@ApiParam(name = "groupId", value = "groupId")
                                      @RequestParam(value = "groupId", required = false) String groupId)  {
        try {
            basePatientGroupDictService.delPatientGroup(groupId);
            return Envelop.getSuccess("操作成功");
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.findPatientGroup)
    @ApiOperation(value = "查询分组患者")
    public MixEnvelop findPatientGroup(@ApiParam(name = "patientName", value = "patientName")
                                   @RequestParam(value = "patientName", required = false) String patientName,
                                   @ApiParam(name = "doctor", value = "doctor")
                                   @RequestParam(value = "doctor", required = false) String doctor,
                                       @ApiParam(name = "groupId", value = "groupId")
                                           @RequestParam(value = "groupId", required = false) String groupId,
                                   @ApiParam(name = "page", value = "page")
                                   @RequestParam(value = "page", required = false) Integer page,
                                   @ApiParam(name = "pageSize", value = "pageSize")
                                   @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        return basePatientGroupDictService.findPatientGroup(patientName,doctor,groupId,page,pageSize);
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.findPatientGroupNum)
    @ApiOperation(value = "查询分组患者数量")
    public Envelop findPatientGroupNum(@ApiParam(name = "doctor", value = "doctor")
                                          @RequestParam(value = "doctor", required = false) String doctor,
                                          @ApiParam(name = "groupIds", value = "多个用逗号隔开")
                                          @RequestParam(value = "groupIds", required = false) String groupIds) throws Exception {
        return success(basePatientGroupDictService.findPatientGroupNum(doctor,groupIds));
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.findOnePatientInfo)
    @ApiOperation(value = "查询单个患者信息")
    public Envelop findOnePatientInfo(@ApiParam(name = "doctor", value = "doctor")
                                       @RequestParam(value = "doctor", required = false) String doctor,
                                       @ApiParam(name = "patient", value = "patient")
                                       @RequestParam(value = "patient", required = false) String patient) throws Exception {
        return success(basePatientService.findPatientInfoById(patient,doctor));
    }
}

+ 35 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -1264,11 +1264,45 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.getPrevious)
	@ApiOperation(value = "查询病人的电子病历", notes = "查询病人的电子病历")
	public ObjEnvelop findPatientEmr(@ApiParam(name = "patientId", value = "patientId")
								 @RequestParam(value = "patientId", required = true)String patientId)throws Exception {
									 @RequestParam(value = "patientId", required = true)String patientId)throws Exception {
		List<WlyyPrescriptionEmrDO> array= ykyyEntranceService.getPrevious(patientId);
		ObjEnvelop objEnvelop = new ObjEnvelop();
		objEnvelop.setObj(array);
		return objEnvelop;
	}
	@GetMapping (value = BaseHospitalRequestMapping.DodtorIM.findRecordByDoctor)
	@ApiOperation(value = "查询服务患者", notes = "查询服务患者")
	public ObjEnvelop findRecordByDoctor(@ApiParam(name = "doctor", value = "医生id")
											 @RequestParam(value = "doctor",required = false) String doctor,
										 @ApiParam(name = "type", value = "咨询类型")
											 @RequestParam(value = "type",required = true) String type,
										 @ApiParam(name = "patientName", value = "patientName")
											 @RequestParam(value = "patientName",required = false) String patientName,
										 @ApiParam(name = "idcard", value = "idcard")
											 @RequestParam(value = "idcard",required = false) String idcard,
										 @ApiParam(name = "page", value = "第几页")
											 @RequestParam(value = "page",required = false) int page,
										 @ApiParam(name = "pagesize", value = "分页大小")
											 @RequestParam(value = "pagesize",required = false) int pagesize)throws Exception {
		List<Map<String,Object>> list = imService.findRecordByDoctor(doctor,type,idcard,patientName,page,pagesize);
		return ObjEnvelop.getSuccess("操作成功",list);
	}
	@GetMapping (value = BaseHospitalRequestMapping.DodtorIM.findRecordCountByDoctor)
	@ApiOperation(value = "查询服务患者数量", notes = "查询服务患者数量")
	public ObjEnvelop findRecordCountByDoctor(@ApiParam(name = "doctor", value = "医生id")
										 @RequestParam(value = "doctor",required = false) String doctor,
										 @ApiParam(name = "type", value = "咨询类型多个用逗号隔开")
										 @RequestParam(value = "type",required = true) String type,
										 @ApiParam(name = "patientName", value = "patientName")
										 @RequestParam(value = "patientName",required = false) String patientName,
										 @ApiParam(name = "idcard", value = "idcard")
										 @RequestParam(value = "idcard",required = false) String idcard)throws Exception {
		List<Map<String,Object>> list = imService.findRecordCountByDoctor(doctor,type,idcard,patientName);
		return ObjEnvelop.getSuccess("操作成功",list);
	}
}

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

@ -41,7 +41,9 @@ public class PrivateDictEndpoint extends EnvelopRestEndpoint {
    @ApiOperation("查询隐私策略")
    @PostMapping(value= BaseHospitalRequestMapping.PatientNoLogin.findPrivateDict)
    public Envelop findPrivateDict(@ApiParam(name = "dictCode", value = "隐私code")
                                    @RequestParam(value = "dictCode", required = false) String dictCode){
                                    @RequestParam(value = "dictCode", required = false) String dictCode,
                                   @ApiParam(name = "hospitalCode", value = "")
                                   @RequestParam(value = "hospitalCode", required = false) String hospitalCode){
        return success(privateDictService.findByHospitalCodeAndDictCode(dictCode));

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

@ -7,6 +7,7 @@ import com.yihu.jw.file_upload.FileManageService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.restmodel.MutilFileInfo;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
@ -204,4 +205,21 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.DELETE_FILE)
    @ApiOperation(value = "删除文件",notes = "删除文件")
    public Envelop deleteFile(@ApiParam(name = "groupName", value = "fastdfs组名")
                                             @RequestParam(value = "groupName", required = true) String groupName,
                              @ApiParam(name = "fileName", value = "fastdfs文件名")
                                           @RequestParam(value = "fileName", required = true) String fileName) throws Exception {
        try {
            fileUploadService.deleteFile(groupName,fileName);
            return success("删除成功");
        }catch (Exception e){
            e.printStackTrace();
            return failed(e.getMessage());
        }
    }
}

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

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.dict.service.BaseDictJobTitleService;
import com.yihu.jw.dict.service.HospitalDeptService;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
@ -21,6 +22,7 @@ import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.util.AesEncryptUtils;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.es.service.StatisticsEsService;
import com.yihu.jw.file_upload.FileUploadService;
@ -59,6 +61,7 @@ import com.yihu.jw.sms.service.YkyyINSMSService;
import com.yihu.jw.util.common.FileUtil;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.service.WechatInfoService;
@ -76,6 +79,9 @@ import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import org.apache.axis.utils.StringUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.apache.jasper.tagplugins.jstl.core.Url;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -86,8 +92,8 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -108,8 +114,6 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private BaseDoctorInfoService baseDoctorInfoService;
    @Autowired
    private PrescriptionExpressageService sfexpressService;
    @Autowired
    private QrcodeService qrcodeService;
@ -209,6 +213,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private String upload_temp_path;
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
@ -247,7 +253,50 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    ) throws Exception{
        logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
        return prescriptionService.findDoctorByHospitalAndDiseaseAndDept(iswork,patientid,
        return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork,patientid,
                orgCode,dept,
                diseaseKey,doctorNameKey,
                jobTitleNameKey,outpatientType,
                keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize);
    }
    @GetMapping("/testFrontQuery")
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
    public MixEnvelop findDoctorByHospitalAndDiseaseAndDept2(@ApiParam(name = "iswork", value = "是否过滤排班,1是")
                                                            @RequestParam(value = "iswork", required = true)String iswork,
                                                            @ApiParam(name = "orgCode", value = "机构code")
                                                            @RequestParam(value = "orgCode", required = true,defaultValue = "350211A1002")String orgCode,
                                                            @ApiParam(name = "patientid", value = "patientid")
                                                            @RequestParam(value = "patientid", required = false)String patientid,
                                                            @ApiParam(name = "dept", value = "部门code")
                                                            @RequestParam(value = "dept", required = false)String dept,
                                                            @ApiParam(name = "diseaseKey", value = "疾病名称关键字")
                                                            @RequestParam(value = "diseaseKey", required = false)String diseaseKey,
                                                            @ApiParam(name = "doctorNameKey", value = "医生名称关键字")
                                                            @RequestParam(value = "doctorNameKey", required = false)String doctorNameKey,
                                                            @ApiParam(name = "jobTitleNameKey", value = "医生职称关键字")
                                                            @RequestParam(value = "jobTitleNameKey", required = false)String jobTitleNameKey,
                                                            @ApiParam(name = "outpatientType", value = "咨询类型1图文,2视频")
                                                            @RequestParam(value = "outpatientType", required = false)String outpatientType,
                                                            @ApiParam(name = "keyName", value = "姓名/科室/疾病模糊搜索关键字")
                                                            @RequestParam(value = "keyName", required = false)String keyName,
                                                            @ApiParam(name = "workingTime", value = "排班时间YYYY-MM-DD")
                                                            @RequestParam(value = "workingTime", required = false)String workingTime,
                                                            @ApiParam(name = "consultStatus", value = "在线状态")
                                                            @RequestParam(value = "consultStatus", required = false,defaultValue = "")String consultStatus,
                                                            @ApiParam(name = "chargType", value = "医生号别")
                                                            @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 = "分页大小")
                                                            @RequestParam(value = "pagesize",required = false) Integer pagesize
    ) throws Exception{
        logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
        return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork,patientid,
                orgCode,dept,
                diseaseKey,doctorNameKey,
                jobTitleNameKey,outpatientType,
@ -393,7 +442,6 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        return success("请求成功",result);
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.getUpcomingByDoctor)
    @ApiOperation(value = "获取医生待办详情", notes = "获取医生待办详情")
    public Envelop getUpcomingByDoctor(@ApiParam(name = "doctorIdcard", value = "doctorIdcard", required = true)
@ -1459,7 +1507,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    public Envelop popularityIncrease (
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", required = false) String doctor) throws Exception {
        BaseDoctorDO baseDoctorDO=baseDoctorInfoService.popularityIncrease(doctor);
        BaseDoctorDO baseDoctorDO=baseDoctorService.popularityIncrease(doctor);
        return  success("操作成功",baseDoctorDO);
    }
    @ApiOperation("查询赠送锦旗")
@ -1811,4 +1859,29 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    }
    @GetMapping("/doctorReviewConsultCount")
    @ApiOperation(value = "提供给i健康:图文复诊、视频复诊咨询数量、协同门诊候诊数量", notes = "提供给i健康:图文复诊、视频复诊咨询数量、协同门诊候诊数量")
    public Envelop doctorReviewConsultCount(@ApiParam(name = "doctorIdcard", value = "医生CODE")
                                            @RequestParam(value = "doctorIdcard",required = true) String doctorIdcard){
        JSONObject result = new JSONObject();
        String doctor ="";
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findByIdcardAndDel(doctorIdcard);
        if (baseDoctorDO!=null){
            doctor = baseDoctorDO.getId();
        }
        logger.info("action:doctorReviewConsultCount--start:doctor"+doctor);
        result.put("imgCount",prescriptionService.getWaitVideoCount(doctor,"1","1",wxId));//图文复诊数量
        result.put("videoCount",prescriptionService.getWaitVideoCount(doctor,"2","1",wxId));//视频复诊数量
        result.put("xtCount",prescriptionService.getWaitVideoCount(doctor,"","2",wxId));//协同门诊候诊数量
        result.put("imgConsultCount",prescriptionService.getWaitVideoCount(doctor,"1","3",wxId));//图文咨询数量
        result.put("videoConsultCount",prescriptionService.getWaitVideoCount(doctor,"2","3",wxId));//视频咨询数量
        result.put("homeConsultCount",prescriptionService.getWaitVideoCount(doctor,"3","3",wxId));//家医咨询数量
        Integer unreadMessageCount = imService.SessionsUnreadMessageCount(doctor,"1");
        result.put("zjUnreadMessageCount",unreadMessageCount);//专家咨询未读数
        if ("sd_tnzyy_wx".equalsIgnoreCase(wxId)){
            result.put("doorServiceCount",prescriptionService.waitUpdoorCount(doctor));//上门服务数量
        }
        logger.info("action:doctorReviewConsultCount--end:"+DateUtil.dateToStrLong(new Date()));
        return success("请求成功",result);
    }
}

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

@ -432,7 +432,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                //发送厦门i健康智能推送
                try{
                    if (doctorDO!=null&&"3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        String wxurl = wlyyUrl+"/im/common/message/sendDoctorTemplateByDoctorIdcard?sessionId=1_1&sessionType=1&from=1&content=1&businessType=1&doctor_idcard="+doctorDO.getIdcard()+"&patientName="+URLEncoder.encode(wlyyOutpatientDO.getPatientName())+"&url=1";
                        String wxurl = wlyyUrl+"/im/common/message/sendDoctorTemplateByDoctorIdcard?sessionId=1_1&sessionType=1&from=1&content=1&businessType=new&doctor_idcard="+doctorDO.getIdcard()+"&patientName="+URLEncoder.encode(wlyyOutpatientDO.getPatientName())+"&url=1";
                        logger.info("发送厦门i健康智能推送url:"+wxurl);
                        wlyyBusinessService.sendDoctorTemplateByDoctorIdcard(wxurl);
                    }

+ 39 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/ykyy/YkyyController.java

@ -1,8 +1,11 @@
package com.yihu.jw.hospital.endpoint.ykyy;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.im.dao.ConsultTeamDao;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -13,6 +16,8 @@ import com.yihu.jw.wechat.service.WxTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.xerces.dom.PSVIAttrNSImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
@ -44,6 +49,10 @@ public class YkyyController extends EnvelopRestEndpoint {
    private WxTemplateService wxTemplateService;
    @Autowired
    private EnterpriseService enterpriseService;
    @Autowired
    private ConsultTeamDao consultTeamDao;
    @Autowired
    private PrescriptionService prescriptionService;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -441,6 +450,36 @@ public class YkyyController extends EnvelopRestEndpoint {
        System.out.println("content======"+content);
        content = content.replace("#","%23");
        System.out.println("转换后content"+content);
        /*try {
            if (StringUtils.isNoneBlank(content)){
                String url = content.substring(content.lastIndexOf("(")+1,content.lastIndexOf(")"));
                if (StringUtils.isNoneBlank(url)){
                    String msg = content.substring(0,content.lastIndexOf("["));
                    System.out.println(msg);
                    String sessionId = url.substring(url.lastIndexOf("=")+1);
                    String consult ="";
                    if (sessionId.contains("_")){
                        String[] outPatientId = sessionId.split("_");
                        if (outPatientId!=null&&outPatientId.length>=2){
                            consult = outPatientId[1];
                        }
                    }else {
                        consult = sessionId;
                    }
                    System.out.println(consult);
                    ConsultTeamDo consultTeamDo = consultTeamDao.queryByRelationCode(consult);
                    if (consultTeamDo!=null){
                        if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
                            prescriptionService.wxTempalteJPush("consult_remind_doctor",null,consultTeamDo,msg,"","","");
                        }
                    }
                }
            }
        }catch (Exception e){
            e.printStackTrace();
            System.out.println("极光消息发送失败");
        }*/
        //ConsultTeamDo consultModel = consultTeamDao.findByConsult(consult);
        String response = enterpriseService.sendMKMesByDoctor(enterpriseId,doctor,content);
        System.out.println("企业模板消息"+response);
        return success(ykyyEntranceService.sendMesToYkt(doctor,patient,orderType));

+ 8 - 5
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/wechat/WeiXinEventProcess.java

@ -3,6 +3,7 @@ package com.yihu.jw.hospital.service.wechat;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.util.wechat.WeiXinMessageReplyUtils;
import com.yihu.jw.util.wechat.WeiXinMessageUtils;
import org.apache.commons.lang3.StringUtils;
@ -31,7 +32,8 @@ public class WeiXinEventProcess {
    private String wechatId;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private PrescriptionService prescriptionService;
    /**
     * 微信推送事件处理
     *
@ -75,6 +77,7 @@ public class WeiXinEventProcess {
    private String scanEventProcess(Map<String, String> message) throws Exception {
        String result = "";
        // 场景值
        String baseUrl = prescriptionService.findDomainUrlInDict();
        String eventKey = message.get("EventKey");
        if (StringUtils.isNotEmpty(eventKey) && (eventKey.startsWith("doctor_"))) {
@ -93,8 +96,8 @@ public class WeiXinEventProcess {
            }
            // 医生二维码跳转URL
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                url = "https://intel.yanketong.com/ims-wx/#/doctorInfo?doctorCode="+keys[0];
                picUrl = "https://intel.yanketong.com/"+picUrl;
                url = baseUrl+"/ims-wx/#/doctorInfo?doctorCode="+keys[0];
                picUrl =baseUrl+ "/"+picUrl;
                article.put("Url", url);
                article.put("Title", keys[1] + "医生个人诊间");
                article.put("Description", "厦门眼科中心医院互联网医院");
@ -130,8 +133,8 @@ public class WeiXinEventProcess {
            String url = null;
            // 医生二维码跳转URL
            if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                url = "https://intel.yanketong.com/ims-wx/redirect.html";
                picUrl = "https://intel.yanketong.com/group1/M00/00/13/wKghxmAZD-iAEyHgAAA-zHpYNyg537.png";
                url =baseUrl+"/ims-wx/redirect.html";
                picUrl = baseUrl+"/group1/M00/00/13/wKghxmAZD-iAEyHgAAA-zHpYNyg537.png";
                article.put("Url", url);
                article.put("Title", "核酸检测预约");
                article.put("Description", "厦门眼科中心医院互联网医院");