Преглед изворни кода

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

Shi Kejing пре 4 година
родитељ
комит
989ce34779
65 измењених фајлова са 2108 додато и 432 уклоњено
  1. 15 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/dao/BasePatientMemberDictDao.java
  2. 10 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/dao/WlyyPatientFamilyMemberDao.java
  3. 21 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/PatientMemberDictService.java
  4. 207 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  5. 1 0
      business/base-service/src/main/java/com/yihu/jw/hospital/mapping/dao/PatientMappingDao.java
  6. 25 2
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerDoctorService.java
  7. 10 1
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java
  8. 12 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java
  9. 19 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java
  10. 23 16
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java
  11. 11 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java
  12. 71 14
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  13. 4 7
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  14. 47 4
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  15. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/ConvertUtil.java
  16. 3 2
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  17. 5 20
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  18. 5 0
      business/es-service/src/main/java/com/yihu/jw/es/es/ElasticFactory.java
  19. 193 59
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  20. 31 31
      business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java
  21. 8 0
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  22. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  23. 49 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/family/BasePatientMemberDictDO.java
  24. 104 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/family/WlyyPatientFamilyMemberDO.java
  25. 44 2
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  26. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationTemplateDetailDO.java
  27. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/bank/HealthBankMapping.java
  28. 24 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  29. 22 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyOutpatientVO.java
  30. 1 1
      readme.MD
  31. 6 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/methodlog/MethodLogEndpoint.java
  32. 2 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  33. 6 0
      svr/svr-base/src/main/resources/application.yml
  34. 13 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/interceptor/ActivatedInterceptor.java
  35. 17 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java
  36. 3 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/PrescriptionOverdueJob.java
  37. 33 48
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java
  38. 2 2
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/AutoTimeOutRemind.java
  39. 68 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/OverdueJob.java
  40. 8 2
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  41. 1 1
      svr/svr-internet-hospital-job/src/main/resources/system.properties
  42. 27 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java
  43. 72 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  44. 234 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java
  45. 84 39
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  46. 7 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  47. 14 14
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/BasePatientBusinessService.java
  48. 32 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java
  49. 21 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeCategoryService.java
  50. 3 1
      svr/svr-internet-hospital/src/main/resources/application.yml
  51. 6 0
      svr/svr-iot/pom.xml
  52. 13 0
      svr/svr-iot/src/main/java/com/yihu/iot/config/MvcConfig.java
  53. 15 16
      svr/svr-iot/src/main/java/com/yihu/iot/controller/common/BaseController.java
  54. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.java
  55. 38 0
      svr/svr-iot/src/main/java/com/yihu/iot/interceptor/CrosXssFilter.java
  56. 119 0
      svr/svr-iot/src/main/java/com/yihu/iot/interceptor/XssHttpServletRequestWrapper.java
  57. 75 0
      svr/svr-iot/src/main/java/com/yihu/iot/util/jwt/JwtUtil.java
  58. 1 1
      svr/svr-iot/src/main/resources/bootstrap.yml
  59. 28 1
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/CreditsDetailController.java
  60. 117 4
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java
  61. 2 1
      svr/svr-wlyy-health-bank/src/main/resources/application.yml
  62. 7 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java
  63. 0 74
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/FileUploadService.java
  64. 53 47
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java
  65. 1 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

+ 15 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/family/dao/BasePatientMemberDictDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.hospital.family.dao;
import com.yihu.jw.entity.hospital.family.BasePatientMemberDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import org.checkerframework.checker.units.qual.A;
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 BasePatientMemberDictDao extends PagingAndSortingRepository<BasePatientMemberDictDO, String>, JpaSpecificationExecutor<BasePatientMemberDictDO> {
    @Query("from BasePatientMemberDictDO t where t.isDel = 1")
    List<BasePatientMemberDictDO> findDictAll();
}

+ 10 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/family/dao/WlyyPatientFamilyMemberDao.java

@ -0,0 +1,10 @@
package com.yihu.jw.hospital.family.dao;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface WlyyPatientFamilyMemberDao extends PagingAndSortingRepository<WlyyPatientFamilyMemberDO, String>, JpaSpecificationExecutor<WlyyPatientFamilyMemberDO> {
}

+ 21 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/PatientMemberDictService.java

@ -0,0 +1,21 @@
package com.yihu.jw.hospital.family.service;
import com.yihu.jw.entity.hospital.family.BasePatientMemberDictDO;
import com.yihu.jw.hospital.family.dao.BasePatientMemberDictDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class PatientMemberDictService extends BaseJpaService<BasePatientMemberDictDO, BasePatientMemberDictDao> {
    @Autowired
    private BasePatientMemberDictDao basePatientMemberDictDao;
    //获取所有关系集合
    public List<BasePatientMemberDictDO> findAllMemberDict(){
        List<BasePatientMemberDictDO> list = basePatientMemberDictDao.findDictAll();
        return list;
    }
}

+ 207 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -0,0 +1,207 @@
package com.yihu.jw.hospital.family.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.family.BasePatientMemberDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.hospital.family.dao.BasePatientMemberDictDao;
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import net.sf.json.JSONArray;
import org.apache.commons.lang.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.management.MXBean;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMemberDO, WlyyPatientFamilyMemberDao> {
    @Autowired
    private WlyyPatientFamilyMemberDao wlyyPatientFamilyMemberDao;
    @Autowired
    private BasePatientMemberDictDao basePatientMemberDictDao;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private PatientMappingDao patientMappingDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    //添加关联家属
    @Transactional
    public MixEnvelop addFamily(String id,String patientId, String familyName, String dictId, String cardType, String idCard, String phoneNum,boolean demo) throws Exception {
        BasePatientMemberDictDO basePatientMemberDictDO = basePatientMemberDictDao.findOne(dictId);
        BasePatientDO basePatientDO = basePatientDao.findByIdcard(idCard);
        Map<String,Object> resultMap = new HashMap<>();
        if(null==basePatientDO){
           basePatientDO = new BasePatientDO();
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByIdcard(idCard);
        if(null==patientMappingDO){
            patientMappingDO = new PatientMappingDO();
        }
        WlyyPatientFamilyMemberDO result = new WlyyPatientFamilyMemberDO();
        if (StringUtils.isNotBlank(id)){
            result = wlyyPatientFamilyMemberDao.findOne(id);
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        String dictName = "";
        if (null!=basePatientMemberDictDO){
            dictName = basePatientMemberDictDO.getRelationName();
        }
        //获取his家属数据
        JSONArray jsonArray = entranceService.BS10008(idCard,familyName,phoneNum,null,null,null,demo);
        if(jsonArray.size()>0){
            net.sf.json.JSONObject jsonObject= net.sf.json.JSONObject.fromObject(jsonArray.get(0).toString());
            String familyId="";
            //如果病人id为空则没有就诊记录
            if (null!=jsonObject.get("Patient_Id")){
                familyId = jsonObject.getString("Patient_Id");
                result.setFamilyRelation(dictId);
                result.setFamilyRelationName(dictName);
                result.setIsDel(1);
                result.setPatient(patientId);
                result.setCardNo(idCard);
                result.setCardType(cardType);
                //保存到base_patient表中
                basePatientDO.setMobile(phoneNum);
                if(null!=jsonObject.get("Birth_Date")){
                    String birth = jsonObject.get("Birth_Date").toString();
                    SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
                    Date saveBirth = sf.parse(birth);
                    basePatientDO.setBirthday(saveBirth);
                }
                basePatientDO.setName(familyName);
                basePatientDO.setIdcard(idCard);
                basePatientDO.setRegister("0");
                basePatientDO.setDel("1");
                if(null!=jsonObject.get("Sex")){
                    basePatientDO.setSex(Integer.parseInt(jsonObject.get("Sex").toString()));
                }
                BasePatientDO sucessPatient= basePatientDao.save(basePatientDO);
                String patientNewId= "";
                if (sucessPatient!=null){
                    patientNewId=sucessPatient.getId();
                }
                result.setFamilyMember(patientNewId);
                wlyyPatientFamilyMemberDao.save(result);
                patientMappingDO.setIdcard(idCard);
                patientMappingDO.setMappingCode(familyId);
                patientMappingDO.setPatient(patientNewId);
                patientMappingDO.setCreateTime(new Date());
                patientMappingDao.save(patientMappingDO);
                resultMap.put("patientId",patientId);
                resultMap.put("familyId",patientNewId);
                resultMap.put("idCard",idCard);
                resultMap.put("phoneNum",phoneNum);
                resultMap.put("relationName",dictName);
                List<Map<String,Object>> resultList = new ArrayList();
                resultList.add(resultMap);
                mixEnvelop.setStatus(200);
                mixEnvelop.setMessage("添加成功");
                mixEnvelop.setDetailModelList(resultList);
            }
        }
        else {
            mixEnvelop.setStatus(408);
            mixEnvelop.setMessage("您所添加的家属无就诊记录,无法添加");
        }
        return mixEnvelop;
    }
    //根据患者id查询关联家属
    public List<Map<String,Object>> findFamilyByPatientId(String patientId) throws ParseException {
        String sql = "select t.id as \"id\",t.card_type as \"cardType\", t.patient as \"patient\",b.name as \"name\",b.sex as \"sex\"," +
                "b.birthday as\"birthday\",b.idcard as \"idcard\",t.family_member as \"familyMember\",c.relation_name as \"relationName\" " +
                " from wlyy_patient_family_member t left join base_patient b" +
                " on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id where 1=1";
        if (StringUtils.isNotBlank(patientId)){
            sql += " and t.patient = '"+patientId+"'";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        if (list.size()>0){
            for (Map<String,Object> map:list){
                if (map.get("birthday")!=null){
                    SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
                    int age = getAgeByBirth(sp.parse(map.get("birthday").toString()));
                    map.put("age",age);
                }
            }
        }
        return list;
    }
    private static int getAgeByBirth(Date birthday) {
        int age = 0;
        try {
            Calendar now = Calendar.getInstance();
            now.setTime(new Date());// 当前时间
            Calendar birth = Calendar.getInstance();
            birth.setTime(birthday);
            if (birth.after(now)) {//如果传入的时间,在当前时间的后面,返回0岁
                age = 0;
            } else {
                age = now.get(Calendar.YEAR) - birth.get(Calendar.YEAR);
                if (now.get(Calendar.DAY_OF_YEAR) > birth.get(Calendar.DAY_OF_YEAR)) {
                    age += 1;
                }
            }
            return age;
        } catch (Exception e) {//兼容性更强,异常后返回数据
            return 0;
        }
    }
    //删除家人信息
    public Envelop delMember(String id){
        Envelop envelop = new Envelop();
        WlyyPatientFamilyMemberDO wlyyPatientFamilyMemberDO = wlyyPatientFamilyMemberDao.findOne(id);
        if (wlyyPatientFamilyMemberDO!=null){
            wlyyPatientFamilyMemberDao.delete(id);
            envelop.setMessage("删除成功");
            return envelop;
        }else {
            envelop.setMessage("删除失败");
            envelop.setStatus(408);
            return envelop;
        }
    }
    //获取单个亲属详细信息
    public List<Map<String,Object>>  findMemberById(String id) throws ParseException {
        String sql="select t.id as \"id\",t.card_type as \"cardType\",t.family_member as \"familyMember\",t.patient as \"patient\"," +
                "b.name as \"name\",b.idcard as \"idcard\",b.mobile as \"mobile\"," +
                "c.relation_name \"relationName\",b.birthday as\"birthday\",b.sex as\"sex\"" +
                " from wlyy_patient_family_member t left join base_patient b" +
                " on t.family_member = b.id left join base_patient_member_dict c on t.family_relation=c.id " +
                " where 1=1";
        if (StringUtils.isNotBlank(id)){
            sql+=" and t.id='"+id+"'";
        }
       List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        if (list.size()>0){
            for (Map<String,Object> map:list){
                if (map.get("birthday")!=null){
                    SimpleDateFormat sp = new SimpleDateFormat("yyyy-MM-dd");
                    int age = getAgeByBirth(sp.parse(map.get("birthday").toString()));
                    map.put("age",age);
                }
            }
        }
        return list;
    }
}

+ 1 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/mapping/dao/PatientMappingDao.java

@ -15,4 +15,5 @@ public interface PatientMappingDao extends PagingAndSortingRepository<PatientMap
    PatientMappingDO findByPatient(String patient);
    PatientMappingDO findByMappingCode(String mappingCode);
    PatientMappingDO findByIdcard(String idCard);
}

+ 25 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerDoctorService.java

@ -32,6 +32,7 @@ import javax.transaction.Transactional;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.jdbc.core.JdbcTemplate;
@ -56,7 +57,12 @@ public class BaseBannerDoctorService
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Value("${wechat.id}")
    private String wxId;
    @Value("${wechat.flag}")
    private boolean flag;
    @Transactional
    public ObjEnvelop bannerGive(String patientId, List<String> list, String content, String doctor, String doctorName, Integer type, String key, String value)
            throws IOException
@ -295,7 +301,15 @@ public class BaseBannerDoctorService
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        String strDate = format.format(date);
        sql.append(" and t.create_time > '" + strDate + " 00:00:00' and t.create_time<'" + strDate + " 23:59:59'");
        if("xm_ykyy_wx".equals(wxId)){
            if (flag){
                sql.append(" and t.create_time > '" + strDate + " 00:00:00' and t.create_time<'" + strDate + " 23:59:59'");
            }else {
                sql.append(" and t.create_time > to_date('" + strDate + " 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and t.create_time< to_date('" + strDate + " 23:59:59','yyyy-mm-dd hh24:mi:ss')");
            }
        }else{
            sql.append(" and t.create_time > '" + strDate + " 00:00:00' and t.create_time<'" + strDate + " 23:59:59'");
        }
        sql.append(" group by t.relation_code,t.patient_id");
        List<Map<String, Object>> list = this.hibenateUtils.createSQLQuery(sql.toString());
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = this.wlyyHospitalSysDictDao.findById("banner_gives_times");
@ -386,7 +400,16 @@ public class BaseBannerDoctorService
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        String strDate = format.format(date);
        sql.append(" and t.create_time > '" + strDate + " 00:00:00' and t.create_time<'" + strDate + " 23:59:59'");
        System.out.println(wxId+flag);
        if("xm_ykyy_wx".equals(wxId)){
            if (flag){
                sql.append(" and t.create_time > '" + strDate + " 00:00:00' and t.create_time<'" + strDate + " 23:59:59'");
            }else {
                sql.append(" and t.create_time > to_date('" + strDate + " 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and t.create_time< to_date('" + strDate + " 23:59:59','yyyy-mm-dd hh24:mi:ss')");
            }
        }else{
            sql.append(" and t.create_time > '" + strDate + " 00:00:00' and t.create_time<'" + strDate + " 23:59:59'");
        }
        List<Map<String, Object>> list = this.hibenateUtils.createSQLQuery(sql.toString());
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = this.wlyyHospitalSysDictDao.findById("leave_message_times");
        long countTimes = 5L;

+ 10 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java

@ -505,7 +505,16 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        String strDate = format.format(date);
        sql.append(" and t.create_time > '" + strDate + " 00:00:00' and t.create_time<'" + strDate + " 23:59:59'");
        System.out.println(wxId+flag);
        if("xm_ykyy_wx".equals(wxId)){
            if (flag){
                sql.append(" and t.create_time > '" + strDate + " 00:00:00' and t.create_time<'" + strDate + " 23:59:59'");
            }else {
                sql.append(" and t.create_time > to_date('" + strDate + " 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and t.create_time< to_date('" + strDate + " 23:59:59','yyyy-mm-dd hh24:mi:ss')");
            }
        }else{
            sql.append(" and t.create_time > '" + strDate + " 00:00:00' and t.create_time<'" + strDate + " 23:59:59'");
        }
        List<Map<String, Object>> list = this.hibenateUtils.createSQLQuery(sql.toString());
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = this.wlyyHospitalSysDictDao.findById("leave_message_times");
        long countTimes = 5L;

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

@ -2,8 +2,10 @@ package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@ -16,6 +18,9 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.status in(0,1)")
    List<WlyyOutpatientDO> findByPatientList(String patient);
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.hisStatus=1")
    List<WlyyOutpatientDO> findByPatientListNoStatus(String patient);
    List<WlyyOutpatientDO> findByDoctorAndStatus(String doctor,String status);
    @Query("from WlyyOutpatientDO a where a.doctor = ?1 and a.status in(2,3)")
@ -37,6 +42,8 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    @Query("from WlyyOutpatientDO a where a.status in(1,2) and a.payStatus = 1")
    List<WlyyOutpatientDO> findByStatus();
    @Query("from WlyyOutpatientDO a where a.status in(1,2) and a.payStatus = 1 and a.createTime<'2020-08-31 23:59:59'")
    List<WlyyOutpatientDO> findPreviousByStatus();
    List<WlyyOutpatientDO> findByDoctorAndCreateTimeAndPatientCancelRemark(String doctor,Date createTime,String patientCancelRemark);
    @Query("select count(id) from  WlyyOutpatientDO a where a.outpatientType = ?1 and a.doctor = ?2 and a.admDate >=?3 and a.admDate <=?4")
@ -47,4 +54,9 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    /*@Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType = 1")
    List<WlyyOutpatientDO> findOutpatientByPatientAndStatus(String patient);*/
    @Transactional
    @Modifying
    @Query("update WlyyOutpatientDO p set p.hisStatus=?2 where p.id=?1")
    void updateHisStatusById(String id,Integer hisStatus);
}

+ 19 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java

@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@ -21,20 +22,33 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    @Query("update WlyyPrescriptionDO p set p.status=?2 where p.id=?1")
    void updateStatus(String id,Integer status);
    @Transactional
    @Modifying
    @Query("update WlyyPrescriptionDO p set p.status=?2,p.payTime=?3  where p.realOrder=?1")
    void updateStatusByRealOrder(String realOrder,Integer status,Date payTime);
    @Modifying
    @Query("update WlyyPrescriptionDO p set p.checkStatus=?2,p.checkReason=?3,p.status=?4 where p.id=?1")
    void updateCheckStatus(String id,Integer checkStatus,String reason,Integer status);
    @Modifying
    @Query("update WlyyPrescriptionDO p set p.status=?2 ,p.finishTime =?3 where p.id=?1")
    void updateStatus(String id, Integer status, Date date);
    @Query("update WlyyPrescriptionDO p set p.status=?1 ,p.finishTime =?2 where p.id=?3")
    void updateStatus(Integer status, Date date,String id);
    @Transactional
    @Modifying
    @Query("update WlyyPrescriptionDO p set p.status=?1 ,p.finishTime =?2 where p.outpatientId=?3")
    void updateStatusByOutPatientId(Integer status, Date date,String id);
    @Query("select a from WlyyPrescriptionDO a where a.outpatientId = ?1 and a.checkStatus <>4 ")
    List<WlyyPrescriptionDO> findByOutpatientId(String outpatientId);
    List<WlyyPrescriptionDO> findById(String id);
    WlyyPrescriptionDO findByRealOrder(String realOrder);
    @Query("select a from WlyyPrescriptionDO a where  a.realOrder =?1 ")
    List<WlyyPrescriptionDO> findByRealOrderList(String realOrder);
    
    WlyyPrescriptionDO findByAdmNoAndRealOrder(String admno,String realOrder);
@ -42,6 +56,9 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    @Query("select a from WlyyPrescriptionDO a where a.admNo = ?1 and a.realOrder =?2 ")
    List<WlyyPrescriptionDO> findByAdmNoAndRealOrderList(String adnmo,String realOrder);
    @Query("select a from WlyyPrescriptionDO a where a.outpatientId = ?1 and a.status>=20 and a.status<30 ")
    List<WlyyPrescriptionDO> findByOutPatientIdList(String outpatientId);
    List<WlyyPrescriptionDO> findByDoctorAndCreateTimeAndRemark(String doctor,Date createTime,String remark);
}

+ 23 - 16
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java

@ -1,30 +1,38 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.order.pay.utils.PayLogService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.http.HttpClientUtil;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.PrintWriter;
import java.io.StringWriter;
@Service
public class PayInfoNoticeService {
    @Value("${hospital.url}")
    private String serverUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private BasePatientDao patientDao;
    public String pushPrescriptionPay(String patient,String doctorName,String orderNo,String outpatientId,String prescriptionId,String total){
        BasePatientDO patientDO = patientDao.findById(patient);
        if (patientDO!=null){
            String userName = patientDO.getName();
            String idcard = patientDO.getIdcard();
            String phone = patientDO.getMobile();
            String title="您在厦门大学附属中山医院有一笔诊察/处方费用以支付完成!";
            String url = "https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId+"&id="+prescriptionId;
            String remark = "结算方式:微信结算" +
                    "点击查看取药\n物流信息";
            return paySuccessNotice(userName,idcard,phone,title,url,doctorName,total,"0",total,orderNo,remark);
        }
        return null;
    }
    /**
     * 支付成功提醒
@ -44,20 +52,19 @@ public class PayInfoNoticeService {
     */
    public String paySuccessNotice(String userName,String idCard,String phone,String title,String url,
                                   String doctorName,String total,String miPay,String selfPay,String orderNo,String remark) {
        url = "https://172.16.1.34";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("userName", userName);
        jsonObject.put("idCard", idCard);
        jsonObject.put("phone", phone);
        jsonObject.put("title", title);
        jsonObject.put("url", serverUrl);
        jsonObject.put("url", url);
        jsonObject.put("doctorName", doctorName);
        jsonObject.put("total", total);
        jsonObject.put("miPay", miPay);
        jsonObject.put("selfPay", selfPay);
        jsonObject.put("orderNo", orderNo);
        jsonObject.put("remark", remark);
        String responseMsg = httpClientUtil.sendPost(url + "/interface/paySuccessNoticePush.htm", jsonObject.toJSONString());
        String responseMsg = httpClientUtil.sendPost(serverUrl + "/interface/paySuccessNoticePush.htm", jsonObject.toJSONString());
        JSONObject result = new JSONObject();
        String respCode = "";
        if (responseMsg != null) {

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

@ -411,7 +411,7 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
            //如果路由信息节点包含了"已收件"节点,这修改处方派送状态为完成,增加物流派送日志为完成
            if(isContainEndRoutInfo){
                //修改处方状态为完成
                prescriptionDao.updateStatus(sfexpress_obj.getId(), 100,new Date());
                prescriptionDao.updateStatus( 100,new Date(),sfexpress_obj.getId());
                //保存门诊处方配送成功的日志
                WlyyOutpatientExpressageLogDO outpatiExpressLog = new WlyyOutpatientExpressageLogDO();
@ -486,6 +486,7 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
        }
    }
    /**
     * 解析顺丰推送过来的路由信息,和本地数据匹配并进行增量更新)
     * @param waybillRoute
@ -591,7 +592,15 @@ public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescripti
            //如果路由信息节点包含了"已收件"节点,则修改处方状态为完成,增加物流派送日志为完成
            if(isContainEndRoutInfo){
                //修改处方状态为完成
                prescriptionDao.updateStatus(sfexpress.getOutpatientId(), 100,new Date());
                prescriptionDao.updateStatusByOutPatientId( 100,new Date(),sfexpress.getOutpatientId());
                /*List<WlyyPrescriptionDO> wlyyPrescriptionDOs = prescriptionDao.findByOutpatientId(sfexpress.getOutpatientId());
                if (wlyyPrescriptionDOs.size()>0){
                    WlyyPrescriptionDO wlyyPrescriptionDO=wlyyPrescriptionDOs.get(0);
                    wlyyPrescriptionDO.setStatus(100);
                    wlyyPrescriptionDO.setFinishTime(new Date());
                    prescriptionDao.save(wlyyPrescriptionDO);
                }*/
                //保存配送成功的日志
                WlyyOutpatientExpressageLogDO outpatiExpressLog = new WlyyOutpatientExpressageLogDO();

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

@ -609,7 +609,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " count(1) AS \"total\" " +
                " FROM " +
                " wlyy_prescription p ";
        totalSql += " WHERE 1=1 ";
        totalSql += " WHERE 1=1 and p.check_status <>3 and p.check_status <>4";
        if (StringUtils.isNotBlank(patient)) {
            totalSql += " AND p.patient_code ='" + patient + "'";
        }
@ -693,7 +693,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " p.pay_status AS \"payStatus\" " +
                " FROM " +
                " wlyy_prescription p " +
                " WHERE 1=1 ";
                " WHERE 1=1 and p.check_status <>3  ";
        if (StringUtils.isNotBlank(patient)) {
            sql += " AND p.patient_code ='" + patient + "'";
        }
@ -833,7 +833,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "复诊-诊查费", "2", "复诊-诊查费", patientDO.getId(), patientDO.getName(), outpatient.getDoctor(), price);
        BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "复诊-诊查费", "2", "复诊-诊查费", outpatient.getConsumer(), outpatient.getConsumerName(), outpatient.getDoctor(), price);
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        WlyyPatientRegisterTimeDO wlyyPatientRegisterTimeDO =new WlyyPatientRegisterTimeDO();
@ -1747,6 +1747,33 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return res;
    }
    public net.sf.json.JSONObject refundRegisterNo(String outpatientId) throws Exception {
        net.sf.json.JSONObject res = new net.sf.json.JSONObject();
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        if(outpatientDO!=null){
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(outpatientDO.getDoctor());
            if (StringUtils.isNoneBlank(outpatientDO.getRegisterNo())){
                net.sf.json.JSONObject rs = entranceService.BS10138(outpatientDO.getCardNo(), doctorMappingDO.getMappingCode(), outpatientDO.getDept(), outpatientDO.getRegisterNo(), outpatientDO.getWinNo(), demoFlag);
                res= rs.getJSONObject("resquest");
                logger.info("挂号结果 res: " + res.toString());
                String rsCode = res.getString("@RESULT");
                //保存日志
                WlyyHttpLogDO log = new WlyyHttpLogDO();
                log.setCode("refundregisterOutPatient");
                log.setName("退号");
                log.setPatient(outpatientDO.getPatient());
                log.setDoctor(outpatientDO.getDoctor());
                log.setResponse(rs.toString());
                log.setRequest("outPatientId=" + outpatientId + "&doctor=" + outpatientDO.getDoctor());
                log.setStatus(rsCode);
                log.setCreateTime(new Date());
                wlyyHttpLogDao.save(log);
            }
        }
        return  res;
    }
    public String registDianziBingli(WlyyOutpatientDO outpatientDO, BasePatientDO basePatientDO, Integer manageType, String RegisterSN, String registerCon) throws Exception {
        //调用电子病历接口注册居民信息
@ -2144,12 +2171,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //=====================保存日志 start=========================================================
        List<WlyyPrescriptionCheckDO> prescriptionCheckDOS = prescriptionCheckDao.findByStatus(prescription.getId(), 5);
        if (prescriptionCheckDOS == null || prescriptionCheckDOS.size() == 0) {
            savePrescriptionCheck(prescription.getDoctor(), "开具处方", 5, prescription.getId());
            savePrescriptionCheck(prescription.getDoctor(), "草稿", 6, prescription.getId());
        }
        if (wlyyPrescriptionDO1 != null && wlyyPrescriptionDO1.size() > 0) {
            savePrescriptionCheck(prescription.getDoctor(), "处方修改", 3, prescription.getId());
        }
        //=====================保存日志 end=========================================================
        //判断是否有检查检验或药品开方
@ -2650,13 +2675,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else {
            sql = sql + "date_format(e.create_time,'%Y-%m-%d %H:%i:%S' )  AS \"createTime\",";
        }
        if ("xm_ykyy_wx".equals(wxId)) {
            if (flag){
                sql = sql + "date_format(p.pay_time,'YYYY-MM-DD hh24:mi:ss')  AS \"payTime\",";
            }else {
                sql = sql + "to_char(p.pay_time,'YYYY-MM-DD hh24:mi:ss')  AS \"payTime\",";
            }
        } else {
            sql = sql + "date_format(p.pay_time,'%Y-%m-%d %H:%i:%S' )  AS \"payTime\",";
        }
        sql = sql + " e.name as \"name\", " +
                " e.oneself_pickup_flg AS \"oneselfPickupFlg\", " +
                " o.id AS \"outpatientId\", " +
                " o.icd10_name AS \"icd10Name\", " +
                " p.status as \"status\", " +
                " p.id AS \"prescriptionId\" ," +
                " e.id AS \"expressageId\"" +
                " e.id AS \"expressageId\""+
                " FROM " +
                " wlyy_outpatient o " +
                " JOIN wlyy_prescription p ON p.outpatient_id = o.id " +
@ -3592,7 +3627,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outPatientId);
        try {
            if (wxId.equalsIgnoreCase("xm_ykyy_wx")) {
                businessOrderService.orderRefund(wxId, wlyyOutpatientDO.getPatient(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                businessOrderService.orderRefund(wxId, wlyyOutpatientDO.getConsumer(), businessOrderDO.getOrderNo(), businessOrderDO.getPayPrice(), description);
                //眼科接诊时更新眼科通状态
                if (!flag){
                    if (businessOrderDO!=null){
@ -6795,7 +6830,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(patient)) {
            patientId = patientMappingService.findHisPatNoByPatient(patient);
        }
        return entranceService.BS10008(idcard, patientId, admitNum, ybcard, demoFlag);
        return entranceService.BS10008(idcard, null,null,patientId, admitNum, ybcard, demoFlag);
    }
    /**
@ -7021,7 +7056,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "FROM\n" +
                "\twlyy_prescription P\n" +
                "WHERE\n" +
                "\t1 = 1  ";
                "\t1 = 1 p.check_status not in (3,4) ";
        Map<String, Object> params = new HashedMap();
        if (StringUtils.isNoneBlank(hospital)) {
            sql += " and p.hospital =:hospital";
@ -7106,7 +7141,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     */
    public void updateStatus(String prescriptionId, Integer status) {
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(prescriptionId);
        prescriptionDao.updateStatus(prescriptionId, status, new Date());
        prescriptionDao.updateStatus( status, new Date(),prescriptionId);
        prescriptionLogService.addPrescriptionLog(prescriptionId, status, 1, wlyyPrescriptionDO.getPatientCode(), wlyyPrescriptionDO.getPatientName(), null, new Date());
    }
@ -7197,7 +7232,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionId);
                        String patientCode = prescriptionDO.getPatientCode();
                        String realerOrder = prescriptionDO.getRealOrder();
                        String free = prescriptionDO.getDrugFee() + "";
                        String recipeTime = DateUtil.dateToStr(prescriptionDO.getCreateTime(), "yyyyMMddHHmmss");
                        List<BaseDoctorHospitalDO> doctorHospitalDOS = baseDoctorHospitalDao.findByDoctorCode(prescriptionDO.getDoctor());
                        String applyDepaName = null;
@ -7223,6 +7258,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                            cardNo = outpatientDO.getCardNo();
                        }
                        logger.info("cardNo:" + cardNo);
                        Double total = 0.0;
                        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutpatientId(prescriptionDO.getOutpatientId());
                        for (WlyyPrescriptionDO wlyyPrescriptionDO1:wlyyPrescriptionDOS){
                            total +=wlyyPrescriptionDO1.getDrugFee();
                        }
                        String free = total + "";
                        List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByPatientListNoStatus(patientCode);
                        if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
                            free=(Double.parseDouble(free)+15)+"";
                        }
                        ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, voucherNo, applyDepaName, applyDoctorName, recipeTime, free, "1");
                    }
                    //sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
@ -7332,6 +7377,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else if (status == 5) {
            wlyyPrescriptionDO.setCheckStatus(0);
            wlyyPrescriptionDO.setCheckReason("未审核");
        }else if (status == 6) {
            wlyyPrescriptionDO.setCheckStatus(3);
            wlyyPrescriptionDO.setCheckReason("草稿");
        }
        prescriptionDao.save(wlyyPrescriptionDO);
        return prescriptionCheckDO;
@ -8336,5 +8384,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            prescriptionDO.setSignFlag(1);
        }
    }
    //删除处方
    public WlyyPrescriptionDO deletePrescription(String id){
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findOne(id);
        if (null!=wlyyPrescriptionDO){
            wlyyPrescriptionDO.setCheckStatus(4);
            wlyyPrescriptionDO.setStatus(-1);
        }
        wlyyPrescriptionDO =  prescriptionDao.save(wlyyPrescriptionDO);
        return wlyyPrescriptionDO;
    }
}

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

@ -4,7 +4,6 @@ package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.area.BaseDrugStoreDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
@ -17,7 +16,6 @@ import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
import com.yihu.jw.hospital.drugstore.service.BaseDrugStoreService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
@ -35,7 +33,6 @@ import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
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;
@ -192,8 +189,8 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        businessOrderDO.setRelationName("复诊-诊查费");
        businessOrderDO.setDescription("复诊-诊查费");
        businessOrderDO.setRematk(outpatient.getDescription());
        businessOrderDO.setPatient(outpatient.getPatient());
        businessOrderDO.setPatientName(outpatient.getPatientName());
        businessOrderDO.setPatient(outpatient.getConsumer());
        businessOrderDO.setPatientName(outpatient.getConsumerName());
        businessOrderDO.setDoctor(outpatient.getDoctor());
        if (outpatientDO.getType().equalsIgnoreCase("1")) {
            businessOrderDO.setOrderType(1);
@ -256,8 +253,8 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName());
        }
        waitingRoom.setPatientId(outpatientDO.getPatient());
        waitingRoom.setPatientName(outpatientDO.getPatientName());
        waitingRoom.setPatientId(outpatientDO.getConsumer());
        waitingRoom.setPatientName(outpatientDO.getConsumerName());
        waitingRoom.setReservationTime(outpatientDO.getRegisterDate());
        waitingRoom.setVisitStatus(0);
        //设置复诊类型

Разлика између датотеке није приказан због своје велике величине
+ 47 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java


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

@ -58,7 +58,7 @@ public class ConvertUtil {
        JSONObject jsonObject=JSONObject.fromObject(obj);
        JSONArray jsonArray=new JSONArray();
        if(null!=jsonObject&&"1".equals(jsonObject.get("code").toString())){
            JSONArray jsonObjectMgsInfo=(JSONArray)jsonObject.get("MsgInfo");
            JSONArray jsonObjectMgsInfo=JSONArray.fromObject(jsonObject.get("MsgInfo"));
            if(null!=jsonObjectMgsInfo){
                for (Object object : jsonObjectMgsInfo) {
                    JSONObject jsonObjectBody=(JSONObject)object;

+ 3 - 2
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -140,6 +140,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        List<BusinessOrderDO> businessOrderDOS = new ArrayList<>();
        if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(wlyyPrescriptionDO.getId());
            if (businessOrderDO==null){
@ -155,8 +156,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                businessOrderDO.setOrderCategory("4");
                businessOrderDO.setOrderType(4);
                businessOrderDO.setDoctor(wlyyPrescriptionDO.getDoctor());
                businessOrderDO.setPatient(wlyyPrescriptionDO.getPatientCode());
                businessOrderDO.setPatientName(wlyyPrescriptionDO.getPatientName());
                businessOrderDO.setPatient(outpatientDO.getConsumer());
                businessOrderDO.setPatientName(outpatientDO.getConsumerName());
                BigDecimal b = new BigDecimal(String.valueOf(wlyyPrescriptionDO.getDrugFee()));
                BigDecimal c = new BigDecimal(String.valueOf(100));
                BigDecimal bc = b.multiply(c);

+ 5 - 20
business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java

@ -2,7 +2,6 @@ package com.yihu.jw.order.pay.ylz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
@ -269,13 +268,7 @@ public class YlzPayService {
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        JSONObject jsonObject = new JSONObject();
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("EXAMFREE");
        Double free = 0.0;
        if (hospitalSysDictDO!=null){
            free = Double.parseDouble(fee)+Integer.parseInt(hospitalSysDictDO.getDictValue());
        }else {
            free = Double.parseDouble(fee);
        }
        Double free = Double.parseDouble(fee);
        try {
            jsonObject.put("cardType",cardType);//卡类型01 社保卡 06 临时卡
            jsonObject.put("cardNo",cardNo);//卡号
@ -584,7 +577,7 @@ public class YlzPayService {
        String error = null;
        RequestParams requestParams = new RequestParams();
        try {
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_balance_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
@ -598,27 +591,19 @@ public class YlzPayService {
        requestParams.setSignType(signType);
        requestParams.setEncryptType(encryptType);
        requestParams.setTimestamp(DateUtil.getCurrentDateTime());
        //分页参数
        if(StringUtils.isNotBlank(queryType)&&"online".equalsIgnoreCase(queryType)){
        if (StringUtils.isNoneBlank(pageNo)&&StringUtils.isNoneBlank(pageSize)){
            JSONObject pageParam = new JSONObject();
            pageParam.put("pageNo",pageNo);
            pageParam.put("pageSize",pageSize);
            requestParams.setPageParam(pageParam);
        }
        JSONObject params = new JSONObject();
        if (StringUtils.isBlank(cardNo)||StringUtils.isBlank(queryType)){
            return "cardNo或者queryType不能为空";
        }
        if (queryType.equalsIgnoreCase("onlineRecordDetail")){
            if(StringUtils.isBlank(billSn)||StringUtils.isBlank(traceNo)){
                return "billSn和traceNo不能为空";
            }
        }
        params.put("cardNo",cardNo);
        params.put("queryType",queryType);
        if (StringUtils.isNotBlank(beginDate)){
            params.put("beginDate",beginDate);
        }if (StringUtils.isNotBlank(endDate)){
        }
        if (StringUtils.isNotBlank(endDate)){
            params.put("endDate",endDate);
        }
        if (StringUtils.isNotBlank(billSn)){

+ 5 - 0
business/es-service/src/main/java/com/yihu/jw/es/es/ElasticFactory.java

@ -37,6 +37,10 @@ public class ElasticFactory {
    private String securityUser;
    @Value("${es.pwflag}")
    private String pwflag;
    @Value("${es.user}")
    private String user;
    @Value("${es.password}")
    private String password;
//-----------------------------------jestClient----------------------------------------
    /**
@ -62,6 +66,7 @@ public class ElasticFactory {
        HttpClientConfig httpClientConfig = new HttpClientConfig
                .Builder(Arrays.asList(hostArray))
                .multiThreaded(true)
                .defaultCredentials(user,password)
                .maxTotalConnection(50)// 最大链接
                .maxConnectionIdleTime(10, TimeUnit.MINUTES)//链接等待时间
                .connTimeout(60 * 1000*10)

+ 193 - 59
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -62,8 +62,7 @@ public class StatisticsEsService {
    private BaseEvaluateScoreService baseEvaluateScoreService;
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    @Value("${wechat.flag}")
    private boolean flag;
    /**
     * 问诊量
     * @param startDate
@ -726,14 +725,14 @@ public class StatisticsEsService {
     * @param level2_type
     * @return
     * @throws Exception
     */
     *//*
    public JSONObject getPrescriptionLine(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception {
        JSONObject object = new JSONObject();
        //开方量增量曲线
        JSONArray array = dateTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null);
        object.put("prescriptionLine",array);
        return object;
    }
    }*/
    /**
@ -753,65 +752,54 @@ public class StatisticsEsService {
        JSONObject object = new JSONObject();
        if (flag){
            object.put("specialistCount",0);//专家咨询数
            object.put("specialistRate","0%");
            object.put("synergyCount",0);//专家咨询数
            object.put("synergyRate","0%");
            object.put("topicCount",0);//图文复诊数量
            object.put("topicRate","0%");
            object.put("videoCount",0);//视频复诊数量
            object.put("videoRate","0%");
            object.put("total",0);
        }else {
            //协同门诊
            SaveModel saveModel1 = null;
            saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "12");
            //图文复诊
            SaveModel saveModel2 = null;
            //saveModel2 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","1");
            saveModel2 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "9");
            //视频复诊
            SaveModel saveModel3 = null;
        //协同门诊
        SaveModel saveModel1 = null;
        saveModel1 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "12");
        //图文复诊
        SaveModel saveModel2 = null;
        //saveModel2 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","1");
        saveModel2 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "9");
        //视频复诊
        SaveModel saveModel3 = null;
/*
        saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","2");
    saveModel3 = elasticsearchUtil.findOneDateQuotaLevel2(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1","2");
*/
            saveModel3 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "16");
            Double specialistCount =0.0;
            //专科咨询
            SaveModel saveModel4 = null;
            saveModel4 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1");
            specialistCount = saveModel4.getResult1();//专家咨询数量
        /*if(index.equalsIgnoreCase("5")){
            //专家咨询数量
            SaveModel saveModel = null;
            if (StringUtils.isNotEmpty(level2_type)) {
                saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, "4", SaveModel.timeLevel_DDL, level2_type);
            } else {
                saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "4", SaveModel.timeLevel_DDL);
            }
            specialistCount = saveModel.getResult1();//专家咨询数量
        saveModel3 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "16");
        Double specialistCount =0.0;
        //专科咨询
        SaveModel saveModel4 = null;
        saveModel4 = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, "1");
        specialistCount = saveModel4.getResult1();//专家咨询数量
    /*if(index.equalsIgnoreCase("5")){
        //专家咨询数量
        SaveModel saveModel = null;
        if (StringUtils.isNotEmpty(level2_type)) {
            saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, endDate, area, level, "4", SaveModel.timeLevel_DDL, level2_type);
        } else {
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, endDate, area, level, "4", SaveModel.timeLevel_DDL);
        }
        specialistCount = saveModel.getResult1();//专家咨询数量
        }else if (index.equalsIgnoreCase("3")){
            specialistCount = 0.0;
        }*/
    }else if (index.equalsIgnoreCase("3")){
        specialistCount = 0.0;
    }*/
            Double synergyCount = saveModel1.getResult1();//协同门诊数量
            Double topicCount = saveModel2.getResult1();//图文复诊数量
            Double videoCount = saveModel3.getResult1();//视频复诊数量
            Double total = specialistCount+synergyCount+topicCount+videoCount;//总量
        Double synergyCount = saveModel1.getResult1();//协同门诊数量
        Double topicCount = saveModel2.getResult1();//图文复诊数量
        Double videoCount = saveModel3.getResult1();//视频复诊数量
        Double total = specialistCount+synergyCount+topicCount+videoCount;//总量
            object.put("specialistCount",specialistCount);//专家咨询数
            object.put("specialistRate",getRange(specialistCount.intValue(),total.intValue(),0));
            object.put("synergyCount",synergyCount);//专家咨询数
            object.put("synergyRate",getRange(synergyCount.intValue(),total.intValue(),0));
            object.put("topicCount",topicCount);//图文复诊数量
            object.put("topicRate",getRange(topicCount.intValue(),total.intValue(),0));
            object.put("videoCount",videoCount);//视频复诊数量
            object.put("videoRate",getRange(videoCount.intValue(),total.intValue(),0));
            object.put("total",total);
        }
        object.put("specialistCount",specialistCount);//专家咨询数
        object.put("specialistRate",getRange(specialistCount.intValue(),total.intValue(),0));
        object.put("synergyCount",synergyCount);//专家咨询数
        object.put("synergyRate",getRange(synergyCount.intValue(),total.intValue(),0));
        object.put("topicCount",topicCount);//图文复诊数量
        object.put("topicRate",getRange(topicCount.intValue(),total.intValue(),0));
        object.put("videoCount",videoCount);//视频复诊数量
        object.put("videoRate",getRange(videoCount.intValue(),total.intValue(),0));
        object.put("total",total);
        return object;
    }
@ -1391,7 +1379,9 @@ public class StatisticsEsService {
            }else {
                saveModels = elasticsearchUtil.findLineChartDateQuotaLevel1(startDate, endDate, area, level, index, timelevel, SaveModel.interval_day, lowCode);
            }
        } else {
        }else if(StringUtils.isNoneBlank(lowCode2)){
            saveModels = elasticsearchUtil.findLineChartDateQuotaLevel2(startDate, endDate, area, level, index, timelevel, SaveModel.interval_day, lowCode,lowCode2);
        }else {
            saveModels = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, area, level, index, timelevel, SaveModel.interval_day);
        }
        List<JSONObject> result = new ArrayList<>();
@ -1764,7 +1754,10 @@ public class StatisticsEsService {
                saveModels = elasticsearchUtil.findLineChartDateQuotaLevel1(startDate, endDate, area, level, index, timelevel, SaveModel.interval_week, lowCode);
            }
        } else {
        }else if(StringUtils.isNoneBlank(lowCode2)){
            saveModels = elasticsearchUtil.findLineChartDateQuotaLevel2(startDate, endDate, area, level, index, timelevel, SaveModel.interval_week, lowCode,lowCode2);
        }
        else {
            saveModels = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, area, level, index, timelevel, SaveModel.interval_week);
        }
@ -1907,6 +1900,9 @@ public class StatisticsEsService {
            }else {
                saveModels = elasticsearchUtil.findLineChartDateQuotaLevel1(startDate, endDate, area, level, index, timelevel, SaveModel.interval_month, lowCode);
            }
        } else if(StringUtils.isNoneBlank(lowCode2)){
            saveModels = elasticsearchUtil.findLineChartDateQuotaLevel2(startDate, endDate, area, level, index, timelevel, SaveModel.interval_month, lowCode,lowCode2);
        } else {
            saveModels = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, area, level, index, timelevel, SaveModel.interval_month);
        }
@ -3457,8 +3453,146 @@ public class StatisticsEsService {
        return object;
    }
    /**
     * 按日期柱状图统计处方量
     *
     *
     * @param startDate
     * @param endDate
     * @param area
     * @param level 2科室
     * @param index
     * @param level2_type 4 医院
     * @return
     * @throws Exception
     */
    public JSONObject getPrescriptionLine(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception {
        logger.info("service index:"+index+" and level2_type:"+level2_type+" and level:"+level);
        String[] indexes = index.split(",");
        JSONArray resultArray = new JSONArray();
        //问诊量
        JSONObject object = new JSONObject();
        if (interval==1){
            //图文
            JSONArray array = dateTotalStatistics2(startDate,endDate,area,level,indexes[1],null,SaveModel.timeLevel_ZL,"1");
            object.put("data",array);
            //视频
            JSONArray array1 = dateTotalStatistics2(startDate,endDate,area,level,indexes[1],null,SaveModel.timeLevel_ZL,"2");
            object.put("data",array1);
        }else if (interval==2){
            JSONArray array = weekTotalStatistics2(startDate,endDate,area,level,indexes[1],null,SaveModel.timeLevel_ZL,"1");
            JSONArray array1 = weekTotalStatistics2(startDate,endDate,area,level,indexes[1],null,SaveModel.timeLevel_ZL,"2");
            object.put("data",array);
            object.put("data",array1);
        }else if (interval==3){
            JSONArray array = monthTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,"1");
            JSONArray array1 = monthTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,"2");
            object.put("data",array);
            object.put("data",array1);
        }
        if (StringUtils.isNoneBlank(level2_type)){
            //问诊量表格
            List<SaveModel> outpatientList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[0], SaveModel.timeLevel_ZL,"",String.valueOf(interval),level2_type);
            //开具处方数量
            List<SaveModel> precriptionList = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"",String.valueOf(interval),level2_type);
            /*for (int i=0;i<prescriptionSaveModels.size();i++){
                JSONObject jsonObject = new JSONObject();
                Double specialist = 0.0;
                Double totalOutpatient = 0.0;
                SaveModel saveModel = prescriptionSaveModels.get(i);
                jsonObject.put("hospitalCode",saveModel.getHospital());
                jsonObject.put("hospitalName",saveModel.getHospitalName());
                jsonObject.put("deptNo",saveModel.getDept());
                jsonObject.put("deptName",saveModel.getDeptName());
                jsonObject.put("name",saveModel.getHospitalName());
                jsonObject.put("specialist",saveModel.getResult1());
                jsonObject.put("doctorName",saveModel.getDoctorName());
                jsonObject.put("doctorcode",saveModel.getDoctor());
                specialist = saveModel.getResult1();
                jsonObject.put("specialist",specialist);
                totalOutpatient = specialistSaveModels.get(i).getResult1();
                String prescriptionRate = getRange(specialist.intValue(),totalOutpatient.intValue(),0);
                jsonObject.put("prescriptionRate",prescriptionRate);
                resultArray.add(jsonObject);
            }*/
            object.put("excelData",resultArray);
        }
        return object;
    }
    /**
     * 按日期柱状图 取药方式统计处方量
     *
     *
     * @param startDate
     * @param endDate
     * @param area
     * @param level 2科室
     * @param index
     * @param level2_type 4 医院
     * @return
     * @throws Exception
     */
    public JSONObject getPrescriptionLineByType(String startDate, String endDate, String area, int level, String index,int interval, String level2_type) throws Exception {
        logger.info("service index:"+index+" and level2_type:"+level2_type+" and level:"+level);
        String[] indexes = index.split(",");
        JSONArray resultArray = new JSONArray();
        //问诊量
        JSONObject object = new JSONObject();
        if (interval==1){
            //图文
            JSONArray array = dateTotalStatistics2(startDate,endDate,area,level,indexes[1],null,SaveModel.timeLevel_ZL,"1");
            object.put("data",array);
            //视频
            JSONArray array1 = dateTotalStatistics2(startDate,endDate,area,level,indexes[1],null,SaveModel.timeLevel_ZL,"2");
            object.put("data",array1);
        }else if (interval==2){
            JSONArray array = weekTotalStatistics2(startDate,endDate,area,level,indexes[1],null,SaveModel.timeLevel_ZL,"1");
            JSONArray array1 = weekTotalStatistics2(startDate,endDate,area,level,indexes[1],null,SaveModel.timeLevel_ZL,"2");
            object.put("data",array);
            object.put("data",array1);
        }else if (interval==3){
            JSONArray array = monthTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,"1");
            JSONArray array1 = monthTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,"2");
            object.put("data",array);
            object.put("data",array1);
        }
        if (StringUtils.isNoneBlank(level2_type)){
            //问诊量表格
            List<SaveModel> specialistSaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[0], SaveModel.timeLevel_ZL,"",String.valueOf(interval),level2_type);
            //开具处方数量中自取的处方
            List<SaveModel> oneselfTake = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"1",String.valueOf(interval),level2_type);
            //开具处方数量中快递的处方
            List<SaveModel> mailPost = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"0",String.valueOf(interval),level2_type);
            for(SaveModel saveModel:oneselfTake)
            {
            }
            /*for (int i=0;i<prescriptionSaveModels.size();i++){
                JSONObject jsonObject = new JSONObject();
                Double specialist = 0.0;
                Double totalOutpatient = 0.0;
                SaveModel saveModel = prescriptionSaveModels.get(i);
                jsonObject.put("hospitalCode",saveModel.getHospital());
                jsonObject.put("hospitalName",saveModel.getHospitalName());
                jsonObject.put("deptNo",saveModel.getDept());
                jsonObject.put("deptName",saveModel.getDeptName());
                jsonObject.put("name",saveModel.getHospitalName());
                jsonObject.put("specialist",saveModel.getResult1());
                specialist = saveModel.getResult1();
                totalOutpatient = specialistSaveModels.get(i).getResult1();
                String prescriptionRate = getRange(specialist.intValue(),totalOutpatient.intValue(),0);
                jsonObject.put("prescriptionRate",prescriptionRate);
                resultArray.add(jsonObject);
            }*/
            object.put("excelData",resultArray);
        }
        return object;
    }
}

+ 31 - 31
business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java

@ -318,16 +318,16 @@ public class ElasticsearchUtil {
            low_level = lowLevel;
        }
        if (SaveModel.doctorLevel.equals(low_level)) {
            sql.append("select doctor as \"doctor\",doctorName as \"doctorName\",sum(result1) as \"result1\", sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select doctor as doctor,doctorName as doctorName,sum(result1) as result1, sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by doctor,doctorName");
        }else if (SaveModel.deptLevel.equals(low_level)) {
            sql.append("select dept as \"dept\",deptName as \"deptName\",sum(result1) as \"result1\", sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select dept as dept,deptName as deptName,sum(result1) as result1, sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by dept,deptName");
        } else if (SaveModel.OrgLevel.equals(low_level)) {
            sql.append("select hospital as \"hospital\" ,hospitalName as \"hospitalName\",sum(result1) as \"result1\",sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select hospital as hospital ,hospitalName as hospitalName,sum(result1) as result1,sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by hospital,hospitalName");
        } else if (SaveModel.townLevel.equals(low_level)) {
            sql.append("select town as \"town\",townName as\"townName\",sum(result1) as \"result1\",sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select town as town,townName astownName,sum(result1) as result1,sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by town,townName");
        } else if (SaveModel.cityLevel.equals(low_level)) {
            sql.append("select city,cityName,sum(result1) result1,sum(result2) result2 from " + esIndex + " where ");
@ -417,19 +417,19 @@ public class ElasticsearchUtil {
            low_level = lowLevel;
        }
        if (SaveModel.doctorLevel.equals(low_level)) {
            sql.append("select doctor as \"doctor\",doctorName as \"doctorName\",count(doctor) as \"result1\", count(doctor) as \"result2\" from " + esIndex + " where ");
            sql.append("select doctor as doctor,doctorName as doctorName,count(doctor) as result1, count(doctor) as result2 from " + esIndex + " where ");
            groupBy.append("  group by doctor,doctorName");
        }else if (SaveModel.deptLevel.equals(low_level)) {
            sql.append("select dept as \"dept\",deptName as \"deptName\",count(DISTINCT doctor) as \"result1\", count(DISTINCT doctor) as \"result2\" from " + esIndex + " where ");
            sql.append("select dept as dept,deptName as deptName,count(DISTINCT doctor) as result1, count(DISTINCT doctor) as result2 from " + esIndex + " where ");
            groupBy.append("  group by ");
        } else if (SaveModel.OrgLevel.equals(low_level)) {
            sql.append("select hospital as \"hospital\",hospitalName as \"hospitalName\",count(DISTINCT doctor) as \"result1\",count(DISTINCT doctor) as \"result2\" from " + esIndex + " where ");
            sql.append("select hospital as hospital,hospitalName as hospitalName,count(DISTINCT doctor) as result1,count(DISTINCT doctor) as result2 from " + esIndex + " where ");
            groupBy.append("  group by ");
        } else if (SaveModel.townLevel.equals(low_level)) {
            sql.append("select town as \"town\",townName as \"townName\",count(DISTINCT doctor) as \"result1\",count(DISTINCT doctor) as \"result2\" from " + esIndex + " where ");
            sql.append("select town as town,townName as townName,count(DISTINCT doctor) as result1,count(DISTINCT doctor) as result2 from " + esIndex + " where ");
            groupBy.append("  group by ");
        } else if (SaveModel.cityLevel.equals(low_level)) {
            sql.append("select city as \"city\",cityName as \"cityName\",count(DISTINCT doctor) as \"result1\",count(DISTINCT doctor) as \"result2\" from " + esIndex + " where ");
            sql.append("select city as city,cityName as cityName,count(DISTINCT doctor) as result1,count(DISTINCT doctor) as result2 from " + esIndex + " where ");
            groupBy.append("  group by ");
        }
@ -519,19 +519,19 @@ public class ElasticsearchUtil {
            low_level = lowLevel;
        }
        if (SaveModel.doctorLevel.equals(low_level)) {
            sql.append("select doctor as \"doctor\",doctorName as \"doctor\",count(doctor) as \"result1\", count(doctor) as \"result2\" from " + esIndex + " where ");
            sql.append("select doctor as doctor,doctorName as doctor,count(doctor) as result1, count(doctor) as result2 from " + esIndex + " where ");
            groupBy.append("  group by doctor,doctorName");
        }else if (SaveModel.deptLevel.equals(low_level)) {
            sql.append("select dept as \"dept\",deptName as \"deptName\",count(DISTINCT doctor) as \"result1\", count(DISTINCT doctor) as \"result2\" from " + esIndex + " where ");
            sql.append("select dept as dept,deptName as deptName,count(DISTINCT doctor) as result1, count(DISTINCT doctor) as result2 from " + esIndex + " where ");
            groupBy.append("  group by dept");
        } else if (SaveModel.OrgLevel.equals(low_level)) {
            sql.append("select hospital as \"hospital\",hospitalName as \"hospitalName\",count(DISTINCT doctor) as \"result1\",count(DISTINCT doctor) as \"result2\" from " + esIndex + " where ");
            sql.append("select hospital as hospital,hospitalName as hospitalName,count(DISTINCT doctor) as result1,count(DISTINCT doctor) as result2 from " + esIndex + " where ");
            groupBy.append("  group by hospital");
        } else if (SaveModel.townLevel.equals(low_level)) {
            sql.append("select town as \"town\",townName as \"townName\",count(DISTINCT doctor) as \"result1\",count(DISTINCT doctor) as \"result2\" from " + esIndex + " where ");
            sql.append("select town as town,townName as townName,count(DISTINCT doctor) as result1,count(DISTINCT doctor) as result2 from " + esIndex + " where ");
            groupBy.append("  group by town");
        } else if (SaveModel.cityLevel.equals(low_level)) {
            sql.append("select city as \"city\",cityName as \"cityName\",count(DISTINCT doctor) as \"result1\",count(DISTINCT doctor) as \"result2\" from " + esIndex + " where ");
            sql.append("select city as city,cityName as cityName,count(DISTINCT doctor) as result1,count(DISTINCT doctor) as result2 from " + esIndex + " where ");
            groupBy.append("  group by city");
        }
@ -620,32 +620,32 @@ public class ElasticsearchUtil {
            low_level = lowLevel;
        }
        if (SaveModel.doctorLevel.equals(low_level)) {
            sql.append("select doctor as \"doctor\",doctorName as \"doctorName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",sum(result1) as \"result1\", sum(result2) as \"result2\",quotaDate as \"quotaDate\" from " + esIndex + " where ");
            sql.append("select doctor as doctor,doctorName as doctorName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,sum(result1) as result1, sum(result2) as result2,quotaDate as quotaDate from " + esIndex + " where ");
            groupBy.append("  group by doctor,doctorName");
            if (!org.springframework.util.StringUtils.isEmpty(slaveKey1)&&!slaveKey1.contains(",")&&(!org.springframework.util.StringUtils.isEmpty(slaveKey1) || commonParams.equals(slaveKey1))) {
                groupBy.append(",slaveKey1,slaveKey1Name");
            }
        }
        if (SaveModel.deptLevel.equals(low_level)) {
            sql.append("select dept as \"dept\",deptName as \"deptName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",sum(result1) result1 as \"result1\", sum(result2) as \"result2\",quotaDate as \"quotaDate\" from " + esIndex + " where ");
            sql.append("select dept as dept,deptName as deptName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,sum(result1) as result1, sum(result2) as result2,quotaDate as quotaDate from " + esIndex + " where ");
            groupBy.append("  group by dept,deptName");
            if (!org.springframework.util.StringUtils.isEmpty(slaveKey1)&&!slaveKey1.contains(",")&&(!org.springframework.util.StringUtils.isEmpty(slaveKey1) || commonParams.equals(slaveKey1))) {
                groupBy.append(",slaveKey1,slaveKey1Name");
            }
        } else if (SaveModel.OrgLevel.equals(low_level)) {
            sql.append("select hospital as \"hospital\",hospitalName as \"hospitalName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",sum(result1)  as \"result1\",sum(result2) as \"result2\",quotaDate as \"quotaDate\" from " + esIndex + " where ");
            sql.append("select hospital as hospital,hospitalName as hospitalName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,sum(result1)  as result1,sum(result2) as result2,quotaDate as quotaDate from " + esIndex + " where ");
            groupBy.append("  group by hospital,hospitalName");
            if (!org.springframework.util.StringUtils.isEmpty(slaveKey1)&&!slaveKey1.contains(",")&&(!org.springframework.util.StringUtils.isEmpty(slaveKey1) || commonParams.equals(slaveKey1))) {
                groupBy.append(",slaveKey1,slaveKey1Name");
            }
        } else if (SaveModel.townLevel.equals(low_level)) {
            sql.append("select town as \"town\",townName as \"townName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",sum(result1) as \"result1\",sum(result2) as \"result2\",quotaDate as \"quotaDate\" from " + esIndex + " where ");
            sql.append("select town as town,townName as townName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,sum(result1) as result1,sum(result2) as result2,quotaDate as quotaDate from " + esIndex + " where ");
            groupBy.append("  group by town,townName");
            if (!org.springframework.util.StringUtils.isEmpty(slaveKey1)&&!slaveKey1.contains(",")&&(!org.springframework.util.StringUtils.isEmpty(slaveKey1) || commonParams.equals(slaveKey1))) {
                groupBy.append(",slaveKey1,slaveKey1Name");
            }
        } else if (SaveModel.cityLevel.equals(low_level)) {
            sql.append("select city as \"city\",cityName as \"cityName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",sum(result1) as \"result1\",sum(result2) as \"result2\",quotaDate as \"quotaDate\" from " + esIndex + " where ");
            sql.append("select city as city,cityName as cityName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,sum(result1) as result1,sum(result2) as result2,quotaDate as quotaDate from " + esIndex + " where ");
            groupBy.append("  group by city,cityName");
            if (!org.springframework.util.StringUtils.isEmpty(slaveKey1)&&!slaveKey1.contains(",")&&(!org.springframework.util.StringUtils.isEmpty(slaveKey1) || commonParams.equals(slaveKey1))) {
                groupBy.append(",slaveKey1,slaveKey1Name");
@ -741,7 +741,7 @@ public class ElasticsearchUtil {
            low_level = lowLevel;
        }
        if (SaveModel.doctorLevel.equals(low_level)) {
            sql.append("select doctor as\"doctor\",doctorName as\"doctorName\",slaveKey1 as\"slaveKey1\",slaveKey1Name as\"slaveKey1Name\",slaveKey2 as\"slaveKey2\",slaveKey2Name as\"slaveKey2Name\",sum(result1) as \"result1\",sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select doctor asdoctor,doctorName asdoctorName,slaveKey1 asslaveKey1,slaveKey1Name asslaveKey1Name,slaveKey2 asslaveKey2,slaveKey2Name asslaveKey2Name,sum(result1) as result1,sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by doctor,doctorName");
            if (!org.springframework.util.StringUtils.isEmpty(slaveKey1) || commonParams.equals(slaveKey1)) {
                groupBy.append(",slaveKey1,slaveKey1Name");
@ -750,7 +750,7 @@ public class ElasticsearchUtil {
                groupBy.append(",slaveKey2,slaveKey2Name");
            }
        }else if (SaveModel.deptLevel.equals(low_level)) {
            sql.append("select dept as \"dept\",deptName as \"deptName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",slaveKey2 as \"slaveKey2\",slaveKey2Name as \"slaveKey2Name\",sum(result1) as \"result1\",sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select dept as dept,deptName as deptName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,slaveKey2 as slaveKey2,slaveKey2Name as slaveKey2Name,sum(result1) as result1,sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by dept,deptName");
            if (!org.springframework.util.StringUtils.isEmpty(slaveKey1) || commonParams.equals(slaveKey1)) {
                groupBy.append(",slaveKey1,slaveKey1Name");
@ -759,7 +759,7 @@ public class ElasticsearchUtil {
                groupBy.append(",slaveKey2,slaveKey2Name");
            }
        } else if (SaveModel.OrgLevel.equals(low_level)) {
            sql.append("select hospital as \"hospital\",hospitalName as \"hospitalName\",sum(result1) as \"result1\",sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select hospital as hospital,hospitalName as hospitalName,sum(result1) as result1,sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by hospital,hospitalName");
            if (!org.springframework.util.StringUtils.isEmpty(slaveKey1) || commonParams.equals(slaveKey1)) {
                groupBy.append(",slaveKey1,slaveKey1Name");
@ -768,7 +768,7 @@ public class ElasticsearchUtil {
                groupBy.append(",slaveKey2,slaveKey2Name");
            }
        } else if (SaveModel.townLevel.equals(low_level)) {
            sql.append("select town as \"town\",townName as \"townName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",slaveKey2 as \"slaveKey2\",slaveKey2Name as \"slaveKey2Name\",sum(result1) as \"result1\",sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select town as town,townName as townName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,slaveKey2 as slaveKey2,slaveKey2Name as slaveKey2Name,sum(result1) as result1,sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by town,townName");
            if (!org.springframework.util.StringUtils.isEmpty(slaveKey1) || commonParams.equals(slaveKey1)) {
                groupBy.append(",slaveKey1,slaveKey1Name");
@ -777,7 +777,7 @@ public class ElasticsearchUtil {
                groupBy.append(",slaveKey2,slaveKey2Name");
            }
        } else if (SaveModel.cityLevel.equals(low_level)) {
            sql.append("select city as \"city\",cityName as \"cityName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",slaveKey2 as \"result1\",slaveKey2Name as \"result1\",sum(result1) as \"result1\",sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select city as city,cityName as cityName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,slaveKey2 as result1,slaveKey2Name as result1,sum(result1) as result1,sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by city,cityName");
            if (!org.springframework.util.StringUtils.isEmpty(slaveKey1) || commonParams.equals(slaveKey1)) {
                groupBy.append(",slaveKey1,slaveKey1Name");
@ -788,7 +788,7 @@ public class ElasticsearchUtil {
        }
        if (StringUtils.isNotEmpty(area)) {
            if (SaveModel.doctorLevel.equals(level + "")) {
                if (SaveModel.doctorLevel.equals(level + "")) {
                sql.append(" doctor='" + area + "'");
            }else if (SaveModel.deptLevel.equals(level + "")) {
                sql.append(" dept='" + area + "'");
@ -922,19 +922,19 @@ public class ElasticsearchUtil {
            low_level = lowLevel;
        }
        if (SaveModel.doctorLevel.equals(low_level)) {
            sql.append("select doctor as \"doctor\",doctorName as \"doctorName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",sum(result1) as \"result1\", sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select doctor as doctor,doctorName as doctorName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,sum(result1) as result1, sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by doctor,doctorName,slaveKey1,slaveKey1Name");
        }else if (SaveModel.deptLevel.equals(low_level)) {
            sql.append("select dept as \"dept\",deptName as \"deptName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",sum(result1) as \"result1\", sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select dept as dept,deptName as deptName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,sum(result1) as result1, sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by dept,deptName,slaveKey1,slaveKey1Name");
        } else if (SaveModel.OrgLevel.equals(low_level)) {
            sql.append("select hospital as \"hospital\",hospitalName as \"hospitalName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",sum(result1) as \"result1\",sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select hospital as hospital,hospitalName as hospitalName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,sum(result1) as result1,sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by hospital,hospitalName,slaveKey1,slaveKey1Name");
        } else if (SaveModel.townLevel.equals(low_level)) {
            sql.append("select town as \"town\",townName as \"townName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",sum(result1) as \"result1\",sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select town as town,townName as townName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,sum(result1) as result1,sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by town,townName,slaveKey1,slaveKey1Name");
        } else if (SaveModel.cityLevel.equals(low_level)) {
            sql.append("select city as \"city\",cityName as \"cityName\",slaveKey1 as \"slaveKey1\",slaveKey1Name as \"slaveKey1Name\",sum(result1) as \"result1\",sum(result2) as \"result2\" from " + esIndex + " where ");
            sql.append("select city as city,cityName as cityName,slaveKey1 as slaveKey1,slaveKey1Name as slaveKey1Name,sum(result1) as result1,sum(result2) as result2 from " + esIndex + " where ");
            groupBy.append("  group by city,cityName,slaveKey1,slaveKey1Name");
        }
@ -1714,7 +1714,7 @@ public class ElasticsearchUtil {
        }
        StringBuffer sb = new StringBuffer();
        sb.append("select sum(result1) as\" result1\",sum(result2) as \"result2\" from ").append(esIndex)
        sb.append("select sum(result1) as result1,sum(result2) as result2 from ").append(esIndex)
                .append(" where city='350200' and quotaCode in(").append(index)
                .append(") and timeLevel='1' and areaLevel='6' and quotaDate>='").append(startDate).append("' ");
        sb.append("and quotaDate<='").append(endDate).append("'");

+ 8 - 0
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
@ -157,6 +159,8 @@ public class ImService {
	private SystemMessageService systemMessageService;
	@Autowired
	private BaseUserMessageDao userMessageDao;
	@Autowired
	private BaseDoctorHospitalDao doctorHospitalDao;
	
	@Value("${wechat.id}")
	private String wxId;
@ -2254,6 +2258,10 @@ public class ImService {
			if (map.get("doctor")!=null){
				String doctorId = map.get("doctor").toString();
				BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
				List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorId);
				if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
					map.put("deptName",doctorHospitalDOS.get(0).getDeptName());
				}
				if (baseDoctorDO!=null){
					map.put("doctorName",baseDoctorDO.getName());
				}

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java

@ -19,13 +19,13 @@ public abstract class IntegerIdentityEntity implements Serializable {
    @Id
//==========mysql 环境 id策略======================================================
    @GeneratedValue(generator = "generator")
    /*@GeneratedValue(generator = "generator")
    @GenericGenerator(name = "generator", strategy = "identity")
    @Column(name = "id", unique = true, nullable = false)
    @Column(name = "id", unique = true, nullable = false)*/
//==========mysql 环境 id策略 end======================================================
//==========Oracle 环境id策略 =========================================================
   /*@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")*/
   @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="id_generated")
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 49 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/family/BasePatientMemberDictDO.java

@ -0,0 +1,49 @@
package com.yihu.jw.entity.hospital.family;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "base_patient_member_dict")
public class BasePatientMemberDictDO extends UuidIdentityEntityWithOperator {
    /*
     *关系名称父母、父子、母子等
     */
    private String relationName;
    /*
     *删除标志:1正常 0删除
     */
    private String isDel;
    /*
     *排序
     */
    private String isSort;
    public String getRelationName() {
        return relationName;
    }
    public void setRelationName(String relationName) {
        this.relationName = relationName;
    }
    public String getIsDel() {
        return isDel;
    }
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }
    public String getIsSort() {
        return isSort;
    }
    public void setIsSort(String isSort) {
        this.isSort = isSort;
    }
}

+ 104 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/family/WlyyPatientFamilyMemberDO.java

@ -0,0 +1,104 @@
package com.yihu.jw.entity.hospital.family;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "wlyy_patient_family_member")
public class WlyyPatientFamilyMemberDO extends UuidIdentityEntityWithOperator {
    /*
     *居民code
     */
    private String patient;
    /*
     *家庭成员code
     */
    private String familyMember;
    /*
     *家庭关系
     */
    private String familyRelation;
    /*
     *是否授权
     */
    private Integer isAuthorize;
    /*
     *家庭关系名称
     */
    private String familyRelationName;
    /*
     *是否删除
     */
    private Integer isDel;
    private String cardType;
    private String cardNo;
    public String getCardType() {
        return cardType;
    }
    public void setCardType(String cardType) {
        this.cardType = cardType;
    }
    public String getCardNo() {
        return cardNo;
    }
    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getFamilyMember() {
        return familyMember;
    }
    public void setFamilyMember(String familyMember) {
        this.familyMember = familyMember;
    }
    public String getFamilyRelation() {
        return familyRelation;
    }
    public void setFamilyRelation(String familyRelation) {
        this.familyRelation = familyRelation;
    }
    public Integer getIsAuthorize() {
        return isAuthorize;
    }
    public void setIsAuthorize(Integer isAuthorize) {
        this.isAuthorize = isAuthorize;
    }
    public String getFamilyRelationName() {
        return familyRelationName;
    }
    public void setFamilyRelationName(String familyRelationName) {
        this.familyRelationName = familyRelationName;
    }
    public Integer getIsDel() {
        return isDel;
    }
    public void setIsDel(Integer isDel) {
        this.isDel = isDel;
    }
}

+ 44 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -84,12 +84,12 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
	private String deptName;
    /**
	 * 居民code
	 * 当前居民code
	 */
	private String patient;
    /**
	 * 居民名称
	 * 当前居民名称
	 */
	private String patientName;
@ -238,6 +238,21 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    *提醒次数
     */
    private Integer remindCount;
    /**
     * 0未结算1已结算
     */
    private Integer hisStatus;
    /**
     * 代就诊人
     */
    private String consumer;
    /**
     * 代就诊人名字
     */
    private String consumerName;
    @Column(name = "remind_count")
    public Integer getRemindCount() {
        return remindCount;
@ -621,4 +636,31 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setSource(String source) {
        this.source = source;
    }
    @Column(name = "his_status")
    public Integer getHisStatus() {
        return hisStatus;
    }
    public void setHisStatus(Integer hisStatus) {
        this.hisStatus = hisStatus;
    }
    @Column(name = "consumer")
    public String getConsumer() {
        return consumer;
    }
    public void setConsumer(String consumer) {
        this.consumer = consumer;
    }
    @Column(name = "consumer_name")
    public String getConsumerName() {
        return consumerName;
    }
    public void setConsumerName(String consumerName) {
        this.consumerName = consumerName;
    }
}

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationTemplateDetailDO.java

@ -34,6 +34,7 @@ public class RehabilitationTemplateDetailDO extends UuidIdentityEntityWithOperat
    private String name;//服务项名称
    private Integer expense;//费用
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
@ -141,4 +142,12 @@ public class RehabilitationTemplateDetailDO extends UuidIdentityEntityWithOperat
    public void setName(String name) {
        this.name = name;
    }
    public Integer getExpense() {
        return expense;
    }
    public void setExpense(String name) {
        this.expense = expense;
    }
}

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/bank/HealthBankMapping.java

@ -53,6 +53,7 @@ public class HealthBankMapping {
        public static final String updateGoods ="/updateGoods";
        public static final String createCreditsDetail = "/createCreditsDetail";
        public static final String findCreditsLogInfo ="/findCreditsLogInfo";
        public static final String findCreditsLogInfoWithOrder ="/findCreditsLogInfoWithOrder";
        public static final String selectByActivity = "/selectByActivity";
        public static final String selectByRanking = "/selectByRanking";
        public static final String selectByActivityRanking = "/selectByActivityRanking";

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

@ -175,6 +175,10 @@ public class BaseHospitalRequestMapping {
         * 获取用药频次
         */
        public static final String getDrugFrequency="/getDrugFrequency";
        /**
         * 删除处方草稿
         */
        public static final String deletePrescriptionByid="/deletePrescriptionByid";
        /**
         * 下诊断
@ -913,6 +917,8 @@ public class BaseHospitalRequestMapping {
        //添加(复诊咨询,协同门诊)
        public static final String addPrescriptionConsult ="/addPrescriptionConsult";
        public static final String refundRegisterNo = "/refundRegisterNo";
        public static final String addConsult= "addConsult";
    
        //全科医生发起求助专科医生的专家咨询
@ -1121,6 +1127,8 @@ public class BaseHospitalRequestMapping {
        public static final String setQrCode  = "/setQrCode";
        //生成所有医生二维码
        public static final String setAllCode  = "/setAllCode";
        public static final String findArticleByCategoryAndName  = "/findArticleByCategoryAndName";
        public static final String getArticleGroup  = "/getArticleGroup";
    }
    /**
@ -1160,6 +1168,7 @@ public class BaseHospitalRequestMapping {
    }
    /**
@ -1186,6 +1195,20 @@ public class BaseHospitalRequestMapping {
        public static final String downBanner = "/downBanner";
        public static final String onOff = "/onOff";
    }
    /**
     * 患者家人关系管理
     */
    public static class WlyyFamilyMember extends Basic{
        public static final String wlyyFamilyMember  = "/wlyyFamilyMember";
        public static final String sendZSFamily = "/sendZSFamily";
        public static final String findRelationDict = "/findRelationDict";
        public static final String findFamilyMumber = "/findFamilyMumber";
        public static final String delFamilyMumber = "/delFamilyMumber";
        public static final String updateFamilyMumber = "/updateFamilyMumber";
        public static final String saveFamilyRelation = "/saveFamilyRelation";
        public static final String findSingleMember = "/findSingleMember";
    }
    /**
     * 医生锦旗展示
     */
@ -1334,7 +1357,7 @@ public class BaseHospitalRequestMapping {
        public static final String checkOperateTime="/checkOperateTime";
        public static final String querySettledRecord="/querySettledRecord";
        public static final String paySuccessNotice="/paySuccessNotice";
        public static final String findHisPatientInfo="/findHisPatientInfo";
    }
    /**

+ 22 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyOutpatientVO.java

@ -220,6 +220,12 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    @ApiModelProperty(value = "来源", example = "来源")
    private String source;
    @ApiModelProperty(value = "代接诊人", example = "代接诊人")
    private String consumer;
    @ApiModelProperty(value = "代接诊人名字", example = "代接诊人名字")
    private String consumerName;
    public String getAdmNo() {
@ -500,4 +506,20 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    public void setSource(String source) {
        this.source = source;
    }
    public String getConsumer() {
        return consumer;
    }
    public void setConsumer(String consumer) {
        this.consumer = consumer;
    }
    public String getConsumerName() {
        return consumerName;
    }
    public void setConsumerName(String consumerName) {
        this.consumerName = consumerName;
    }
}

+ 1 - 1
readme.MD

@ -19,7 +19,7 @@
     ag-basic 对外的接口网关
     manage-gateway 基卫后台管理系统的接口网关
     .gitignore   项目提交忽略配置文件
     
项目运行
    环境变量配置
        开发环境:  spring_profiles_active jwdev

+ 6 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/methodlog/MethodLogEndpoint.java

@ -7,6 +7,7 @@ import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
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.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -44,6 +45,11 @@ public class MethodLogEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "page") int page,
			@ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
			@RequestParam(value = "size") int size) throws Exception {
				if(StringUtil.isBlank(sorts)){
					sorts = "-createTime";
				}
		List<BaseMethodLogDO> baseDoctors = baseMethodLogService.search(fields, filters, sorts, page, size);
		int count = (int) baseMethodLogService.getCount(filters);
		return success(baseDoctors, count, page, size);

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

@ -378,6 +378,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            return result.toJSONString();
        }
        baseDoctorDO.setSalt(randomString(5));
        baseDoctorDO.setEnabled(1);
        baseDoctorDO.setLocked(0);
        baseDoctorDO.setPassword(MD5.md5Hex(baseDoctorDO.getIdcard().substring(12, 18) + "{" + baseDoctorDO.getSalt() + "}"));
        this.save(baseDoctorDO);

+ 6 - 0
svr/svr-base/src/main/resources/application.yml

@ -124,6 +124,8 @@ wechat:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://172.26.0.105:3000/
---
spring:
  profiles: jwtest
@ -170,6 +172,8 @@ pay:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://172.26.0.105:3000/
---
spring:
  profiles: iottest
@ -304,6 +308,8 @@ wechat:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://172.26.0.105:3000/
---
spring:
  profiles: jwOracleTest

+ 13 - 0
svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/interceptor/ActivatedInterceptor.java

@ -1,25 +1,38 @@
package com.yihu.jw.healthyhouse.interceptor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.healthyhouse.constant.LoginInfo;
import com.yihu.jw.healthyhouse.model.user.User;
import com.yihu.jw.healthyhouse.service.user.UserService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.wlyy.HouseUserContant;
import javassist.*;
import javassist.bytecode.CodeAttribute;
import javassist.bytecode.LocalVariableAttribute;
import javassist.bytecode.MethodInfo;
import net.sf.json.JSON;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

+ 17 - 1
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java

@ -4,7 +4,6 @@ package com.yihu.jw.entrance.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.RegisterService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
@ -156,6 +155,23 @@ public class MqSdkController extends EnvelopRestEndpoint {
        return ObjEnvelop.getSuccess("获取成功",obj);
    }
    @PostMapping(value = "/BS10138")
    @ApiOperation(value = "  线上挂号接口")
    public ObjEnvelop BS10138(
            @ApiParam(name = "cardNo", value = "卡号")
            @RequestParam(value = "cardNo", required = false) String cardNo,
            @ApiParam(name = "doctor", value = "医生工号")
            @RequestParam(value = "doctor", required = false) String doctor,
            @ApiParam(name = "dept", value = "科室编码")
            @RequestParam(value = "dept", required = false) String dept,
            @ApiParam(name = "serial_no", value = "挂号号")
            @RequestParam(value = "serial_no", required = false) String serial_no,
            @ApiParam(name = "winNo", value = "分部号")
            @RequestParam(value = "winNo", required = false) String winNo) throws Exception {
        JSONObject obj = entranceService.BS10138(cardNo, doctor, dept, serial_no, winNo,demoFlag);
        return ObjEnvelop.getSuccess("获取成功",obj);
    }
    //多个前端使用json传参
    @PostMapping(value = "/BS10112")
    @ApiOperation(value = "线上处方接口")

+ 3 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/PrescriptionOverdueJob.java

@ -4,6 +4,7 @@ import com.yihu.jw.service.channel.PrescriptionStatusUpdateService;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Trigger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -20,6 +21,8 @@ public class PrescriptionOverdueJob implements Job {
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("START========PrescriptionOverdueJob========");
        try {
            Trigger trigger =jobExecutionContext.getTrigger();
            System.out.println("执行时间为"+trigger.getNextFireTime());
            prescriptionStatusUpdateService.setOutPatientOver();
            logger.info("END========PrescriptionOverdueJob========");
        } catch (Exception e) {

+ 33 - 48
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java

@ -3,7 +3,6 @@ package com.yihu.jw.service.channel;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.job.QuartzJobLog;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
@ -43,7 +42,7 @@ public class PrescriptionStatusUpdateService {
    private static Logger logger = LoggerFactory.getLogger(PrescriptionStatusUpdateService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Value("${wechat.id}")
    @Value("${wechat.ids}")
    private String wechatId;
    @Value("${hlwyyEntrance.url}")
    private String hlwyyEntranceUrl;
@ -280,62 +279,48 @@ public class PrescriptionStatusUpdateService {
     */
    public void setOutPatientOver(){
        logger.info("setOutPatientOver start ");
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        int i = calendar.get(Calendar.HOUR_OF_DAY);
        QuartzJobLog quartzJobLog = new QuartzJobLog();
        //复诊记录状态状态安全锁,每天0~2点才允许触发,避免误调用
        //将所有的已接诊的处方记录
        if(i==0||i==1){
            List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus();
            if(outpatientDOs!=null&&outpatientDOs.size()>0){
                for(WlyyOutpatientDO outpatientDO:outpatientDOs){
                    //结束门诊
                    outpatientDO.setStatus("3");
                    logger.info(outpatientDO.getId()+"的处方记录设置为结束");
                    String consultCode = imService.getConsultCodeByOutpatientId(outpatientDO.getId());
        List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus();
        if(outpatientDOs!=null&&outpatientDOs.size()>0){
            System.out.println(outpatientDOs.get(0).getId()+"id______-");
            for(WlyyOutpatientDO outpatientDO:outpatientDOs){
                //结束门诊
                outpatientDO.setStatus("3");
                String consultCode ="";
                try {
                    consultCode = imService.getConsultCodeByOutpatientId(outpatientDO.getId());
                    logger.info("consultCode"+consultCode);
                    if(StringUtils.isNoneBlank(consultCode)){
                        try {
                            imService.finish(consultCode,"admin",2);
                        }catch(Exception e)  {
                            e.printStackTrace();
                            logger.info("自动结束咨询报错 consultCode: "+consultCode);
                        }
                       
                        imService.finish(consultCode,"admin",2);
                    }
                    //保存操作日志
                    quartzJobLog.setId(UUID.randomUUID().toString());
                    quartzJobLog.setJobName("setOutPatientOver");
                    quartzJobLog.setJobId("setOutPatientOver");
                    quartzJobLog.setJobContent(outpatientDO.getId()+"问诊执行自动结束"+outpatientDO.getStatus());
                    quartzJobLog.setJobStartTime(new Date());
                    quartzJobLogDao.save(quartzJobLog);
                }catch(Exception e)  {
                    e.printStackTrace();
                    logger.info("自动结束咨询报错 consultCode: "+consultCode);
                }
                outpatientDao.save(outpatientDOs);
                //退费
                for (WlyyOutpatientDO outpatientDO:outpatientDOs){
                    try {
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                    if (businessOrderDO!=null){
                        if (businessOrderDO.getPayType()==1){
                            businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                        }else if (businessOrderDO.getPayType()==3){
                logger.info(outpatientDO.getId()+"的处方记录设置为结束");
            }
            outpatientDao.save(outpatientDOs);
            //退费
            for (WlyyOutpatientDO outpatientDO:outpatientDOs){
                try {
                BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                if (businessOrderDO!=null){
                    if (businessOrderDO.getPayType()==1){
                        businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                    }else if (businessOrderDO.getPayType()==3){
    /*
                            businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                        businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
    */
                        }
                    } } catch (Exception e) {
                        e.printStackTrace();
                    }
                } } catch (Exception e) {
                    e.printStackTrace();
                }
                logger.info("setOutPatientOver count :"+outpatientDOs.size());
            }else {
                logger.info("setOutPatientOver count :"+0);
            }
        }else{
            logger.info("setOutPatientOver Time is not up ");
            logger.info("setOutPatientOver count :"+outpatientDOs.size());
        }else {
            logger.info("setOutPatientOver count :"+0);
        }
        logger.info("setOutPatientOver end ");
    }

+ 2 - 2
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/AutoTimeOutRemind.java

@ -32,7 +32,7 @@ import java.util.List;
public class AutoTimeOutRemind implements SchedulingConfigurer {
    private static final Logger logger = LoggerFactory.getLogger(AutoTimeOutRemind.class);
    private static String cron = "0 0/1 * * * ?";
    private static String cron = "0 0/5 * * * ?";
    private static String dictName = "remind_patient_job";
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
@ -45,7 +45,7 @@ public class AutoTimeOutRemind implements SchedulingConfigurer {
    @Value("${wechat.ids}")
    private String wxId;
    public AutoTimeOutRemind() {
      cron = "0 0/1 * * * ?";
      cron = "0 0/5 * * * ?";
        System.out.println("创建时的corn"+cron);
    }
    public String change(String corIn){

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

@ -0,0 +1,68 @@
package com.yihu.jw.util;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.job.PrescriptionOverdueJob;
import com.yihu.jw.service.channel.PrescriptionStatusUpdateService;
import com.yihu.jw.util.date.DateUtil;
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 OverdueJob implements SchedulingConfigurer {
    private static final Logger logger = LoggerFactory.getLogger(OverdueJob.class);
    private static String cron = "0 0 1 * * ?";
    public OverdueJob(){
        cron="0 0 1 * * ?";
        System.out.println("初始化时的corn"+cron);
    }
    @Autowired
    private PrescriptionStatusUpdateService prescriptionStatusUpdateService;
    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() {
                logger.info("START========OverdueJob========");
                try {
                    prescriptionStatusUpdateService.setOutPatientOver();
                    logger.info("END========OverdueJob========");
                } catch (Exception e) {
                    e.printStackTrace();
                    logger.error("END===ERROE===OverdueJob,message:"+e.getMessage());
                }
            }
        }, new Trigger() {
            @Override
            public Date nextExecutionTime(TriggerContext triggerContext) {
                // 任务触发,可修改任务的执行周期
                CronTrigger trigger = new CronTrigger(cron);
                System.out.println("OverdueJob任务触发,可修改任务的执行周期"+cron);
                Date nextExec = trigger.nextExecutionTime(triggerContext);
                return nextExec;
            }
        });
    }
}

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

@ -1,6 +1,5 @@
package com.yihu.jw.web.quota;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.im.service.ImService;
@ -16,6 +15,7 @@ import com.yihu.jw.repository.job.QuartzJobConfigDao;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.util.AutoTimeOutRemind;
import com.yihu.jw.util.OverdueJob;
import com.yihu.jw.util.SystemConf;
import com.yihu.jw.web.BaseController;
import com.yihu.jw.wechat.service.WxTemplateService;
@ -28,7 +28,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.sound.midi.Soundbank;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
@ -621,5 +620,12 @@ public class JobController extends BaseController {
        return autoTimeOutRemind.change(corn);
    }
    @RequestMapping(value = "changeOverDueTime", method = RequestMethod.GET)
    public String changeOverDueTime(String corn){
        OverdueJob autoTimeOutRemind = new OverdueJob();
        return autoTimeOutRemind.change(corn);
    }
}

+ 1 - 1
svr/svr-internet-hospital-job/src/main/resources/system.properties

@ -3,7 +3,7 @@
prescriptionStatus_update_job=0 */2 * * * ?
# 门诊记录过期job,每天1 点触发
prescription_overdue_job=0 0 1 * * ?
prescription_overdue_job=0 0 2 * * ?
#每天13 点触发
data_upload_job=0 0 2 * * ?

+ 27 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java

@ -15,13 +15,16 @@ import com.yihu.jw.hospital.service.consult.KnowledgeArticleUserService;
import com.yihu.jw.hospital.service.consult.KnowledgeCategoryService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.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 io.swagger.models.auth.In;
import org.apache.commons.lang.StringUtils;
import org.jboss.netty.handler.codec.http.multipart.MixedAttribute;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -378,4 +381,28 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
		return success(result);
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findArticleByCategoryAndName)
	@ApiOperation(value = "查询文章")
	public MixEnvelop findArticleByCategoryAndName(@ApiParam(name = "categoryFirst", value = "一级分类code")
										   @RequestParam(value = "categoryFirst",required = false)String categoryFirst,
												   @ApiParam(name = "categorySecond", value = "二级分类code")
										   @RequestParam(value = "categorySecond",required = false)String categorySecond,
												   @ApiParam(name = "keyWords", value = "关键词")
										   @RequestParam(value = "keyWords",required = false)String keyWords,
												   @ApiParam(name = "page", value = "当前页")
										   @RequestParam(value = "page",required = false)Integer page,
												   @ApiParam(name = "pageSize", value = "分页大小)")
										   @RequestParam(value = "pageSize",required = false)Integer pageSize)throws Exception {
		MixEnvelop mixEnvelop=knowledgeArticleService.findArticleByCategoryAndName(categoryFirst,categorySecond,keyWords,page,pageSize);
		return mixEnvelop;
	}
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.getArticleGroup)
	@ApiOperation(value = "查询分类")
	public MixEnvelop getGroup(){
		MixEnvelop envelop = knowledgeCategoryService.findAllGroup();
		return envelop;
	}
}

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

@ -12,6 +12,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionEmrDO;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService;
@ -19,6 +20,7 @@ import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.dao.ConsultDao;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -96,6 +98,10 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	private ConsultDao consultDao;
	@Autowired
	private YkyyEntranceService ykyyEntranceService;
	@Autowired
	private YlzPayService ylzPayService;
	@Autowired
	private PatientMappingDao patientMappingDao;
	
	@Value("${wechat.id}")
	private String wxId;
@ -226,12 +232,51 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
						return failed(mes);
					}
					logger.info("调用挂号接口====END");
				}else {
					result = imService.addPrescriptionConsult(outpatientCode, patientCode,doctorCode,consult,reason,type,wxId);
				}
			}
			return success("操作成功",result);
	}
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.refundRegisterNo)
	@ApiOperation(value = "退号", notes = "退号")
	public Envelop refundRegisterNo(@ApiParam(name = "outpatientCode", value = "就诊记录code", defaultValue = "1")
										  @RequestParam(value = "outpatientCode", required = true) String outpatientCode)throws Exception{
		JSONObject result = new JSONObject();
		synchronized (outpatientCode.intern()){
			if(!"xm_ykyy_wx".equals(wxId)){//中山医院-心脏中心需要挂号
				//1.调用退号接口
				logger.info("调用挂号接口====START");
				String rsCode = "";
				String mes = "";
				if("xm_xzzx_wx".equals(wxId)){ //心脏中心挂号
				}else {
					if (demoFlag.equalsIgnoreCase("true")){
						rsCode="0";
						mes="已退号";
					}else {
						net.sf.json.JSONObject res = prescriptionService.refundRegisterNo(outpatientCode);
						rsCode = (String)res.get("@RESULT");
						mes = (String)res.get("@MSG");
					}
				}
				if("-1".equals(rsCode)){
					return failed(mes);
				}
				logger.info("调用退号接口====END");
			}else {
			}
		}
		return success("操作成功",result);
	}
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.addConsult)
	@ApiOperation(value = "添加(复诊咨询,协同门诊)", notes = "添加(复诊咨询,协同门诊)")
@ -367,9 +412,34 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		JSONObject msgObj = new JSONObject();
		msgObj.put("msg",baseDoctorDO.getName()+"结束了咨询");
		msgObj.put("consultcode",consult);
		
		String jsonStr = "";
		
		/*ConsultDo cons = consultDao.findOne(consult);
		if (StringUtils.isNoneBlank(cons.getRelationCode())){
			List<WlyyOutpatientDO> wlyyOutpatientDOList = outpatientDao.findByPatientListNoStatus(cons.getPatient());
			//发送诊断消息
			if (wlyyOutpatientDOList==null||wlyyOutpatientDOList.size()==0){
				WlyyOutpatientDO outpatientDO = wlyyOutpatientDOList.get(0);
				BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
				String userName = null;
				String idcard = null;
				if (patientDO != null) {
					userName = patientDO.getName();
					idcard = patientDO.getIdcard();
				}
				PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(outpatientDO.getPatient());
				String userNo = null;
				if (patientMappingDO != null) {
					userNo = patientMappingDO.getMappingCode();
				}
				String cardNo = null;
				if (StringUtils.isNoneBlank(outpatientDO.getCardNo())) {
					cardNo = outpatientDO.getCardNo();
				}
				String date=DateUtil.dateToStr(outpatientDO.getRegisterDate(), "yyyyMMddHHmmss");
				ylzPayService.msgPush("01", cardNo, "01", patientDO.getMobile(), "00", userNo, userName, idcard, null, outpatientDO.getDeptName(), outpatientDO.getDoctorName(), date, "15", "1");
			}
		}
*/
		if(1 == resutl){
			jsonStr = "{\"id\":\""+ UUID.randomUUID().toString()+"\",\"sender_id\":\""+doctorCode+"\",\"sender_name\":\"系统\",\"timestamp\":"+new Date().getTime()+",\"content_type\":7,\"content\":"+msgObj.toString()+",\"business_type\":1}";
		}

+ 234 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

@ -0,0 +1,234 @@
package com.yihu.jw.hospital.endpoint.hospital;
import com.alibaba.fastjson.JSONObject;
import com.sun.media.jfxmedia.logging.Logger;
import com.yihu.jw.entity.base.doctor.BaseDoctorBackgroundDO;
import com.yihu.jw.hospital.family.service.PatientMemberDictService;
import com.yihu.jw.hospital.family.service.WlyyFamilyMemberService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.service.YkyySMSService;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.sms.util.ykyy.vo.ResultMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.wlyyFamilyMember)
@Api(value = "互联网医院家人关联管理", description = "互联网医院家人关联管理", tags = {"互联网医院 - 互联网医院家人关联管理"})
public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    @Autowired
    private WlyyFamilyMemberService wlyyFamilyMemberService;
    @Autowired
    private PatientMemberDictService patientMemberDictService;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private YkyySMSService ykyySMSService;
    private final String KEY_SUFFIX = ":code";
    @Autowired
    private ZhongShanSMSService zhongShanSMSService;
    @Value("${wechat.id}")
    private String wxId;
    @ApiOperation("获取家人关系")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.findRelationDict)
    public Envelop findRelationDict() {
        return success(patientMemberDictService.findAllMemberDict());
    }
    @ApiOperation("发送验证码")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.sendZSFamily)
    public MixEnvelop sendZSCaptcha(@ApiParam(name = "jsonData", value = "jsonData", required = false)
                                    @RequestParam(value = "jsonData", required = false) String jsonData) throws Exception {
        MixEnvelop mixEnvelop = new MixEnvelop();
        JSONObject obj = JSONObject.parseObject(jsonData);
        String client_id = obj.getString("client_id");
        String username = obj.getString("phoneNum");
        String idCard = obj.getString("idCard");
        String familyName = obj.getString("familyName");
        JSONArray jsonArray = entranceService.BS10008(idCard, familyName, username, null, null, null, true);
        if (StringUtils.isEmpty(client_id)) {
            mixEnvelop.setStatus(468);
            mixEnvelop.setMessage("client_id不能为空");
            return mixEnvelop;
        }
        if (StringUtils.isEmpty(username)) {
            mixEnvelop.setStatus(468);
            mixEnvelop.setMessage("username不能为空");
            return mixEnvelop;
        }
        if (username.length() > 12) {
            mixEnvelop.setStatus(468);
            mixEnvelop.setMessage("请输入正确的手机号");
            return mixEnvelop;
        }
        //验证请求间隔超时,防止频繁获取验证码
        if (!this.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
            //发送短信获取验证码
        }
        String captcha = this.getCodeNumber();
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            System.out.println("发送眼科验证码开始");
            ResultMsg result= null;
            if (jsonArray.size() > 0) {
                result = ykyySMSService.ykyySendSMS(username, "您好,您的此次操作的验证码是:" + captcha + ",2分钟内有效。");
                if (result.isSuccess()){
                    this.store(client_id, username, captcha, 120);
                    mixEnvelop.setMessage("验证码发送成功");
                } else {
                    mixEnvelop.setMessage("验证码发送失败");
                    mixEnvelop.setStatus(500);
                }
            }else {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
            }
        }else {
            System.out.println("发送中山验证码开始");
            int result = 1;
            if (jsonArray.size() > 0) {
                result = zhongShanSMSService.ZhongShangSendSMS(username, "您好,您当前操作的验证码是:" + captcha + ",2分钟内有效。");
            } else {
                result = 2;
            }
            if (0 == result) {
                this.store(client_id, username, captcha, 120);
                mixEnvelop.setMessage("验证码发送成功");
            } else if (2 == result) {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("您所添加的家属无就诊记录,无法发送验证码");
            } else {
                mixEnvelop.setMessage("验证码发送失败");
                mixEnvelop.setStatus(500);
            }
        }
        return mixEnvelop;
    }
    public void store(String client_id, String username, String code, int expire) {
        String key = client_id + ":" + username + KEY_SUFFIX;
        redisTemplate.opsForValue().set(key, code);
        redisTemplate.expire(key, expire, TimeUnit.SECONDS);
        String intervalKey = key + ":" + code + "_interval";
        redisTemplate.opsForValue().set(intervalKey, 60);
        redisTemplate.expire(intervalKey, 60, TimeUnit.SECONDS);
    }
    public boolean isIntervalTimeout(String client_id, String username) {
        String key = client_id + ":" + username + KEY_SUFFIX;
        String code = (String) redisTemplate.opsForValue().get(key);
        if (null == code) {
            return true;
        }
        String intervalKey = key + ":" + code + "_interval";
        if (redisTemplate.opsForValue().get(intervalKey) != null) {
            return false;
        }
        return true;
    }
    //生成6位随机数
    public String getCodeNumber() {
        return (int) ((Math.random() * 9 + 1) * 100000) + "";
    }
    //验证验证码
    public boolean verification(String client_id, String username, String code) {
        if (StringUtils.isEmpty(code)) {
            return false;
        }
        String key = client_id + ":" + username + KEY_SUFFIX;
        String _code = (String) redisTemplate.opsForValue().get(key);
        if (null == _code) {
            return false;
        }
        if (code.equalsIgnoreCase(_code)) {
            return true;
        }
        return false;
    }
    @ApiOperation("保存家人关系")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.saveFamilyRelation)
    public MixEnvelop saveFamilyRelation(@ApiParam(name = "jsonData", value = "jsonData", required = false)
                                         @RequestParam(value = "jsonData", required = false) String jsonData) {
        MixEnvelop mixEnvelop = new MixEnvelop();
        try {
            JSONObject jsonObject = JSONObject.parseObject(jsonData);
            String client_id = jsonObject.getString("client_id");
            String username = jsonObject.getString("phoneNum");
            String code = jsonObject.getString("code");
            boolean checkCode = this.verification(client_id, username, code);
            if (true) {
                String patientId = jsonObject.getString("patientId");
                String familyName = jsonObject.getString("familyName");
                String dictId = jsonObject.getString("dictId");
                String cardType = jsonObject.getString("cardType");
                String idCard = jsonObject.getString("idCard");
                String id = "";
                if (null != jsonObject.get("id")) {
                    id = jsonObject.get("id").toString();
                }
                ;
                mixEnvelop = wlyyFamilyMemberService.addFamily(id, patientId, familyName, dictId, cardType, idCard, username, true);
            } else {
                mixEnvelop.setStatus(408);
                mixEnvelop.setMessage("验证码不正确");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mixEnvelop;
    }
    @ApiOperation("查询就诊人")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.findFamilyMumber)
    public Envelop findFamilyMumberByPatientId(@ApiParam(name = "patientId", value = "patientId", required = false)
                                               @RequestParam(value = "patientId", required = false) String patientId) {
        List<Map<String, Object>> list = new ArrayList<>();
        try {
            list = wlyyFamilyMemberService.findFamilyByPatientId(patientId);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return success(list);
    }
    @ApiOperation("删除就诊人")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.delFamilyMumber)
    public Envelop delFamilyMumber(@ApiParam(name = "id", value = "id", required = false)
                                   @RequestParam(value = "id", required = false) String id) {
        return wlyyFamilyMemberService.delMember(id);
    }
    @ApiOperation("获取单个亲属信息")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.findSingleMember)
    public Envelop findSingleMember(@ApiParam(name = "id", value = "id", required = false)
                                    @RequestParam(value = "id", required = false) String id) throws ParseException {
        return success(wlyyFamilyMemberService.findMemberById(id));
    }
}

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

@ -16,13 +16,12 @@ import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionLogDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.PayInfoNoticeService;
import com.yihu.jw.hospital.prescription.service.PrescriptionExpressageService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
@ -45,7 +44,6 @@ import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.wechat.dao.WechatDao;
@ -61,6 +59,7 @@ import com.ylzinfo.onepay.sdk.utils.StringUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import org.apache.axis.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -148,6 +147,10 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private EntranceService entranceService;
    @Autowired
    private PayInfoNoticeService payInfoNoticeService;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    private String successxml = "SUCCESS";
@ -502,12 +505,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                        }
                    }
                    businessOrderService.updatePayStatus(traceNo);
                    response.getWriter().write("SUCCESS");
                    return "SUCCESS";
                }
            }
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
            e.printStackTrace();
        }
        return appId;
@ -561,7 +563,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        } catch (Exception e1) {
            logger.error("解密回调报文错误");
            response.getWriter().write("ERROR:" + e1.getMessage());
            return e1.getMessage();
        }
        OnepayClient payService = new OnepayClient("", appId, appSecret, res.getSignType(), res.getEncryptType());
@ -603,14 +605,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                        businessOrderService.updatePayStatus(outChargeNo);
                    }
                }
                response.getWriter().write("SUCCESS");
                return "SUCCESS";
            } else {
                response.getWriter().write("FAIL");
                return "FAIL";
            }
        } catch (Exception e) {
            error = e.getMessage();
            response.getWriter().write(e.getMessage());
            e.printStackTrace();
        }
        logService.saveHttpLog(isSuccess, "hop.trade.verifyResponseSign", "支付回调", "POST", null,JSON.toJSONString(responseParams), jsonObject, error,logService.shoppatType);
        return appId;
@ -802,7 +803,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @RequestMapping(value = "/ylzSettleRecord")
    public String ylzSettleRecord(HttpServletRequest request, HttpServletResponse response) throws Exception{
        response.setContentType("text/html;charset=utf-8");
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_balance_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
@ -812,7 +813,6 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        String params = StreamUtils.copyToString(inputStream, Charset.forName("UTF-8"));
        logger.info("回调参数:{}", params);
        if (StringUtil.isEmpty(params)) {
            response.getWriter().write("empty");
            return appId;
        }
        // 参数转换
@ -822,47 +822,92 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            logger.info("解密前:{}", JSON.toJSONString(encryptRes));
            ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
            logger.info("解密后:{}",JSON.toJSONString(decryptRes) );
            JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
            boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
            if (!isDecrypt) {
                response.getWriter().write("DECRYPT FAILURE");
            } else {
                boolean isVerify = client.verifyResponseSign(decryptRes);
                boolean isVerify = true;
                logger.info("验签结果:{}", isVerify);
                if (!isVerify) {
                    response.getWriter().write("FAILURE");
                } else {
                    JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
                    JSONObject param = jsonObject.getJSONObject("param");
                    logger.info("param"+params);
                    String cardNo = param.getString("cardNo");
                    String billSn =  param.getString("billSn");
                    String traceNo = param.getString("traceNo");
                    String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",billSn,traceNo,"1","10000");
                    JSONObject jsonObjectTotal = JSON.parseObject(result);
                    if (jsonObjectTotal.get("respCode").toString().equalsIgnoreCase("000000")){
                       JSONObject listParam =  JSON.parseObject(jsonObjectTotal.get("param").toString());
                       String bills = listParam.getString("bills");
                       String len = listParam.getString("len");
                       JSONObject billParam = JSON.parseObject(bills);
                       String drugState = billParam.getString("drugState");
                       String messageRemind = "您在中山医院医院内科就诊费用已支付成功!";
                       WaitPayDetailVO waitPayDetailVO = new WaitPayDetailVO();
                       if ("1".equalsIgnoreCase(drugState)){
                           messageRemind += "自取患者请于周一至周五上午8点到12点、下午2:30到5:30,到门诊药房9号或10号窗口凭相应的就诊卡或电子健康卡取药。";
                        }else {
                           messageRemind += "";
                       }
                        List<WaitPayDetailVO> listWPD = JSONObject.parseArray(billParam.getString("waitPayDetailVOs"),  WaitPayDetailVO.class);
                    if (param!=null){
                        JSONObject object = param.getJSONObject("externalMap");
                        String cardNo = object.getString("cardNo");
                        String traceNo = object.getString("traceNo");
                        String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",null,traceNo,"1","10000");
                        JSONObject jsonObjectTotal = JSONObject.parseObject(result);
                        logger.info("查询在线结算处方信息"+jsonObjectTotal);
                        if (jsonObjectTotal.getString("respCode").equalsIgnoreCase("000000")){
                            JSONObject listParam =  JSONObject.parseObject(jsonObjectTotal.getString("param"));
                            List<WaitPayDetailVO> listWPD = JSONObject.parseArray(listParam.getString("waitPayDetailVOs"),  WaitPayDetailVO.class);
                            if (listWPD!=null&&listWPD.size()!=0){
                                WaitPayDetailVO waitPayDetailVO = listWPD.get(0);
                                String voucherNo = waitPayDetailVO.getVoucherNo();
                                List<WlyyPrescriptionDO> prescriptionDOList = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                for (WlyyPrescriptionDO prescriptionDO:prescriptionDOList){
                                    String patient = prescriptionDO.getPatientCode();
                                    if (prescriptionDO.getStatus()!=30){
                                        String pushPayLog = payInfoNoticeService.pushPrescriptionPay(prescriptionDO.getPatientCode(),prescriptionDO.getDoctorName(),voucherNo,prescriptionDO.getOutpatientId(),prescriptionDO.getId(),prescriptionDO.getDrugFee().toString());
                                        WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
                                        prescriptionLogDO.setCreateTime(new Date());
                                        prescriptionLogDO.setStatus(30);
                                        prescriptionLogDO.setOutpatientId(prescriptionDO.getOutpatientId());
                                        prescriptionLogDO.setPrescriptionCode(prescriptionDO.getId());
                                        prescriptionLogDO.setUserCode(prescriptionDO.getPatientCode());
                                        prescriptionLogDO.setUserName(prescriptionDO.getPatientName());
                                        prescriptionLogDO.setUserType(1);
                                        prescriptionLogDO.setDatajson("处方结算");
                                        prescriptionLogDao.save(prescriptionLogDO);
                                        logger.info("处方结算成功"+pushPayLog+"====="+waitPayDetailVO.getRecipeNo());
                                    }
                                }
                            }
                            for (WaitPayDetailVO waitPayDetailVO:listWPD){
                                if (waitPayDetailVO.getItemName().equalsIgnoreCase("互联网医院复诊诊查费")){
                                   List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByRealOrderList(waitPayDetailVO.getRecipeNo());
                                   if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                                       WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                                       outpatientDao.updateHisStatusById(wlyyPrescriptionDO.getOutpatientId(),1);
                                       logger.info("更新门诊结算状态");
                                   }
                                }
                                prescriptionDao.updateStatusByRealOrder(waitPayDetailVO.getRecipeNo(),30,new Date());
                            }
                            logger.info("更新系统处方支付状态");
                        }
                    }
                    response.getWriter().write("SUCCESS");
                    return "SUCCESS";
                }
            }
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
            e.printStackTrace();
        }
        return appId;
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findHisPatientInfo)
    @ApiOperation(value = "查询his门诊病人基本信息")
    public Envelop findHisPatientInfo(@ApiParam(name = "idcard", value = "idcard", required = false)
                                      @RequestParam(value = "idcard", required = false)String idcard,
                                      @ApiParam(name = "patientName", value = "patientName", required = false)
                                      @RequestParam(value = "patientName", required = false)String patientName,
                                      @ApiParam(name = "phoneNum", value = "phoneNum", required = false)
                                      @RequestParam(value = "phoneNum", required = false)String phoneNum,
                                      @ApiParam(name = "patientId", value = "patientId", required = false)
                                      @RequestParam(value = "patientId", required = false)String patientId,
                                      @ApiParam(name = "admitNum", value = "admitNum", required = false)
                                      @RequestParam(value = "admitNum", required = false)String admitNum,
                                      @ApiParam(name = "ybcard", value = "ybcard", required = false)
                                      @RequestParam(value = "ybcard", required = false)String ybcard,
                                      @ApiParam(name = "demoFlag", value = "是否demo", required = false)
                                      @RequestParam(value = "demoFlag", required = false)boolean demoFlag) throws Exception{
        JSONArray result = entranceService.BS10008(idcard,patientName,phoneNum,patientId,admitNum,ybcard,false);
        logger.info(result.toString());
        return success("操作成功",result.toString());
    }
}

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

@ -410,8 +410,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    public ListEnvelop getDrugFrequency()throws Exception {
        return success(prescriptionService.getDrugFrequency());
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.deletePrescriptionByid)
    @ApiOperation(value = "删除处方草稿", notes = "删除处方草稿")
    public Envelop deletePrescription(@ApiParam(name = "id", value = "处方id")
                                              @RequestParam(value = "id", required = true)String id)throws Exception {
        return success(prescriptionService.deletePrescription(id));
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.makeDiagnosis)
    @ApiOperation(value = "下诊断", notes = "下诊断接口")

+ 14 - 14
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/BasePatientBusinessService.java

@ -57,7 +57,7 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
	 * @param status
	 * @return
	 */
	public KnowledgeArticleUserDO setCollectionById(String id,Integer flag,Integer status,String user,String userType){
	public KnowledgeArticleDO setCollectionById(String id,Integer flag,Integer status,String user,String userType){
		KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleDao.findByIdAndDel(id);
		KnowledgeArticleUserDO knowledgeArticleUserDO =knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(id,user);
		if (knowledgeArticleUserDO==null){
@ -96,15 +96,15 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
					if (knowledgeArticleDO.getCollection()!=null){
						if (status==1){
							knowledgeArticleDO.setCollection(knowledgeArticleDO.getCollection()+1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO = knowledgeArticleDao.save(knowledgeArticleDO);
						}else {
							knowledgeArticleDO.setCollection(knowledgeArticleDO.getCollection()-1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO =knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}else {
						if (status==1){
							knowledgeArticleDO.setCollection(1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO=	knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}
				}
@ -115,15 +115,15 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
					if (knowledgeArticleDO.getReadCount()!=null){
						if (status==1){
							knowledgeArticleDO.setReadCount(knowledgeArticleDO.getReadCount()+1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO = knowledgeArticleDao.save(knowledgeArticleDO);
						}else {
							knowledgeArticleDO.setReadCount(knowledgeArticleDO.getReadCount()-1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO = knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}else {
						if (status==1){
							knowledgeArticleDO.setReadCount(1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO = knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}
				}
@ -134,15 +134,15 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
					if (knowledgeArticleDO.getFabulous()!=null){
						if (status==1){
							knowledgeArticleDO.setFabulous(knowledgeArticleDO.getFabulous()+1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO=knowledgeArticleDao.save(knowledgeArticleDO);
						}else {
							knowledgeArticleDO.setFabulous(knowledgeArticleDO.getFabulous()-1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO = knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}else {
						if (status==1){
							knowledgeArticleDO.setFabulous(1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO= knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}
				}
@ -153,21 +153,21 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
					if (knowledgeArticleDO.getShare()!=null){
						if (status==1){
							knowledgeArticleDO.setShare(knowledgeArticleDO.getShare()+1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO = knowledgeArticleDao.save(knowledgeArticleDO);
						}else {
							knowledgeArticleDO.setShare(knowledgeArticleDO.getShare()-1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO = knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}else {
						if (status==1){
							knowledgeArticleDO.setShare(1);
							knowledgeArticleDao.save(knowledgeArticleDO);
							knowledgeArticleDO = knowledgeArticleDao.save(knowledgeArticleDO);
						}
					}
				}
			}
		}
		return knowledgeArticleUserDO;
		return knowledgeArticleDO;
	}
	public void setUsed(String id,Integer used,String doctor){
		WlyySurveyTemplateDO wlyySurveyTemplateDO = surveyTemplateDao.findOne(id);

+ 32 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java

@ -19,7 +19,10 @@ import com.yihu.jw.hospital.survey.dao.SurveyTemplateDao;
import com.yihu.jw.hospital.survey.dao.SurveyUserDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientBusinessDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -57,6 +60,8 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
	private SurveyUserDao surveyUserDao;
	@Autowired
	private SurveyTemplateDao surveyTemplateDao;
	@Autowired
    private HibenateUtils hibenateUtils;
	
	/**
	 * 删除,支持批量
@ -327,8 +332,33 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
	public KnowledgeArticleDO selectById(String id){
		return knowledgeArticleDao.findByIdAndDel(id);
	}
	//根据分类查询文章
	public MixEnvelop findArticleByCategoryAndName(String categoryFirst, String categorySecond, String keyWords, Integer page, Integer pageSize){
		MixEnvelop objEnvelop = new MixEnvelop();
		String sql = "select t.id as \"id\",t.title as \"title\",t.read_count as \"readCount\"," +
				"t.collection as \"collection\",t.fabulous as \"fabulous\",t.is_share as \"share\"," +
                " t.intro as \"intro\",t.category_first_name as \"categoryFirstName\"," +
                " t.category_second_name as \"categorySecondName\" ," +
                "t.content as \"content\",t.image as \"image\",t.create_user_name as \"createUserName\",c.job_title_name as \"jobTitleName\"," +
                "b.dept_name as \"deptName\",b.org_name as \"hospitalName\" from wlyy_knowledge_article t left join wlyy_knowledge_article_dept a " +
                " on a.article_id = t.id left join base_doctor_hospital b on b.doctor_code = t.create_user" +
				" left join base_doctor c on c.id = t.create_user where 1=1 and t.del = 1";
		if (StringUtils.isNotBlank(categoryFirst)&&StringUtils.isNotBlank(categorySecond)){
		    sql+=" and t.category_first = '"+categoryFirst+"' and t.category_second ='"+categorySecond+"'";
        }
        if (StringUtils.isNotBlank(keyWords)){
            sql+=" and (t.create_user_name like '%"+keyWords+"%' or t.title like '%"+keyWords+"%' or t.content like '%"+keyWords+"%' or a.dept_name like '%"+keyWords+"%' )";
        }
		sql+=" group by t.id ,t.title ,t.intro,t.category_first_name ,t.category_second_name ,c.job_title_name," +
				"t.read_count,t.collection,t.fabulous,t.is_share,t.content ,t.image ,t.create_user_name ,b.dept_name ,b.org_name order by t.create_time desc";
        List<Map<String,Object>> result = hibenateUtils.createSQLQuery(sql,page,pageSize);
        List<Map<String,Object>> countList = hibenateUtils.createSQLQuery(sql);
        objEnvelop.setObj(result);
        objEnvelop.setTotalCount(countList.size());
        objEnvelop.setPageSize(pageSize);
        objEnvelop.setCurrPage(page);
        return objEnvelop;
	}
}

+ 21 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeCategoryService.java

@ -5,6 +5,8 @@ import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeCategoryDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -14,6 +16,7 @@ import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
@ -29,7 +32,8 @@ public class KnowledgeCategoryService extends BaseJpaService<KnowledgeCategoryDO
	
	@Autowired
	private ObjectMapper objectMapper;
	
	@Autowired
	private HibenateUtils hibenateUtils;
	public KnowledgeCategoryDO saveCategory(String jsonData) throws Exception {
		jsonData = URLDecoder.decode(jsonData,"utf-8");
		KnowledgeCategoryDO knowledgeCategoryDO = objectMapper.readValue(jsonData, KnowledgeCategoryDO.class);
@ -58,4 +62,20 @@ public class KnowledgeCategoryService extends BaseJpaService<KnowledgeCategoryDO
		knowledgeCategoryDao.updateDel(code);
		return true;
	}
	public MixEnvelop findAllGroup(){
		String sqlPid = "select id as \"id\",name as \"name\",pid as \"pid\" from wlyy_knowledge_category  where pid = '0' and del = 1";
		List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sqlPid);
		String child = "select id as \"id\",name as \"name\",pid as \"pid\" from wlyy_knowledge_category  where del = 1";
		if (list.size()>0){
			for (Map<String,Object> map:list){
				String pid = map.get("id").toString();
				child+=" and pid = '"+pid+"'";
				List<Map<String,Object>> childList = hibenateUtils.createSQLQuery(child);
				map.put("childList",childList);
			}
		}
		MixEnvelop envelop = new MixEnvelop();
		envelop.setDetailModelList(list);
		return envelop;
	}
}

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

@ -218,7 +218,9 @@ es:
  host:  http://172.26.0.55:9200
  tHost: 172.26.0.55:9300
  clusterName: jkzl
  securityUser: elastic:changeme
  securityUser: lion:jkzlehr
  user: lion
  password: jkzlehr
# 上传文件临时路径配置
FileTempPath:

+ 6 - 0
svr/svr-iot/pom.xml

@ -66,6 +66,12 @@
            <version>3.15-beta1</version>
        </dependency>
        <dependency>
            <groupId>com.auth0</groupId>
            <artifactId>java-jwt</artifactId>
            <version>3.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>

+ 13 - 0
svr/svr-iot/src/main/java/com/yihu/iot/config/MvcConfig.java

@ -1,10 +1,13 @@
package com.yihu.iot.config;
import com.yihu.iot.interceptor.CrosXssFilter;
import com.yihu.iot.interceptor.GateWayInterceptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@ -31,4 +34,14 @@ public class MvcConfig extends WebMvcConfigurerAdapter {
        super.addInterceptors(registry);
        logger.info("init gateWayInterceptor");
    }
    @Bean
    public FilterRegistrationBean testFilterRegistration() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(new CrosXssFilter());
        registration.addUrlPatterns("/*");
        registration.setName("CrosXssFilter");
        registration.setOrder(1);
        return registration;
    }
}

+ 15 - 16
svr/svr-iot/src/main/java/com/yihu/iot/controller/common/BaseController.java

@ -1,7 +1,6 @@
package com.yihu.iot.controller.common;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -515,19 +514,19 @@ public class BaseController {
	 * 获取被代理人code,若没有则返回当前登录者
	 * @return
	 */
	public String getRepUID(){
		try {
			String userAgent = request.getHeader("userAgent");
			if (StringUtils.isEmpty(userAgent)) {
				userAgent = request.getHeader("User-Agent");
			}
			JSONObject json = new JSONObject(userAgent);
			if(json.isNull("represented")){
				return json.getString("uid");
			}
			return json.getString("represented");
		} catch (Exception e) {
			return null;
		}
	}
//	public String getRepUID(){
//		try {
//			String userAgent = request.getHeader("userAgent");
//			if (StringUtils.isEmpty(userAgent)) {
//				userAgent = request.getHeader("User-Agent");
//			}
//			JSONObject json = new JSONObject(userAgent);
//			if(json.isNull("represented")){
//				return json.getString("uid");
//			}
//			return json.getString("represented");
//		} catch (Exception e) {
//			return null;
//		}
//	}
}

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.java

@ -143,7 +143,7 @@ public class MonitorPlatformController extends EnvelopRestEndpoint {
    @RequestMapping(value = "/smartDeviceDistribution",method = RequestMethod.GET)
    @ApiOperation("智能设备发放")
    public MixEnvelop smartDeviceDistribution(@ApiParam(name="startTime",value="开始时间",defaultValue = "")
                                                  @RequestParam(value="startTime",required = false) String startTime,
                                              @RequestParam(value="startTime",required = false) String startTime,
                                              @ApiParam(name="endTime",value="结束时间",defaultValue = "")
                                                  @RequestParam(value="endTime",required = false) String endTime,
                                              @ApiParam(name="deviceType",value="设备类型",defaultValue = "")

+ 38 - 0
svr/svr-iot/src/main/java/com/yihu/iot/interceptor/CrosXssFilter.java

@ -0,0 +1,38 @@
package com.yihu.iot.interceptor;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
/**
 * Created by yeshijie on 2020/9/2.
 */
//@WebFilter(filterName = "CrosXssFilter", urlPatterns = { "/*" })
public class CrosXssFilter implements Filter {
    private static final Logger logger = LoggerFactory.getLogger(CrosXssFilter.class);
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
    }
    @Override
    public void doFilter(ServletRequest request, ServletResponse response,
                         FilterChain chain) throws IOException, ServletException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        //sql,xss过滤
        HttpServletRequest httpServletRequest=(HttpServletRequest)request;
        logger.info("CrosXssFilter.......orignal url:{},ParameterMap:{}",httpServletRequest.getRequestURI(), JSONObject.toJSONString(httpServletRequest.getParameterMap()));
        XssHttpServletRequestWrapper xssHttpServletRequestWrapper=new XssHttpServletRequestWrapper(
                httpServletRequest);
        chain.doFilter(xssHttpServletRequestWrapper, response);
        logger.info("CrosXssFilter..........doFilter url:{},ParameterMap:{}",xssHttpServletRequestWrapper.getRequestURI(), JSONObject.toJSONString(xssHttpServletRequestWrapper.getParameterMap()));
    }
    @Override
    public void destroy() {
    }
}

+ 119 - 0
svr/svr-iot/src/main/java/com/yihu/iot/interceptor/XssHttpServletRequestWrapper.java

@ -0,0 +1,119 @@
package com.yihu.iot.interceptor;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
/**
 * Created by yeshijie on 2020/9/1.
 */
public class XssHttpServletRequestWrapper extends HttpServletRequestWrapper {
    private final Logger log = LoggerFactory.getLogger(getClass());
    private static String key = "select|update|and|or|delete|insert|trancate|char|into|substr|ascii|declare|exec|count|master|into|drop|execute|*|%";
    private static Set<String> notAllowedKeyWords = new HashSet<String>(0);
    private static String replacedString="INVALID";
    static {
        String keyStr[] = key.split("\\|");
        for (String str : keyStr) {
            notAllowedKeyWords.add(str);
        }
    }
    private String currentUrl;
    public XssHttpServletRequestWrapper(HttpServletRequest servletRequest) {
        super(servletRequest);
        currentUrl = servletRequest.getRequestURI();
    }
    /**覆盖getParameter方法,将参数名和参数值都做xss过滤。
     * 如果需要获得原始的值,则通过super.getParameterValues(name)来获取
     * getParameterNames,getParameterValues和getParameterMap也可能需要覆盖
     */
    @Override
    public String getParameter(String parameter) {
        String value = super.getParameter(parameter);
        if (value == null) {
            return null;
        }
        return cleanXSS(value);
    }
    @Override
    public String[] getParameterValues(String parameter) {
        String[] values = super.getParameterValues(parameter);
        if (values == null) {
            return null;
        }
        int count = values.length;
        String[] encodedValues = new String[count];
        for (int i = 0; i < count; i++) {
            encodedValues[i] = cleanXSS(values[i]);
        }
        return encodedValues;
    }
    @Override
    public Map<String, String[]> getParameterMap(){
        Map<String, String[]> values=super.getParameterMap();
        if (values == null) {
            return null;
        }
        Map<String, String[]> result=new HashMap<>();
        for(String key:values.keySet()){
            String encodedKey=cleanXSS(key);
            int count=values.get(key).length;
            String[] encodedValues = new String[count];
            for (int i = 0; i < count; i++){
                encodedValues[i]=cleanXSS(values.get(key)[i]);
            }
            result.put(encodedKey,encodedValues);
        }
        return result;
    }
    /**
     * 覆盖getHeader方法,将参数名和参数值都做xss过滤。
     * 如果需要获得原始的值,则通过super.getHeaders(name)来获取
     * getHeaderNames 也可能需要覆盖
     */
    @Override
    public String getHeader(String name) {
        String value = super.getHeader(name);
        if (value == null) {
            return null;
        }
        return cleanXSS(value);
    }
    private String cleanXSS(String valueP) {
        // You'll need to remove the spaces from the html entities below
        String value = valueP.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
        value = value.replaceAll("<", "& lt;").replaceAll(">", "& gt;");
        value = value.replaceAll("\\(", "& #40;").replaceAll("\\)", "& #41;");
        value = value.replaceAll("'", "& #39;");
        value = value.replaceAll("eval\\((.*)\\)", "");
        value = value.replaceAll("[\\\"\\\'][\\s]*javascript:(.*)[\\\"\\\']", "\"\"");
        value = value.replaceAll("script", "");
        value = cleanSqlKeyWords(value);
        return value;
    }
    private String cleanSqlKeyWords(String value) {
        String paramValue = value;
        for (String keyword : notAllowedKeyWords) {
            if (paramValue.length() > keyword.length() + 4
                    && (paramValue.contains(" "+keyword)||paramValue.contains(keyword+" ")||paramValue.contains(" "+keyword+" "))) {
                paramValue = StringUtils.replace(paramValue, keyword, replacedString);
                log.error(this.currentUrl + "已被过滤,因为参数中包含不允许sql的关键词(" + keyword
                        + ")"+";参数:"+value+";过滤后的参数:"+paramValue);
            }
        }
        return paramValue;
    }
}

+ 75 - 0
svr/svr-iot/src/main/java/com/yihu/iot/util/jwt/JwtUtil.java

@ -0,0 +1,75 @@
package com.yihu.iot.util.jwt;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTCreator;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.Claim;
import com.auth0.jwt.interfaces.DecodedJWT;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by yeshijie on 2020/9/2.
 */
public class JwtUtil {
    private static final String SECRET = "9a96349e2345_*#%4e0f4254dee";
    private static String ISSUER = "sys_user";
    /**
     * 生成token
     * @param claims
     * @param expireDatePoint  过期时间点
     * @return
     */
    public static String genToken(Map<String, String> claims, Date expireDatePoint){
        try {
            //使用HMAC256进行加密
            Algorithm algorithm = Algorithm.HMAC256(SECRET);
            //创建jwt
            JWTCreator.Builder builder = JWT.create().
                    withIssuer(ISSUER). //发行人
                    withExpiresAt(expireDatePoint); //过期时间点
            //传入参数
            claims.forEach((key,value)-> {
                builder.withClaim(key, value);
            });
            //签名加密
            return builder.sign(algorithm);
        } catch (IllegalArgumentException | UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }
    /**
     * 解密jwt
     * @param token
     * @return
     * @throws RuntimeException
     */
    public static Map<String,String> verifyToken(String token) throws RuntimeException{
        Algorithm algorithm = null;
        try {
            //使用HMAC256进行加密
            algorithm = Algorithm.HMAC256(SECRET);
        } catch (IllegalArgumentException | UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        //解密
        JWTVerifier verifier = JWT.require(algorithm).withIssuer(ISSUER).build();
        DecodedJWT jwt =  verifier.verify(token);
        Map<String, Claim> map = jwt.getClaims();
        Map<String, String> resultMap = new HashMap<>();
        map.forEach((k,v) -> resultMap.put(k, v.asString()));
        return resultMap;
    }
}

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

@ -1,6 +1,6 @@
spring:
  application:
    name:  svr-iot
    name:  svr-iot-lb
  cloud:
    config:
      failFast: true

+ 28 - 1
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/CreditsDetailController.java

@ -61,7 +61,34 @@ public class CreditsDetailController extends EnvelopRestEndpoint {
            return MixEnvelop.getError(e.getMessage());
        }
    }
    /**
     * 查看积分记录  带排序
     *
     * @param creditsDetail 积分对象
     * @param orderType  排序类型:0默认排序;1扣分排序;2加分排序
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.findCreditsLogInfoWithOrder)
    @ApiOperation(value = "查看积分记录,带排序")
    public MixEnvelop<CreditsDetailDO, CreditsDetailDO> selectCreditsLogInfoWithOeder(@ApiParam(name = "creditsDetail",value = "积分记录JSON")
                                                                             @RequestParam(value = "creditsDetail",required = false)String creditsDetail,
                                                                             @ApiParam(name = "orderType",defaultValue = "0",value = "排序类型:0默认排序;1扣分排序;2加分排序")
                                                                             @RequestParam(value = "orderType", required = false)Integer orderType,
                                                                             @ApiParam(name = "page", value = "第几页,从1开始")
                                                                             @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                                                             @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                                                             @RequestParam(value = "size", required = false)Integer size){
        try{
            CreditsDetailDO creditsDetailDO = toEntity(creditsDetail,CreditsDetailDO.class);
            return service.findByConditionWithOrder(creditsDetailDO,orderType,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
        }
    }
    /**

+ 117 - 4
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java

@ -16,14 +16,19 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.persistence.Column;
import javax.persistence.Table;
import javax.print.DocFlavor;
import javax.transaction.Transactional;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -64,6 +69,8 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
    private ExchangeGoodsDao exchangeGoodsDao;
    @Autowired
    private TaskGoodsDao taskGoodsDao;
    @Value("${account.initPassword}")
    private String initPassword;
   /**
     *  find creditsLogInfo
@ -93,6 +100,112 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
        }
        return MixEnvelop.getSuccessListWithPage(HealthBankMapping.api_success, creditsDetailDOS,page,size,count);
    }
    /**
     *  find creditsLogInfo
     *  带排序
     * @return
     * @throws ParseException
     */
    public MixEnvelop<CreditsDetailDO, CreditsDetailDO> findByConditionWithOrder(CreditsDetailDO creditsDetailDO, Integer orderType, Integer page, Integer size) throws ParseException {
        String sql = getCreditsLogInSqlWithOrder(creditsDetailDO,page,size,"*",orderType);
        List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(CreditsDetailDO.class));
        for (CreditsDetailDO creditsDetailDO1 : creditsDetailDOS){
            if (creditsDetailDO1.getTradeType() != null && creditsDetailDO1.getTradeType().equalsIgnoreCase("ACTIVITY_TASK")){
                TaskDO taskDO = taskDao.findOne(creditsDetailDO1.getTransactionId());
                creditsDetailDO1.setTaskDO(taskDO);
            }else if (creditsDetailDO1.getTradeType()!=null&&creditsDetailDO1.getTradeType().equals("EXCHANGE_GOODS")){
                ExchangeGoodsDO exchangeGoodsDO =exchangeGoodsDao.findOne(creditsDetailDO1.getTransactionId());
                TaskGoodsDO taskGoodsDO = taskGoodsDao.selectById(exchangeGoodsDO.getActivityGoodsId());
                exchangeGoodsDO.setTaskGoodsDO(taskGoodsDO);
                creditsDetailDO1.setExchangeGoodsDO(exchangeGoodsDO);
            }
        }
        String sqlcount = getCreditsLogInSqlWithOrder(creditsDetailDO,0,0,"count",orderType);
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return MixEnvelop.getSuccessListWithPage(HealthBankMapping.api_success, creditsDetailDOS,page,size,count);
    }
    public  String getCreditsLogInSqlWithOrder(Object object,Integer page,Integer size,String isFlag,Integer orderType){
        StringBuffer sb = new StringBuffer();
        Class c =object.getClass();
        Table table = (Table)c.getAnnotation(Table.class);
        String tableName = table.name();
        if (isFlag.equalsIgnoreCase("count")){
            sb.append("select count(1) AS total from ").append(tableName).append(" where 1=1 and status=1 ");
        }else if(isFlag.equalsIgnoreCase("*")){
            sb.append("select * from ").append(tableName).append(" where 1=1 and status=1 ");
        }
        JSONObject object1  = (JSONObject) JSONObject.toJSON(object);
        if (object1.getString("id") !=null){
            sb.append(" and id = '" + object1.getString("id")+"' ");
        }
        Field[] fArray= c.getDeclaredFields();
        for(Field f:fArray){
            //拿到字段后与实体类中的属性匹配,并得到其get方法,用来获取他的属性值
            String getMethodName ="";
            boolean isCExist =f.isAnnotationPresent(Column.class);
            if(isCExist){
                Column mc =f.getAnnotation(Column.class);
                String columeName =mc.name();  //字段对应数据库名字
                String name =f.getName();       //字段名字
                Class a= f.getType();          //字段类型
                Object value=null;              //字段值
                getMethodName="get"+name.substring(0,1).toUpperCase()+name.substring(1);//拼接属性的get方法
                try {
                    Method m =c.getMethod(getMethodName);
                    value =(Object)m.invoke(object);     //拿到属性的值
                    if(value == null || "".equals(value)){  //如果属性没值,不拼接sql
                        continue;
                    }
                    else if(value instanceof String){
                        value ="'%"+value+"%'";
                        sb.append(" and ").append(columeName +" like " ).append(value+"");
                    }else if (value instanceof Integer){
                        value = value;
                        sb.append(" and ").append(columeName +" = " ).append(value+"");
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        JSONObject jsonObject = (JSONObject) JSONObject.toJSON(object);
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date1 = jsonObject.getDate("startTime");
        Date date2 = jsonObject.getDate("endTime");
        String startTime = null;
        String endTime = null;
        if (date1 != null){
            startTime = sdf.format(date1);
        }
        if (date2 != null) {
            endTime = sdf.format(date2);
        }
        if (org.apache.commons.lang3.StringUtils.isNoneBlank(startTime)&& org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)){
            sb.append(" and start_time >= '"+startTime+"' and end_time <='"+endTime+"'");
        } else if (org.apache.commons.lang3.StringUtils.isNoneBlank(startTime)&&!org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)) {
            sb.append(" and start_time >= '"+startTime+"'");
        }else if (org.apache.commons.lang3.StringUtils.isNoneBlank(endTime)&&!org.apache.commons.lang3.StringUtils.isNoneBlank(startTime)){
            sb.append(" and end_time <= '"+endTime+"'");
        }
        if(isFlag.equalsIgnoreCase("*")){
            if(orderType==0){
                sb.append(" ORDER BY create_time DESC ").append("LIMIT ").append((page-1)*size+",").append(size);
            }
            else if(orderType==1){
                sb.append(" ORDER BY trade_direction ASC,create_time DESC ").append("LIMIT ").append((page-1)*size+",").append(size);
            }
            else if(orderType==2){
                sb.append(" ORDER BY trade_direction DESC,create_time DESC ").append("LIMIT ").append((page-1)*size+",").append(size);
            }
        }
        return sb.toString();
    }
    /**
@ -115,7 +228,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                accountDO1.setCardNumber(cardNumber+Integer.toString(random));
            }
            accountDO1.setHospital(creditsDetailDO.getHospital());
            accountDO1.setPassword("123456");
            accountDO1.setPassword(initPassword);
            accountDO1.setHospitalName(creditsDetailDO.getHospitalName());
            accountDO1.setStatus(1);
            accountDO1.setSaasId("dev");
@ -249,7 +362,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                        accountDO1.setCardNumber(cardNumber+Integer.toString(random));
                    }
                    accountDO1.setHospital(creditsDetailDO.getHospital());
                    accountDO1.setPassword("123456");
                    accountDO1.setPassword(initPassword);
                    accountDO1.setHospitalName(creditsDetailDO.getHospitalName());
                    accountDO1.setStatus(1);
                    accountDO1.setCreateTime(new Date());
@ -793,7 +906,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                        accountDO1.setCardNumber(cardNumber+Integer.toString(random));
                    }
                    accountDO1.setHospital(creditsDetailDO.getHospital());
                    accountDO1.setPassword("123456");
                    accountDO1.setPassword(initPassword);
                    accountDO1.setHospitalName(creditsDetailDO.getHospitalName());
                    accountDO1.setStatus(1);
                    accountDO1.setCreateTime(new Date());
@ -1009,7 +1122,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                int random = (int)((Math.random()*9+1)*100000);
                accountDO.setCardNumber(cardNumber+Integer.toString(random));
            }
            accountDO.setPassword("123456");
            accountDO.setPassword(initPassword);
            accountDO.setSaasId("dev");
            accountDO.setStatus(1);
            accountDO.setCreateTime(new Date());

+ 2 - 1
svr/svr-wlyy-health-bank/src/main/resources/application.yml

@ -48,7 +48,8 @@ fast-dfs:
    init-size: 5
    max-size: 20
    wait-time: 500
account:
  initPassword: 123456
---
spring:
  profiles: jwdev

+ 7 - 4
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java

@ -93,7 +93,7 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
    @GetMapping(value = SpecialistMapping.rehabilitation.findTemplateDetailByTemplateId)
    @ApiOperation(value = "获取康复服务套餐模板明细")
    public ListEnvelop findTemplateDetailByTemplateId(@ApiParam(name = "templateId", value = "模板id")
                                                                                      @RequestParam(value = "templateId", required = true)String templateId){
                                                      @RequestParam(value = "templateId", required = true)String templateId){
        try {
            return rehabilitationPlanService.findTemplateDetailByTemplateId(templateId);
        }catch (Exception e){
@ -138,9 +138,6 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
                                                                       @RequestParam(value = "rehabilitationPlan", required = true)String rehabilitationPlan){
        try {
            JSONObject json = new JSONObject(rehabilitationPlan);
            if(json.has("totalExpense")) {
                json.put("totalExpense", DataUtils.doubleToInt(json.getDouble("totalExpense")));
            }
            JSONArray array = new JSONArray();
            for(Object planDetail : json.getJSONArray("detail")) {
                JSONObject j = (JSONObject)planDetail;
@ -379,6 +376,12 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
            JSONArray array = new JSONArray();
            for(Object planDetail : json.getJSONArray("detail")) {
                JSONObject j = (JSONObject)planDetail;
                String expense = j.getString("expense");
                if(expense.contains(".")){
                    int pointIndex = expense.indexOf(".");
                    expense = expense.substring(0,pointIndex);
                }
                j.put("expense",expense);
                if(j.has("executeTime")) {
                    String executeTime = j.get("executeTime").toString();
                    String[] result = null;

+ 0 - 74
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/FileUploadService.java

@ -1,25 +1,7 @@
package com.yihu.jw.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
/**
 * @author zhangdan on 2018/08/22.
@ -31,61 +13,5 @@ public class FileUploadService{
    private String neiwangWlyy;  //内网的项目地址
    /**
     * 通用的文件上传
     * @param request
     * @param in
     * @param fileName
     * @return
     */
    public UploadVO request(HttpServletRequest request, InputStream in, String fileName) {
        String url = neiwangWlyy + "/fileUpload/commonUpload";//uri请求路径 http://172.19.103.88/wlyy/upload/chat
        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
        String result = "";
        UploadVO uploadVO = null;
        try {
            HttpPost httpPost = new HttpPost(url);
            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
            builder.addBinaryBody("file", in, ContentType.MULTIPART_FORM_DATA, fileName);// 文件流
            builder.addTextBody("filename", fileName);// 类似浏览器表单提交,对应input的name和value
            if (!org.springframework.util.StringUtils.isEmpty(request.getParameter("type"))) {
                builder.addTextBody("type", request.getParameter("type")); //发送类型
            }
            HttpEntity entity = builder.build();
            httpPost.setEntity(entity);
            HttpResponse response = httpClient.execute(httpPost);// 执行提交
            HttpEntity responseEntity = response.getEntity();
            if (responseEntity != null) {
                // 将响应内容转换为字符串
                result = EntityUtils.toString(responseEntity, Charset.forName("UTF-8"));
            }
            JSONObject jsonObject = JSONObject.parseObject(result);
            if(jsonObject.getInteger("status")==200){
                JSONObject obj = jsonObject.getJSONObject("obj");
                uploadVO = new UploadVO();
                uploadVO.setFileName(obj.getString("groupName"));
                uploadVO.setFileType(obj.getString("remoteFileName"));
                uploadVO.setFullUri(obj.getString("fileId"));
                uploadVO.setFullUrl(obj.getString("fileUrl"));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                httpClient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return uploadVO;
    }
}

+ 53 - 47
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java

@ -378,57 +378,63 @@ public class RehabilitationManageService {
                m = map.get(executeTime);
                Map<String,Integer> family = null;
                Map<String,Integer> specialist = null;
                if((Integer)one.get("type")==1){//家庭医生
                    if(m.containsKey("family")){
                        family = (Map<String,Integer>)m.get("family");
                    }else{
                        family = new HashMap<>();
                        family.put("all",0);
                        family.put("finish",0);
                    }
                    if((Integer)one.get("status")==1){
                        family.put("finish",family.get("finish")+1);
                    }
                    family.put("all",family.get("all")+1);
                    m.put("family",family);
                }else if((Integer)one.get("type")==2){//专科医生
                if(one.get("type")!=null){
                    if((Integer)one.get("type")==1){//家庭医生
                        if(m.containsKey("family")){
                            family = (Map<String,Integer>)m.get("family");
                        }else{
                            family = new HashMap<>();
                            family.put("all",0);
                            family.put("finish",0);
                        }
                        if((Integer)one.get("status")==1){
                            family.put("finish",family.get("finish")+1);
                        }
                        family.put("all",family.get("all")+1);
                        m.put("family",family);
                    }else if((Integer)one.get("type")==2){//专科医生
                    if(m.containsKey("specialist")){
                        if(m.containsKey("specialist")){
                        specialist = (Map<String,Integer>)m.get("specialist");
                    }else{
                        specialist = new HashMap<>();
                        specialist.put("all",0);
                        specialist.put("finish",0);
                    }
                    if((Integer)one.get("status")==1){
                        specialist.put("finish",(specialist.get("finish"))+1);
                            specialist = (Map<String,Integer>)m.get("specialist");
                        }else{
                            specialist = new HashMap<>();
                            specialist.put("all",0);
                            specialist.put("finish",0);
                        }
                        if((Integer)one.get("status")==1){
                            specialist.put("finish",(specialist.get("finish"))+1);
                        }
                        specialist.put("all",(specialist.get("all"))+1);
                        m.put("specialist",specialist);
                    }
                    specialist.put("all",(specialist.get("all"))+1);
                    m.put("specialist",specialist);
                }
            }else{
                m = new HashMap<>();
//                m.put("specialist",new HashMap<String,Object>());
                if((Integer)one.get("type")==1){//家庭医生
                    Map<String,Integer> family = new HashMap<>();
                    family.put("all",0);
                    family.put("finish",0);
                    if((Integer)one.get("status")==1){
                        family.put("finish",family.get("finish")+1);
                    }
                    family.put("all",family.get("all")+1);
                    m.put("family",family);
                }else if((Integer)one.get("type")==2){//专科医生
                    Map<String,Integer> specialist = new HashMap<>();
                    specialist.put("all",0);
                    specialist.put("finish",0);
                    if((Integer)one.get("status")==1){
                        specialist.put("finish",specialist.get("finish")+1);
                if(one.get("type")!=null){
                    if((Integer)one.get("type")==1){//家庭医生
                        Map<String,Integer> family = new HashMap<>();
                        family.put("all",0);
                        family.put("finish",0);
                        if((Integer)one.get("status")==1){
                            family.put("finish",family.get("finish")+1);
                        }
                        family.put("all",family.get("all")+1);
                        m.put("family",family);
                    }else if((Integer)one.get("type")==2){//专科医生
                        Map<String,Integer> specialist = new HashMap<>();
                        specialist.put("all",0);
                        specialist.put("finish",0);
                        if((Integer)one.get("status")==1){
                            specialist.put("finish",specialist.get("finish")+1);
                        }
                        specialist.put("all",specialist.get("all")+1);
                        m.put("specialist",specialist);
                    }
                    specialist.put("all",specialist.get("all")+1);
                    m.put("specialist",specialist);
                }
            }
            //myTaskFlag,1:有自己任务,0:没有自己任务
            if(StringUtils.isNotEmpty(doctorCode)){
@ -648,7 +654,7 @@ public class RehabilitationManageService {
            resultMap.put("hospitalName",one.get("hospital_name"));//地点
            resultMap.put("executeTime",one.get("execute_time"));//执行时间
            DecimalFormat df = new DecimalFormat("0.00");
            resultMap.put("expense", one.get("expense")!=null?df.format(((Integer)one.get("expense")*1.00)/100.00):0);//收费
            resultMap.put("expense", one.get("expense")!=null?df.format(((Integer)one.get("expense")*1.00)):0);//收费
            resultMap.put("reserve",null);//是否需要预约(1预约、0不预约)
            resultMap.put("planStatus",one.get("planStatus"));//计划的状态
            Integer status = Integer.valueOf(one.get("status").toString());//状态(0未完成,1已完成,2已预约)
@ -738,11 +744,11 @@ public class RehabilitationManageService {
//        if(!(one.get("specialistDoctor")+"").equals((one.get("create_user")+""))){
//            executeDoctorList.add(one.get("create_user_name")+"");
//        }
        executeDoctorList.add(one.get("executeDoctorName")+"");
        resultMap.put("remark",one.get("remark"));
        executeDoctorList.add(one.get("executeDoctorName")+"");//
        resultMap.put("remark",one.get("remark"));//备注
        resultMap.put("executeDoctorList",executeDoctorList);//执行医生名称列表
        resultMap.put("executeDoctorCode",one.get("executeDoctor")+"");//执行医生code
        resultMap.put("executeDoctorName",one.get("executeDoctorName")+"");//执行医生code
        resultMap.put("executeDoctorName",one.get("executeDoctorName")+"");//执行医生名称
        resultMap.put("specialistDoctorCode",one.get("createDoctor")+"");//创建人(专科)医生code
        resultMap.put("specialistDoctorName",one.get("createDoctorName")+"");//创建人(专科)医生名字
        resultMap.put("title",one.get("title"));//项目标题
@ -751,7 +757,7 @@ public class RehabilitationManageService {
        resultMap.put("hospitalName",one.get("hospital_name"));//地点
        resultMap.put("executeTime",one.get("execute_time"));//执行时间
        DecimalFormat df = new DecimalFormat("0.00");
        resultMap.put("expense",one.get("expense")!=null?df.format(((Integer)one.get("expense")*1.00)/100.00):0);//收费
        resultMap.put("expense",one.get("expense")!=null?df.format(((Integer)one.get("expense")*1.00)):0);//收费
        resultMap.put("reserve",one.get("reserve"));//是否需要预约(1预约、0不预约)
        resultMap.put("planStatus",one.get("planStatus"));//计划的状态
        resultMap.put("relationCode",one.get("relationCode"));//业务关联code

+ 1 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

@ -123,6 +123,7 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
            templateDetailDao.deleteByTemplateId(templateId);
        }
        for(RehabilitationTemplateDetailDO detail : details){
            detail.setCreateTime(new Date());
            detail.setUpdateTime(new Date());