Selaa lähdekoodia

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

Conflicts:
	svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java
yeshijie 4 vuotta sitten
vanhempi
commit
967831e9b2
63 muutettua tiedostoa jossa 2581 lisäystä ja 536 poistoa
  1. 6 0
      business/base-service/pom.xml
  2. 15 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/dao/BasePatientMemberDictDao.java
  3. 10 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/dao/WlyyPatientFamilyMemberDao.java
  4. 21 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/PatientMemberDictService.java
  5. 207 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  6. 1 0
      business/base-service/src/main/java/com/yihu/jw/hospital/mapping/dao/PatientMappingDao.java
  7. 4 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseBannerDoctorDao.java
  8. 2 1
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseUserMessageDao.java
  9. 354 107
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerDoctorService.java
  10. 123 21
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java
  11. 12 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java
  12. 21 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java
  13. 79 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java
  14. 11 2
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java
  15. 78 46
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  16. 4 7
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  17. 47 43
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  18. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/ConvertUtil.java
  19. 1 1
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  20. 126 27
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  21. 5 20
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  22. 5 0
      business/es-service/src/main/java/com/yihu/jw/es/es/ElasticFactory.java
  23. 173 57
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  24. 31 31
      business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java
  25. 98 5
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  26. 2 4
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  27. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/version/AppVersionDO.java
  28. 49 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/family/BasePatientMemberDictDO.java
  29. 104 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/family/WlyyPatientFamilyMemberDO.java
  30. 44 2
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  31. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationTemplateDetailDO.java
  32. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/bank/HealthBankMapping.java
  33. 24 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  34. 22 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyOutpatientVO.java
  35. 1 1
      readme.MD
  36. 6 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/methodlog/MethodLogEndpoint.java
  37. 2 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  38. 6 0
      svr/svr-base/src/main/resources/application.yml
  39. 13 0
      svr/svr-healthy-house/src/main/java/com/yihu/jw/healthyhouse/interceptor/ActivatedInterceptor.java
  40. 17 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java
  41. 3 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/PrescriptionOverdueJob.java
  42. 41 46
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java
  43. 2 2
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/AutoTimeOutRemind.java
  44. 68 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/OverdueJob.java
  45. 8 2
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  46. 1 1
      svr/svr-internet-hospital-job/src/main/resources/system.properties
  47. 27 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java
  48. 72 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  49. 234 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java
  50. 17 11
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BannerDoctorController.java
  51. 15 8
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseUserMsgController.java
  52. 90 23
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  53. 7 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  54. 32 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java
  55. 21 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeCategoryService.java
  56. 3 1
      svr/svr-internet-hospital/src/main/resources/application.yml
  57. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/monitorPlatform/MonitorPlatformController.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. 113 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java
  61. 7 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java
  62. 53 47
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java
  63. 1 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java

+ 6 - 0
business/base-service/pom.xml

@ -185,6 +185,12 @@
            <version>1.4</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.kaptcha</groupId>
            <artifactId>kaptcha</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>

+ 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\",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.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);
}

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseBannerDoctorDao.java

@ -20,5 +20,9 @@ public interface BaseBannerDoctorDao extends PagingAndSortingRepository<BaseBann
    Integer getTotalBannerCount(String doctor);
    @Query( value = "SELECT * from base_banner_doctor t where t.doctor = ?1 and t.patient_id =?2 and t.relation_code =?3" ,nativeQuery = true)
    List<BaseBannerDoctorDO> getBanners(String doctor,String patientId,String relationCode);
    @Query("from BaseBannerDoctorDO t where t.patientId =?1 order by t.createTime desc ")
    List<BaseBannerDoctorDO> getBannersBypatients(String patientId);
    @Query("from BaseBannerDoctorDO t where t.patientId =?1 and t.doctor =?2 order by t.createTime desc ")
    public abstract List<BaseBannerDoctorDO> getBannersBypatients(String paramString1, String paramString2);
}

+ 2 - 1
business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseUserMessageDao.java

@ -20,7 +20,8 @@ public interface BaseUserMessageDao extends PagingAndSortingRepository<BaseUserM
    Integer getMessageNotReadCount(String doctor);
    @Query(value = "select *  from base_user_message t where t.receiver = ?1 and t.is_read = 0 order by t.update_time desc",nativeQuery = true)
    List<BaseUserMessageDO> getMessageNotReadNotPage(String doctor);
    @Query("from BaseUserMessageDO p where p.receiver=?1 and p.sender=?2 order by p.createTime desc ")
    public abstract List<BaseUserMessageDO> getMessageByPatientAndDoctor(String paramString1, String paramString2);

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 354 - 107
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerDoctorService.java


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

@ -7,12 +7,14 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.score.BaseEvaluateDO;
import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
import com.yihu.jw.entity.base.words.BaseSensitiveDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.entity.hospital.message.BaseUserMessageDO;
import com.yihu.jw.entity.hospital.message.BaseUserMsgContentDO;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.message.dao.BaseBannerDao;
import com.yihu.jw.hospital.message.dao.BaseBannerDoctorDao;
import com.yihu.jw.hospital.message.dao.BaseUserMessageDao;
@ -21,6 +23,7 @@ import com.yihu.jw.hospital.prescription.dao.BaseSensitiveDao;
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.restmodel.web.ObjEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.date.DateUtil;
@ -34,12 +37,15 @@ import org.hibernate.dialect.Ingres9Dialect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.jpa.provider.HibernateUtils;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.swing.plaf.PanelUI;
import javax.transaction.Transactional;
import java.io.IOException;
import java.lang.annotation.ElementType;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
@ -67,6 +73,12 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
    private BaseBannerDao bannerDao;
    @Autowired
    private BaseSensitiveDao baseSensitiveDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private BaseBannerDoctorService baseBannerDoctorService;
    @Value("${wechat.id}")
    private String wxId;
@ -75,29 +87,66 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
    @Value("${wechat.flag}")
    private boolean flag;
    //患者给医生自身留言接口
    public void leaveMessage(String content, String reciverId, String reciverName, String senderId, Integer type) {
    public ObjEnvelop leaveMessage(String content, String reciverId, String reciverName, String senderId, Integer type, String key, String value)
            throws IOException
    {
        BaseUserMessageDO baseUserMessageDO = new BaseUserMessageDO();
        BasePatientDO patientDO= basePatientDao.findById(senderId);
        String senderName=null;
        if(null!=patientDO){
            senderName = patientDO.getName();
        ObjEnvelop objEnvelop = new ObjEnvelop();
        boolean checkTimeOut = checkGiveTimeOut(senderId, reciverId);
        if ((StringUtils.isNotBlank(key)) && (StringUtils.isNotBlank(value))) {
            if (this.baseBannerDoctorService.verifyCaptcha(key, value))
            {
                checkTimeOut = true;
            }
            else
            {
                objEnvelop.setMessage("验证码错误");
                objEnvelop.setStatus(Integer.valueOf(78));
                return objEnvelop;
            }
        }
        String relationCode=UUID.randomUUID().toString();
        baseUserMessageDO.setContent(content);
        baseUserMessageDO.setSender(senderId);
        baseUserMessageDO.setSenderName(senderName);
        baseUserMessageDO.setReceiver(reciverId);
        baseUserMessageDO.setReceiverName(reciverName);
        baseUserMessageDO.setRelationCode(relationCode);
        baseUserMessageDO.setRelationName("留言");
        baseUserMessageDO.setRelationType(1);
        baseUserMessageDO.setStatus(1);
        baseUserMessageDO.setDel(1);
        baseUserMessageDO.setType(type);
        baseUserMessageDO.setIsRead(0);
        baseUserMessageDao.save(baseUserMessageDO);
        boolean checkTimes = checkGiveTimes(senderId, reciverId);
        if (checkTimes)
        {
            if (checkTimeOut)
            {
                BasePatientDO patientDO = this.basePatientDao.findById(senderId);
                String senderName = null;
                if (null != patientDO) {
                    senderName = patientDO.getName();
                }
                String relationCode = UUID.randomUUID().toString();
                baseUserMessageDO.setContent(content);
                baseUserMessageDO.setSender(senderId);
                baseUserMessageDO.setSenderName(senderName);
                baseUserMessageDO.setReceiver(reciverId);
                baseUserMessageDO.setReceiverName(reciverName);
                baseUserMessageDO.setRelationCode(relationCode);
                baseUserMessageDO.setRelationName("留言");
                baseUserMessageDO.setRelationType(Integer.valueOf(1));
                baseUserMessageDO.setStatus(Integer.valueOf(1));
                baseUserMessageDO.setDel(Integer.valueOf(1));
                baseUserMessageDO.setType(type);
                baseUserMessageDO.setIsRead(Integer.valueOf(0));
                this.baseUserMessageDao.save(baseUserMessageDO);
                objEnvelop.setStatus(Integer.valueOf(200));
                objEnvelop.setMessage("留言成功");
            }
            else
            {
                objEnvelop.setMessage("生成验证码");
                objEnvelop.setStatus(200);
                objEnvelop.setObj(baseBannerDoctorService.generateCaptcha());
                return objEnvelop;
            }
        }
        else
        {
            objEnvelop.setMessage("当天留言已达规定次数");
            objEnvelop.setStatus(Integer.valueOf(77));
            return objEnvelop;
        }
        return objEnvelop;
    }
    //回复留言接口
    @Transactional
@ -423,5 +472,58 @@ public class BaseUserMsgService extends BaseJpaService<BaseUserMessageDO, BaseUs
        }
        return sql.toString();
    }
    public boolean checkGiveTimeOut(String sender, String reciver)
{
    List<BaseUserMessageDO> baseBannerDoctorDOS = this.baseUserMessageDao.getMessageByPatientAndDoctor(reciver, sender);
    WlyyHospitalSysDictDO wlyyHospitalSysDictDO = this.wlyyHospitalSysDictDao.findById("leave_message_timeout");
    if (null != baseBannerDoctorDOS)
    {
        BaseUserMessageDO lastOne = (BaseUserMessageDO)baseBannerDoctorDOS.get(0);
        Date lastDate = lastOne.getCreateTime();
        long timeOut = wlyyHospitalSysDictDO.getDictValue() != null ? Long.valueOf(wlyyHospitalSysDictDO.getDictValue()).longValue() : 5L;
        Date current = new Date();
        if (current.getTime() - lastDate.getTime() > timeOut * 1000L * 60L) {
            return true;
        }
        return false;
    }
    return true;
}
    public boolean checkGiveTimes(String patientId, String doctorId)
    {
        boolean flag = false;
        StringBuffer sql = new StringBuffer();
        sql.append("select t.sender as \"sender\",t.receiver as \"receiver\" from base_user_message t");
        sql.append(" where 1=1 ");
        if (StringUtils.isNotBlank(patientId)) {
            sql.append(" and t.sender = '" + patientId + "'");
        }
        if (StringUtils.isNotBlank(doctorId)) {
            sql.append(" and t.receiver = '" + doctorId + "'");
        }
        Date date = new Date();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        String strDate = format.format(date);
        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;
        if (wlyyHospitalSysDictDO != null) {
            countTimes = wlyyHospitalSysDictDO.getDictValue() == null ? countTimes : Long.valueOf(wlyyHospitalSysDictDO.getDictValue()).longValue();
        }
        if (list.size() > countTimes) {
            return false;
        }
        return true;
    }
}

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

+ 21 - 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,25 +22,43 @@ 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);
    @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);
}

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

@ -0,0 +1,79 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.http.HttpClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@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;
    }
    /**
     * 支付成功提醒
     * @param userName 用户名 (不能为空)
     * @param idCard 身份证 (能为空)
     * @param phone 推送人手机号 (不能为空)
     * @param title 推送标题 (不能为空)
     * @param url 支付链接   (不能为空)
     * @param doctorName 就诊医生 (不能为空)
     * @param total 总费用 (不能为空)
     * @param miPay 医保支付 (不能为空)
     * @param selfPay 个人支付 (不能为空)
     * @param orderNo 单据号 (不能为空)
     * @param remark 备注 (不能为空)
     * @return
     * @throws Exception
     */
    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) {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("userName", userName);
        jsonObject.put("idCard", idCard);
        jsonObject.put("phone", phone);
        jsonObject.put("title", title);
        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(serverUrl + "/interface/paySuccessNoticePush.htm", jsonObject.toJSONString());
        JSONObject result = new JSONObject();
        String respCode = "";
        if (responseMsg != null) {
            result = JSONObject.parseObject(responseMsg);
            respCode = result.get("respCode").toString();
        }
        return respCode;
    }
}

+ 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();

+ 78 - 46
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();
@ -883,30 +883,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //3.创建候诊室
        createRoom(outpatient, chargeType);
        //发送企业模板消息给医生
        String msg = "";
        String name=outpatient.getPatientName();
        String sex = "";
        String age="";
        String date = "";
        String title = "";
        String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatient.getDescription()+"&type=3&id="+outpatient.getId();
        if (patientDO!=null){
            sex=IdCardUtil.getSexForIdcard(patientDO.getIdcard());
            age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard())+"";
        }
        if (outpatient!=null){
            if (outpatient.getType().equalsIgnoreCase("1")){
                title = "图文复诊";
                msg = name+"("+sex+" "+age+"岁)向您发起了图文复诊,点击查看";
            }else if (outpatient.getType().equalsIgnoreCase("2")){
                title = "视频复诊";
                date = DateUtil.dateToStrLong(outpatient.getRegisterDate());
                msg = name+"("+sex+" "+age+"岁)预约了"+date+"的视频复诊,点击查看";
            }
        }
        enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
        System.out.println("发送企业模板消息成功");
        String content = "向您发起了图文复诊,点击查看";
        return outpatient;
@ -1771,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 {
        //调用电子病历接口注册居民信息
@ -2168,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=========================================================
        //判断是否有检查检验或药品开方
@ -2674,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 " +
@ -3616,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){
@ -5691,13 +5702,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //根据门诊唯一号取就诊记录
//        List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByAdmNo(admNo);
        WlyyPrescriptionDO wlyyPrescriptionDOS = prescriptionDao.findByAdmNoAndRealOrder(admNo, realOrder);
        List<WlyyPrescriptionDO> wlyyPrescriptionDOList = prescriptionDao.findByRealOrderList(realOrder);
        Object result = "";
        System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null=" + wlyyPrescriptionDOS != null);
        if (wlyyPrescriptionDOS != null) {
        System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null=" + wlyyPrescriptionDOList != null);
        if (wlyyPrescriptionDOList != null&&wlyyPrescriptionDOList.size()!=0) {
            WlyyPrescriptionDO wlyyPrescriptionDOS = wlyyPrescriptionDOList.get(0);
            List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId", wlyyPrescriptionDOS.getOutpatientId());
            WlyyPrescriptionExpressageDO sfexpress_obj = null;
            System.out.println("获取顺丰物流面单信息:CollectionUtils.isEmpty(expressageDOList)=" + CollectionUtils.isEmpty(expressageDOList));
@ -5707,7 +5717,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                System.out.println("获取顺丰物流面单信息:1");
                sfexpress_obj = expressageDOList.get(0);
                System.out.println("获取顺丰物流面单信息:2");
                BasePatientDO basePatientDO = basePatientDao.findById(wlyyPrescriptionDOS.getPatientCode());
                //如果该处方的快递单号已生成,则说明已经下单成功,不需要重复下单,直接返回面单信息
                System.out.println("获取顺丰物流面单信息:3");
                if (org.apache.commons.lang.StringUtils.isNotBlank(sfexpress_obj.getMailno())) {
@ -5736,9 +5745,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    System.out.println("获取顺丰物流面单信息:6");
                }
                wlyyPrescriptionDOS.setStatus(32);
                prescriptionDao.save(wlyyPrescriptionDOS);
                for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOList){
                    prescriptionDO.setStatus(32);
                    prescriptionDao.save(prescriptionDO);
                }
                if (sfexpress_obj != null && StringUtils.isNoneBlank(sfexpress_obj.getMailno())) {
                    com.alibaba.fastjson.JSONObject object = sfexpressService.postSFOrderQueryService(sfexpress_obj);
                    System.out.println("获取顺丰物流面单信息7-1"+object.toJSONString());
@ -6820,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);
    }
    /**
@ -7131,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());
    }
@ -7222,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;
@ -7248,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);
@ -7357,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;
@ -8361,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);
        //设置复诊类型

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 47 - 43
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;

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

@ -92,7 +92,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
    public String orgSub ;
    public String imgUrl;
    static String imgPath =File.separator+"usr"+File.separator+"local"+File.separator+"hospital"+File.separator+"svr-internet-hospital-job"+File.separator+"img"+File.separator;
    static String imgPath =File.separator+"usr"+File.separator+"local"+File.separator+"ehr"+File.separator+"svr-internet-hospital-job"+File.separator+"img"+File.separator;
    public ObjectMapper objectMapper;

+ 126 - 27
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -33,6 +33,7 @@ import com.yihu.jw.order.dao.ConsultOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.util.common.XMLUtil;
import com.yihu.jw.util.date.DateUtil;
@ -42,6 +43,7 @@ import com.yihu.jw.utils.ByteToInputStream;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPayLogDao;
import com.yihu.jw.wechat.enterprise.EnterpriseService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
@ -108,6 +110,11 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
    private XzzxEntranceService xzzxEntranceService;
    @Value("${wechat.flag}")
    private boolean flag;
    @Value("${wechat.id}")
    private String wechatId;
    @Autowired
    private EnterpriseService enterpriseService;
@ -133,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){
@ -148,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);
@ -430,12 +438,18 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        if (tradeType.equalsIgnoreCase("JSAPI")){
            map.put("openid", openId);
        }
        String wapUrl = "";
        String wapName = "";
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            wapUrl = "https://www1.yanketong.com";
            wapName = "厦门大学附中厦门眼科中心";
        }
        if (tradeType.equalsIgnoreCase("MWEB")){
            JSONObject jsonObject = new JSONObject();
            JSONObject object = new JSONObject();
            object.put("type","Wap");
            object.put("wap_url","");
            object.put("wap_name","");
            object.put("wap_url",wapUrl);
            object.put("wap_name",wapName);
            jsonObject.put("h5_info",object);
            map.put("scene_info",jsonObject.toJSONString());
        }
@ -462,30 +476,58 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            String mchId = pay.get("mch_id").toString();
            String nonceStr = pay.get("nonce_str").toString();
            String prepayId = pay.get("prepay_id").toString();
            String trade = pay.get("trade_type").toString();
            if (trade.equalsIgnoreCase("Native")){
            String trade = "";
            if ("SUCCESS".equalsIgnoreCase(resultCode)){
                trade = pay.get("trade_type").toString();
                if (trade.equalsIgnoreCase("Native")){
                    Map<String,String> param = new HashedMap();
                    param.put("appId",appid);
                    param.put("package","prepay_id="+prepayId);
                    param.put("nonceStr",nonceStr);
                    param.put("signType","MD5");
                    param.put("timeStamp",getTimeStamp());
                    param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
                    InputStream qrcode = QrcodeUtil.createQrcode(pay.get("code_url").toString(),300,"jpg");
                    ByteToInputStream byteToInputStream = new ByteToInputStream();
                    String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
                    param.put("qrcode","data:image/png;base64,"+ QRCodeImg);
                    pay.put("native",param);
                }//h5支付方法 返回跳转的微信收银台地址
                else if("MWEB".equalsIgnoreCase(trade)){
                    Map<String,String> param = new HashedMap();
                    param.put("appId",appid);
                    param.put("package","prepay_id="+prepayId);
                    param.put("nonceStr",nonceStr);
                    param.put("signType","MD5");
                    param.put("timeStamp",getTimeStamp());
                    param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
                    //微信收银台地址
                    String mwebUrl = pay.get("mweb_url").toString();
                    param.put("mweb_url",mwebUrl);
                    pay.put("MWEB",param);
                }else {
                    Map<String,String> param = new HashedMap();
                    param.put("appId",appid);
                    param.put("package","prepay_id="+prepayId);
                    param.put("nonceStr",nonceStr);
                    param.put("signType","MD5");
                    param.put("timeStamp",getTimeStamp());
                    param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
                    pay.put("jsapi",param);
            }
            }else {
                //支付失败返回信息
                Map<String,String> param = new HashedMap();
                param.put("appId",appid);
                param.put("package","prepay_id="+prepayId);
                param.put("nonceStr",nonceStr);
                param.put("signType","MD5");
                param.put("timeStamp",getTimeStamp());
                param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
                InputStream qrcode = QrcodeUtil.createQrcode(pay.get("code_url").toString(),300,"jpg");
                ByteToInputStream byteToInputStream = new ByteToInputStream();
                String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
                param.put("qrcode","data:image/png;base64,"+ QRCodeImg);
                pay.put("native",param);
                param.put("err_code",pay.get("err_code").toString());
                param.put("err_code_des",pay.get("err_code_des").toString());
                pay.put("payFailed",param);
            }
        }else {
            //通信失败返回信息
            Map<String,String> param = new HashedMap();
            param.put("appId",appid);
            param.put("package","prepay_id="+prepayId);
            param.put("nonceStr",nonceStr);
            param.put("signType","MD5");
            param.put("timeStamp",getTimeStamp());
            param = WeiXinPayUtils.getMapAfterUnifiedorder(param,wxWechatDO.getAppKey());
            pay.put("jsapi",param);
            param.put("return_code",pay.get("return_code").toString());
            param.put("return_msg",pay.get("return_msg").toString());
            pay.put("connectFailed",param);
        }
        return pay;
    }
@ -992,7 +1034,36 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")||businessOrderDO.getOrderCategory().equalsIgnoreCase("3")){
           WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
           wlyyOutpatientDO.setPayStatus(1);
           outpatientDao.save(wlyyOutpatientDO);
           WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
           if (businessOrderDO.getStatus()!=null&&businessOrderDO.getStatus()!=1){
               //发送企业模板消息给医生
               BasePatientDO patientDO = new BasePatientDO();
               patientDO = patientDao.findById(outpatientDO.getPatient());
               String msg = "";
               String name=outpatientDO.getPatientName();
               String sex = "";
               String age="";
               String date = "";
               String title = "";
               String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
               if (patientDO!=null){
                   sex= IdCardUtil.getSexForIdcard(patientDO.getIdcard());
                   age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard())+"";
               }
               if (outpatientDO!=null){
                   if (outpatientDO.getType().equalsIgnoreCase("1")){
                       title = "图文复诊";
                       msg = name+"("+sex+" "+age+"岁)向您发起了图文复诊,点击查看";
                   }else if (outpatientDO.getType().equalsIgnoreCase("2")){
                       title = "视频复诊";
                       date = DateUtil.dateToStrLong(outpatientDO.getRegisterDate());
                       msg = name+"("+sex+" "+age+"岁)预约了"+date+"的视频复诊,点击查看";
                   }
               }
               enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
               System.out.println("发送企业模板消息成功");
           }
        } else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
           List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
           if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
@ -1027,7 +1098,35 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("2")){
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
            wlyyOutpatientDO.setPayStatus(1);
            outpatientDao.save(wlyyOutpatientDO);
            WlyyOutpatientDO outpatientDO = outpatientDao.save(wlyyOutpatientDO);
            if (businessOrderDO.getStatus()!=null&&businessOrderDO.getStatus()!=1){
                //发送企业模板消息给医生
                BasePatientDO patientDO = new BasePatientDO();
                patientDO = patientDao.findById(outpatientDO.getPatient());
                String msg = "";
                String name=outpatientDO.getPatientName();
                String sex = "";
                String age="";
                String date = "";
                String title = "";
                String url="https://hlwyy.xmzsh.com/hlwyy/ims-app-web/#/onlineChat/detail?_rs_title="+outpatientDO.getDescription()+"&type=3&id="+outpatientDO.getId();
                if (patientDO!=null){
                    sex= IdCardUtil.getSexForIdcard(patientDO.getIdcard());
                    age = IdCardUtil.getAgeForIdcard(patientDO.getIdcard())+"";
                }
                if (outpatientDO!=null){
                    if (outpatientDO.getType().equalsIgnoreCase("1")){
                        title = "图文复诊";
                        msg = name+"("+sex+" "+age+"岁)向您发起了图文复诊,点击查看";
                    }else if (outpatientDO.getType().equalsIgnoreCase("2")){
                        title = "视频复诊";
                        date = DateUtil.dateToStrLong(outpatientDO.getRegisterDate());
                        msg = name+"("+sex+" "+age+"岁)预约了"+date+"的视频复诊,点击查看";
                    }
                }
                enterpriseService.sendTWMesByDoctor("zsyy",outpatientDO.getDoctor(),title,msg,url);
                System.out.println("发送企业模板消息成功");
            }
        } else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")) {
            List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
            if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){

+ 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)

+ 173 - 57
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;
    }
@ -3457,8 +3445,136 @@ 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 array = new JSONArray();
        JSONArray resultArray = new JSONArray();
        //问诊量
        JSONObject object = new JSONObject();
        if (interval==1){
             array = dateTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null);
            object.put("data",array);
        }else if (interval==2){
             array = weekTotalStatistics(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL);
            object.put("data",array);
        }else if (interval==3){
             array = monthTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null);
            object.put("data",array);
        }
        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> prescriptionSaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"",String.valueOf(interval),"4");
            //每个医生根据传入时间查询开具处方数量
            List<SaveModel> doctorSaveModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level, indexes[1], SaveModel.timeLevel_ZL,"",String.valueOf(interval),"6");
            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);
            object.put("detailList",prescriptionSaveModels);
        }
        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 array = new JSONArray();
        JSONArray resultArray = new JSONArray();
        //问诊量
        JSONObject object = new JSONObject();
        if (interval==1){
            array = dateTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null);
            object.put("data",array);
        }else if (interval==2){
            array = weekTotalStatistics(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL);
            object.put("data",array);
        }else if (interval==3){
            array = monthTotalStatistics2(startDate,endDate,area,level,index,null,SaveModel.timeLevel_ZL,null);
            object.put("data",array);
        }
        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("'");

+ 98 - 5
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());
				}
@ -2276,7 +2284,7 @@ public class ImService {
	 */
	public Long countConsultRecordByDoctor(String doctor, String id,String type, Integer status,String title,String start_time,String end_time) {
		
		String  sql = "SELECT " +
		/*String  sql = "SELECT " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult_team b," +
				"base_patient d," +
@ -2302,7 +2310,7 @@ public class ImService {
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
			/*sql +=" and a.czrq >= '"+start_time+"'";*/
			*//*sql +=" and a.czrq >= '"+start_time+"'";*//*
		}
		
		if(!StringUtils.isEmpty(end_time)){
@ -2343,8 +2351,93 @@ public class ImService {
		Long count = 0L;
		if (rstotal != null && rstotal.size() > 0) {
			count = Long.parseLong(rstotal.get(0).get("total").toString());
		}*/
		String  sql = "";
		//专家咨询
		if("1".equals(type) || "15".equals(type) || type.contains(",")){
			sql = "SELECT " +
					" COUNT(1) AS \"total\" "+
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d " +
					"WHERE a.id=b.consult " +
					"AND b.patient=d.id ";
		}else{
			sql = "SELECT " +
					" COUNT(1) AS \"total\" "+
					"FROM wlyy_consult_team b," +
					"base_patient d," +
					"wlyy_consult a   " +
					"left join wlyy_outpatient op on  a.relation_code = op.id " +
					"WHERE a.id=b.consult " +
					"AND b.patient=d.id ";
		}
		if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)){
			sql+=" AND b.doctor='"+doctor+"' ";
		}
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			sql +=" and a.symptoms like '"+title+"'";
		}
		if(!StringUtils.isEmpty(start_time)){
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql +=" and a.czrq >= str_to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
		}
		if(!StringUtils.isEmpty(end_time)){
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql +=" and a.czrq <= str_to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq <= '"+end_time+"'";
			}
		}
		//咨询状态
		if(status != 0){
			if(status ==2 ){//就诊中
				sql +=" and b.status = 0 ";
			}else if(status ==3 ){
				sql +=" and b.status = 1 ";
			}else{}
		}
		//咨询类型
		if(!StringUtils.isEmpty(type)&&!type.equalsIgnoreCase("0")){
			sql +=" AND a.type in ("+type+")" ;
		}
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		sql += " ORDER BY a.czrq desc ";
		List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql);
		Long count = 0L;
		if (mapList != null && mapList.size() > 0) {
			count = Long.parseLong(mapList.get(0).get("total").toString());
		}
		
		return count;
	}
	
@ -2984,6 +3077,7 @@ public class ImService {
		}
		if("9".equals(type) || "16".equals(type)|| "12".equals(type)){
			sql = "SELECT " +
					" DISTINCT op.id AS \"outpatientId\"," +
					"op.description AS \"title\"," +
					"op.description AS \"symptoms\",";
			if("xm_ykyy_wx".equals(wxId)){
@ -3003,8 +3097,7 @@ public class ImService {
					"patient.id AS \"patientId\"," +
					"patient.idcard AS \"patientIdcard\"," +
					"patient.sex AS \"patientsex\"," +
					"patient.photo AS \"patientphoto\"," +
					"op.id AS \"outpatientId\"," ;
					"patient.photo AS \"patientphoto\",";
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";

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

@ -19,15 +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")
*/
//==========Oracle 环境id策略 =========================================================
    public Integer getId() {
        return id;

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/version/AppVersionDO.java

@ -102,7 +102,7 @@ public class AppVersionDO extends IntegerIdentityEntity {
        this.info = info;
    }
	@Column(name = "size")
	@Column(name = "app_size")
    public double getSize() {
        return size;
    }

+ 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) {

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

@ -9,6 +9,7 @@ import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.repository.job.QuartzJobLogDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
@ -41,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;
@ -61,6 +62,8 @@ public class PrescriptionStatusUpdateService {
    private BusinessOrderService businessOrderService;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private QuartzJobLogDao quartzJobLogDao;
    public void autoPush() throws Exception {
@ -143,11 +146,11 @@ public class PrescriptionStatusUpdateService {
                if (!preExistFlag) {
                    updatePrescriptionInfo(preId,wlyyPrescriptionVO,wlyyOutpatientDO);
                }
                //更改门诊状态为已经检查
                /*//更改门诊状态为已经检查
                if (100 == wlyyPrescriptionVO.getStatus()) {
                    wlyyOutpatientDO.setStatus("2");
                    wlyyOutpatientDO.setStatus("3");
                }
                outpatientDao.save(wlyyOutpatientDO);
                outpatientDao.save(wlyyOutpatientDO);*/
                //更新处方状态记录
                wlyyPrescriptionDO.setStatus(wlyyPrescriptionVO.getStatus());
@ -276,56 +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);
        //复诊记录状态状态安全锁,每天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");
    
                    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);
                    }
                }catch(Exception e)  {
                    e.printStackTrace();
                    logger.info("自动结束咨询报错 consultCode: "+consultCode);
                }
                outpatientDao.save(outpatientDOs);
                //退费
                for (WlyyOutpatientDO outpatientDO:outpatientDOs){
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                    if (businessOrderDO!=null){
                        try {
                            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());
*/
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                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());
    */
                    }
                } } 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));
    }
}

+ 17 - 11
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BannerDoctorController.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.hospital.message.dao.BaseBannerDoctorDao;
import com.yihu.jw.hospital.message.service.BaseBannerDoctorService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
@ -30,23 +31,28 @@ public class BannerDoctorController extends EnvelopRestEndpoint {
    private BaseBannerDoctorService baseBannerDoctorService;
    @ApiOperation("批量赠送锦旗")
    @PostMapping(value= BaseHospitalRequestMapping.DoctorBanner.giveBanner)
    public Envelop giveBanner(@ApiParam(name = "bannerIds", value = "bannerIds", required = true)
    public ObjEnvelop giveBanner(@ApiParam(name = "bannerIds", value = "bannerIds", required = true)
                                  @RequestParam(value = "bannerIds", required = true)String bannerIds,
                              @ApiParam(name = "doctor", value = "doctor", required = false)
                                 @ApiParam(name = "doctor", value = "doctor", required = false)
                                  @RequestParam(value = "doctor", required = false)String doctor,
                              @ApiParam(name = "doctorName", value = "doctorName", required = false)
                                 @ApiParam(name = "doctorName", value = "doctorName", required = false)
                                  @RequestParam(value = "doctorName", required = false)String doctorName,
                              @ApiParam(name = "content", value = "content", required = false)
                                 @ApiParam(name = "content", value = "content", required = false)
                                  @RequestParam(value = "content", required = false)String content,
                              @ApiParam(name = "type", value = "type", required = false)
                                  @RequestParam(value = "type", required = false)Integer type){
        List<BaseBannerDoctorDO> resultList = new ArrayList<>();
                                 @ApiParam(name = "type", value = "type", required = false)
                                  @RequestParam(value = "type", required = false)Integer type,
                                 @ApiParam(name = "key", value = "key", required = false)
                                  @RequestParam(value = "key", required = false)String key,
                                 @ApiParam(name = "value", value = "value", required = false)
                                  @RequestParam(value = "value", required = false)String value) throws Exception{
        ObjEnvelop objEnvelop = new ObjEnvelop();
        List<String> list = new ArrayList<>();
        if(StringUtils.isNotEmpty(bannerIds)){
            List<String> list =  Arrays.asList(bannerIds.split(","));
            String patientId= getUID();
            resultList = baseBannerDoctorService.bannerGive(patientId,list,content,doctor,doctorName,type);
            list =  Arrays.asList(bannerIds.split(","));
        }
    return success("赠送成功",resultList);
        String patientId= getUID();
        objEnvelop = baseBannerDoctorService.bannerGive(patientId,list,content,doctor,doctorName,type,key,value);
    return objEnvelop;
    }
    @ApiOperation("查询赠送锦旗")
    @PostMapping(value= BaseHospitalRequestMapping.DoctorBanner.getBanner)

+ 15 - 8
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseUserMsgController.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.hospital.message.service.BaseUserMsgService;
import com.yihu.jw.hospital.message.service.UserMsgContentService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.print.Doc;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
@ -45,20 +47,25 @@ public class BaseUserMsgController extends EnvelopRestEndpoint {
    }
    @ApiOperation("自身评论")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.leaveMessage)
    public Envelop leaveMessage(@ApiParam(name = "reciverId", value = "reciverId", required = false)
    public ObjEnvelop leaveMessage(@ApiParam(name = "reciverId", value = "reciverId", required = false)
                              @RequestParam(value = "reciverId", required = false)String reciverId,
                              @ApiParam(name = "reciverName", value = "reciverName", required = false)
                                   @ApiParam(name = "reciverName", value = "reciverName", required = false)
                              @RequestParam(value = "reciverName", required = false)String reciverName,
                              @ApiParam(name = "content", value = "content", required = false)
                                   @ApiParam(name = "content", value = "content", required = false)
                              @RequestParam(value = "content", required = false)String content,
                                @ApiParam(name = "type", value = "type", required = false)
                                    @RequestParam(value = "type", required = false)Integer type
                              ){
                                   @ApiParam(name = "type", value = "type", required = false)
                                    @RequestParam(value = "type", required = false)Integer type,
                                   @ApiParam(name = "key", value = "key", required = false)
                                    @RequestParam(value = "key", required = false)String key,
                                   @ApiParam(name = "value", value = "value", required = false)
                                    @RequestParam(value = "value", required = false)String value
                              ) throws IOException {
        String senderId = getUID();
        System.out.println("senderId"+senderId);
        //String senderName = getUNAME();
        baseUserMsgService.leaveMessage(content,reciverId,reciverName,senderId,type);
        return success("留言成功" );
        ObjEnvelop objEnvelop = new ObjEnvelop();
        objEnvelop= baseUserMsgService.leaveMessage(content,reciverId,reciverName,senderId,type,key,value);
        return objEnvelop;
}
    @ApiOperation("医生评论展示")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.showMessage)

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

@ -16,13 +16,13 @@ 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;
import com.yihu.jw.hospital.prescription.service.WorkTimeService;
@ -44,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;
@ -53,12 +52,14 @@ import com.ylzinfo.onepay.sdk.OnepayClient;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.domain.WebHook;
import com.ylzinfo.onepay.sdk.domain.ext.WaitPayDetailVO;
import com.ylzinfo.onepay.sdk.exception.PayException;
import com.ylzinfo.onepay.sdk.utils.SecurityUtil;
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;
@ -144,6 +145,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private YlzPayService ylzPayService;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private PayInfoNoticeService payInfoNoticeService;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private PrescriptionLogDao prescriptionLogDao;
    private String successxml = "SUCCESS";
@ -498,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;
@ -557,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());
@ -599,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;
@ -784,7 +789,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                        @RequestParam(value = "orderNo", required = false)String orderNo,
                                    @ApiParam(name = "remark", value = "备注", required = false)
                                        @RequestParam(value = "remark", required = false)String remark) throws Exception{
        String result = entranceService.paySuccessNotice(userName,idCard,phone,title,url,doctorName,total,miPay,selfPay,orderNo,remark);
        String result = payInfoNoticeService.paySuccessNotice(userName,idCard,phone,title,url,doctorName,total,miPay,selfPay,orderNo,remark);
        logger.info(result);
        return success("操作成功",result);
    }
@ -798,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 "未找到支付配置文件";
        }
@ -808,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;
        }
        // 参数转换
@ -818,29 +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 traceNo = param.getString("traceNo");
                    String result = ylzPayService.querySettledRecord(cardNo,null,null,"",null,traceNo,"1","10000");
                    response.getWriter().write("SUCCESS");
                    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("更新系统处方支付状态");
                        }
                    }
                    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 = "下诊断接口")

+ 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:

+ 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 = "")

+ 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());
        }
    }
    /**

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

@ -14,14 +14,21 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
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.*;
@ -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();
    }
    /**

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

+ 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());