소스 검색

Merge branch 'baseCopy1' of wangjun/wlyy2.0 into dev

wangzhinan 4 년 전
부모
커밋
2e9fe4db97
84개의 변경된 파일6997개의 추가작업 그리고 1425개의 파일을 삭제
  1. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyHospitalSysDictDao.java
  2. 2 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 159 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/XzyyPrescriptionService.java
  4. 14 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java
  5. 0 1
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  6. 1 1
      business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java
  7. 2 1
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  8. 6 0
      business/sms-service/pom.xml
  9. 7 0
      common/common-entity/sql记录
  10. 28 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  11. 87 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseLinkDictDO.java
  12. 210 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseMenuDictDO.java
  13. 86 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseMenuShowDO.java
  14. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/module/SaasTypeModuleDO.java
  15. 309 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDictDO.java
  16. 55 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleMenuDO.java
  17. 12 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  18. 1 1
      common/common-fegin/src/main/java/com/yihu/jw/fegin/base/wx/GraphicMessageFeign.java
  19. 53 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  20. 2 1
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  21. 4 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionServerDictDao.java
  22. 6 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/ListEnvelop.java
  23. 5 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/PageEnvelop.java
  24. 42 3
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/endpoint/EnvelopRestEndpoint.java
  25. 4 7
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionDictDao.java
  26. 2 2
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionLogDao.java
  27. 18 0
      common/common-util/src/main/java/com/yihu/jw/util/dao/BaseExceptionServerDictUtilDao.java
  28. 57 4
      common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java
  29. 1 8
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/DidiFilterProcessor.java
  30. 53 1
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java
  31. 1 0
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseExceptionService.java
  32. 0 11
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionServerDictDao.java
  33. 0 6
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  34. 19 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/article/KnowledgeArticleDeptDao.java
  35. 40 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/article/KnowledgeArticleDictDao.java
  36. 22 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/article/KnowledgeArticleMenuDao.java
  37. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/article/KnowledgeArticleUserDao.java
  38. 17 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/article/KnowledgeCategoryDao.java
  39. 27 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/menu/BaseLinkDictDao.java
  40. 23 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/menu/BaseMenuDictDao.java
  41. 18 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/menu/BaseMenuShowDao.java
  42. 381 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/article/ArticleEndpoint.java
  43. 18 3
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java
  44. 309 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuManageEndpoint.java
  45. 65 0
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuNoLoginEndpoint.java
  46. 483 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/article/KnowledgeArticleService.java
  47. 20 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/article/KnowledgeArticleUserService.java
  48. 80 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/article/KnowledgeCategoryService.java
  49. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorHospitalService.java
  50. 42 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  51. 704 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/menu/BaseMenuManageService.java
  52. 6 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java
  53. 5 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/role/MenuService.java
  54. 533 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/util/YkyyBaseService.java
  55. 78 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java
  56. 58 19
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/account/PatientEndpoint.java
  57. 7 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/analysis/AnalysisEndPoint.java
  58. 212 125
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java
  59. 55 26
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/base/BaseInfoEndpoint.java
  60. 46 16
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/config/DoctorServiceEndPoint.java
  61. 39 24
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/ConsultPriceEndpoint.java
  62. 293 161
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  63. 262 168
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  64. 30 25
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/ReservationSettingEndpoint.java
  65. 71 51
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/SysDictEndpoint.java
  66. 56 19
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/dict/PrivateDictEndpoint.java
  67. 32 17
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/drugstore/BaseDrugStoreEndpoint.java
  68. 7 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/enterprise/EnterpriseController.java
  69. 90 31
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseDoctorBGController.java
  70. 34 15
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseSuggestionController.java
  71. 70 41
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseSuggestionDictController.java
  72. 22 7
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java
  73. 33 13
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BannerDoctorController.java
  74. 54 40
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseBannerController.java
  75. 72 28
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseUserMsgController.java
  76. 39 20
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/SystemMessageController.java
  77. 423 199
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  78. 27 6
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/NationalDrugDictEndpoint.java
  79. 546 224
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  80. 132 50
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  81. 5 5
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java
  82. 120 24
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/survey/SurveyEndpoint.java
  83. 17 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/tnyy/TnyyController.java
  84. 7 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/version/VersionEndpoint.java

+ 3 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/dict/WlyyHospitalSysDictDao.java

@ -42,4 +42,7 @@ public interface WlyyHospitalSysDictDao extends PagingAndSortingRepository<WlyyH
    @Query("from WlyyHospitalSysDictDO where dictName = ?1  and  hospital=?2 and sort >= ?3 order by sort asc")
    List<WlyyHospitalSysDictDO> findByDictNameSortOrderBySort(String dictName,String hospital,Integer sort);
    @Query("from WlyyHospitalSysDictDO where dictName = ?1  and  dictCode=?2 ")
    WlyyHospitalSysDictDO findOneByDictNameAndDictCode(String dictName,String dictCode);
}

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

@ -951,7 +951,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        BaseDoctorDO doctorDO = baseDoctorDao.findById(outpatientDO.getDoctor());
        outpatientDO.setIsAgree("1");
        outpatientDO.setMjz("mz");
        outpatientDO.setStatus("0");
        outpatientDO.setCreateTime(new Date());
@ -12659,4 +12659,5 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            return "";
        }
    }
}

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

@ -6,10 +6,12 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.ca.OauthCaConfigDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
@ -21,6 +23,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Connection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -71,6 +74,8 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    private BaseDoctorDao doctorDao;
    @Autowired
    private PrescriptionEmrDao prescriptionEmrDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    /**
@ -418,4 +423,158 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        }
        return null;
    }
    /***
     * 自动签名授权-请求自动签名授权接口
     * @param openId 患者姓名
     * @param sysTag 患者年
     * @return
     */
    public JSONObject selfSignRequest(String openId,String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            String clientId= "";
            String clientSecret = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/selfSign/request";
                clientId=oauthCaConfigDO.getClientId();
                clientSecret=oauthCaConfigDO.getClientSecret();
            }
            JSONObject object = new JSONObject();
            JSONObject msg = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("clientId",clientId);
            head.put("clientSecret",clientSecret);
            msg.put("head",head);
            JSONObject body = new JSONObject();
            if (StringUtils.isNoneBlank(sysTag)){
                body.put("sysTag",sysTag);
            }
            body.put("openId",openId);
            msg.put("body",body);
            object.put("msg",msg);
            object.put("signType",0);
            logger.info("请求参数:"+object);
            String response = httpClientUtil.sendPost(url,object.toJSONString());
            logger.info("请求自动签名授权接口 :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    /***
     * 自动签名授权-获取授权结果
     * @param baseDoctorDO
     * @param sysTag
     * @return
     */
    public JSONObject selfSignGetResult(BaseDoctorDO baseDoctorDO, String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            String clientId= "";
            String clientSecret = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/selfSign/getResult";
                clientId=oauthCaConfigDO.getClientId();
                clientSecret=oauthCaConfigDO.getClientSecret();
            }
            JSONObject object = new JSONObject();
            JSONObject msg = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("clientId",clientId);
            head.put("clientSecret",clientSecret);
            msg.put("head",head);
            JSONObject body = new JSONObject();
            if (StringUtils.isNoneBlank(sysTag)){
                body.put("sysTag",sysTag);
            }
            body.put("openId",baseDoctorDO.getOpenid());
            msg.put("body",body);
            object.put("msg",msg);
            object.put("signType",0);
            logger.info("请求参数:"+object);
            String response = httpClientUtil.sendPost(url,object.toJSONString());
            JSONObject jsonRes=JSONObject.parseObject(response);
            JSONObject jsonObject = jsonRes.getJSONObject("data");
            Integer grantStep = jsonObject.getInteger("grantStep");
            if(1==grantStep){
                baseDoctorDO.setIsSign("1");
                baseDoctorDO.setLastSignTime(new Date());
                baseDoctorDao.save(baseDoctorDO);
            }
            logger.info("获取授权结果 :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    /***
     * 自动签名授权-退出授权接口
     * @param openId
     * @param sysTag
     * @return
     */
    public JSONObject selfSignQuit(String openId,String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            String clientId= "";
            String clientSecret = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/selfSign/quit";
                clientId=oauthCaConfigDO.getClientId();
                clientSecret=oauthCaConfigDO.getClientSecret();
            }
            JSONObject object = new JSONObject();
            JSONObject msg = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("clientId",clientId);
            head.put("clientSecret",clientSecret);
            msg.put("head",head);
            JSONObject body = new JSONObject();
            if (StringUtils.isNoneBlank(sysTag)){
                body.put("sysTag",sysTag);
            }
            body.put("openId",openId);
            msg.put("body",body);
            object.put("msg",msg);
            object.put("signType",0);
            logger.info("请求参数:"+object);
            String response = httpClientUtil.sendPost(url,object.toJSONString());
            logger.info("退出授权接口 :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    public JSONObject checkDoctorNeedSign(String doctorId,String sysTag){
        BaseDoctorDO baseDoctorDO =baseDoctorDao.findById(doctorId);
        JSONObject jsonObject = new JSONObject();
        if (baseDoctorDO!=null){
            int defaultMinute=360;
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO=wlyyHospitalSysDictDao.findById("singTimeControl");
            if (wlyyHospitalSysDictDO!=null){
                defaultMinute=Integer.parseInt(wlyyHospitalSysDictDO.getDictValue());
            }
            long nowTime = new Date().getTime();
            long lastSignTime = baseDoctorDO.getLastSignTime()==null?new Date().getTime():baseDoctorDO.getLastSignTime().getTime();
            if ((nowTime-lastSignTime)>defaultMinute*60*1000){
                baseDoctorDO.setIsSign("0");
                jsonObject = this.selfSignRequest(baseDoctorDO.getOpenid(),sysTag);
                jsonObject.put("isNeedSign","true");
            }else {
                jsonObject.put("status",200);
                jsonObject.put("isNeedSign","false");
            }
            baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
        }
        return jsonObject;
    }
}

+ 14 - 5
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -50,10 +50,14 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.transaction.Transactional;
import java.io.IOException;
import java.io.StringReader;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
@ -2378,6 +2382,7 @@ public class XzzxEntranceService{
        String response="";
        String idCard = patientDO.getIdcard();
        String url = entranceUrl+"findPatientCard?idCard="+idCard;
        String mappingCode="";
        response = httpClientUtil.get(url,"GBK");
        JSONObject object = JSONObject.parseObject(response);
        if(object.getInteger("status")==200){
@ -2396,10 +2401,11 @@ public class XzzxEntranceService{
                }else {
                    patientMappingDO.setMappingCode(object1.getString("SICKID"));
                }
                mappingCode=object1.getString("SICKID");
                patientMappingDO = patientMappingDao.save(patientMappingDO);
            }
        }
        return patientMappingDO.getMappingCode();
        return mappingCode;
    }
    public String updatePatientMapping(String patient,String cardNo){
        BasePatientDO patientDO = patientDao.findById(patient);
@ -3066,7 +3072,7 @@ public class XzzxEntranceService{
                object1.put("pack_size",jsonObject.getString("PACK_SPEC"));
                object1.put("retprice",jsonObject.getString("RETAIL_PRICE"));
                object1.put("specification",jsonObject.getString("PHYSIC_SPEC"));
                object1.put("pack_retprice",jsonObject.getString("RETAIL_PRICE"));
                object1.put("pack_retprice",jsonObject.getString(" "));
                object1.put("stock_amount",jsonObject.getString("QUANTITY"));
                object1.put("visible_flag",jsonObject.getString("VALID_FLAG"));
                object1.put("drug_flag",jsonObject.getString("OTC_FLAG"));
@ -3076,6 +3082,11 @@ public class XzzxEntranceService{
                object1.put("weigh_unit",jsonObject.getString("DOSE_UNIT"));
                object1.put("vol_unit","");
                object1.put("mini_unit_name",jsonObject.getString("PHYSIC_UNIT"));
                DecimalFormat df =new DecimalFormat("0.00");
                Double packSize=Double.parseDouble(jsonObject.get("PACK_SPEC")==null?"1":jsonObject.getString("PACK_SPEC"));
                Double retprice=Double.parseDouble(jsonObject.get("RETAIL_PRICE")==null?"0":jsonObject.getString("RETAIL_PRICE"));
                Double miniUnitPrice=retprice/packSize;
                object1.put("mini_unit_price",df.format(miniUnitPrice));
                object1.put("pack_unit_name",jsonObject.getString("PRICE_UNIT"));
                object1.put("weigh_unit_name",jsonObject.getString("DOSE_UNIT"));
                object1.put("vol_unit_name","");
@ -3091,14 +3102,12 @@ public class XzzxEntranceService{
                object1.put("bz_usage_name",jsonObject.getString("FREQUENCY"));
                object1.put("QUANTITY",jsonObject.getString("QUANTITY"));
                object1.put("DAY_COUNT",jsonObject.getString("DAY_COUNT"));
                jsonArray.add(object1);
            }
        }
        return jsonArray;
    }
    /**
     * 查询药品用药方法
     * @param spellCode 拼音码

+ 0 - 1
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -371,7 +371,6 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
        return list.get(0);
    }
    public Boolean updatePatientPw(String id,String pw,String orgPw){
        BasePatientDO patientDO = basePatientDao.findOne(id);
        String orgPwMd5 = MD5.md5Hex(orgPw + "{" + patientDO.getSalt() + "}");

+ 1 - 1
business/base-service/src/main/java/com/yihu/jw/wechat/enterprise/EnterpriseService.java

@ -253,7 +253,7 @@ public class EnterpriseService {
    public String sendTWMes(String enterpriseId,String userId,String title,String description,String url)throws Exception{
        String mesurl = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token="+getToken(enterpriseId);
        String mesurl = "https://qyapi.weixin.qq.com/cg1-bin/message/send?access_token="+getToken(enterpriseId);
        JSONObject param = new JSONObject();
        param.put("touser",userId);

+ 2 - 1
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -3981,7 +3981,7 @@ public class ImService {
	public void doctorReplyUpdateYktState(String consult,String doctor,String wxId){
		if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
			String sql ="SELECT * FROM topics t where " +
			String sql ="SELECT * FROM im_internet_hospital.topics t where " +
					"t.id='"+consult+"' and t.reply_user='"+doctor+"' and t.reply=1 and t.status IN(0,1) ";
			List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
			logger.info("sql======"+sql);
@ -3990,6 +3990,7 @@ public class ImService {
				if (!flag){
					BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(consult);
					if (businessOrderDO!=null){
                        System.out.println("11111");
						ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"5");
					}
				}

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

@ -61,5 +61,11 @@
            <artifactId>tencentcloud-sdk-java</artifactId>
            <version>3.1.272</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-redis</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>

+ 7 - 0
common/common-entity/sql记录

@ -985,3 +985,10 @@ CREATE TABLE `base_emergency_warn_doctor_response` (
DROP TABLE IF EXISTS `base_security_monitoring_conclusion`;
DROP TABLE IF EXISTS `base_security_monitoring_order_cancel_log`;
DROP TABLE IF EXISTS `base_semoni_patient_confirm_log`;
alter table wlyy_prescription ADD disable_time timestamp ;
alter table wlyy_outpatient ADD is_agree  varchar(2);
alter table base_doctor ADD is_sign  varchar(2);
alter table base_doctor ADD last_sign_time  timestamp;

+ 28 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -6,6 +6,7 @@ import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
@ -290,7 +291,34 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    private String doctorLat;//医生当前定位地址纬度
    private String doctorLon;//医生当前定位地址经度
    private String doctorLocateAddress;//医生定位地址
    private String levelName;
    private String isSign;
    private Date lastSignTime;
    @Column(name = "is_sign")
    public String getIsSign() {
        return isSign;
    }
    public void setIsSign(String isSign) {
        this.isSign = isSign;
    }
    @Column(name = "last_sign_time")
    public Date getLastSignTime() {
        return lastSignTime;
    }
    public void setLastSignTime(Date lastSignTime) {
        this.lastSignTime = lastSignTime;
    }
    @Transient
    public String getLevelName() {
        return levelName;
    }
    public void setLevelName(String levelName) {
        this.levelName = levelName;
    }
    @Column(name = "visit_time")
    public String getVisitTime() {

+ 87 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseLinkDictDO.java

@ -0,0 +1,87 @@
package com.yihu.jw.entity.base.menu;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
@Entity
@Table(name = "base_link_dict")
public class BaseLinkDictDO extends UuidIdentityEntityWithCreateTime {
    private String name;
    private String linkUrl;
    private String isShow;
    private Integer linkSort;
    private String isDel;
    private String status;
    private String showName;
    private String statusName;
    @Transient
    public String getShowName() {
        return showName;
    }
    public void setShowName(String showName) {
        this.showName = showName;
    }
    @Transient
    public String getStatusName() {
        return statusName;
    }
    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "link_url")
    public String getLinkUrl() {
        return linkUrl;
    }
    public void setLinkUrl(String linkUrl) {
        this.linkUrl = linkUrl;
    }
    @Column(name = "is_show")
    public String getIsShow() {
        return isShow;
    }
    public void setIsShow(String isShow) {
        this.isShow = isShow;
    }
    @Column(name = "link_sort")
    public Integer getLinkSort() {
        return linkSort;
    }
    public void setLinkSort(Integer linkSort) {
        this.linkSort = linkSort;
    }
    @Column(name = "is_del")
    public String getIsDel() {
        return isDel;
    }
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }
}

+ 210 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseMenuDictDO.java

@ -0,0 +1,210 @@
package com.yihu.jw.entity.base.menu;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
@Entity
@Table(name = "base_menu_dict")
public class BaseMenuDictDO extends UuidIdentityEntityWithOperator {
    private String parentId;
    private String name;
    private Integer menuSort;
    private String icon;
    private String url;
    private String isShow;
    private Integer status;
    private String remark;
    private Integer menuLevel;
    private String functionType;
    private String menuLocation;
    private String menuImg;
    private String functionName;
    private String locaTionName;
    private String showName;
    private String statusName;
    private String parentName;
    private String isDel;
    private String bgImg;
    private String menuTitle;
    private String describtion;
    @Column(name = "bg_img")
    public String getBgImg() {
        return bgImg;
    }
    public void setBgImg(String bgImg) {
        this.bgImg = bgImg;
    }
    @Column(name = "menu_title")
    public String getMenuTitle() {
        return menuTitle;
    }
    public void setMenuTitle(String menuTitle) {
        this.menuTitle = menuTitle;
    }
    @Column(name = "describtion")
    public String getDescribtion() {
        return describtion;
    }
    public void setDescribtion(String describtion) {
        this.describtion = describtion;
    }
    public String getIsDel() {
        return isDel;
    }
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }
    @Transient
    public String getParentName() {
        return parentName;
    }
    public void setParentName(String parentName) {
        this.parentName = parentName;
    }
    @Transient
    public String getFunctionName() {
        return functionName;
    }
    public void setFunctionName(String functionName) {
        this.functionName = functionName;
    }
    @Transient
    public String getLocaTionName() {
        return locaTionName;
    }
    public void setLocaTionName(String locaTionName) {
        this.locaTionName = locaTionName;
    }
    @Transient
    public String getShowName() {
        return showName;
    }
    public void setShowName(String showName) {
        this.showName = showName;
    }
    @Transient
    public String getStatusName() {
        return statusName;
    }
    public void setStatusName(String statusName) {
        this.statusName = statusName;
    }
    @Column(name = "parent_id")
    public String getParentId() {
        return parentId;
    }
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "menu_sort")
    public Integer getMenuSort() {
        return menuSort;
    }
    public void setMenuSort(Integer menuSort) {
        this.menuSort = menuSort;
    }
    @Column(name = "icon")
    public String getIcon() {
        return icon;
    }
    public void setIcon(String icon) {
        this.icon = icon;
    }
    @Column(name = "url")
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    @Column(name = "is_show")
    public String getIsShow() {
        return isShow;
    }
    public void setIsShow(String isShow) {
        this.isShow = isShow;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "menu_level")
    public Integer getMenuLevel() {
        return menuLevel;
    }
    public void setMenuLevel(Integer menuLevel) {
        this.menuLevel = menuLevel;
    }
    @Column(name = "function_type")
    public String getFunctionType() {
        return functionType;
    }
    public void setFunctionType(String functionType) {
        this.functionType = functionType;
    }
    @Column(name = "menu_location")
    public String getMenuLocation() {
        return menuLocation;
    }
    public void setMenuLocation(String menuLocation) {
        this.menuLocation = menuLocation;
    }
    @Column(name = "menu_img")
    public String getMenuImg() {
        return menuImg;
    }
    public void setMenuImg(String menuImg) {
        this.menuImg = menuImg;
    }
}

+ 86 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/menu/BaseMenuShowDO.java

@ -0,0 +1,86 @@
package com.yihu.jw.entity.base.menu;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "base_menu_show")
public class BaseMenuShowDO extends UuidIdentityEntityWithCreateTime {
    private String modelId;
    private String modelName;
    private String menuId;
    private String menuName;
    private String isDel;
    private Integer menuSort;
    private String styleCode;
    private String styleName;
    @Column(name = "model_id")
    public String getModelId() {
        return modelId;
    }
    public void setModelId(String modelId) {
        this.modelId = modelId;
    }
    @Column(name = "model_name")
    public String getModelName() {
        return modelName;
    }
    public void setModelName(String modelName) {
        this.modelName = modelName;
    }
    @Column(name = "menu_id")
    public String getMenuId() {
        return menuId;
    }
    public void setMenuId(String menuId) {
        this.menuId = menuId;
    }
    @Column(name = "menu_name")
    public String getMenuName() {
        return menuName;
    }
    public void setMenuName(String menuName) {
        this.menuName = menuName;
    }
    @Column(name = "is_del")
    public String getIsDel() {
        return isDel;
    }
    public void setIsDel(String isDel) {
        this.isDel = isDel;
    }
    @Column(name = "menu_sort")
    public Integer getMenuSort() {
        return menuSort;
    }
    public void setMenuSort(Integer menuSort) {
        this.menuSort = menuSort;
    }
    @Column(name = "style_code")
    public String getStyleCode() {
        return styleCode;
    }
    public void setStyleCode(String styleCode) {
        this.styleCode = styleCode;
    }
    @Column(name = "style_name")
    public String getStyleName() {
        return styleName;
    }
    public void setStyleName(String styleName) {
        this.styleName = styleName;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/SaasTypeModuleDO.java

@ -145,7 +145,7 @@ public class SaasTypeModuleDO extends UuidIdentityEntityWithOperator {
		this.isMust = isMust;
	}
	@Column(name = "level")
	@Column(name = "saas_level")
	public Integer getLevel() {
		return level;
	}

+ 309 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDictDO.java

@ -0,0 +1,309 @@
package com.yihu.jw.entity.hospital.article;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
/**
 * 健康文章
 * @author huangwenjie
 * @date 2019/9/10 13:58
 */
@Entity
@Table(name = "wlyy_knowledge_article_dict")
public class KnowledgeArticleDictDO extends UuidIdentityEntity {
	
	private String createUser; // 创建人
	private String createUserName; // 创建人
	private String createUserDept; // 创建人科室CODE
	private String createUserDeptName; // 创建人科室名称
	private String title;   // 文章标题
	private String categoryFirst;    // 1级分类标识
	private String categoryFirstName;    // 1级分类标识
	private String categorySecond;    // 2级分类标识
	private String categorySecondName;    // 2级分类标识
	private String content; // 文章内容
	private String source;  // 文章来源--客服
	private String image;   // 封面图片
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date createTime;  // 添加时间
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date updateTime;  // 编辑时间
	private Integer del; // 是否删除,1正常,0删除
	private Integer status;// 0未审核 1已审核
	private String cancelReason;//退回理由
	private Integer used;//常用数
	private Integer readCount;//已读数
	private Integer collection;//收藏数量
	private Integer fabulous;//点赞数量
	@Column(name = "is_share")
	private Integer share;//分享 数量
	private String intro;//简介
	@Transient
	private Integer isUsed;//是否已设置常用
	@Transient
	private KnowledgeArticleUserDO knowledgeArticleUserDO;
	@Transient
	private String deptName;
	@Transient
	private String hospitalName;
	private Date checkTime;
	private Integer releaseStatus;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date releaseTime;
	@Column(name = "release_time")
	public Date getReleaseTime() {
		return releaseTime;
	}
	public void setReleaseTime(Date releaseTime) {
		this.releaseTime = releaseTime;
	}
	@Column(name = "check_time")
	public Date getCheckTime() {
		return checkTime;
	}
	public void setCheckTime(Date checkTime) {
		this.checkTime = checkTime;
	}
	@Column(name = "release_status")
	public Integer getReleaseStatus() {
		return releaseStatus;
	}
	public void setReleaseStatus(Integer releaseStatus) {
		this.releaseStatus = releaseStatus;
	}
	public String getCreateUser() {
		return createUser;
	}
	
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	
	public String getTitle() {
		return title;
	}
	
	public void setTitle(String title) {
		this.title = title;
	}
	
	public String getCategoryFirst() {
		return categoryFirst;
	}
	
	public void setCategoryFirst(String categoryFirst) {
		this.categoryFirst = categoryFirst;
	}
	
	public String getCategorySecond() {
		return categorySecond;
	}
	
	public void setCategorySecond(String categorySecond) {
		this.categorySecond = categorySecond;
	}
	
	public String getContent() {
		return content;
	}
	
	public void setContent(String content) {
		this.content = content;
	}
	
	public String getSource() {
		return source;
	}
	
	public void setSource(String source) {
		this.source = source;
	}
	
	public String getImage() {
		return image;
	}
	
	public void setImage(String image) {
		this.image = image;
	}
	
	public Date getCreateTime() {
		return createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	public Date getUpdateTime() {
		return updateTime;
	}
	
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	
	public Integer getDel() {
		return del;
	}
	
	public void setDel(Integer del) {
		this.del = del;
	}
	
	public Integer getStatus() {
		return status;
	}
	
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	public String getCancelReason() {
		return cancelReason;
	}
	
	public void setCancelReason(String cancelReason) {
		this.cancelReason = cancelReason;
	}
	
	public String getCreateUserName() {
		return createUserName;
	}
	
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	
	public String getCategoryFirstName() {
		return categoryFirstName;
	}
	
	public void setCategoryFirstName(String categoryFirstName) {
		this.categoryFirstName = categoryFirstName;
	}
	
	public String getCategorySecondName() {
		return categorySecondName;
	}
	
	public void setCategorySecondName(String categorySecondName) {
		this.categorySecondName = categorySecondName;
	}
	
	public String getCreateUserDept() {
		return createUserDept;
	}
	
	public void setCreateUserDept(String createUserDept) {
		this.createUserDept = createUserDept;
	}
	
	public String getCreateUserDeptName() {
		return createUserDeptName;
	}
	
	public void setCreateUserDeptName(String createUserDeptName) {
		this.createUserDeptName = createUserDeptName;
	}
	public Integer getUsed() {
		return used;
	}
	public void setUsed(Integer used) {
		this.used = used;
	}
	@Transient
	public String getDeptName() {
		return deptName;
	}
	public void setDeptName(String deptName) {
		this.deptName = deptName;
	}
	@Transient
	public String getHospitalName() {
		return hospitalName;
	}
	public void setHospitalName(String hospitalName) {
		this.hospitalName = hospitalName;
	}
	public Integer getCollection() {
		return collection;
	}
	public void setCollection(Integer collection) {
		this.collection = collection;
	}
	public Integer getFabulous() {
		return fabulous;
	}
	public void setFabulous(Integer fabulous) {
		this.fabulous = fabulous;
	}
	@Column(name = "is_share")
	public Integer getShare() {
		return share;
	}
	public void setShare(Integer share) {
		this.share = share;
	}
	public Integer getReadCount() {
		return readCount;
	}
	public void setReadCount(Integer readCount) {
		this.readCount = readCount;
	}
	@Transient
	public Integer getIsUsed() {
		return isUsed;
	}
	public void setIsUsed(Integer isUsed) {
		this.isUsed = isUsed;
	}
	@Transient
	public KnowledgeArticleUserDO getKnowledgeArticleUserDO() {
		return knowledgeArticleUserDO;
	}
	public void setKnowledgeArticleUserDO(KnowledgeArticleUserDO knowledgeArticleUserDO) {
		this.knowledgeArticleUserDO = knowledgeArticleUserDO;
	}
	public String getIntro() {
		return intro;
	}
	public void setIntro(String intro) {
		this.intro = intro;
	}
}

+ 55 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleMenuDO.java

@ -0,0 +1,55 @@
package com.yihu.jw.entity.hospital.article;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 健康文章部门关系表
 * @author huangwenjie
 * @date 2019/9/18 10:00
 */
@Entity
@Table(name = "wlyy_knowledge_article_menu")
public class KnowledgeArticleMenuDO extends UuidIdentityEntity {
	
	/**
	 * 文章ID
	 */
	private String articleId;
	
	/**
	 * 菜单id
	 */
	private String menuId;
	
	/**
	 * 菜单名称
	 */
	private String menuName;
	public String getArticleId() {
		return articleId;
	}
	public void setArticleId(String articleId) {
		this.articleId = articleId;
	}
	public String getMenuId() {
		return menuId;
	}
	public void setMenuId(String menuId) {
		this.menuId = menuId;
	}
	public String getMenuName() {
		return menuName;
	}
	public void setMenuName(String menuName) {
		this.menuName = menuName;
	}
}

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

@ -287,6 +287,18 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
     * 上次提醒时间
     */
    private Date lastRemindTime;
    /**
     * 是否同意查看就诊记录1已同意0未同意
     */
    private String isAgree;
    @Column(name = "is_agree")
    public String getIsAgree() {
        return isAgree;
    }
    public void setIsAgree(String isAgree) {
        this.isAgree = isAgree;
    }
    @Column(name = "last_remind_time")
    public Date getLastRemindTime() {
        return lastRemindTime;

+ 1 - 1
common/common-fegin/src/main/java/com/yihu/jw/fegin/base/wx/GraphicMessageFeign.java

@ -3,7 +3,7 @@ package com.yihu.jw.fegin.base.wx;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.fegin.fallbackfactory.base.wx.GraphicMessageFeignFallbackFactory;
import com.yihu.jw.common.CommonContants;
import com.yihu.jw.restmodel.web.MixEnvelop;;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.base.WechatRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;

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

@ -208,6 +208,58 @@ public class BaseRequestMapping {
        public static final String findLoginRoleMenuTree  = "/findLoginRoleMenuTree";
    }
    /**
     * 首页菜单字典
     */
    public static class MenuDict extends Basic {
        public static final String PREFIX  = "/baseMenuDict";
        public static final String createMenuDict  = "/createMenuDict";
        public static final String STATUS  = "/status";
        public static final String MOVE_UP  = "/moveUp";
        public static final String MOVE_DOWN  = "/moveDown";
        public static final String findOneMenuDict  = "/findOneMenuDict";
        public static final String deleteMenuDict  = "/deleteMenuDict";
    }
    /**
     * 首页菜单免登录
     */
    public static class MenuNologin extends Basic {
        public static final String PREFIX  = "/open/noLogin";
        public static final String findAllMenu  = "/findAllMenu";
        public static final String findMenuByParentId  = "/findMenuByParentId";
        public static final String findArticleByMenuId= "/findArticleByMenuId";
    }
    /**
     * 友情链接
     */
    public static class LinkDict extends Basic {
        public static final String PREFIX  = "/baseLinkDict";
        public static final String createLinkDict = "/createLinkDict";
        public static final String linkStatus  = "/linkStatus";
        public static final String linkShow  = "/linkShow";
        public static final String MOVELinkUP  = "/moveLinkUp";
        public static final String MOVELinkDOWN  = "/moveLinkDown";
        public static final String findLinkDictALL  = "/findLinkDictALL";
        public static final String findOneLink  = "/findOneLink";
        public static final String deleteLink  = "/deleteLink";
    }
    /**
     * 首页菜单
     */
    public static class MenuShow extends Basic {
        public static final String PREFIX  = "/baseLinkDict";
        public static final String createMenuShow = "/createMenuShow";
        public static final String menuShowstatus  = "/menuShowstatus";
        public static final String MOVEMenuShowUP  = "/moveMenuShowUp";
        public static final String MOVEMenuShowDOWN  = "/moveMenuShowDown";
        public static final String findMenuShow  = "/findMenuShow";
        public static final String findMenuShowDict  = "/findMenuShowDict";
        public static final String findRoleMenuTree  = "/findRoleMenuTree";
        public static final String findLoginRoleMenuTree  = "/findLoginRoleMenuTree";
    }
    /**
     * 错误码
     */
@ -406,6 +458,7 @@ public class BaseRequestMapping {
    public static class BaseDoctor extends Basic {
            public static final String PREFIX  = "/baseDoctor";
        public static final String DOCINFO  = "/docInfo";
        public static final String CREATE  = "/create";
        public static final String getOrgListByTown  = "/getOrgListByTown";
        public static final String enableOrDis  = "/enableOrDis";
        public static final String docFullInfo  = "/docFullInfo";

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

@ -1143,7 +1143,8 @@ public class BaseHospitalRequestMapping {
        public static final String PREFIX  = "/article";
        //获取文章列表
        public static final String searchKnowledgePageList  = "/searchKnowledgePageList";
        
        //获取文章列表
        public static final String searchKnowledgeList  = "/searchKnowledgeList";
        //获取我的文章列表
        public static final String searchMyPageList  = "/searchMyPageList";
    

+ 4 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/exception/dao/BaseExceptionServerDictDao.java

@ -5,7 +5,11 @@ 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 BaseExceptionServerDictDao extends PagingAndSortingRepository<BaseExceptionServerDictDO, String>, JpaSpecificationExecutor<BaseExceptionServerDictDO> {
    @Query("from BaseExceptionServerDictDO t where t.isDel='1' and t.path=?1")
    BaseExceptionServerDictDO findServiceByPath(String path);
    @Query("from BaseExceptionServerDictDO t where t.isDel='1'")
    List<BaseExceptionServerDictDO> findServiceAll();
}

+ 6 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/ListEnvelop.java

@ -49,4 +49,10 @@ public class ListEnvelop<T> extends Envelop {
        envelop.setStatus(-1);
        return envelop;
    }
    public static ListEnvelop getCodeError(String message,Integer code) {
        ListEnvelop envelop = new ListEnvelop();
        envelop.setMessage(message);
        envelop.setStatus(code);
        return envelop;
    }
}

+ 5 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/PageEnvelop.java

@ -1,8 +1,11 @@
package com.yihu.jw.restmodel.web;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.entity.base.dict.BaseExceptionDictDO;
import com.yihu.jw.restmodel.exception.dao.BaseExceptionDictDao;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.Serializable;
import java.util.ArrayList;
@ -27,7 +30,8 @@ import java.util.List;
public class PageEnvelop<T> extends Envelop implements Serializable {
    private static final long serialVersionUID = 2076324875575488461L;
    @Autowired
    protected BaseExceptionDictDao baseExceptionDictDao;
    @ApiModelProperty(value = "当前页", example = "1")
    private int currPage = 1;

+ 42 - 3
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/endpoint/EnvelopRestEndpoint.java

@ -201,9 +201,19 @@ public abstract class EnvelopRestEndpoint extends Exception {
    protected Envelop failed (String message) {
        return failed(message, -10000);
    }
    public PageEnvelop failedPageEnvelopException(Exception e){
        System.out.println(e.getClass());
        BaseExceptionDictDO baseExceptionDictDO =baseExceptionDictDao.findByExceptionInfo(e.getClass().toString());
        if (baseExceptionDictDO!=null){
            e.printStackTrace();
            return PageEnvelop.getError(baseExceptionDictDO.getRemindContent(),Integer.parseInt(baseExceptionDictDO.getCode()));
        }else {
            return PageEnvelop.getError(e.getMessage(),-10000);
        }
    }
    protected Envelop failedException(Exception e){
        BaseExceptionDictDO baseExceptionDictDO =baseExceptionDictDao.findByExceptionInfo(DataAccessException.class.toString());
        System.out.println(e.getClass());
        BaseExceptionDictDO baseExceptionDictDO =baseExceptionDictDao.findByExceptionInfo(e.getClass().toString());
        if (baseExceptionDictDO!=null){
            e.printStackTrace();
            return failed(baseExceptionDictDO.getRemindContent(),Integer.parseInt(baseExceptionDictDO.getCode()));
@ -256,7 +266,36 @@ public abstract class EnvelopRestEndpoint extends Exception {
            return null;
        }*/
    }
    protected MixEnvelop failedMixEnvelopException(Exception e){
        System.out.println(e.getClass());
        BaseExceptionDictDO baseExceptionDictDO =baseExceptionDictDao.findByExceptionInfo(e.getClass().toString());
        if (baseExceptionDictDO!=null){
            e.printStackTrace();
            return MixEnvelop.getError(baseExceptionDictDO.getRemindContent(),Integer.parseInt(baseExceptionDictDO.getCode()));
        }else {
            return MixEnvelop.getError(e.getMessage(),-10000);
        }
    }
    protected ListEnvelop failedListEnvelopException(Exception e){
        System.out.println(e.getClass());
        BaseExceptionDictDO baseExceptionDictDO =baseExceptionDictDao.findByExceptionInfo(e.getClass().toString());
        if (baseExceptionDictDO!=null){
            e.printStackTrace();
            return ListEnvelop.getCodeError(baseExceptionDictDO.getRemindContent(),Integer.parseInt(baseExceptionDictDO.getCode()));
        }else {
            return ListEnvelop.getCodeError(e.getMessage(),-10000);
        }
    }
    protected ObjEnvelop failedObjEnvelopException(Exception e){
        System.out.println(e.getClass());
        BaseExceptionDictDO baseExceptionDictDO =baseExceptionDictDao.findByExceptionInfo(e.getClass().toString());
        if (baseExceptionDictDO!=null){
            e.printStackTrace();
            return ObjEnvelop.getError(baseExceptionDictDO.getRemindContent(),Integer.parseInt(baseExceptionDictDO.getCode()));
        }else {
            return ObjEnvelop.getError(e.getMessage(),-10000);
        }
    }
    protected Envelop failed (String message, int status) {
        Envelop envelop = new Envelop();
        envelop.setMessage(message);

+ 4 - 7
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionDictDao.java

@ -1,14 +1,11 @@
package com.yihu.jw.gateway.methlog.dao;
package com.yihu.jw.util.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
public interface BaseExceptionDictDao  extends PagingAndSortingRepository<BaseExceptionDictDO, String>, JpaSpecificationExecutor<BaseExceptionDictDO> {
    @Query("from BaseExceptionDictDO  t where t.isDel='1' and t.code=?1")
    List<Map<String,Object>> findByCode(String code);
public interface BaseExceptionDictUtilDao extends PagingAndSortingRepository<BaseExceptionDictDO, String>, JpaSpecificationExecutor<BaseExceptionDictDO> {
    @Query("from BaseExceptionDictDO  t where t.isDel='1' and t.exceptionInfo=?1")
    BaseExceptionDictDO findByExceptionInfo(String exceptionInfo);
}

+ 2 - 2
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionLogDao.java

@ -1,8 +1,8 @@
package com.yihu.jw.gateway.methlog.dao;
package com.yihu.jw.util.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseExceptionLogDao extends PagingAndSortingRepository<BaseExceptionLogDO, String>, JpaSpecificationExecutor<BaseExceptionLogDO> {
public interface BaseExceptionLogUtilDao extends PagingAndSortingRepository<BaseExceptionLogDO, String>, JpaSpecificationExecutor<BaseExceptionLogDO> {
}

+ 18 - 0
common/common-util/src/main/java/com/yihu/jw/util/dao/BaseExceptionServerDictUtilDao.java

@ -0,0 +1,18 @@
package com.yihu.jw.util.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionServerDictDO;
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 BaseExceptionServerDictUtilDao extends PagingAndSortingRepository<BaseExceptionServerDictDO, String>, JpaSpecificationExecutor<BaseExceptionServerDictDO> {
    @Query("from BaseExceptionServerDictDO t where t.isDel='1' and t.path=?1")
    BaseExceptionServerDictDO findServiceByPath(String path);
    @Query("from BaseExceptionServerDictDO t where t.isDel='1'")
    List<BaseExceptionServerDictDO> findServiceAll();
    @Query("from BaseExceptionServerDictDO t where t.isDel='1' and t.name=?1")
    BaseExceptionServerDictDO findServiceByName(String name);
}

+ 57 - 4
common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientUtil.java

@ -1,6 +1,12 @@
package com.yihu.jw.util.http;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.dict.BaseExceptionDictDO;
import com.yihu.jw.entity.base.dict.BaseExceptionLogDO;
import com.yihu.jw.entity.base.dict.BaseExceptionServerDictDO;
import com.yihu.jw.util.dao.BaseExceptionDictUtilDao;
import com.yihu.jw.util.dao.BaseExceptionLogUtilDao;
import com.yihu.jw.util.dao.BaseExceptionServerDictUtilDao;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
@ -14,23 +20,58 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
@Component
@Transactional(propagation= Propagation.NOT_SUPPORTED)
public class HttpClientUtil {
    @Autowired
    private BaseExceptionDictUtilDao baseExceptionDictUtilDao;
    @Autowired
    private BaseExceptionLogUtilDao baseExceptionLogUtilDao;
    @Autowired
    private BaseExceptionServerDictUtilDao baseExceptionServerDictUtilDao;
    @Value("${spring.application.name}")
    private String serverName;
    public  void saveExceptionLog(Exception e,String request,String response){
        BaseExceptionDictDO baseExceptionDictDO = baseExceptionDictUtilDao.findByExceptionInfo(e.getClass().toString());
        BaseExceptionLogDO baseExceptionLogDO = new BaseExceptionLogDO();
        BaseExceptionServerDictDO baseExceptionServerDictDO = baseExceptionServerDictUtilDao.findServiceByName(serverName);
        baseExceptionLogDO.setRequest(request);
        baseExceptionLogDO.setResponse(response);
        if (baseExceptionDictDO!=null){
            if (baseExceptionServerDictDO!=null){
                baseExceptionLogDO.setServiceCode(baseExceptionServerDictDO.getId());
                baseExceptionLogDO.setExceptionCode(baseExceptionServerDictDO.getId()+baseExceptionDictDO.getCode());
                baseExceptionLogDO.setExceptionType(baseExceptionDictDO.getExceptionType());
            }
            baseExceptionLogDO.setCreateTime(new Date());
        }else {
            baseExceptionLogDO.setExceptionCode(e.getCause().toString());
            baseExceptionLogDO.setCreateTime(new Date());
            if (baseExceptionServerDictDO!=null){
                baseExceptionLogDO.setServiceCode(baseExceptionServerDictDO.getId());
            }
        }
        baseExceptionLogDO = baseExceptionLogUtilDao.save(baseExceptionLogDO);
        System.out.println("saveSuccess");
    }
    /**
     * 发送post请求
     *
@ -99,10 +140,16 @@ public class HttpClientUtil {
                response.close();
            }
        } catch (ClientProtocolException e) {
            System.out.println(e.getClass()+"1");
            e.printStackTrace();
            saveExceptionLog(e,url,e.getMessage());
        } catch (ParseException e) {
            System.out.println(e.getClass()+"2");
            saveExceptionLog(e,url,e.getMessage());
            e.printStackTrace();
        } catch (IOException e) {
            System.out.println(e.getClass()+"3");
            saveExceptionLog(e,url,e.getMessage());
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
@ -134,10 +181,13 @@ public class HttpClientUtil {
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
            saveExceptionLog(e,url,e.getMessage());
        } catch (ParseException e) {
            e.printStackTrace();
            saveExceptionLog(e,url,e.getMessage());
        } catch (IOException e) {
            e.printStackTrace();
            saveExceptionLog(e,url,e.getMessage());
        } finally {
            // 关闭连接,释放资源
            try {
@ -333,10 +383,13 @@ public class HttpClientUtil {
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
            saveExceptionLog(e,url,e.getMessage());
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
            saveExceptionLog(e1,url,e1.getMessage());
        } catch (IOException e) {
            e.printStackTrace();
            saveExceptionLog(e,url,e.getMessage());
        } finally {
            // 关闭连接,释放资源
            try {

+ 1 - 8
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/DidiFilterProcessor.java

@ -7,20 +7,13 @@ import com.netflix.zuul.exception.ZuulException;
import com.yihu.jw.entity.base.dict.BaseExceptionLogDO;
import com.yihu.jw.gateway.AesEncryptUtils;
import com.yihu.jw.gateway.methlog.BaseExceptionService;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionDictDao;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionLogDao;
import com.yihu.jw.gateway.methlog.dao.BaseExceptionServerDictDao;
import com.yihu.jw.gateway.security.BeanUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.yihu.jw.restmodel.exception.dao.BaseExceptionLogDao;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.util.StreamUtils;
import org.springframework.util.StringUtils;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

+ 53 - 1
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/PostFilter.java

@ -1,9 +1,19 @@
package com.yihu.jw.gateway.filter;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.yihu.jw.entity.base.dict.BaseExceptionLogDO;
import com.yihu.jw.entity.base.dict.BaseExceptionServerDictDO;
import com.yihu.jw.gateway.AesEncryptUtils;
import com.yihu.jw.gateway.methlog.BaseExceptionService;
import com.yihu.jw.gateway.security.BeanUtil;
import com.yihu.jw.restmodel.exception.dao.BaseExceptionLogDao;
import com.yihu.jw.restmodel.exception.dao.BaseExceptionServerDictDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@ -11,8 +21,13 @@ import org.springframework.util.StreamUtils;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.zip.GZIPInputStream;
@Component
public class PostFilter extends ZuulFilter {
 
@ -35,10 +50,12 @@ public class PostFilter extends ZuulFilter {
        //是否执行该过滤器,true代表需要过滤
        return true;
    }
 
    @Override
    public Object run() {
        RequestContext ctx = RequestContext.getCurrentContext();
        BaseExceptionServerDictDao baseExceptionServiceDictDao = BeanUtil.getBean(BaseExceptionServerDictDao.class);
        BaseExceptionLogDao baseExceptionLogDao = BeanUtil.getBean(BaseExceptionLogDao.class);
        BaseExceptionService baseExceptionService = BeanUtil.getBean(BaseExceptionService.class);
        logger.info("进入post过滤器");
        HttpServletRequest request = ctx.getRequest();
        String url = request.getRequestURI();
@ -56,6 +73,41 @@ public class PostFilter extends ZuulFilter {
            bytes = StreamUtils.copyToByteArray(stream);
        }
        String body = new String(bytes,"UTF8");
        String serviceId="";
        String responseCode="";
        String exceptionType="";
        List<BaseExceptionServerDictDO> baseExceptionServerDictDOS =baseExceptionServiceDictDao.findServiceAll();
        for (BaseExceptionServerDictDO baseExceptionServerDictDO:baseExceptionServerDictDOS){
            if (url.contains(baseExceptionServerDictDO.getPath())){
                serviceId=baseExceptionServerDictDO.getId();
                break;
            }
        }
        net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(body);
        String status =jsonObject.getString("status");
        if (!"200".equalsIgnoreCase(status)){
            jsonObject.put("status",serviceId+status);
            BaseExceptionLogDO baseExceptionLogDO = new BaseExceptionLogDO();
            baseExceptionLogDO.setCreateTime(new Date());
            List<Map<String,Object>> list = baseExceptionService.findExceptionDict("",status,"","1");
            if (list!=null&&list.size()>0){
                responseCode=serviceId+list.get(0).get("code").toString();
                exceptionType = list.get(0).get("exceptionType").toString();
                baseExceptionLogDO.setExceptionType(exceptionType);
                baseExceptionLogDO.setServiceCode(serviceId);
                baseExceptionLogDO.setExceptionCode(responseCode);
                try {
                    String  in = ctx.getRequest().getParameter("object");
                    String jsonobject = AesEncryptUtils.decrypt(in);
                    baseExceptionLogDO.setRequest(jsonobject);
                    baseExceptionLogDO.setResponse(jsonObject.toString());
                    baseExceptionLogDao.save(baseExceptionLogDO);
                }catch (Exception s){
                    s.printStackTrace();
                }
            }
        }
        JSONObject object = new JSONObject();
        object.put("status","200");
        object.put("data", AesEncryptUtils.encrypt(body));

+ 1 - 0
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/BaseExceptionService.java

@ -1,6 +1,7 @@
package com.yihu.jw.gateway.methlog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

+ 0 - 11
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/methlog/dao/BaseExceptionServerDictDao.java

@ -1,11 +0,0 @@
package com.yihu.jw.gateway.methlog.dao;
import com.yihu.jw.entity.base.dict.BaseExceptionServerDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface BaseExceptionServerDictDao extends PagingAndSortingRepository<BaseExceptionServerDictDO, String>, JpaSpecificationExecutor<BaseExceptionServerDictDO> {
    @Query("from BaseExceptionServerDictDO t where t.isDel='1' and t.path=?1")
    BaseExceptionServerDictDO findServiceByPath(String path);
}

+ 0 - 6
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -296,12 +296,6 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    }
    public static void main(String[] args) throws Exception{
        String encodedText = "OiF6sj1G11jLgHrvgPVUilE9IGeqgNZs2EFh%2FiCyFd9uhZqC5vl%2BwyrVXVM9jAEgRvxbi3jYK%2BmFvmRa5s1EQg%3D%3D";
        encodedText = URLDecoder.decode(encodedText,"utf-8");
        String str =  AES.decrypt("3bdc154ed1e44a9c9f44451a16d8e0aa",encodedText);
        System.out.println(str);
    }
    /**
     * 单点登陆第二步 - token验证

+ 19 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/article/KnowledgeArticleDeptDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.base.dao.article;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDeptDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 健康文章部门关系DAO
 * @author huangwenjie
 * @date 2019/9/18 10:03
 */
public interface KnowledgeArticleDeptDao extends PagingAndSortingRepository<KnowledgeArticleDeptDO, String>, JpaSpecificationExecutor<KnowledgeArticleDeptDO> {
	
	List<KnowledgeArticleDeptDO> findByArticleId(String articleId);
	
	List<KnowledgeArticleDeptDO> findByDept(String dept);
}

+ 40 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/article/KnowledgeArticleDictDao.java

@ -0,0 +1,40 @@
package com.yihu.jw.base.dao.article;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 健康文章DAO
 * @author huangwenjie
 * @date 2019/9/10 14:07
 */
public interface KnowledgeArticleDictDao extends PagingAndSortingRepository<KnowledgeArticleDictDO, String>, JpaSpecificationExecutor<KnowledgeArticleDictDO> {
	@Query("select a from KnowledgeArticleDictDO a where a.del=1 and (categoryFirst = ?1 or categorySecond=?1)")
	List<KnowledgeArticleDictDO> findByCategory(String category);
	@Query("select a from KnowledgeArticleDictDO a where a.del=1 and categoryFirst = ?1 ")
	List<KnowledgeArticleDictDO> findByCategoryFirst(String category);
	@Query("select a from KnowledgeArticleDictDO a where a.del=1 and  categorySecond=?1")
	List<KnowledgeArticleDictDO> findByCategorySecond(String category);
	@Query("select a from KnowledgeArticleDictDO a where a.del=1 and a.id=?1")
	KnowledgeArticleDictDO findByIdAndDel(String id);
	@Query("select count(*) from KnowledgeArticleDictDO a where a.del=1 and a.categoryFirst = ?1 and a.releaseStatus=1 ")
	Integer getCountByCategoryFirst(String category);
	@Query(" select count(*) from KnowledgeArticleDictDO a where a.del=1 and  a.categorySecond=?1 and a.releaseStatus=1")
	Integer getCountByCategorySecond(String category);
	@Query("select a from KnowledgeArticleDictDO a where a.del=1 and  a.categorySecond=?1 and a.releaseStatus=1")
	List<KnowledgeArticleDictDO> findByCategorySecondAndPage(String category,Pageable pageRequest);
}

+ 22 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/article/KnowledgeArticleMenuDao.java

@ -0,0 +1,22 @@
package com.yihu.jw.base.dao.article;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDeptDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleMenuDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 健康文章部门关系DAO
 * @author huangwenjie
 * @date 2019/9/18 10:03
 */
public interface KnowledgeArticleMenuDao extends PagingAndSortingRepository<KnowledgeArticleMenuDO, String>, JpaSpecificationExecutor<KnowledgeArticleMenuDO> {
	
	List<KnowledgeArticleMenuDO> findByArticleId(String articleId);
	
	List<KnowledgeArticleMenuDO> findByMenuId(String menuId);
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/article/KnowledgeArticleUserDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.dao.article;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 健康文章中间库DAO
 * @author
 * @date 2019/9/10 14:07
 */
public interface KnowledgeArticleUserDao extends PagingAndSortingRepository<KnowledgeArticleUserDO, String>, JpaSpecificationExecutor<KnowledgeArticleUserDO> {
	@Query("select a from KnowledgeArticleUserDO a where a.del=1 and a.relationCode=?1 and a.user=?2")
	KnowledgeArticleUserDO findByrelationCodeAndUserAndDel(String relationCode, String user);
}

+ 17 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/article/KnowledgeCategoryDao.java

@ -0,0 +1,17 @@
package com.yihu.jw.base.dao.article;
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
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;
/**
 * 健康文章分类
 * @author huangwenjie
 */
public interface KnowledgeCategoryDao extends PagingAndSortingRepository<KnowledgeCategoryDO, String>, JpaSpecificationExecutor<KnowledgeCategoryDO> {
	@Query("update KnowledgeCategoryDO c set c.del = 0 where c.id = ?1")
	@Modifying
	void updateDel(String id);
}

+ 27 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/menu/BaseLinkDictDao.java

@ -0,0 +1,27 @@
package com.yihu.jw.base.dao.menu;
import com.yihu.jw.entity.base.menu.BaseLinkDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuDictDO;
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;
public interface BaseLinkDictDao extends PagingAndSortingRepository<BaseLinkDictDO, String>, JpaSpecificationExecutor<BaseLinkDictDO> {
    @Query( value = "select max(t.link_sort) AS \"zuida\" from base_link_dict t where t.is_del='1'",nativeQuery = true)
    Integer getMaxSort();
    @Query( value = "select min(t.link_sort) AS \"zuixiao\" from base_link_dict t  where t.is_del='1'",nativeQuery = true)
    Integer getMinSort();
    @Modifying
    @Query("update BaseLinkDictDO p set p.status=?2 where p.id=?1")
    void updateStatus(String id,String status);
    @Modifying
    @Query("update BaseLinkDictDO p set p.isShow=?2 where p.id=?1")
    void updateShow(String id,String status);
    @Modifying
    @Query("update BaseLinkDictDO p set p.isDel=?2 where p.id=?1")
    void updateDel(String id,String status);
}

+ 23 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/menu/BaseMenuDictDao.java

@ -0,0 +1,23 @@
package com.yihu.jw.base.dao.menu;
import com.yihu.jw.entity.base.menu.BaseMenuDictDO;
import com.yihu.jw.entity.base.role.MenuDO;
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 java.util.List;
public interface BaseMenuDictDao extends PagingAndSortingRepository<BaseMenuDictDO, String>, JpaSpecificationExecutor<BaseMenuDictDO> {
    @Query( value = "select max(t.menu_sort) AS \"zuida\" from base_menu_dict t where t.parent_id=?1 and t.is_del='1'",nativeQuery = true)
    Integer getMaxSort(String parentId);
    @Query( value = "select min(t.menu_sort) AS \"zuixiao\" from base_menu_dict t where t.parent_id=?1 and t.is_del='1'",nativeQuery = true)
    Integer getMinSort(String parentId);
    @Modifying
    @Query("update BaseMenuDictDO p set p.status=?2 where p.id=?1")
    void updateStatus(String id,Integer status);
    @Query("from BaseMenuDictDO p where p.parentId=?1 and p.isDel='1'")
    List<BaseMenuDictDO> findByParentId(String parentId);
}

+ 18 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/menu/BaseMenuShowDao.java

@ -0,0 +1,18 @@
package com.yihu.jw.base.dao.menu;
import com.yihu.jw.entity.base.menu.BaseMenuDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuShowDO;
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;
public interface BaseMenuShowDao  extends PagingAndSortingRepository<BaseMenuShowDO, String>, JpaSpecificationExecutor<BaseMenuShowDO> {
    @Modifying
    @Query("update BaseMenuShowDO p set p.isDel=?2 where p.id=?1")
    BaseMenuShowDO updateStatus(String id,String status);
    @Query( value = "select max(t.menu_sort) AS \"zuida\" from base_menu_show t where t.is_del='1'",nativeQuery = true)
    Integer getMaxSort();
    @Query( value = "select min(t.menu_sort) AS \"zuixiao\" from base_menu_show t where t.is_del='1'",nativeQuery = true)
    Integer getMinSort();
}

+ 381 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/article/ArticleEndpoint.java

@ -0,0 +1,381 @@
package com.yihu.jw.base.endpoint.article;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.dao.article.KnowledgeArticleDictDao;
import com.yihu.jw.base.dao.article.KnowledgeArticleUserDao;
import com.yihu.jw.base.service.article.KnowledgeArticleService;
import com.yihu.jw.base.service.article.KnowledgeArticleUserService;
import com.yihu.jw.base.service.article.KnowledgeCategoryService;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
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 org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * 健康文章
 * @author huangwenjie
 */
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.PREFIX)
@Api(value = "文章管理接口", description = "文章管理接口", tags = {"文章管理接口"})
public class ArticleEndpoint extends EnvelopRestEndpoint {
	
	@Autowired
	private KnowledgeArticleService knowledgeArticleService;
	
	@Autowired
	private KnowledgeCategoryService knowledgeCategoryService;
	@Autowired
	private BaseDoctorHospitalDao doctorHospitalDao;
	@Autowired
	private KnowledgeArticleUserService knowledgeArticleUserService;
	@Autowired
	private KnowledgeArticleUserDao knowledgeArticleUserDao;
	@Autowired
	private KnowledgeArticleDictDao knowledgeArticleDictDao;
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
	@ApiOperation(value = "获取文章列表")
	public Envelop searchKnowledgePageList(
//			@ApiParam(name = "category_first", value = "1级分类编码")
//			@RequestParam(value = "category_first", required = false) String category_first,
//			@ApiParam(name = "category_secend", value = "2级分类编码")
//			@RequestParam(value = "category_second", required = false) String category_second,
//			@ApiParam(name = "keyword", value = "关键字")
//			@RequestParam(value = "keyword", required = false) String keyword,
//			@ApiParam(name = "status", value = "审核状态:0未审核,1已审核")
//			@RequestParam(value = "status", required = false) String status,
//			@ApiParam(name = "start", value = "开始时间")
//			@RequestParam(value = "start", required = false) String start,
//			@ApiParam(name = "end", value = "结束时间")
//			@RequestParam(value = "end", required = false) String end,
			@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
			@RequestParam(value = "fields", required = false) String fields,
			@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
			@RequestParam(value = "filters", required = false) String filters,
			@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
			@RequestParam(value = "sorts", required = false) String sorts,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		try {
			if(StringUtils.isBlank(filters)){
				filters=filters+"del=1";
			}else{
				filters=filters+";del=1";
			}
			List<KnowledgeArticleDictDO> list  = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
			List<KnowledgeArticleDictDO> totals  = knowledgeArticleService.search(fields,filters,sorts);
			JSONObject result = new JSONObject();
			result.put("total",totals.size());
			result.put("detailModelList",list);
			return success(result);
		}catch (Exception e){
			return failedException(e);
		}
	}
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgeList)
	@ApiOperation(value = "获取文章列表")
	public Envelop searchKnowledgeList(
			@ApiParam(name = "first", value = "second")
			@RequestParam(value = "first", required = false) String first,
			@ApiParam(name = "second", value = "second")
			@RequestParam(value = "second", required = false) String second,
			@ApiParam(name = "key", value = "关键字")
			@RequestParam(value = "key", required = false) String key,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		try {
			return success(knowledgeArticleService.findArticleList(first,second,key,page,pageSize));
		}catch (Exception e){
			return failedException(e);
		}
	}
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.queryById)
	@ApiOperation(value = "根据id查询文章")
	public Envelop queryByCode(
			@ApiParam(name = "id", value = "id", required = true)
			@RequestParam(value = "id", required = true)String id) throws Exception{
			try {
				KnowledgeArticleDictDO articleDO = knowledgeArticleService.retrieve(id);
				KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDO.getId(),getUID());
				if (knowledgeArticleUserDO!=null){
					articleDO.setIsUsed(knowledgeArticleUserDO.getUsed());
					articleDO.setKnowledgeArticleUserDO(knowledgeArticleUserDO);
				}
				List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(articleDO.getCreateUser());
				if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
					articleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
					articleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
				}
				return success(articleDO);
			}catch (Exception e){
				return failedException(e);
			}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.deleteById)
	@ApiOperation(value = "根据id删除文章")
	public Envelop deleteById(
			@ApiParam(name = "id", value = "id,多个使用英文逗号分隔", required = true)
			@RequestParam(value = "id", required = true)String id)throws Exception {
			try {
				knowledgeArticleService.delArticle(id);
				return success("操作成功");
			}catch (Exception e){
				return failedException(e);
			}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticle)
	@ApiOperation(value = "保存/更新文章")
	public Envelop saveArticle(
			@ApiParam(name = "jsonData", value = "Json数据", required = true)
			@RequestParam String jsonData)throws Exception {
		try {
			knowledgeArticleService.saveArticle(jsonData);
			return success("操作成功");
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.reviewArticle)
	@ApiOperation(value = "审核/退回文章")
	public Envelop saveArticle(
			@ApiParam(name = "articleId", value = "文章ID")
			@RequestParam(value = "articleId", required = true) String articleId,
			@ApiParam(name = "status", value = "0未审核,1已审核,2退回")
			@RequestParam(value = "status", required = true) Integer status,
			@ApiParam(name = "reason", value = "退回理由")
			@RequestParam(value = "reason", required = false) String reason
	)throws Exception {
		try {
			knowledgeArticleService.reviewArticle(articleId,status,reason);
			return success("操作成功");
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchCategoryList)
	@ApiOperation(value = "获取分类列表")
	public ListEnvelop searchCategoryList(
			@ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
			@RequestParam(value = "fields", required = false) String fields,
			@ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
			@RequestParam(value = "filters", required = false) String filters,
			@ApiParam(name = "sorts", value = "排序,规则参见说明文档")
			@RequestParam(value = "sorts", required = false) String sorts,
			@ApiParam(name = "page", value = "第几页,从1开始", required = true, defaultValue = "1")
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		try {
			List<KnowledgeCategoryDO> list  = knowledgeCategoryService.search(fields,filters,sorts,page,pageSize);
			List<KnowledgeCategoryDO> result = new ArrayList<>();
			for(KnowledgeCategoryDO knowledgeCategoryDO:list){
				if(knowledgeCategoryDO.getDel() == 1){
					result.add(knowledgeCategoryDO);
				}
			}
			return success(result);
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.saveCategory)
	@ApiOperation(value = "保存/更新分类")
	public Envelop saveCategory(
			@ApiParam(name = "jsonData", value = "Json数据", required = true)
			@RequestParam String jsonData)throws Exception {
		try {
			knowledgeCategoryService.saveCategory(jsonData);
			return success("操作成功");
		} catch (Exception e){
			return failedException(e);
		}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.updateDel)
	@ApiOperation(value = "根据分类code删除分类")
	public Envelop updateDel(
			@ApiParam(name = "id", value = "id", required = true)
			@RequestParam(value = "id", required = true)String id)throws Exception {
		try {
			Boolean flag = knowledgeCategoryService.updateDel(id);
			if (flag) {
				return success("操作成功");
			}else{
				return failed("操作失败");
			}
		}catch (Exception e){
			return failedException(e);
		}
		
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticleDept)
	@ApiOperation(value = "设置文章发送的科室")
	public ObjEnvelop saveArticleDept(@ApiParam(name = "articleId", value = "文章ID")
	                                 @RequestParam(value = "articleId",required = true)String articleId,
	                                 @ApiParam(name = "sdJsons", value = "部门与科室关系json")
	                                 @RequestParam(value = "sdJsons",required = true)String sdJsons)throws Exception {
		try {
			return success(knowledgeArticleService.saveArticleDept(articleId,sdJsons));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findDeptByArticle)
	@ApiOperation(value = "查询文章下的科室")
	public ListEnvelop findDeptByArticle(@ApiParam(name = "articleId", value = "文章ID")
	                                    @RequestParam(value = "articleId",required = true)String articleId)throws Exception {
		try {
			return success(knowledgeArticleService.findDeptByArticle(articleId));
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findArticleByDept)
	@ApiOperation(value = "查询部门下发放的文章")
	public ListEnvelop findArticleByDept(@ApiParam(name = "dept", value = "科室")
	                                    @RequestParam(value = "dept",required = true)String dept)throws Exception {
		try {
			return success(knowledgeArticleService.findArticleByDept(dept));
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.saveDeptArticle)
	@ApiOperation(value = "设置科室发送的文章")
	public ObjEnvelop saveDeptArticle(@ApiParam(name = "dept", value = "部门code")
	                                 @RequestParam(value = "dept",required = true)String dept,
	                                 @ApiParam(name = "sdJsons", value = "部门与科室关系json")
	                                 @RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
		try {
			return success(knowledgeArticleService.saveDeptArticle(dept,sdJsons));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.sendPatientBusiness)
	@ApiOperation(value = "发送文章/问卷")
	public ListEnvelop sendPatientBusiness(@ApiParam(name = "json", value = "患者业务关联表")
									  @RequestParam(value = "json",required = false)String json)throws Exception {
		try {
			ListEnvelop listEnvelop = new ListEnvelop();
			JSONArray jsonArray = JSONArray.parseArray(json);
			List<BasePatientBusinessDO> patientBusinessDOList = new ArrayList<>();
			for (int i=0;i<jsonArray.size();i++){
				JSONObject jsonObject = jsonArray.getJSONObject(i);
				BasePatientBusinessDO patientBusinessDO = toEntity(jsonObject.toJSONString(),BasePatientBusinessDO.class);
				patientBusinessDOList.add(patientBusinessDO);
			}
			listEnvelop.setDetailModelList(knowledgeArticleService.sendBusinessToPatient(patientBusinessDOList));
			return  listEnvelop;
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleUsed)
	@ApiOperation(value = "发布文章")
	public ObjEnvelop setArticleUsed(@ApiParam(name = "id", value = "文章id")
									  @RequestParam(value = "id",required = true)String id,
									  @ApiParam(name = "status", value = "1发布0未发布")
									  @RequestParam(value = "status",required = false)Integer status)throws Exception {
		try {
			return success(knowledgeArticleService.releaseArticle(id,status));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}
}
	@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(){
		try {
			MixEnvelop envelop = knowledgeCategoryService.findAllGroup();
			return envelop;
		}catch (Exception e){
			return failedMixEnvelopException(e);
		}
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findPatientFavorite)
	@ApiOperation(value = "查询收藏文章")
	public Envelop findPatientFavorite(@ApiParam(name = "patient", value = "病人id")
												   @RequestParam(value = "patient",required = false)String patient,
												   @ApiParam(name = "page", value = "当前页")
												   @RequestParam(value = "page",required = false)Integer page,
												   @ApiParam(name = "pageSize", value = "分页大小)")
												   @RequestParam(value = "pageSize",required = false)Integer pageSize)throws Exception {
		try {
			return success(knowledgeArticleService.findPatientFavorite(patient,page,pageSize));
		}catch (Exception e){
			return failedException(e);
		}
	}
}

+ 18 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java

@ -9,7 +9,9 @@ import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDOReader;
import com.yihu.jw.base.service.org.OrgTreeService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.dict.service.BaseIncentiveDictService;
import com.yihu.jw.restmodel.base.doctor.BaseDoctorVO;
import com.yihu.jw.restmodel.web.Envelop;
@ -70,6 +72,8 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
    private BaseDoctorExcelDOReader doctorExcelDOReader;
    @Autowired
    private BaseIncentiveDictService baseIncentiveDictService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${wechat.id}")
    private String wechatId;
@ -124,6 +128,14 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<BaseDoctorDO> baseDoctors = baseDoctorService.search(fields, filters, sorts, page, size);
        List<WlyyHospitalSysDictDO> list = wlyyHospitalSysDictDao.findByDictName("doctor_level");
        for(BaseDoctorDO baseDoctorDO:baseDoctors){
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:list){
                if (baseDoctorDO.getLevel().equals(wlyyHospitalSysDictDO.getDictCode())){
                    baseDoctorDO.setLevelName(wlyyHospitalSysDictDO.getDictValue());
                }
            }
        }
        int count = (int) baseDoctorService.getCount(filters);
        return success(baseDoctors, count, page, size, BaseDoctorVO.class);
    }
@ -489,11 +501,14 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = BaseRequestMapping.BaseDoctor.resetDoctorPwd)
    @ApiOperation(value = "医生充值密码")
    @ApiOperation(value = "医生重置密码")
    public Envelop resetDoctorPwd(
            @ApiParam(name = "doctor", value = "", required = false)
            @RequestParam(value = "doctor", required = true)String doctor) {
        return success(baseDoctorService.resetDoctorPwd(doctor));
        try {
            return success(baseDoctorService.resetDoctorPwd(doctor));
        }catch (Exception e){
           return failedException(e);
        }
    }
}

+ 309 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuManageEndpoint.java

@ -0,0 +1,309 @@
package com.yihu.jw.base.endpoint.menu;
import com.yihu.jw.base.service.menu.BaseMenuManageService;
import com.yihu.jw.base.service.role.RoleMenuService;
import com.yihu.jw.base.util.ErrorCodeUtil;
import com.yihu.jw.entity.base.menu.BaseLinkDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuShowDO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author yeshijie on 2018/9/26.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.MenuDict.PREFIX)
@Api(value = "首页菜单管理", description = "首页菜单管理", tags = {"基础服务 - 首页菜单管理"})
public class BaseMenuManageEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseMenuManageService menuService;
    @PostMapping(value = BaseRequestMapping.MenuDict.deleteMenuDict)
    @ApiOperation(value = "删除菜单")
    public Envelop deleteMenuDict(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            menuService.deletMenuDict(id);
            return success("删除成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.MenuDict.createMenuDict)
    @ApiOperation(value = "新建或修改")
    public Envelop create (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) {
        try {
            BaseMenuDictDO baseMenuDictDO = menuService.createOrUpdateMenu(jsonData);
            return success(baseMenuDictDO);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.MenuDict.findOneMenuDict)
    @ApiOperation(value = "根据id查询链接单条")
    public Envelop findOneMenuDict(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            return success(menuService.findOneMenuDict(id));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.MenuDict.MOVE_DOWN)
    @ApiOperation(value = "下移")
    public Envelop moveDown(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            BaseMenuDictDO baseMenuDictDO = menuService.downMenu(id);
            return success(baseMenuDictDO);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.MenuDict.MOVE_UP)
    @ApiOperation(value = "上移")
    public Envelop moveUp(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            BaseMenuDictDO baseMenuDictDO = menuService.upMenu(id);
            return success(baseMenuDictDO);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.MenuDict.STATUS)
    @ApiOperation(value = "生效/失效")
    public Envelop status(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id,
            @ApiParam(name = "status", value = "1生效,0失效", required = true)
            @RequestParam(value = "status") Integer status) {
        try {
            menuService.updateStatus(id, status);
            return success("修改成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.MenuDict.LIST)
    @ApiOperation(value = "查询菜单字典列表")
    public Envelop findMenuDictByKey(
            @ApiParam(name = "parentId", value = "parentId", required = false)
            @RequestParam(value = "parentId",required = false) String parentId,
            @ApiParam(name = "name", value = "name", required = false)
            @RequestParam(value = "name",required = false) String name) {
        try {
            return success(menuService.findMenuDictByKey(parentId, name));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.LinkDict.createLinkDict)
    @ApiOperation(value = "新建或修改")
    public Envelop createLink (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) {
        try {
            BaseLinkDictDO baseLinkDictDO = menuService.createOrUpdateLink(jsonData);
            return success(baseLinkDictDO);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.LinkDict.MOVELinkDOWN)
    @ApiOperation(value = "下移")
    public Envelop moveDownDict(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            BaseLinkDictDO baseLinkDictDO = menuService.downlink(id);
            return success(baseLinkDictDO);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.LinkDict.MOVELinkUP)
    @ApiOperation(value = "上移")
    public Envelop moveLink(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            BaseLinkDictDO baseLinkDictDO = menuService.upLink(id);
            return success(baseLinkDictDO);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.LinkDict.linkStatus)
    @ApiOperation(value = "生效/失效")
    public Envelop statusLink(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id,
            @ApiParam(name = "status", value = "1生效,0失效", required = true)
            @RequestParam(value = "status") String status) {
        try {
            menuService.updateLinkStatus(id, status);
            return success("修改成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.LinkDict.findOneLink)
    @ApiOperation(value = "根据id查询链接单条")
    public Envelop findOneLink(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            return success(menuService.findOneLinkDict(id));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.LinkDict.deleteLink)
    @ApiOperation(value = "删除链接")
    public Envelop deleteLink(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            menuService.updateLinkDel(id);
            return success("删除成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.LinkDict.linkShow)
    @ApiOperation(value = "生效/失效")
    public Envelop isShow(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id,
            @ApiParam(name = "status", value = "1展示0不展示", required = true)
            @RequestParam(value = "status") String status) {
        try {
            menuService.updateLinkShow(id, status);
            return success("修改成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.LinkDict.findLinkDictALL)
    @ApiOperation(value = "查询友情链接字典列表")
    public Envelop findLinkDictByKey(
            @ApiParam(name = "name", value = "name", required = false)
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "status", value = "status", required = false)
            @RequestParam(value = "status",required = false) String status) {
        try {
            return success(menuService.findLinkDict(name,status));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.MenuShow.menuShowstatus)
    @ApiOperation(value = "移除")
    public Envelop removeMenu(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            menuService.removeMenu(id);
            return success("修改成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.MenuShow.createMenuShow)
    @ApiOperation(value = "新建或修首页菜单")
    public Envelop createMenuShow (
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestParam String jsonData) {
        try {
            menuService.saveMenuShow(jsonData);
            return success("操作成功");
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.MenuShow.MOVEMenuShowDOWN)
    @ApiOperation(value = "下移")
    public Envelop moveDownShow(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            BaseMenuShowDO  baseMenuShowDO= menuService.downMenuShow(id);
            return success(baseMenuShowDO);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.MenuShow.MOVEMenuShowUP)
    @ApiOperation(value = "上移")
    public Envelop moveUpShow(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id) {
        try {
            BaseMenuShowDO baseMenuShowDO = menuService.upMenuShow(id);
            return success(baseMenuShowDO);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.MenuShow.findMenuShow)
    @ApiOperation(value = "查询首页列表")
    public Envelop findMenuShowByKey(
            @ApiParam(name = "parentId", value = "parentId", required = false)
            @RequestParam(value = "parentId",required = false) String parentId,
            @ApiParam(name = "name", value = "name", required = false)
            @RequestParam(value = "name",required = false) String name) {
        try {
            return success(menuService.findMenuShow());
        }catch (Exception e){
            return failedException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.MenuShow.findMenuShowDict)
    @ApiOperation(value = "查询首页菜单词典列表")
    public Envelop findMenuShowDict(@ApiParam(name = "parentId", value = "parentId", required = false)
                                        @RequestParam(value = "parentId",required = false) String parentId,
                                    @ApiParam(name = "name", value = "name", required = false)
                                        @RequestParam(value = "name",required = false) String name) {
        try {
            return success(menuService.findMenuDictParent(parentId,name));
        }catch (Exception e){
            return failedException(e);
        }
    }
}

+ 65 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuNoLoginEndpoint.java

@ -0,0 +1,65 @@
package com.yihu.jw.base.endpoint.menu;
import com.yihu.jw.base.service.menu.BaseMenuManageService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = BaseRequestMapping.MenuNologin.PREFIX)
@Api(value = "首页菜单管理免登录接口", description = "首页菜单管理免登录接口", tags = {"基础服务 - 首页菜单管理免登录接口"})
public class BaseMenuNoLoginEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private BaseMenuManageService menuService;
    @GetMapping(value = BaseRequestMapping.MenuNologin.findAllMenu)
    @ApiOperation(value = "查询首页列表")
    public Envelop findMenuShowByKey(
            @ApiParam(name = "parentId", value = "parentId", required = false)
            @RequestParam(value = "parentId",required = false) String parentId,
            @ApiParam(name = "name", value = "name", required = false)
            @RequestParam(value = "name",required = false) String name) {
        try {
            return success(menuService.findMenuShow());
        }catch (Exception e){
            return failedException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.MenuNologin.findMenuByParentId)
    @ApiOperation(value = "查询二级菜单")
    public Envelop findMenuByParentId(
            @ApiParam(name = "parentId", value = "parentId", required = false)
            @RequestParam(value = "parentId",required = false) String parentId,
            @ApiParam(name = "status", value = "status", required = false)
            @RequestParam(value = "status",required = false) Integer status) {
        try {
            return success(menuService.findByParentId(parentId,status));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.MenuNologin.findArticleByMenuId)
    @ApiOperation(value = "查询文章")
    public Envelop findArticleByMenuid(
            @ApiParam(name = "menuId", value = "menuId", required = false)
            @RequestParam(value = "menuId",required = true) String menuId,
            @ApiParam(name = "page", value = "page", required = false)
            @RequestParam(value = "page",required = true) Integer page,
            @ApiParam(name = "pageSize", value = "pageSize", required = false)
            @RequestParam(value = "pageSize",required = true) Integer pageSize) {
        try {
            return success(menuService.findArticleByMenuId(menuId,page,pageSize));
        }catch (Exception e){
            return failedException(e);
        }
    }
}

+ 483 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/article/KnowledgeArticleService.java

@ -0,0 +1,483 @@
package com.yihu.jw.base.service.article;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.base.dao.article.KnowledgeArticleDictDao;
import com.yihu.jw.base.dao.article.KnowledgeArticleDeptDao;
import com.yihu.jw.base.dao.article.KnowledgeArticleMenuDao;
import com.yihu.jw.base.dao.article.KnowledgeArticleUserDao;
import com.yihu.jw.base.dao.menu.BaseMenuDictDao;
import com.yihu.jw.base.dao.user.UserDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.menu.BaseMenuDictDO;
import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDeptDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyTemplateDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyUserDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.survey.dao.SurveyTemplateDao;
import com.yihu.jw.hospital.survey.dao.SurveyUserDao;
import com.yihu.jw.patient.dao.BasePatientBusinessDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
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;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
 * 健康文章业务层代码
 * @author huangwenjie
 * @date 2019/9/10 13:54
 */
@Service
public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDictDO, KnowledgeArticleDictDao> {
	
	@Autowired
	private KnowledgeArticleDictDao knowledgeArticleDictDao;
	@Autowired
	private BaseMenuDictDao baseMenuDictDao;
	
	@Autowired
	private KnowledgeArticleDeptDao knowledgeArticleDeptDao;
	@Autowired
	private WlyyHospitalSysDictDao hospitalSysDictDao;
	@Autowired
	private BasePatientBusinessDao patientBusinessDao;
	@Autowired
	private KnowledgeArticleUserDao knowledgeArticleUserDao;
	@Autowired
	private BaseDoctorHospitalDao doctorHospitalDao;
	@Autowired
	private BaseDoctorDao doctorDao;
	@Autowired
	private SurveyUserDao surveyUserDao;
	@Autowired
	private SurveyTemplateDao surveyTemplateDao;
	@Autowired
    private HibenateUtils hibenateUtils;
	@Autowired
	private UserDao userDao;
	//查询文章列表
	public List<Map<String,Object>> findArticleList(String first,String second ,String key,Integer page ,Integer pageSize){
		String sql ="select b.id as \"id\", " +
				" b.title as \"title\"," +
				" b.intro as \"intro\"," +
				" b.category_first as \"categoryFirst\"," +
				" b.category_first_name as \"categoryFirstName\"," +
				" b.category_second as \"category_second\"," +
				" b.category_second_name as \"categorySecondName\"," +
				" b.create_user as \"createUser\"," +
				" b.status as \"status\"," +
				" b.used as \"used\"," +
				" b.create_user_name as \"createUserName\"," +
				" b.create_time as \"createTime\"," +
				" b.check_time as \"checkTime\"," +
				" b.release_status as \"releaseStatus\"," +
				" t.menu_id as \"menuId\"," +
				" t.parent_id as \"parentId\"," +
				" t.menu_name as \"menuName\"  " +
				" from wlyy_knowledge_article_menu t left join wlyy_knowledge_article b" +
				" on t.article_id=b.id left join base_menu_dict c " +
				" on c.id= t.menu_id where t.del=1";
		if (StringUtils.isNotBlank(first)){
			sql+=" and t.category_first ='"+first+"'";
		}
		if (StringUtils.isNotBlank(second)){
			sql+=" and t.category_second ='"+second+"'";
		}
		if (StringUtils.isNotBlank(key)){
			sql+=" and (t.title like '%"+first+"&' or t.intro like '%"+key+"%' or t.content like '%"+key+"%')";
		}
		List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
		for (Map<String,Object> map:list){
			if (!"0".equalsIgnoreCase(map.get("parentId").toString())){
				BaseMenuDictDO baseMenuDictDO = baseMenuDictDao.findOne(map.get("parentId").toString());
				if (baseMenuDictDO!=null){
					map.put("parentName",baseMenuDictDO.getName());
				}
			}else {
				map.put("parentName",map.get("menuName").toString());
			}
		}
		return list;
	}
	
	/**
	 * 删除,支持批量
	 * @param id
	 */
	public boolean delArticle1(String id){
		String[] split = id.split(",|,");
		String ids = StringUtils.join(split, ",");
		String sql = "update wlyy_knowledge_article a set a.del = 0 where a.id in(" + ids + ")";
		String sqlUser = "update wlyy_knowledge_article_user a set a.del = 0 where a.relation_code in(" + ids + ")";
		String sqlBussiness = "update base_patient_business a set a.del = 0 where a.relation_code in(" + ids + ")";
		int update = jdbcTemplate.update(sql);
		int updateUser = jdbcTemplate.update(sqlUser);
		int updateBussiness  = jdbcTemplate.update(sqlBussiness);
		if (update > 0||updateUser>0||updateBussiness>0) {
			return true;
		}
		return false;
	}
	public boolean delArticle(String id){
		KnowledgeArticleDictDO knowledgeArticleDictDO = knowledgeArticleDictDao.findByIdAndDel(id);
		if (knowledgeArticleDictDO!=null){
			knowledgeArticleDictDO.setDel(0);
			knowledgeArticleDictDao.save(knowledgeArticleDictDO);
			return true;
		}
		return false;
	}
	/**
	 * 更新/保存健康文章
	 * @param jsonData
	 * @return
	 * @throws Exception
	 */
	public KnowledgeArticleDictDO saveArticle(String jsonData) throws  Exception {
		KnowledgeArticleDictDO knowledgeArticleDO = EntityUtils.jsonToEntity(jsonData, KnowledgeArticleDictDO.class);
		if (!StringUtils.isNotBlank(knowledgeArticleDO.getId()) ) {
			// 新增
			knowledgeArticleDO.setId(UUID.randomUUID().toString().replace("-", ""));
			knowledgeArticleDO.setCreateTime(new Date());
			knowledgeArticleDO.setStatus(0);
			knowledgeArticleDO.setReleaseStatus(0);
			knowledgeArticleDO.setDel(1);
			UserDO userDO = userDao.findById(knowledgeArticleDO.getCreateUser());
			if (userDO!=null){
				knowledgeArticleDO.setCreateUserName(userDO.getName());
			}
			knowledgeArticleDO = knowledgeArticleDictDao.save(knowledgeArticleDO);
			return knowledgeArticleDO;
		} else {
			KnowledgeArticleDictDO one = knowledgeArticleDictDao.findOne(knowledgeArticleDO.getId());
			one.setTitle(knowledgeArticleDO.getTitle());
			one.setContent(knowledgeArticleDO.getContent());
			one.setImage(knowledgeArticleDO.getImage());
			one.setIntro(knowledgeArticleDO.getIntro());
			one.setUpdateTime(new Date());
			one.setCategoryFirst(knowledgeArticleDO.getCategoryFirst());
			one.setCategoryFirstName(knowledgeArticleDO.getCategoryFirstName());
			one.setCategorySecond(knowledgeArticleDO.getCategorySecond());
			one.setCategorySecondName(knowledgeArticleDO.getCategorySecondName());
			one.setStatus(0);
			knowledgeArticleDictDao.save(one);
			return  one;
		}
	}
	
	//审核/退回文章
	public KnowledgeArticleDictDO reviewArticle(String articleId,Integer status,String reason) throws Exception{
		KnowledgeArticleDictDO knowledgeArticleDO = knowledgeArticleDictDao.findOne(articleId);
		if (null == knowledgeArticleDO) {
			throw new Exception("该文章不存在");
		} else {
			knowledgeArticleDO.setStatus(status);
			knowledgeArticleDO.setCheckTime(new Date());
			if(StringUtils.isNotBlank(reason)){
				knowledgeArticleDO.setCancelReason(reason);
			}
			knowledgeArticleDictDao.save(knowledgeArticleDO);
			return  knowledgeArticleDO;
		}
	}
	
	/**
	 * 保存文章科室关系
	 * @param articleId
	 * @param sdJsons
	 * @return
	 * @throws Exception
	 */
	public Boolean saveArticleDept(String articleId,String sdJsons)throws Exception{
		
		//删除之前关系
		List<KnowledgeArticleDeptDO> list = knowledgeArticleDeptDao.findByArticleId(articleId);
		if(list!=null&&list.size()>0){
			knowledgeArticleDeptDao.delete(list);
		}
		
		if(org.apache.commons.lang3.StringUtils.isNotBlank(sdJsons)){
			List<KnowledgeArticleDeptDO> _list = EntityUtils.jsonToList(sdJsons,KnowledgeArticleDeptDO.class);
			if(_list!=null&&_list.size()>0){
				knowledgeArticleDeptDao.save(_list);
			}
		}
		return true;
	}
	
	/**
	 * 查询文章下科室
	 * @param articleId
	 * @return
	 */
	public List<Map<String,Object>> findDeptByArticle(String articleId)throws Exception{
		String sql ="SELECT " +
				" d.article_id AS articleId," +
				" d.dept, " +
				" d.dept_name AS deptName " +
				" FROM " +
				" wlyy_knowledge_article t " +
				" JOIN wlyy_knowledge_article_dept d ON t.id = d.article_id " +
				" WHERE " +
				" t.id = '"+articleId+"'";
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		return list;
	}
	
	/**
	 * 查询部门下的文章
	 * @param dept
	 * @return
	 */
	public List<Map<String,Object>> findArticleByDept(String dept)throws Exception{
		String sql = "SELECT " +
				" t.id as \"id\", " +
				" t.title as \"title\", " +
				" t.create_time AS \"create_time\" ," +
				" t.image AS \"image\" " +
				" FROM " +
				" wlyy_knowledge_article t " +
				" JOIN wlyy_knowledge_article_dept d ON t.id = d.article_id " +
				" WHERE " +
				" d.dept = '"+dept+"'";
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		return list;
	}
	
	/**
	 * 设置部门发送文章
	 * @param dept
	 * @param sdJsons
	 * @return
	 */
	public Boolean saveDeptArticle(String dept, String sdJsons) throws Exception{
		
		//删除之前关系
		List<KnowledgeArticleDeptDO> dels = knowledgeArticleDeptDao.findByDept(dept);
		if(dels!=null&&dels.size()>0){
			knowledgeArticleDeptDao.delete(dels);
		}
		
		if(org.apache.commons.lang3.StringUtils.isNotBlank(sdJsons)){
			List<KnowledgeArticleDeptDO> list = EntityUtils.jsonToList(sdJsons,KnowledgeArticleDeptDO.class);
			if(list!=null&&list.size()>0){
				knowledgeArticleDeptDao.save(list);
			}
		}
		return true;
	}
	public KnowledgeArticleDictDO releaseArticle(String articleId,Integer releaseStatus ){
		KnowledgeArticleDictDO knowledgeArticleDictDO = knowledgeArticleDictDao.findByIdAndDel(articleId);
		if (null!=knowledgeArticleDictDO){
			knowledgeArticleDictDO.setReleaseStatus(releaseStatus);
			knowledgeArticleDictDO.setReleaseTime(new Date());
			knowledgeArticleDictDao.save(knowledgeArticleDictDO);
		}
		return knowledgeArticleDictDO;
	}
	/**
	 *	患者接收问卷/文章
	 * @param businessDOS
	 * @return
	 */
	public List<BasePatientBusinessDO> sendBusinessToPatient(List<BasePatientBusinessDO> businessDOS) throws Exception {
		if (businessDOS!=null&&businessDOS.size()!=0){
			for (BasePatientBusinessDO patientBusinessDO:businessDOS){
				BasePatientBusinessDO basePatientBusinessDO = patientBusinessDao.findByPatientAndRelationCodeAndDel(patientBusinessDO.getPatient(),patientBusinessDO.getRelationCode());
				if (basePatientBusinessDO != null) {
					throw new Exception("已发送过!");
				}
				patientBusinessDO.setCreateTime(new Date());
				patientBusinessDO.setUpdateTime(new Date());
				patientBusinessDO.setCreateUser(patientBusinessDO.getDoctor());
				patientBusinessDO.setUpdateUser(patientBusinessDO.getDoctor());
				patientBusinessDO.setCreateUserName(patientBusinessDO.getDoctorName());
				patientBusinessDO.setUpdateUserName(patientBusinessDO.getUpdateUserName());
				patientBusinessDO.setCollection(0);
				patientBusinessDO.setDel(1);
				patientBusinessDO = patientBusinessDao.save(patientBusinessDO);
					if (patientBusinessDO.getRelationType()==1){
						KnowledgeArticleDictDO knowledgeArticleDO = knowledgeArticleDictDao.findByIdAndDel(patientBusinessDO.getRelationCode());
					System.out.println("content:"+JSON.toJSONString(knowledgeArticleDO));
					JSONObject object = new JSONObject();
					object.put("id",knowledgeArticleDO.getId());
					object.put("title",knowledgeArticleDO.getTitle());
					object.put("content",knowledgeArticleDO.getIntro());
					object.put("img",knowledgeArticleDO.getImage());
				}else {
					WlyySurveyUserDO wlyySurveyUserDO = new WlyySurveyUserDO();
					String doctor = patientBusinessDO.getDoctor();
					BaseDoctorDO doctorDO = doctorDao.findById(doctor);
					wlyySurveyUserDO.setDept(doctorDO.getVisitDept());
					wlyySurveyUserDO.setDeptName(doctorDO.getVisitDeptName());
					wlyySurveyUserDO.setDoctor(doctor);
					wlyySurveyUserDO.setDoctorName(doctorDO.getName());
					wlyySurveyUserDO.setStatus(0);
					wlyySurveyUserDO.setPatient(patientBusinessDO.getPatient());
					wlyySurveyUserDO.setPatientName(patientBusinessDO.getPatientName());
					wlyySurveyUserDO.setSurveyTempCode(patientBusinessDO.getRelationCode());
					wlyySurveyUserDO.setSurveyTempTitle(patientBusinessDO.getRelationName());
					wlyySurveyUserDO.setCreateTime(new Date());
					wlyySurveyUserDO.setEndTime(new Date());
					wlyySurveyUserDO = surveyUserDao.save(wlyySurveyUserDO);
					JSONObject object = new JSONObject();
					WlyySurveyTemplateDO wlyySurveyTemplateDO = surveyTemplateDao.findOne(wlyySurveyUserDO.getSurveyTempCode());
					if (null!=wlyySurveyTemplateDO){
						object.put("title",wlyySurveyTemplateDO.getTitle());
						object.put("content",wlyySurveyTemplateDO.getTemplateComment());
						object.put("id",wlyySurveyTemplateDO.getId());
					}
				}
			}
		}
		return businessDOS;
	}
	/**
	 * 设置为1常用或者0不常用
	 * @param id
	 * @param used
	 * @return
	 */
	public KnowledgeArticleDictDO setUsed(String id,Integer used,String doctor){
		KnowledgeArticleDictDO knowledgeArticleDO = knowledgeArticleDictDao.findByIdAndDel(id);
		BaseDoctorDO doctorDO = doctorDao.findById(doctor);
		KnowledgeArticleUserDO knowledgeArticleUserDO =knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(id,doctor);
		if (knowledgeArticleUserDO==null){
			knowledgeArticleUserDO = new KnowledgeArticleUserDO();
			knowledgeArticleUserDO.setRelationCode(id);
			knowledgeArticleUserDO.setRelationName(knowledgeArticleDO.getTitle());
			knowledgeArticleUserDO.setRelationType(1);
			knowledgeArticleUserDO.setDel(1);
			knowledgeArticleUserDO.setUser(doctor);
			if (doctorDO!=null){
				knowledgeArticleUserDO.setUserName(doctorDO.getName());
				knowledgeArticleUserDO.setCreateUserName(doctorDO.getName());
			}
			knowledgeArticleUserDO.setCreateTime(new Date());
			knowledgeArticleUserDO.setUpdateTime(new Date());
			knowledgeArticleUserDO.setCreateUser(doctor);
			knowledgeArticleUserDO.setUpdateUser(doctor);
			knowledgeArticleUserDO.setUsed(used);
			knowledgeArticleUserDO = knowledgeArticleUserDao.save(knowledgeArticleUserDO);
		}
        if (knowledgeArticleDO!=null){
            if (knowledgeArticleDO.getUsed()!=null){
            	if (used==1){
					knowledgeArticleUserDO.setUsed(1);
					knowledgeArticleDO.setUsed(knowledgeArticleDO.getUsed()+1);
				}else if (used==0){
            		knowledgeArticleUserDO.setUsed(0);
            		knowledgeArticleDO.setUsed(knowledgeArticleDO.getUsed()-1);
				}
			}else {
				if (used==1){
					knowledgeArticleDO.setUsed(1);
				}else if (used==0){
					knowledgeArticleDO.setUsed(0);
				}
			}
        }
		knowledgeArticleUserDO.setRelationName(knowledgeArticleDO.getTitle());
        knowledgeArticleUserDao.save(knowledgeArticleUserDO);
		return knowledgeArticleDictDao.save(knowledgeArticleDO);
	}
	public KnowledgeArticleDictDO selectById(String id){
		return knowledgeArticleDictDao.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\"," +
				"t.create_time as \"createTime\" " +
				" 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 and t.status = 1";
		if (StringUtils.isNotBlank(categoryFirst)){
		    sql+=" and t.category_first = '"+categoryFirst+"'";
        }
		if (StringUtils.isNotBlank(categorySecond)){
			sql+=" 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,t.create_time " +
				" 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;
	}
	//查询患者收藏的文章列表
	public JSONObject findPatientFavorite(String patient,Integer page,Integer pageSize){
		String sql = "select t.id as \"id\",t.user_code as \"user\",t.user_name as \"userName\"," +
				"t.relation_code as \"relationCode\"," +
				"t.relation_type as \"relationType\"," +
				"t.relation_name as \"relationName\"," +
				"t.is_read as \"isRead\",t.fabulous as \"fabulous\"," +
				"t.is_share as \"share\"," +
				"t.collection as \"collection\",t.used as \"used\",t.del as \"del\"";
		sql+=" from wlyy_knowledge_article_user t left join wlyy_knowledge_article a" +
				" on t.relation_code = a.id where 1=1 and a.del=1 and a.collection=1 ";
		if (StringUtils.isNotEmpty(patient)){
			sql+=" and t.user_code = '"+patient+"'";
		}
		List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
		if(list!=null&&list.size()>0){
			for (Map<String,Object> map:list){
				String relationCode = map.get("relationCode").toString();
				String type =  map.get("relationType").toString();
				if ("1".equalsIgnoreCase(type)){
					KnowledgeArticleDictDO knowledgeArticleDO = this.selectById(relationCode);
					if (knowledgeArticleDO!=null){
						List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
						if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
							knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
							knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
						}
					}
					map.put("KnowledgeArticleUserDO",knowledgeArticleDO);
				}
			}
		}
		List<Map<String,Object>> listCount = hibenateUtils.createSQLQuery(sql);
		JSONObject result = new JSONObject();
		result.put("total",listCount.size());
		result.put("detailModelList",list);
		return result;
	}
}

+ 20 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/article/KnowledgeArticleUserService.java

@ -0,0 +1,20 @@
package com.yihu.jw.base.service.article;
import com.yihu.jw.base.dao.article.KnowledgeArticleUserDao;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 健康文章中间表层代码
 * @author
 * @date
 */
@Service
public class KnowledgeArticleUserService extends BaseJpaService<KnowledgeArticleUserDO, KnowledgeArticleUserDao> {
	
}

+ 80 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/article/KnowledgeCategoryService.java

@ -0,0 +1,80 @@
package com.yihu.jw.base.service.article;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.article.KnowledgeArticleDictDao;
import com.yihu.jw.base.dao.article.KnowledgeCategoryDao;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
import com.yihu.jw.entity.hospital.article.KnowledgeCategoryDO;
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;
import javax.transaction.Transactional;
import java.net.URLDecoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 健康文章分类
 * @author huangwenjie
 */
@Service
public class KnowledgeCategoryService extends BaseJpaService<KnowledgeCategoryDO, KnowledgeCategoryDao> {
	@Autowired
	private KnowledgeCategoryDao knowledgeCategoryDao;
	@Autowired
	private KnowledgeArticleDictDao articleDao;
	
	@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);
		if (null == knowledgeCategoryDO.getPid()) {
			knowledgeCategoryDO.setPid("0");
		}
		if (null == knowledgeCategoryDO.getId()) {
			// 新增
			knowledgeCategoryDO.setCreateTime(new Date());
			knowledgeCategoryDO.setDel(1);
		} else {
			KnowledgeCategoryDO one = knowledgeCategoryDao.findOne(knowledgeCategoryDO.getId());
			knowledgeCategoryDO.setId(one.getId());
			knowledgeCategoryDO.setDel(one.getDel());
			knowledgeCategoryDO.setUpdateTime(new Date());
		}
		return knowledgeCategoryDao.save(knowledgeCategoryDO);
	}
	
	@Transactional
	public Boolean updateDel(String code) {
		List<KnowledgeArticleDictDO> byCategory = articleDao.findByCategory(code);
		if (null != byCategory && byCategory.size() > 0) {
			return false;
		}
		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;
	}
}

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorHospitalService.java

@ -63,7 +63,7 @@ public class BaseDoctorHospitalService extends BaseJpaService<BaseDoctorHospital
     * 根据医生标识获取医生已经选择的机构和职务信息
     *
     * @param doctorCode
     * @return
     * @returnb
     */
    List<Map<String, Object>> getOrgAndDutyListByDoctorCode(String doctorCode) {
        List<Map<String, Object>> result = new ArrayList<>();

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

@ -11,6 +11,7 @@ import com.yihu.jw.base.service.dict.DictDoctorDutyService;
import com.yihu.jw.base.service.doctor.excelImport.BaseDoctorExcelDO;
import com.yihu.jw.base.service.org.OrgTree;
import com.yihu.jw.base.service.org.OrgTreeService;
import com.yihu.jw.base.service.util.YkyyBaseService;
import com.yihu.jw.base.util.ConstantUtils;
import com.yihu.jw.base.util.JavaBeanUtils;
import com.yihu.jw.dict.dao.DictDoctorDutyDao;
@ -123,6 +124,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    private BaseIncentiveDictDao baseIncentiveDictDao;
    @Autowired
    private BaseTeamMemberDao baseTeamMemberDao;
    @Autowired
    private YkyyBaseService ykyyService;
    @Value("${wechat.flag}")
    private boolean flag;
@ -161,7 +164,12 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            result.put("response",ConstantUtils.FAIL);
            return result;
        }
        List<WlyyHospitalSysDictDO> list = wlyyHospitalSysDictDao.findByDictName("doctor_level");
        for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:list){
            if (doctors.getLevel().equals(wlyyHospitalSysDictDO.getDictCode())){
                doctors.setLevelName(wlyyHospitalSysDictDO.getDictValue());
            }
        }
        //医生归属业务模块角色信息,非必填,数据可有可没有
        String[] paramNames = {"doctorCode"};
        Object[] paramValue = {doctorId};
@ -251,6 +259,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "\ttb.orgName AS \"orgName\",\n" +
                "\ttb.deptname AS \"deptname\",\n" +
                "\ttb.doctorDutyName AS \"doctorDutyName\",\n" +
                "\ttb.doctor_level AS \"doctorLevel\",\n" +
                "\ttb.mobile AS \"mobile\",";
        if ("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            if (flag){
@ -280,6 +289,7 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "\t\t\t'未知'\n" +
                "\t\tEND AS sex,\n" +
                "\t\tdoc.mobile,\n" +
                "\t\tdoc.doctor_level,\n" +
                "\t\thos.org_name || '/' || dept. NAME || '/' || hos.doctor_duty_name AS org,\n" +
                "\t\thos.org_name as orgName,\n" +
                "\t\tdept.NAME as deptname,\n" +
@ -407,11 +417,17 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
//        List<Map<String,Object>> list = jdbcTemplate.queryForList(finalSql);
        Logger.getAnonymousLogger().info("finalCountSql="+countSql);
        int count = jdbcTemplate.queryForObject(countSql,Integer.class);
        List<WlyyHospitalSysDictDO> listDict = wlyyHospitalSysDictDao.findByDictName("doctor_level");
        for (Map<String,Object> map:list){
            String orgname = map.get("orgName")==null?"":map.get("orgName").toString();
            String deptname = map.get("deptname")==null?"":map.get("deptname").toString();
            String doctorDutyName = map.get("doctorDutyName")==null?"":map.get("doctorDutyName").toString();
            map.put("orgInfo",orgname+"/"+deptname+"/"+doctorDutyName);
            /*for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:listDict){
                if (map.get("doctorlevel").toString().equals(wlyyHospitalSysDictDO.getDictCode())){
                    map.put("levelName",wlyyHospitalSysDictDO.getDictValue());
                }
            }*/
        }
        result.put("count", count);
        result.put("msg", JavaBeanUtils.getInstance().mapListJson(list));
@ -1252,7 +1268,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
        return list;
    }
    //医生重置密码
    public String  resetDoctorPwd(String doctor){
    @Transactional
    public String  resetDoctorPwd(String doctor) throws Exception{
        BaseDoctorDO baseDoctorDO= baseDoctorDao.findById(doctor);
        if (baseDoctorDO!=null){
@ -1263,6 +1280,29 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
            }
            baseDoctorDO.setPassword(MD5.md5Hex(baseDoctorDO.getIdcard().substring(12, 18) + "{" + salt + "}"));
            baseDoctorDao.save(baseDoctorDO);
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                String res = ykyyService.getResetCode("4",baseDoctorDO.getMobile());
                String resltCode ="";
                String captcha = "";
                if (!StringUtils.isEmpty(res)){
                    JSONObject jsonObject = JSONObject.parseObject(res);
                    if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
                        captcha = jsonObject.getString("value");
                        resltCode = jsonObject.getString("code");
                        String response =  ykyyService.ResetPwd(baseDoctorDO.getMobile(),baseDoctorDO.getIdcard().substring(12, 18),captcha);
                        if (org.apache.commons.lang3.StringUtils.isNoneBlank(response)){
                            JSONObject object = JSONObject.parseObject(response);
                            if (object.getString("code").equalsIgnoreCase("10000")){
                                return "修改成功!";
                            }else {
                                throw  new Exception("修改失败");
                            }
                        }else {
                            throw  new Exception("修改失败");
                        }
                    }
                }
            }
            return "操作成功";
        }
        return "医生不存在";

+ 704 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/menu/BaseMenuManageService.java

@ -0,0 +1,704 @@
package com.yihu.jw.base.service.menu;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.base.dao.article.KnowledgeArticleDictDao;
import com.yihu.jw.base.dao.article.KnowledgeArticleMenuDao;
import com.yihu.jw.base.dao.menu.BaseLinkDictDao;
import com.yihu.jw.base.dao.menu.BaseMenuDictDao;
import com.yihu.jw.base.dao.menu.BaseMenuShowDao;
import com.yihu.jw.entity.base.menu.BaseLinkDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuDictDO;
import com.yihu.jw.entity.base.menu.BaseMenuShowDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDictDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
@Service
public class BaseMenuManageService {
    @Autowired
    private BaseMenuDictDao baseMenuDictDao;
    @Autowired
    private BaseMenuShowDao baseMenuShowDao;
    @Autowired
    private BaseLinkDictDao baseLinkDictDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private KnowledgeArticleMenuDao knowledgeArticleMenuDao;
    @Autowired
    private KnowledgeArticleDictDao knowledgeArticleDictDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    //删除菜单字典
    public void deletMenuDict(String id) throws  Exception{
        BaseMenuDictDO baseMenuDictDO= baseMenuDictDao.findOne(id);
        if (baseMenuDictDO!=null){
            if ("0".equalsIgnoreCase(baseMenuDictDO.getParentId())){
                 List<BaseMenuDictDO> childList = baseMenuDictDao.findByParentId(baseMenuDictDO.getId());
                 if (childList!=null&&childList.size()>0){
                     throw  new Exception("存在子菜单不允许删除");
                 }else {
                     baseMenuDictDO.setIsDel("0");
                 }
            }else {
                if (1==baseMenuDictDO.getStatus()){
                    throw  new Exception("生效的子菜单不允许删除");
                }else{
                    baseMenuDictDO.setIsDel("0");
                }
            }
            baseMenuDictDao.save(baseMenuDictDO);
        }
    }
    //菜单词典查询
    public List<Map<String,Object>> findMenuDictByKey(String parentId, String name){
        String sql = "select t.id as \"id\", " +
                " t.parent_id as \"parentId\", " +
                " t.name as \"name\", " +
                " t.menu_sort as \"menuSort\", " +
                " t.icon as \"icon\", " +
                " t.url as \"url\", " +
                " t.is_show as \"isShow\", " +
                " t.status as \"status\", " +
                " t.create_time as \"createTime\", " +
                " t.remark as \"remark\", " +
                " t.function_type as \"functionType\", " +
                " t.menu_level as \"menuLevel\", " +
                " t.menu_location as \"menuLocation\", " +
                " t.bg_img as \"bgImg\", " +
                " t.menu_title as \"menuTitle\", " +
                " t.describtion as \"describtion\", " +
                " t.menu_img as \"menuImg\"  " +
                "from base_menu_dict t  where 1=1 and t.is_del ='1' ";
        String sqlParent ="select t.id as \"id\", " +
                " t.parent_id as \"parentId\", " +
                " t.name as \"name\", " +
                " t.menu_sort as \"menuSort\", " +
                " t.icon as \"icon\", " +
                " t.url as \"url\", " +
                " t.is_show as \"isShow\", " +
                " t.status as \"status\", " +
                " t.create_time as \"createTime\", " +
                " t.remark as \"remark\", " +
                " t.function_type as \"functionType\", " +
                " t.menu_level as \"menuLevel\", " +
                " t.bg_img as \"bgImg\", " +
                " t.menu_title as \"menuTitle\", " +
                " t.describtion as \"describtion\", " +
                " t.menu_location as \"menuLocation\", " +
                " t.menu_img as \"menuImg\"  " +
                "from base_menu_dict t   where 1=1 and t.is_del ='1' ";
        if (StringUtils.isNoneBlank(parentId)){
            sql+=" and t.parent_id = '"+parentId+"'";
            sqlParent+=" and t.id = '"+parentId+"'";
        }else {
            sqlParent+=" and t.parent_id = '0'";
        }
        if (StringUtils.isNoneBlank(name)){
            sql+=" and t.name like '%"+name+"%'";
            sqlParent+=" and t.name like '%"+name+"%'";
        }
        sql+=" order by t.parent_id asc ,t.menu_sort asc ";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        List<Map<String,Object>> listParent = hibenateUtils.createSQLQuery(sqlParent);
        List<WlyyHospitalSysDictDO> menuLocation = wlyyHospitalSysDictDao.findByDictName("menuLocation");
        List<WlyyHospitalSysDictDO> menuFunction = wlyyHospitalSysDictDao.findByDictName("menuFunction");
        List<WlyyHospitalSysDictDO> effect = wlyyHospitalSysDictDao.findByDictName("isEffect");
        for (Map<String,Object> map:listParent){
            List<Map<String,Object>> childList = new ArrayList<>();
            Integer articleParentNum= knowledgeArticleDictDao.getCountByCategoryFirst(map.get("id").toString());
            map.put("articleNum",articleParentNum);
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:effect){
                if (map.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    map.put("statusName",wlyyHospitalSysDictDO.getDictValue());
                    map.put("isShow",map.get("status").toString().equalsIgnoreCase("1")?"是":"否");
                }
            }
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:menuLocation){
                if (map.get("menuLocation").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    map.put("menuLocationName",wlyyHospitalSysDictDO.getDictValue());
                }
            }
            for (Map<String,Object> mapchild:list){
                if (mapchild.get("parentId").toString().equalsIgnoreCase(map.get("id").toString())){
                   Integer articleChildNum= knowledgeArticleDictDao.getCountByCategorySecond(mapchild.get("id").toString());
                    mapchild.put("articleNum",articleChildNum);
                    for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:effect){
                        if (mapchild.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                            mapchild.put("statusName",wlyyHospitalSysDictDO.getDictValue());
                            mapchild.put("isShow",mapchild.get("status").toString().equalsIgnoreCase("1")?"是":"否");
                        }
                    }
                    for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:menuFunction){
                        if (mapchild.get("functionType").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                            mapchild.put("functionTypeName",wlyyHospitalSysDictDO.getDictValue());
                        }
                    }
                    childList.add(mapchild);
                }
            }
            map.put("childList",childList);
        }
        return listParent;
    }
    //查询单挑菜单字典
    public BaseMenuDictDO findOneMenuDict(String id){
        BaseMenuDictDO baseMenuDictDO= baseMenuDictDao.findOne(id);
        if (baseMenuDictDO!=null){
            WlyyHospitalSysDictDO effect = wlyyHospitalSysDictDao.findOneByDictNameAndDictCode("isEffect",baseMenuDictDO.getStatus().toString());
            baseMenuDictDO.setShowName(baseMenuDictDO.getStatus().equals("1")?"是":"否");
            baseMenuDictDO.setStatusName(effect.getDictValue());
            if (!"0".equalsIgnoreCase(baseMenuDictDO.getParentId())){
                BaseMenuDictDO parentDo= baseMenuDictDao.findOne(baseMenuDictDO.getParentId());
                if (parentDo!=null){
                    baseMenuDictDO.setParentName(parentDo.getName());
                }
                WlyyHospitalSysDictDO menuFunction = wlyyHospitalSysDictDao.findOneByDictNameAndDictCode("menuFunction",baseMenuDictDO.getFunctionType());
                baseMenuDictDO.setFunctionName(menuFunction.getDictValue());
            }else {
                WlyyHospitalSysDictDO menuLocation = wlyyHospitalSysDictDao.findOneByDictNameAndDictCode("menuLocation",baseMenuDictDO.getMenuLocation());
                baseMenuDictDO.setLocaTionName(menuLocation.getDictValue());
            }
        }
        return baseMenuDictDO;
    }
    /**
     * 二级菜单下移
     * @param
     * @return
     * @throws Exception
     */
    public BaseMenuDictDO downMenu(String id) throws Exception{
        BaseMenuDictDO baseMenuDictDO= baseMenuDictDao.findOne(id);
        int maxSort = baseMenuDictDao.getMaxSort(baseMenuDictDO.getParentId());
        int sort = 0;
        if(null!=baseMenuDictDO){
            sort = baseMenuDictDO.getMenuSort();
        }
        if (maxSort==sort){
            throw new Exception("不能下移");
        }
        String sql = "select t.id AS \"id\" from base_menu_dict t where t.is_del='1' and t.menu_sort > "+sort+" and " +
                " t.parent_id='"+baseMenuDictDO.getParentId()+"' order by t.menu_sort asc ";
        System.out.println(sql);
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
        BaseMenuDictDO upPrevious = new BaseMenuDictDO();
        if (list.size()>0){
            String prviousBannerId = list.get(0).get("id").toString();
            upPrevious =baseMenuDictDao.findOne(prviousBannerId);
        }
        //交换sort值
        baseMenuDictDO.setMenuSort(upPrevious.getMenuSort());
        upPrevious.setMenuSort(sort);
        baseMenuDictDao.save(baseMenuDictDO);
        baseMenuDictDao.save(upPrevious);
        return baseMenuDictDO;
    }
    /**
     * 二级菜单上移
     * * @param
     * @return
     * @throws Exception
     */
    public BaseMenuDictDO upMenu(String id) throws Exception{
        //当前
        BaseMenuDictDO baseMenuDictDO = baseMenuDictDao.findOne(id);
        int minSort = baseMenuDictDao.getMinSort(baseMenuDictDO.getParentId());
        int sort = 0;
        if(null!=baseMenuDictDO){
            sort = baseMenuDictDO.getMenuSort();
        }
        if (minSort==sort){
            throw new Exception("不能上移");
        }
        String sql = " select id AS \"id\" from base_menu_dict where  is_del='1' and menu_sort < "+sort+" and" +
                " parent_id='"+baseMenuDictDO.getParentId()+"'order by menu_sort desc ";
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
        BaseMenuDictDO downPrevious = new BaseMenuDictDO();
        if (list.size()>0){
            String prviousBannerId = list.get(0).get("id").toString();
            downPrevious =baseMenuDictDao.findOne(prviousBannerId);
        }
        //获取的下一条b
        //交换sort值
        baseMenuDictDO.setMenuSort(downPrevious.getMenuSort());
        downPrevious.setMenuSort(sort);
        baseMenuDictDao.save(baseMenuDictDO);
        baseMenuDictDao.save(downPrevious);
        return baseMenuDictDO;
    }
    /**
     * 设置生效和失效
     * @param id
     * @param status
     */
    @Transactional(rollbackFor = Exception.class)
    public void updateStatus(String id,Integer status){
        baseMenuDictDao.updateStatus(id,status);
    }
    //新增修改菜单
    public BaseMenuDictDO createOrUpdateMenu(String json) throws  Exception{
        BaseMenuDictDO menuDO = objectMapper.readValue(json,BaseMenuDictDO.class);
        if (StringUtils.isNoneBlank(menuDO.getId())){
            BaseMenuDictDO menuOld = baseMenuDictDao.findOne(menuDO.getId());
            if (menuOld!=null){
                menuOld.setParentId(menuDO.getParentId());
                menuOld.setName(menuDO.getName());
                menuOld.setMenuLocation(menuDO.getMenuLocation());
                menuOld.setFunctionType(menuDO.getFunctionType());
                //menuOld.setIsShow(menuDO.getIsShow());
                menuOld.setMenuImg(menuDO.getMenuImg());
                menuOld.setDescribtion(menuDO.getDescribtion());
                menuOld.setMenuTitle(menuDO.getMenuTitle());
                menuOld.setBgImg(menuDO.getBgImg());
                menuOld.setUpdateTime(new Date());
                menuOld.setIsDel("1");
                menuDO = baseMenuDictDao.save(menuOld);
            }
        }else {
            if (!"0".equalsIgnoreCase(menuDO.getParentId())){
                Integer maxSort=baseMenuDictDao.getMaxSort(menuDO.getParentId());
                menuDO.setMenuSort((maxSort==null?0:maxSort)+1);
                menuDO.setIsDel("1");
                menuDO.setIsShow(menuDO.getStatus()==1?"1":"0");
            }else{
                menuDO.setIsDel("1");
                menuDO.setIsShow(menuDO.getStatus()==1?"1":"0");
                menuDO.setMenuSort(1);
            }
            menuDO = baseMenuDictDao.save(menuDO);
        }
        return menuDO;
    }
    //新增修改友情链接
    public BaseLinkDictDO createOrUpdateLink(String json) throws  Exception{
        BaseLinkDictDO linkDictDO = objectMapper.readValue(json,BaseLinkDictDO.class);
        Integer maxSort=baseLinkDictDao.getMaxSort();
        if (StringUtils.isNoneBlank(linkDictDO.getId())){
            BaseLinkDictDO baseLinkDictDO=baseLinkDictDao.findOne(linkDictDO.getId());
            if (baseLinkDictDO!=null){
                baseLinkDictDO.setName(linkDictDO.getName());
                baseLinkDictDO.setLinkUrl(linkDictDO.getLinkUrl());
                //baseLinkDictDO.setLinkSort((maxSort==null?0:maxSort)+1);
                baseLinkDictDO.setIsShow(linkDictDO.getIsShow());
                baseLinkDictDO.setStatus(linkDictDO.getStatus());
                baseLinkDictDO.setIsDel("1");
                linkDictDO =  baseLinkDictDao.save(baseLinkDictDO);
            }else {
                throw new  NoSuchElementException();
            }
        }else {
            linkDictDO.setLinkSort((maxSort==null?0:maxSort)+1);
            linkDictDO.setIsDel("1");
            linkDictDO =  baseLinkDictDao.save(linkDictDO);
        }
        return linkDictDO;
    }
    public List<Map<String,Object>> findLinkDict(String name,String status){
        String sql="select t.id as \"id\"," +
                " t.name as \"name\"," +
                " t.link_url as \"linkUrl\"," +
                " t.is_show as \"isShow\"," +
                " t.status as \"status\"," +
                " t.link_sort as \"linkSort\"," +
                " t.create_time as \"createTime\"," +
                " t.is_del as \"isDel\" " +
                " from base_link_dict t where 1=1 and t.is_del='1'";
        if (StringUtils.isNoneBlank(name)){
            sql+=" and t.name like '%"+name+"%'";
        }
        if (StringUtils.isNoneBlank(status)){
            sql+=" and t.status = '"+status+"'";
        }
        sql+=" order by t.link_sort asc";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        List<WlyyHospitalSysDictDO> effect = wlyyHospitalSysDictDao.findByDictName("isEffect");
        for (Map<String,Object> map:list){
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:effect){
                if (map.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    map.put("statusName",wlyyHospitalSysDictDO.getDictValue());
                    map.put("isShow",map.get("status").toString().equalsIgnoreCase("1")?"是":"否");
                }
            }
        }
        return list;
    }
    public BaseLinkDictDO findOneLinkDict(String id){
        BaseLinkDictDO baseLinkDictDO= baseLinkDictDao.findOne(id);
        if (baseLinkDictDO!=null){
            WlyyHospitalSysDictDO effect = wlyyHospitalSysDictDao.findOneByDictNameAndDictCode("isEffect",baseLinkDictDO.getStatus());
            baseLinkDictDO.setShowName(baseLinkDictDO.getStatus().equalsIgnoreCase("1")?"是":"否");
            baseLinkDictDO.setStatusName(effect.getDictValue());
        }
        return baseLinkDictDO;
    }
    /**
     * 友情链接下移
     * @param
     * @return
     * @throws Exception
     */
    public BaseLinkDictDO downlink(String id) throws Exception{
        BaseLinkDictDO baseLinkDictDO= baseLinkDictDao.findOne(id);
        int maxSort = baseLinkDictDao.getMaxSort();
        int sort = 0;
        if(null!=baseLinkDictDO){
            sort = baseLinkDictDO.getLinkSort();
        }
        if (maxSort==sort){
            throw new Exception("不能下移");
        }
        String sql = "select t.id AS \"id\" from base_link_dict t where t.is_del='1' and  t.link_sort > "+sort+" order by t.link_sort asc ";
        System.out.println(sql);
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
        BaseLinkDictDO upPrevious = new BaseLinkDictDO();
        if (list.size()>0){
            String prviousBannerId = list.get(0).get("id").toString();
            upPrevious =baseLinkDictDao.findOne(prviousBannerId);
        }
        //交换sort值
        baseLinkDictDO.setLinkSort(upPrevious.getLinkSort());
        upPrevious.setLinkSort(sort);
        baseLinkDictDao.save(baseLinkDictDO);
        baseLinkDictDao.save(upPrevious);
        return baseLinkDictDO;
    }
    /**
     * 友情链接上移
     * * @param
     * @return
     * @throws Exception
     */
    public BaseLinkDictDO upLink(String id) throws Exception{
        //当前
        BaseLinkDictDO baseLinkDictDO = baseLinkDictDao.findOne(id);
        int minSort = baseLinkDictDao.getMinSort();
        int sort = 0;
        if(null!=baseLinkDictDO){
            sort = baseLinkDictDO.getLinkSort();
        }
        if (minSort==sort){
            throw new Exception("不能上移");
        }
        String sql = " select id AS \"id\" from base_link_dict where is_del='1' and link_sort < "+sort+" order by link_sort desc ";
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
        BaseLinkDictDO downPrevious = new BaseLinkDictDO();
        if (list.size()>0){
            String prviousBannerId = list.get(0).get("id").toString();
            downPrevious =baseLinkDictDao.findOne(prviousBannerId);
        }
        //获取的下一条b
        //交换sort值
        baseLinkDictDO.setLinkSort(downPrevious.getLinkSort());
        downPrevious.setLinkSort(sort);
        baseLinkDictDao.save(baseLinkDictDO);
        baseLinkDictDao.save(downPrevious);
        return baseLinkDictDO;
    }
    /**
     * 设置生效和失效
     * @param id
     * @param status
     */
    @Transactional(rollbackFor = Exception.class)
    public void updateLinkStatus(String id,String status){
        baseLinkDictDao.updateStatus(id,status);
    }
    /**
     * 设置生效和失效
     * @param id
     * @param status
     */
    @Transactional(rollbackFor = Exception.class)
    public void updateLinkShow(String id,String status){
        baseLinkDictDao.updateShow(id,status);
    }
    /**
     * 友情链接删除
     * @param id
     *
     */
    @Transactional(rollbackFor = Exception.class)
    public void updateLinkDel(String id){
        baseLinkDictDao.updateDel(id,"0");
    }
    /**
     * 移除首页菜单
     * @param menuId
     *
     */
    public BaseMenuShowDO removeMenu(String menuId){
        BaseMenuShowDO baseMenuShowDO = baseMenuShowDao.findOne(menuId);
        baseMenuShowDO.setIsDel("0");
        baseMenuShowDao.save(baseMenuShowDO);
        return baseMenuShowDO;
    }
    public  List<Map<String,Object>> findMenuShow(){
        String modelSql = "select t.id as \"id\"," +
                " t.model_id as \"modelId\", " +
                " t.model_name as \"modelName\" from base_menu_show t where t.is_del ='1'" +
                " group by  t.model_id, t.model_name" ;
        List<Map<String,Object>> listModel=hibenateUtils.createSQLQuery(modelSql);
        String sql =" select t.id as \"id\", " +
                " t.model_id as \"modelId\", " +
                " t.model_name as \"modelName\", " +
                " t.menu_id as \"menuId\", " +
                " t.menu_name as \"menuName\", " +
                " t.is_del as \"isDel\"," +
                " t.create_time as \"createTime\"," +
                " t.menu_sort as \"menuSort\"," +
                " t.style_code as \"styleCode\"," +
                " t.style_name as \"styleName\" " +
                " from base_menu_show t left join " +
                " base_menu_dict m on t.menu_id= m.id" +
                " where t.is_del ='1' order by t.model_id asc ,t.menu_sort asc ";
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql);
        String sqlLink =" select t.id as \"id\", " +
                " t.model_id as \"modelId\", " +
                " t.model_name as \"modelName\", " +
                " t.menu_id as \"menuId\", " +
                " t.menu_name as \"menuName\", " +
                " t.is_del as \"isDel\"," +
                " t.create_time as \"createTime\"," +
                " t.menu_sort as \"menuSort\"," +
                " t.style_code as \"styleCode\"," +
                " t.style_name as \"styleName\" " +
                " from base_menu_show t left join " +
                " base_link_dict m on t.menu_id= m.id" +
                " where t.is_del ='1' and t.model_id='03' and t.status='1' order by t.menu_sort asc ";
        List<Map<String,Object>> listLink=hibenateUtils.createSQLQuery(sqlLink);
        for (Map<String,Object> map:listModel){
            List<Map<String,Object>> child = new ArrayList<>();
            if("03".equalsIgnoreCase(map.get("modelId").toString())){
                map.put("childList",listLink);
                map.put("childListNum",listLink==null?0:listLink.size());
            }else {
                for (Map<String,Object> childMap:list){
                    if (childMap.get("modelId").toString().equalsIgnoreCase(map.get("modelId").toString())){
                        child.add(childMap);
                    }
                }
            }
            map.put("childList",child);
        }
        return listModel;
    }
    /**
     * 首页菜单展示下移
     * @param
     * @return
     * @throws Exception
     */
    public BaseMenuShowDO downMenuShow(String id) throws Exception{
        BaseMenuShowDO baseMenuShowDO= baseMenuShowDao.findOne(id);
        int maxSort = baseMenuShowDao.getMaxSort();
        int sort = 0;
        if(null!=baseMenuShowDO){
            sort = baseMenuShowDO.getMenuSort();
        }
        if (maxSort==sort){
            throw new Exception("不能下移");
        }
        String sql = "select t.id AS \"id\" from base_menu_show t where t.is_del='1' and t.menu_sort > "+sort+" " +
                " and t.model_id='"+baseMenuShowDO.getModelId()+"'order by t.menu_sort asc ";
        System.out.println(sql);
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
        BaseMenuShowDO upPrevious = new BaseMenuShowDO();
        if (list.size()>0){
            String prviousBannerId = list.get(0).get("id").toString();
            upPrevious =baseMenuShowDao.findOne(prviousBannerId);
        }
        //交换sort值
        baseMenuShowDO.setMenuSort(upPrevious.getMenuSort());
        upPrevious.setMenuSort(sort);
        baseMenuShowDao.save(baseMenuShowDO);
        baseMenuShowDao.save(upPrevious);
        return baseMenuShowDO;
    }
    /**
     * 首页菜单展示上移
     * * @param
     * @return
     * @throws Exception
     */
    public BaseMenuShowDO upMenuShow(String id) throws Exception{
        //当前
        BaseMenuShowDO baseMenuShowDO = baseMenuShowDao.findOne(id);
        int minSort = baseMenuShowDao.getMinSort();
        int sort = 0;
        if(null!=baseMenuShowDO){
            sort = baseMenuShowDO.getMenuSort();
        }
        if (minSort==sort){
            throw new Exception("不能上移");
        }
        String sql = " select id AS \"id\" from base_menu_show where is_del='1' and menu_sort < "+sort+" " +
                " and model_id ='"+baseMenuShowDO.getModelId()+"'order by menu_sort desc ";
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
        BaseMenuShowDO downPrevious = new BaseMenuShowDO();
        if (list.size()>0){
            String prviousBannerId = list.get(0).get("id").toString();
            downPrevious =baseMenuShowDao.findOne(prviousBannerId);
        }
        //获取的下一条b
        //交换sort值
        baseMenuShowDO.setMenuSort(downPrevious.getMenuSort());
        downPrevious.setMenuSort(sort);
        baseMenuShowDao.save(baseMenuShowDO);
        baseMenuShowDao.save(downPrevious);
        return baseMenuShowDO;
    }
    public void saveMenuShow(String json) throws  Exception{
        List<BaseMenuShowDO> menuShowDO = JSON.parseArray(json,BaseMenuShowDO.class);
        List<WlyyHospitalSysDictDO> list = wlyyHospitalSysDictDao.findByDictName("menuStyle");
        int i =1;
        for (BaseMenuShowDO baseMenuShowDO:menuShowDO){
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:list){
                if (baseMenuShowDO.getStyleCode().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    baseMenuShowDO.setStyleName(wlyyHospitalSysDictDO.getDictValue());
                }
            }
            String modelSql = "select t.id as \"id\"," +
                    " t.model_id as \"modelId\", max(t.menu_sort) as \"maxSort\"" +
                    " from base_menu_show t where t.is_del ='1'" +"and t.model_id='"+baseMenuShowDO.getModelId()+"'"+
                    " group by  t.model_id " ;
            List<Map<String,Object>> listModel=hibenateUtils.createSQLQuery(modelSql);
            if (listModel!=null&&listModel.size()>0){
                baseMenuShowDO.setMenuSort((listModel.get(0).get("maxSort")==null?0:Integer.valueOf(listModel.get(0).get("maxSort").toString()))+i);
            }else {
                baseMenuShowDO.setMenuSort(1);
            }
            baseMenuShowDO.setIsDel("1");
            baseMenuShowDO.setCreateTime(new Date());
            i++;
        }
        baseMenuShowDao.save(menuShowDO);
    }
    public List<Map<String,Object>> findByParentId(String parentId,Integer status){
        String sql = "select t.id as \"id\", " +
                " t.parent_id as \"parentId\", " +
                " t.name as \"name\", " +
                " t.menu_sort as \"menuSort\", " +
                " t.icon as \"icon\", " +
                " t.url as \"url\", " +
                " t.is_show as \"isShow\", " +
                " t.status as \"status\", " +
                " t.create_time as \"createTime\", " +
                " t.remark as \"remark\", " +
                " t.function_type as \"functionType\", " +
                " t.menu_level as \"menuLevel\", " +
                " t.menu_location as \"menuLocation\", " +
                " t.bg_img as \"bgImg\", " +
                " t.menu_title as \"menuTitle\", " +
                " t.describtion as \"describtion\", " +
                " t.menu_img as \"menuImg\"  " +
                "from base_menu_dict t  where 1=1 and t.is_del ='1' ";
        if (StringUtils.isNoneBlank(parentId)){
            sql+=" and t.parent_id='"+parentId+"'";
        }
        if (status!=null){
            sql+=" and t.status="+status+"";
        }
        sql+="order by t.menu_sort asc";
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql);
        return list;
    }
    public MixEnvelop findArticleByMenuId(String menuId,Integer page,Integer pageSize){
        Pageable pageRequest = new PageRequest(page-1,pageSize);
        List<KnowledgeArticleDictDO> list=knowledgeArticleDictDao.findByCategorySecondAndPage(menuId,pageRequest);
        Integer count = knowledgeArticleDictDao.getCountByCategorySecond(menuId);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setTotalCount(count);
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        return mixEnvelop;
    }
    //菜单词典查询
    public List<Map<String,Object>> findMenuDictParent(String parentId, String name){
        String sqlParent ="select t.id as \"id\", " +
                " t.parent_id as \"parentId\", " +
                " t.name as \"name\", " +
                " t.menu_sort as \"menuSort\", " +
                " t.icon as \"icon\", " +
                " t.url as \"url\", " +
                " t.is_show as \"isShow\", " +
                " t.status as \"status\", " +
                " t.create_time as \"createTime\", " +
                " t.remark as \"remark\", " +
                " t.function_type as \"functionType\", " +
                " t.menu_level as \"menuLevel\", " +
                " t.menu_location as \"menuLocation\", " +
                " t.bg_img as \"bgImg\", " +
                " t.menu_title as \"menuTitle\", " +
                " t.describtion as \"describtion\", " +
                " t.menu_img as \"menuImg\"  " +
                "from base_menu_dict t   where 1=1 and t.is_del ='1' and status =1";
        if (StringUtils.isNoneBlank(parentId)){
            sqlParent+=" and t.id = '"+parentId+"'";
        }else {
            sqlParent+=" and t.parent_id = '0'";
        }
        if (StringUtils.isNoneBlank(name)){
            sqlParent+=" and t.name like '%"+name+"%'";
        }
        List<Map<String,Object>> listParent = hibenateUtils.createSQLQuery(sqlParent);
        List<WlyyHospitalSysDictDO> menuLocation = wlyyHospitalSysDictDao.findByDictName("menuLocation");
        List<WlyyHospitalSysDictDO> effect = wlyyHospitalSysDictDao.findByDictName("isEffect");
        for (Map<String,Object> map:listParent){
            Integer articleParentNum= knowledgeArticleDictDao.getCountByCategoryFirst(map.get("id").toString());
            map.put("articleNum",articleParentNum);
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:effect){
                if (map.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    map.put("statusName",wlyyHospitalSysDictDO.getDictValue());
                    map.put("isShow",map.get("status").toString().equalsIgnoreCase("1")?"是":"否");
                }
            }
            for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:menuLocation){
                if (map.get("menuLocation").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                    map.put("menuLocationName",wlyyHospitalSysDictDO.getDictValue());
                }
            }
        }
        return listParent;
    }
}

+ 6 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/org/BaseOrgService.java

@ -360,8 +360,12 @@ public class BaseOrgService extends BaseJpaService<BaseOrgDO, BaseOrgDao> {
    }
    public String getOrgAreaTree(String saasId){
        StringBuffer sql = new StringBuffer("SELECT t.* from base_org b,org_tree t,base_org_saas o ")
                .append("WHERE o.saasid='").append(saasId).append("' AND o.org_code = b.`code` AND ")
        StringBuffer sql = new StringBuffer("SELECT t.id as \"id\"," +
                "t.PARENT_CODE as \"PARENT_CODE\"," +
                "t.CODE as\"CODE\"," +
                "t.NAME as \"NAME\"," +
                "t.ORG_LEVEL as \"ORG_LEVEL \" from base_org b,org_tree t,base_org_saas o ")
                .append("WHERE o.saasid='").append(saasId).append("' AND o.org_code = b.code AND ")
                .append("(b.code= t.code or b.city_code=t.code or b.province_code = t.code or b.town_code=t.code)");
        List<TreeNode> treeNodes = new ArrayList<>();

+ 5 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/role/MenuService.java

@ -3,9 +3,11 @@ package com.yihu.jw.base.service.role;
import com.yihu.jw.base.contant.CommonContant;
import com.yihu.jw.base.dao.role.MenuDao;
import com.yihu.jw.entity.base.role.MenuDO;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.provider.HibernateUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -20,6 +22,8 @@ public class MenuService extends BaseJpaService<MenuDO, MenuDao> {
    @Autowired
    private MenuDao menuDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    /**
     * 设置生效和失效
@ -122,4 +126,5 @@ public class MenuService extends BaseJpaService<MenuDO, MenuDao> {
    public MenuDO findOne(String id){
        return menuDao.findOne(id);
    }
    //public List<Map<String,Object>> queryMenuBy
}

+ 533 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/util/YkyyBaseService.java

@ -0,0 +1,533 @@
package com.yihu.jw.base.service.util;
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.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.idcard.IdCardUtil;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.yihu.jw.util.common.PwdUtil.randomString;
/**
 * 眼科医院
 * Created by yeshijie on 2020/4/24.
 *
 * @author yeshijie.
 */
@Service
public class YkyyBaseService {
    private Logger logger = LoggerFactory.getLogger(YkyyBaseService.class);
    @Autowired
    private HttpClientUtil httpClientUtil;
    private static String yktUrl1 = "http://www.yanketong.com:90/";
    @Autowired
    private BasePatientDao patientDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private BaseDoctorRoleDao baseDoctorRoleDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    private final static String orgCode ="350211A5004";
    private final static String orgName ="厦门大学附属厦门眼科中心";
    private final static String url="http://192.168.20.55:10023/ykyy/createSQLQuery";
    private static String yktUrl = "http://www.yanketong.com:133/api/";
    /**
     * 眼科医院单点登录接口
     * @return
     */
    public String getDoctorInfoByVerifycode(String verifyCode){
        String url = "api/Doctor/GetDoctorInfoByverifycode";
        return httpClientUtil.get(yktUrl1+url+"?verifyCode="+verifyCode,"GBK");
    }
    /**
     * 眼科医院单点登录接口
     * @return
     */
    public String getPatientInfoByVerifycode(String verifyCode){
        String url = "/api/patient/GetPatientInfoByVerifycode";
        return httpClientUtil.get(yktUrl1+url+"?verifyCode="+verifyCode,"GBK");
    }
    /**
     *获取家庭成员信息
     *
     * @param tel
     * @param userId
     * @return
     */
    public String getFamilyList(String tel,String userId){
        String response="";
        String url = yktUrl+"doc_jkzl/get_family_list?";
        if (StringUtils.isNoneBlank(tel)&&StringUtils.isNoneBlank(userId)){
            url+="tel="+tel;
            url+="&user_id="+userId;
        }else if (StringUtils.isNoneBlank(tel)&&!StringUtils.isNoneBlank(userId)){
            url+="tel="+tel;
        }else if (!StringUtils.isNoneBlank(tel)&&StringUtils.isNoneBlank(userId)){
            url+="user_id="+userId;
        }
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取家庭成员信息:"+response);
        return response;
    }
    /**
     * 眼科通登录接口
     * @param tel
     * @param password
     * @return
     */
    public String yktLogin(String tel,String password){
        String response="";
        String url = yktUrl+"user_center/patient_login?patient_account="+tel+"&patient_pwd="+password;
        response = httpClientUtil.get(url,"GBK");
        logger.info("获取眼科通登录信息:"+response);
        return response;
    }
    /**
     * 眼科通验证码
     * @param type
     * @param phone
     * @return
     */
    public String getShortMessage(String type,String phone){
        String response="";
        String url = yktUrl+"verification_code/short_message?type="+type+"&telephone="+phone;
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通验证码:"+response);
        return response;
    }
    /**
     * 获取眼科通修改密码验证码
     * @param type
     * @param phone
     * @return
     */
    public String getResetCode(String type,String phone) throws  Exception{
        String response="";
        String codeResponse = getVerificationReal(phone,type,"");
        String veryCode = "";
        if (StringUtils.isNoneBlank(codeResponse)){
            JSONObject jsonObject = JSONObject.parseObject(codeResponse);
            if ("10000".equalsIgnoreCase(jsonObject.getString("code"))){
                veryCode =  jsonObject.getString("value");
            }
        }
        String url = yktUrl1+"api/Doctor/GetVerificationCode";
        Map param = new HashMap();
        param.put("loginid",phone);
        param.put("type",type);
        param.put("VerificationReal",veryCode);
        logger.info("请求参数:"+param.toString());
        response = httpClientUtil.httpPost(url,param);
        logger.info("眼科通验证码:"+response);
        return response;
    }
    /**获取图形验证码
     *
     * @param loginid
     * @param type
     * @param IPAddress
     * @return
     */
    public String getVerificationReal(String loginid,String type,String IPAddress) throws  Exception{
        String response="";
        Map map = new HashMap();
        map.put("loginid",loginid);
        map.put("type",type);
        map.put("IPAddress",IPAddress);
        String url = yktUrl1+"api/Share/GetVerificationReal";
        response = httpClientUtil.httpPost(url,map);
        logger.info("修改眼科同密码后的信息:"+response);
        return response;
    }
    /**
     * 忘记密码修改
     * @param loginid
     * @param password
     * @return
     */
    public String ResetPwd(String loginid,String password,String verCode) throws  Exception{
        String response="";
        String url = yktUrl1+"api/Doctor/ResetPassword";
        Map param = new HashMap();
        param.put("loginid",loginid);
        param.put("password",password);
        param.put("verCode",verCode);
        logger.info("请求参数:"+param.toString());
        response = httpClientUtil.httpPost(url,param);
        logger.info("眼科通验证码:"+response);
        return response;
    }
    /**
     * 增加家庭成员
     * @param userId
     * @param idcard
     * @param name
     * @param sex
     * @param birth
     * @param age
     * @param tel
     * @return
     */
    public String addFamily(String userId,String idcard,String name,String sex,String birth,String age,String tel){
        String response="";
        String url = yktUrl+"doc_jkzl/add_family?ass_user_id="+userId+"&id_card="+idcard+"&name="+name+"&sex="+sex
                +"&birth="+birth+"&age="+age+"&tel="+tel+"&medical_card=&illness=本人&clinic_id=";
        response = httpClientUtil.get(url,"GBK");
        logger.info("增加家庭成员:"+response);
        return response;
    }
    /**获取眼科通忘记密码信息
     *
     * @param tel
     * @param password
     * @param vercode
     * @return
     */
    public String   forgetPassword(String tel,String password,String vercode){
        String response="";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("loginid",tel);
        jsonObject.put("password",password);
        String url = "http://www.yanketong.com:90/api/Patient/ForgotPassword4Jkzl";
        response = httpClientUtil.sendPost(url,jsonObject.toJSONString());
        logger.info("获取眼科通忘记密码信息:"+response);
        return response;
    }
    /**
     * telephone=15578008051&patient_pwd=123456&code=513970&invite_code=a01522&equipment_type=ios&equipment_guid=12312321
     * 眼科通用户注册
     *
     * @param telephone
     * @param patientPwd
     * @param code
     * @return
     */
    public String getRegisterUser(String telephone,String patientPwd,String code,String inviteCode,String equipmentType,String equipmentGuid){
        String response="";
        String url = yktUrl+"user_center/patient_register01?telephone="+telephone+"&patient_pwd="+patientPwd+"&code="+code+"&invite_code="+inviteCode+"&equipment_type="+equipmentType+
                "&equipment_guid="+equipmentGuid;
        response = httpClientUtil.get(url,"GBK");
        logger.info("眼科通用户注册:"+response);
        return response;
    }
    /**
     * 同步眼科通数据
     * @param patient
     * @return
     * @throws Exception
     */
    public void registerYkt(String patient,String pw,String code) throws Exception {
        BasePatientDO basePatientDO  = patientDao.findById(patient);
        if (basePatientDO!=null){
            String userId = basePatientDO.getUserId();
            if (StringUtils.isNoneBlank(userId)){
                String familyList =getFamilyList(null,userId);
                JSONObject object = JSONObject.parseObject(familyList);
                if (object.getString("code").equalsIgnoreCase("200")){
                    JSONObject object1 = object.getJSONObject("data");
                    JSONArray array = object1.getJSONArray("list");
                    if (array!=null&&array.size()!=0){
                        JSONObject jsonObject = array.getJSONObject(0);
                        if (jsonObject!=null){
                            String yktId = jsonObject.getString("ID");
                            basePatientDO.setYktId(yktId);
                            patientDao.save(basePatientDO);
                        }
                    }else {
                        String birdth = IdCardUtil.getBirthdayForIdcardStr(basePatientDO.getIdcard());
                        Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
                        Integer sex = basePatientDO.getSex()!=null?basePatientDO.getSex():0;
                        String family = addFamily(userId,basePatientDO.getIdcard(),basePatientDO.getName(),sex.toString(),birdth,age.toString(),basePatientDO.getMobile());
                        JSONObject object2 = JSONObject.parseObject(family);
                        if (object2.getString("code").equalsIgnoreCase("200")){
                            JSONObject object3 = object2.getJSONObject("data");
                            String yktId = object3.getString("ID");
                            basePatientDO.setYktId(yktId);
                            patientDao.save(basePatientDO);
                        }
                    }
                }else {
                    throw new Exception("查询家庭成员失败!");
                }
            }else {
                String r =getRegisterUser(basePatientDO.getMobile(),pw,code,"a01522","xmijk","xmijk");
                JSONObject object4 = JSONObject.parseObject(r);
                if (object4.getString("code").equalsIgnoreCase("200")){
                    JSONObject object5 = object4.getJSONObject("data");
                    if (object5!=null){
                        userId = object5.getString("ID");
                        basePatientDO.setUserId(userId);
                        patientDao.save(basePatientDO);
                        String familyList =getFamilyList(null,userId);
                        JSONObject object = JSONObject.parseObject(familyList);
                        if (object.getString("code").equalsIgnoreCase("200")){
                            JSONObject object1 = object.getJSONObject("data");
                            JSONArray array = object1.getJSONArray("list");
                            if (array!=null&&array.size()!=0){
                                JSONObject jsonObject1 = array.getJSONObject(0);
                                if (jsonObject1!=null){
                                    String yktId = jsonObject1.getString("ID");
                                    userId = jsonObject1.getString("ASSUSERID");
                                    basePatientDO.setYktId(yktId);
                                    basePatientDO.setUserId(userId);
                                    patientDao.save(basePatientDO);
                                }
                            }else {
                                String birdth = IdCardUtil.getBirthdayForIdcardStr(basePatientDO.getIdcard());
                                Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
                                Integer sex = basePatientDO.getSex()!=null?basePatientDO.getSex():0;
                                String family = addFamily(userId,basePatientDO.getIdcard(),basePatientDO.getName(),sex.toString(),birdth,age.toString(),basePatientDO.getMobile());
                                JSONObject object2 = JSONObject.parseObject(family);
                                if (object2.getString("code").equalsIgnoreCase("200")){
                                    JSONObject object3 = object2.getJSONObject("data");
                                    String yktId = object3.getString("ID");
                                    basePatientDO.setYktId(yktId);
                                    userId = object3.getString("ASSUSERID");
                                    basePatientDO.setUserId(userId);
                                    patientDao.save(basePatientDO);
                                }
                            }
                        }else {
                            throw new Exception("查询家庭成员失败!");
                        }
                    }
                }else {
                    String familyList =getFamilyList(basePatientDO.getMobile(),null);
                    JSONObject object = JSONObject.parseObject(familyList);
                    if (object.getString("code").equalsIgnoreCase("200")){
                        JSONObject object1 = object.getJSONObject("data");
                        JSONArray array = object1.getJSONArray("list");
                        if (array!=null&&array.size()!=0){
                            JSONObject jsonObject1 = array.getJSONObject(0);
                            if (jsonObject1!=null){
                                String yktId = jsonObject1.getString("ID");
                                userId = jsonObject1.getString("ASSUSERID");
                                basePatientDO.setYktId(yktId);
                                basePatientDO.setUserId(userId);
                                patientDao.save(basePatientDO);
                            }
                        }else {
                            userId=object1.getString("user_id");
                            String birdth = DateUtil.dateToStrShort(IdCardUtil.getBirthdayForIdcard(basePatientDO.getIdcard()));
                            Integer age = IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard());
                            Integer sex = basePatientDO.getSex()!=null?basePatientDO.getSex():0;
                            String family = addFamily(userId,basePatientDO.getIdcard(),basePatientDO.getName(),sex.toString(),birdth,age.toString(),basePatientDO.getMobile());
                            JSONObject object2 = JSONObject.parseObject(family);
                            if (object2.getString("code").equalsIgnoreCase("200")){
                                JSONObject object3 = object2.getJSONObject("data");
                                String yktId = object3.getString("ID");
                                basePatientDO.setYktId(yktId);
                                userId = object3.getString("ASSUSERID");
                                basePatientDO.setUserId(userId);
                                patientDao.save(basePatientDO);
                            }
                        }
                    }else {
                        throw new Exception("查询家庭成员失败!");
                    }
                }
            }
        }
    }
    /**
     * 医生端眼科通登陆
     * @param loginId 账户
     * @param password 密码
     * @return
     */
    public String DoctorLogin(String loginId,String password){
        String response="";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("loginId",loginId);//账户
        jsonObject.put("password",password);//密码
        String url = "http://www.yanketong.com:90/api/Doctor/DoctorLogin";
        response = httpClientUtil.sendPost(url,jsonObject.toJSONString());
        logger.info("医生端登陆:"+response);
        return response;
    }
    public String updateYkyyDoctor(String idCard,String verifyCode,String yktDoctorId)throws Exception{
        String sql ="select y.code AS \"code\",y.name AS \"name\",y.expertise AS \"expertise\",y.introduce AS \"introduce\",y.mobile AS \"mobile\",y.idCard AS \"idcard\",y.JOBTITLECODE AS \"jobTitleCode\",y.JOBTITLENAME AS \"jobTitleName\",y.dept AS \"dept\",y.deptName AS \"deptName\" from v_Hlw_Ysxx y where y.idcard is not null";
        sql +=" and y.idcard ='"+idCard+"' ";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            JSONArray array = rs.getJSONArray("detailModelList");
            logger.info("doctor size:"+array.size());
            if(array!=null&&array.size()>0) {
                for (int i = 0; i < array.size(); i++) {
                    JSONObject doctorJson = array.getJSONObject(i);
                    String idcard = doctorJson.getString("idcard");
                    //过滤身份证脏数据
                    if(idcard.length()>=15){
                        BaseDoctorDO doctorDOs = baseDoctorDao.findByIdcardAndId(idcard);
                        if(doctorDOs!=null){
                            BaseDoctorDO doctor = doctorDOs;
                            String salt = randomString(5);
                            String pw = idcard.substring(idcard.length() - 6);
                            doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                            doctor.setSalt(salt);
                            if(StringUtils.isNoneBlank(doctorJson.getString("jobTitleCode"))){
                                doctor.setJobTitleCode(doctorJson.getString("jobTitleCode"));
                                doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
                            }
                            doctor.setVerifyCode(verifyCode);
                            doctor.setYktDoctorId(yktDoctorId);
//                            doctor.setExpertise(doctorJson.getString("expertise"));
//                            doctor.setIntroduce(doctorJson.getString("introduce"));
//                            doctor.setMobile(doctorJson.getString("mobile"));
                            BaseDoctorDO temp = baseDoctorDao.save(doctor);
                            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByOrgCodeAndDeptCodeAndDoctorCode(orgCode,doctorJson.getString("dept"),doctor.getId());
                            if(hospitalDOs!=null&&hospitalDOs.size()>0){
                                //机构信息部门信息
                                BaseDoctorHospitalDO hospitalDO = hospitalDOs.get(0);
                                hospitalDO.setDeptCode(doctorJson.getString("dept"));
                                hospitalDO.setDeptName(doctorJson.getString("deptName"));
                                hospitalDO.setDel("1");
                                baseDoctorHospitalDao.save(hospitalDO);
                            }
                        }else{
                            //新增医生
                            BaseDoctorDO doctor = new BaseDoctorDO();
                            doctor.setName(doctorJson.getString("name"));
                            doctor.setIdcard(idcard);
                            doctor.setSex(Integer.parseInt(com.yihu.jw.util.common.IdCardUtil.getSexForIdcard_new(idcard)));
                            doctor.setBirthday(com.yihu.jw.util.common.IdCardUtil.getBirthdayForIdcard(idcard));
                            doctor.setProvinceCode("350000");
                            doctor.setProvinceName("福建省");
                            doctor.setTownCode("350203");
                            doctor.setTownName("思明区");
                            doctor.setCityCode("350200");
                            doctor.setCityName("厦门市");
                            doctor.setVerifyCode(verifyCode);
                            doctor.setYktDoctorId(yktDoctorId);
//                            doctor.setExpertise(doctorJson.getString("expertise"));
//                            doctor.setIntroduce(doctorJson.getString("introduce"));
//                            doctor.setMobile(doctorJson.getString("mobile"));
                            //认证信息设置
                            String salt = randomString(5);
                            String pw = idcard.substring(idcard.length() - 6);
                            doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                            doctor.setSalt(salt);
                            doctor.setDel("1");
                            doctor.setEnabled(1);
                            doctor.setLocked(0);
                            doctor.setCreateTime(new Date());
                            doctor.setJobTitleCode(doctorJson.getString("jobTitleCode"));
                            doctor.setJobTitleName(doctorJson.getString("jobTitleName"));
                            BaseDoctorDO temp = baseDoctorDao.save(doctor);
                            //机构信息部门信息
                            BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
                            hospitalDO.setDoctorCode(temp.getId());
                            hospitalDO.setOrgCode(orgCode);
                            hospitalDO.setOrgName(orgName);
                            hospitalDO.setDeptCode(doctorJson.getString("dept"));
                            hospitalDO.setDeptName(doctorJson.getString("deptName"));
                            hospitalDO.setDel("1");
                            baseDoctorHospitalDao.save(hospitalDO);
                            //保存角色
                            BaseDoctorRoleDO role = new BaseDoctorRoleDO();
                            role.setDoctorCode(temp.getId());
                            role.setRoleCode("specialist");
                            baseDoctorRoleDao.save(role);
                            //保存mapping
                            DoctorMappingDO mappingDO = new DoctorMappingDO();
                            mappingDO.setIdcard(idcard);
                            mappingDO.setDoctor(temp.getId());
                            mappingDO.setDoctorName(temp.getName());
                            mappingDO.setOrgCode(orgCode);
                            mappingDO.setOrgName(orgName);
                            mappingDO.setMappingCode(doctorJson.getString("code"));
                            mappingDO.setMappingName(temp.getName());
                            mappingDO.setCreateTime(new Date());
                            doctorMappingDao.save(mappingDO);
                        }
                    }
                }
            }
        }
        return "success";
    }
}

+ 78 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java

@ -1,5 +1,8 @@
package com.yihu.jw.hospital.endpoint.Xzyy;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -25,6 +28,10 @@ public class XzyyController extends EnvelopRestEndpoint {
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private XzyyPrescriptionService xzyyPrescriptionService;
    /**
     * 查询患者就诊卡
@ -35,7 +42,12 @@ public class XzyyController extends EnvelopRestEndpoint {
    @ApiOperation(value = "查询患者就诊卡", notes = "查询患者就诊卡")
    public ListEnvelop findPatientCard(@ApiParam(name = "patient", value = "居民code", required = false)
                                      @RequestParam(value = "patient",required = false)String patient)throws Exception{
        return success(xzzxEntranceService.selectPateintCard(patient));
        try {
            return success(xzzxEntranceService.selectPateintCard(patient));
        }catch (Exception e){
            return null;
        }
    }
@ -176,5 +188,70 @@ public class XzyyController extends EnvelopRestEndpoint {
                                     @RequestParam(value = "eventNo",required = false)String eventNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectHistoryEmrRecord(templateId,patientId,eventNo));
    }
    /**
     * 请求自动签名授权接口
     * @param sysTag
     * @param doctorId
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/selfSignRequest")
    @ApiOperation(value = "请求自动签名授权接口", notes = "请求自动签名授权接口")
    public ObjEnvelop selfSignRequest(@ApiParam(name = "sysTag", value = "默认his", required = false)
                                           @RequestParam(value = "sysTag",required = false)String sysTag,
                                           @ApiParam(name = "doctorId", value = "医生id", required = false)
                                           @RequestParam(value = "doctorId",required = false)String doctorId)throws Exception{
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
        return ObjEnvelop.getSuccess("ok", xzyyPrescriptionService.selfSignRequest(baseDoctorDO.getOpenid(),sysTag));
    }
    /**
     * 请求自动签名授权接口
     * @param sysTag
     * @param doctorId
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/selfSignResult")
    @ApiOperation(value = "获取授权结果", notes = "获取授权结果")
    public ObjEnvelop selfSignResult(@ApiParam(name = "sysTag", value = "默认his", required = false)
                                      @RequestParam(value = "sysTag",required = false)String sysTag,
                                      @ApiParam(name = "doctorId", value = "医生id", required = false)
                                      @RequestParam(value = "doctorId",required = false)String doctorId)throws Exception{
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
        return ObjEnvelop.getSuccess("ok", xzyyPrescriptionService.selfSignGetResult(baseDoctorDO,sysTag));
    }
    /**
     * 请求自动签名授权接口
     * @param sysTag
     * @param doctorId
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/selfSignQuit")
    @ApiOperation(value = "退出授权接口", notes = "退出授权接口")
    public ObjEnvelop selfSignQuit(@ApiParam(name = "sysTag", value = "默认his", required = false)
                                      @RequestParam(value = "sysTag",required = false)String sysTag,
                                      @ApiParam(name = "doctorId", value = "医生id", required = false)
                                      @RequestParam(value = "doctorId",required = false)String doctorId)throws Exception{
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
        return ObjEnvelop.getSuccess("ok", xzyyPrescriptionService.selfSignQuit(baseDoctorDO.getOpenid(),sysTag));
    }
    /**
     * 请求自动签名授权接口
     * @param doctorId
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/checkIsNeedSign")
    @ApiOperation(value = "判断是否需要授权", notes = "判断是否需要授权")
    public ObjEnvelop checkIsNeedSign(
                                   @ApiParam(name = "doctorId", value = "医生id", required = false)
                                   @RequestParam(value = "doctorId",required = false)String doctorId,
                                   @ApiParam(name = "sysTag", value = "系统类型", required = false)
                                   @RequestParam(value = "sysTag",required = false)String sysTag)throws Exception{
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
        return ObjEnvelop.getSuccess("ok", xzyyPrescriptionService.checkDoctorNeedSign(doctorId,sysTag));
    }
}

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

@ -30,8 +30,11 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
    public Envelop getPatientById(
            @ApiParam(name = "id", value = "居民id")
            @RequestParam(value = "id", required = true) String id) throws Exception {
        return success(basePatientService.getPatientById(id));
        try {
            return success(basePatientService.getPatientById(id));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.updatePatientPw)
@ -42,11 +45,16 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                  @RequestParam(value = "pw", required = true)String pw,
                                  @ApiParam(name = "orgPw", value = "原密码")
                                  @RequestParam(value = "orgPw", required = false)String orgPw)throws Exception{
        Boolean isSuccess = basePatientService.updatePatientPw(id,pw,orgPw);
        if (isSuccess){
            return success(isSuccess);
        }else {
            return failed("修改失败,请检查原密码是否正确");
        try {
            Boolean isSuccess = basePatientService.updatePatientPw(id,pw,orgPw);
            if (isSuccess){
                return success(isSuccess);
            }else {
                return failed("修改失败,请检查原密码是否正确");
            }
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
@ -58,7 +66,11 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "patient", value = "patient")
            @RequestParam(value = "patient", required = false) String patient) throws Exception {
        return success(basePatientService.getPatientCountByDoctor(doctor,patient));
        try {
            return success(basePatientService.getPatientCountByDoctor(doctor,patient));
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.getPatientEmrByDoctor)
    @ApiOperation(value = "获取居民电子病历信息")
@ -71,7 +83,11 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                            @ApiParam(name = "pageSize", value = "pageSize")
                                             @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        return basePatientService.findEmrByPatientId(patient,doctor,page,pageSize);
        try {
            return basePatientService.findEmrByPatientId(patient,doctor,page,pageSize);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.findPaitentPrescription)
@ -93,7 +109,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        try {
            return basePatientService.findPatientAllPrescription(doctor,keyName,status,page,size,patient,isSelectDrug);
        } catch (Exception e) {
            return PageEnvelop.getError(e.getMessage(),-1);
            return failedPageEnvelopException(e);
        }
    }
    @PostMapping(value = BaseRequestMapping.BasePatient.createPatientGroupDict)
@ -107,7 +123,11 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                            @ApiParam(name = "groupName", value = "groupName")
                                            @RequestParam(value = "groupName", required = false) String groupName) throws Exception {
        return success(basePatientGroupDictService.createPatientGroupDict(groupId,doctor,groupCode,groupName));
        try {
            return success(basePatientGroupDictService.createPatientGroupDict(groupId,doctor,groupCode,groupName));
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.deletePatientGroupDict)
@ -117,7 +137,11 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                          @ApiParam(name = "del", value = "del")
                                          @RequestParam(value = "del", required = false) String del) throws Exception {
        return success(basePatientGroupDictService.delPatientGroupDict(groupId,del));
        try {
            return success(basePatientGroupDictService.delPatientGroupDict(groupId,del));
        }catch (Exception e) {
            return failedException(e);
        }
    }
@ -132,7 +156,11 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                @ApiParam(name = "pageSize", value = "pageSize")
                                    @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        return basePatientGroupDictService.findByDoctor(doctor,groupName,page,pageSize);
        try {
            return basePatientGroupDictService.findByDoctor(doctor,groupName,page,pageSize);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.movePatientToGroup)
@ -147,8 +175,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
            basePatientGroupDictService.movePatientToGroup(groupId,patient,doctor);
            return Envelop.getSuccess("操作成功");
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
            return failedException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.delPatientGroup)
@ -159,7 +186,7 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
            basePatientGroupDictService.delPatientGroup(groupId);
            return Envelop.getSuccess("操作成功");
        }catch (Exception e){
            return Envelop.getError(e.getMessage());
            return failedException(e);
        }
    }
@ -177,7 +204,11 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                   @ApiParam(name = "pageSize", value = "pageSize")
                                   @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        return basePatientGroupDictService.findPatientGroup(patientName,doctor,groupId,page,pageSize);
        try {
            return basePatientGroupDictService.findPatientGroup(patientName,doctor,groupId,page,pageSize);
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.BasePatient.findPatientGroupNum)
@ -187,7 +218,11 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                          @ApiParam(name = "groupIds", value = "多个用逗号隔开")
                                          @RequestParam(value = "groupIds", required = false) String groupIds) throws Exception {
        return success(basePatientGroupDictService.findPatientGroupNum(doctor,groupIds));
        try {
            return success(basePatientGroupDictService.findPatientGroupNum(doctor,groupIds));
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
@ -198,7 +233,11 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
                                       @ApiParam(name = "patient", value = "patient")
                                       @RequestParam(value = "patient", required = false) String patient) throws Exception {
        return success(basePatientService.findPatientInfoById(patient,doctor));
        try {
            return success(basePatientService.findPatientInfoById(patient,doctor));
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
}

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

@ -40,8 +40,13 @@ public class AnalysisEndPoint extends EnvelopRestEndpoint {
            @ApiParam(name = "endTime", value = "endTime", required = true)
            @RequestParam(value = "endTime", required = false)String endTime)throws Exception{
        Object num = analysisService.queryAnalysis(doctor,startTime,endTime);
        return success(num);
        try {
            Object num = analysisService.queryAnalysis(doctor,startTime,endTime);
            return success(num);
        }catch (Exception e){
            return failedException(e);
        }
    }

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

@ -85,34 +85,39 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		if(StringUtils.isBlank(filters)){
			filters=filters+"del=1";
		}else{
			filters=filters+";del=1";
		}
		
		List<KnowledgeArticleDO> list  = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
		for (KnowledgeArticleDO knowledgeArticleDO:list){
			List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
			if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
				BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
				knowledgeArticleDO.setDeptName(doctorHospitalDO.getDeptName());
				knowledgeArticleDO.setHospitalName(doctorHospitalDO.getOrgName());
		try {
			if(StringUtils.isBlank(filters)){
				filters=filters+"del=1";
			}else{
				filters=filters+";del=1";
			}
			KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(knowledgeArticleDO.getId(),getUID());
			if (knowledgeArticleUserDO!=null){
				if (knowledgeArticleUserDO.getUsed()!=null&&knowledgeArticleUserDO.getUsed()==1){
					knowledgeArticleDO.setIsUsed(1);
			List<KnowledgeArticleDO> list  = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
			for (KnowledgeArticleDO knowledgeArticleDO:list){
				List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
				if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
					BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
					knowledgeArticleDO.setDeptName(doctorHospitalDO.getDeptName());
					knowledgeArticleDO.setHospitalName(doctorHospitalDO.getOrgName());
				}
				KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(knowledgeArticleDO.getId(),getUID());
				if (knowledgeArticleUserDO!=null){
					if (knowledgeArticleUserDO.getUsed()!=null&&knowledgeArticleUserDO.getUsed()==1){
						knowledgeArticleDO.setIsUsed(1);
					}
				}
			}
			List<KnowledgeArticleDO> totals  = knowledgeArticleService.search(fields,filters,sorts);
			JSONObject result = new JSONObject();
			result.put("total",totals.size());
			result.put("detailModelList",list);
			return success(result);
		}catch (Exception e){
			return failedException(e);
		}
		List<KnowledgeArticleDO> totals  = knowledgeArticleService.search(fields,filters,sorts);
		
		JSONObject result = new JSONObject();
		result.put("total",totals.size());
		result.put("detailModelList",list);
		
		return success(result);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.queryById)
@ -120,18 +125,22 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	public Envelop queryByCode(
			@ApiParam(name = "id", value = "id", required = true)
			@RequestParam(value = "id", required = true)String id) throws Exception{
			KnowledgeArticleDO articleDO = knowledgeArticleService.retrieve(id);
			KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDO.getId(),getUID());
			if (knowledgeArticleUserDO!=null){
				articleDO.setIsUsed(knowledgeArticleUserDO.getUsed());
				articleDO.setKnowledgeArticleUserDO(knowledgeArticleUserDO);
			}
			List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(articleDO.getCreateUser());
			if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
				articleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
				articleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
			try {
				KnowledgeArticleDO articleDO = knowledgeArticleService.retrieve(id);
				KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDO.getId(),getUID());
				if (knowledgeArticleUserDO!=null){
					articleDO.setIsUsed(knowledgeArticleUserDO.getUsed());
					articleDO.setKnowledgeArticleUserDO(knowledgeArticleUserDO);
				}
				List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(articleDO.getCreateUser());
				if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
					articleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
					articleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
				}
				return success(articleDO);
			}catch (Exception e){
				return failedException(e);
			}
		return success(articleDO);
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.deleteById)
@ -139,8 +148,12 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	public Envelop deleteById(
			@ApiParam(name = "id", value = "id,多个使用英文逗号分隔", required = true)
			@RequestParam(value = "id", required = true)String id)throws Exception {
			knowledgeArticleService.delArticle(id);
			return success("操作成功");
			try {
				knowledgeArticleService.delArticle(id);
				return success("操作成功");
			}catch (Exception e){
				return failedException(e);
			}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.saveArticle)
@ -148,8 +161,13 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	public Envelop saveArticle(
			@ApiParam(name = "jsonData", value = "Json数据", required = true)
			@RequestParam String jsonData)throws Exception {
		knowledgeArticleService.saveArticle(jsonData);
		return success("操作成功");
		try {
			knowledgeArticleService.saveArticle(jsonData);
			return success("操作成功");
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.reviewArticle)
@ -162,8 +180,12 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "reason", value = "退回理由")
			@RequestParam(value = "reason", required = false) String reason
	)throws Exception {
		knowledgeArticleService.reviewArticle(articleId,status,reason);
		return success("操作成功");
		try {
			knowledgeArticleService.reviewArticle(articleId,status,reason);
			return success("操作成功");
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	
@ -180,14 +202,19 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		List<KnowledgeCategoryDO> list  = knowledgeCategoryService.search(fields,filters,sorts,page,pageSize);
		List<KnowledgeCategoryDO> result = new ArrayList<>();
		for(KnowledgeCategoryDO knowledgeCategoryDO:list){
			if(knowledgeCategoryDO.getDel() == 1){
				result.add(knowledgeCategoryDO);
		try {
			List<KnowledgeCategoryDO> list  = knowledgeCategoryService.search(fields,filters,sorts,page,pageSize);
			List<KnowledgeCategoryDO> result = new ArrayList<>();
			for(KnowledgeCategoryDO knowledgeCategoryDO:list){
				if(knowledgeCategoryDO.getDel() == 1){
					result.add(knowledgeCategoryDO);
				}
			}
			return success(result);
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
		return success(result);
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.saveCategory)
@ -195,8 +222,13 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	public Envelop saveCategory(
			@ApiParam(name = "jsonData", value = "Json数据", required = true)
			@RequestParam String jsonData)throws Exception {
		knowledgeCategoryService.saveCategory(jsonData);
		return success("操作成功");
		try {
			knowledgeCategoryService.saveCategory(jsonData);
			return success("操作成功");
		} catch (Exception e){
			return failedException(e);
		}
	}
	
	@PostMapping (value = BaseHospitalRequestMapping.KnowledgeArticle.updateDel)
@ -204,11 +236,16 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	public Envelop updateDel(
			@ApiParam(name = "id", value = "id", required = true)
			@RequestParam(value = "id", required = true)String id)throws Exception {
		Boolean flag = knowledgeCategoryService.updateDel(id);
		if (flag) {
			return success("操作成功");
		}else{
			return failed("操作失败");
		try {
			Boolean flag = knowledgeCategoryService.updateDel(id);
			if (flag) {
				return success("操作成功");
			}else{
				return failed("操作失败");
			}
		}catch (Exception e){
			return failedException(e);
		}
		
	}
@ -219,21 +256,34 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	                                 @RequestParam(value = "articleId",required = true)String articleId,
	                                 @ApiParam(name = "sdJsons", value = "部门与科室关系json")
	                                 @RequestParam(value = "sdJsons",required = true)String sdJsons)throws Exception {
		return success(knowledgeArticleService.saveArticleDept(articleId,sdJsons));
		try {
			return success(knowledgeArticleService.saveArticleDept(articleId,sdJsons));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findDeptByArticle)
	@ApiOperation(value = "查询文章下的科室")
	public ListEnvelop findDeptByArticle(@ApiParam(name = "articleId", value = "文章ID")
	                                    @RequestParam(value = "articleId",required = true)String articleId)throws Exception {
		return success(knowledgeArticleService.findDeptByArticle(articleId));
		try {
			return success(knowledgeArticleService.findDeptByArticle(articleId));
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findArticleByDept)
	@ApiOperation(value = "查询部门下发放的文章")
	public ListEnvelop findArticleByDept(@ApiParam(name = "dept", value = "科室")
	                                    @RequestParam(value = "dept",required = true)String dept)throws Exception {
		return success(knowledgeArticleService.findArticleByDept(dept));
		try {
			return success(knowledgeArticleService.findArticleByDept(dept));
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.saveDeptArticle)
@ -242,7 +292,12 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	                                 @RequestParam(value = "dept",required = true)String dept,
	                                 @ApiParam(name = "sdJsons", value = "部门与科室关系json")
	                                 @RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
		return success(knowledgeArticleService.saveDeptArticle(dept,sdJsons));
		try {
			return success(knowledgeArticleService.saveDeptArticle(dept,sdJsons));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}
	}
@ -250,16 +305,21 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "发送文章/问卷")
	public ListEnvelop sendPatientBusiness(@ApiParam(name = "json", value = "患者业务关联表")
									  @RequestParam(value = "json",required = false)String json)throws Exception {
		ListEnvelop listEnvelop = new ListEnvelop();
		JSONArray jsonArray = JSONArray.parseArray(json);
		List<BasePatientBusinessDO> patientBusinessDOList = new ArrayList<>();
		for (int i=0;i<jsonArray.size();i++){
			JSONObject jsonObject = jsonArray.getJSONObject(i);
			BasePatientBusinessDO patientBusinessDO = toEntity(jsonObject.toJSONString(),BasePatientBusinessDO.class);
			patientBusinessDOList.add(patientBusinessDO);
		try {
			ListEnvelop listEnvelop = new ListEnvelop();
			JSONArray jsonArray = JSONArray.parseArray(json);
			List<BasePatientBusinessDO> patientBusinessDOList = new ArrayList<>();
			for (int i=0;i<jsonArray.size();i++){
				JSONObject jsonObject = jsonArray.getJSONObject(i);
				BasePatientBusinessDO patientBusinessDO = toEntity(jsonObject.toJSONString(),BasePatientBusinessDO.class);
				patientBusinessDOList.add(patientBusinessDO);
			}
			listEnvelop.setDetailModelList(knowledgeArticleService.sendBusinessToPatient(patientBusinessDOList));
			return  listEnvelop;
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
		listEnvelop.setDetailModelList(knowledgeArticleService.sendBusinessToPatient(patientBusinessDOList));
		return  listEnvelop;
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleUsed)
@ -270,7 +330,11 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
									  @RequestParam(value = "used",required = false)Integer used,
									 @ApiParam(name = "doctor", value = "医生code")
										 @RequestParam(value = "doctor",required = false)String doctor)throws Exception {
		return success(knowledgeArticleService.setUsed(id,used,doctor));
		try {
			return success(knowledgeArticleService.setUsed(id,used,doctor));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}
}
@ -287,43 +351,48 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		if(StringUtils.isBlank(filters)){
			filters=filters+"del=1";
		}else{
			filters=filters+";del=1";
		}
		List<BasePatientBusinessDO> list  = patientBusinessService.search(fields,filters,sorts,page,pageSize);
		for (BasePatientBusinessDO patientBusinessDO:list){
			Integer type = patientBusinessDO.getRelationType();
			if (type==1){
				KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleService.selectById(patientBusinessDO.getRelationCode());
				if (knowledgeArticleDO!=null){
					List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
					if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
						knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
						knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
		try {
			if(StringUtils.isBlank(filters)){
				filters=filters+"del=1";
			}else{
				filters=filters+";del=1";
			}
			List<BasePatientBusinessDO> list  = patientBusinessService.search(fields,filters,sorts,page,pageSize);
			for (BasePatientBusinessDO patientBusinessDO:list){
				Integer type = patientBusinessDO.getRelationType();
				if (type==1){
					KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleService.selectById(patientBusinessDO.getRelationCode());
					if (knowledgeArticleDO!=null){
						List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
						if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
							knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
							knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
						}
					}
					patientBusinessDO.setKnowledgeArticleDO(knowledgeArticleDO);
					KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(patientBusinessDO.getRelationCode(),patientBusinessDO.getPatient());
					if (knowledgeArticleUserDO!=null){
						patientBusinessDO.setIsRead(knowledgeArticleUserDO.getIsRead());
						patientBusinessDO.setShare(knowledgeArticleUserDO.getShare());
						patientBusinessDO.setFabulous(knowledgeArticleUserDO.getFabulous());
						patientBusinessDO.setCollection(knowledgeArticleUserDO.getCollection());
					}
				}
				patientBusinessDO.setKnowledgeArticleDO(knowledgeArticleDO);
				KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(patientBusinessDO.getRelationCode(),patientBusinessDO.getPatient());
				if (knowledgeArticleUserDO!=null){
					patientBusinessDO.setIsRead(knowledgeArticleUserDO.getIsRead());
					patientBusinessDO.setShare(knowledgeArticleUserDO.getShare());
					patientBusinessDO.setFabulous(knowledgeArticleUserDO.getFabulous());
					patientBusinessDO.setCollection(knowledgeArticleUserDO.getCollection());
				}
			}
		}
		List<BasePatientBusinessDO> totals  = patientBusinessService.search(fields,filters,sorts);
			}
			List<BasePatientBusinessDO> totals  = patientBusinessService.search(fields,filters,sorts);
		JSONObject result = new JSONObject();
		result.put("total",totals.size());
		result.put("detailModelList",list);
			JSONObject result = new JSONObject();
			result.put("total",totals.size());
			result.put("detailModelList",list);
		return success(result);
			return success(result);
		}catch (Exception e){
			return failedException(e);
		}
	}
@ -339,7 +408,12 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
											   @RequestParam(value = "user",required = true)String user,
										   @ApiParam(name = "userType", value = "用户类型(1患者2医生)")
											   @RequestParam(value = "userType",required = true)String userType)throws Exception {
		return success(patientBusinessService.setCollectionById(id,flag,status,user,userType));
		try {
			return success(patientBusinessService.setCollectionById(id,flag,status,user,userType));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}
	}
@ -356,33 +430,38 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		if(StringUtils.isBlank(filters)){
			filters=filters+"del=1";
		}else{
			filters=filters+";del=1";
		}
		List<KnowledgeArticleUserDO> list  = knowledgeArticleUserService.search(fields,filters,sorts,page,pageSize);
		for (KnowledgeArticleUserDO knowledgeArticleUserDO:list){
			Integer type = knowledgeArticleUserDO.getRelationType();
			if (type==1){
				KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleService.selectById(knowledgeArticleUserDO.getRelationCode());
				if (knowledgeArticleDO!=null){
					List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
					if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
						knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
						knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
		try {
			if(StringUtils.isBlank(filters)){
				filters=filters+"del=1";
			}else{
				filters=filters+";del=1";
			}
			List<KnowledgeArticleUserDO> list  = knowledgeArticleUserService.search(fields,filters,sorts,page,pageSize);
			for (KnowledgeArticleUserDO knowledgeArticleUserDO:list){
				Integer type = knowledgeArticleUserDO.getRelationType();
				if (type==1){
					KnowledgeArticleDO knowledgeArticleDO = knowledgeArticleService.selectById(knowledgeArticleUserDO.getRelationCode());
					if (knowledgeArticleDO!=null){
						List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
						if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
							knowledgeArticleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
							knowledgeArticleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
						}
					}
					knowledgeArticleUserDO.setKnowledgeArticleDO(knowledgeArticleDO);
				}
				knowledgeArticleUserDO.setKnowledgeArticleDO(knowledgeArticleDO);
			}
		}
		List<KnowledgeArticleUserDO> totals  = knowledgeArticleUserService.search(fields,filters,sorts);
		JSONObject result = new JSONObject();
		result.put("total",totals.size());
		result.put("detailModelList",list);
			List<KnowledgeArticleUserDO> totals  = knowledgeArticleUserService.search(fields,filters,sorts);
			JSONObject result = new JSONObject();
			result.put("total",totals.size());
			result.put("detailModelList",list);
		return success(result);
			return success(result);
		}catch (Exception e){
			return failedException(e);
		}
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findArticleByCategoryAndName)
@ -404,8 +483,12 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	@GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.getArticleGroup)
	@ApiOperation(value = "查询分类")
	public MixEnvelop getGroup(){
		MixEnvelop envelop = knowledgeCategoryService.findAllGroup();
		return envelop;
		try {
			MixEnvelop envelop = knowledgeCategoryService.findAllGroup();
			return envelop;
		}catch (Exception e){
			return failedMixEnvelopException(e);
		}
	}
@ -419,6 +502,10 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
												   @ApiParam(name = "pageSize", value = "分页大小)")
												   @RequestParam(value = "pageSize",required = false)Integer pageSize)throws Exception {
		return success(knowledgeArticleService.findPatientFavorite(patient,page,pageSize));
		try {
			return success(knowledgeArticleService.findPatientFavorite(patient,page,pageSize));
		}catch (Exception e){
			return failedException(e);
		}
	}
}

+ 55 - 26
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/base/BaseInfoEndpoint.java

@ -68,11 +68,15 @@ public class BaseInfoEndpoint extends EnvelopRestEndpoint {
    @GetMapping(value = "/getCity")
    @ApiOperation(value = "获取市列表信息", notes = "基础数据获取")
    public Envelop getCity() throws Exception {
        List<BaseCityDO> res =  cityService.getAllCity();
        if(res != null && res.size() > 0 ){
            return  success(res);
        }else{
            return success("无法获取市列表信息!");
        try {
            List<BaseCityDO> res =  cityService.getAllCity();
            if(res != null && res.size() > 0 ){
                return  success(res);
            }else{
                return success("无法获取市列表信息!");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -87,11 +91,16 @@ public class BaseInfoEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "cityCode", required = false) String cityCode,
            @ApiParam(name = "level", value = "等级医院,1等级医院,2.社区医院")
            @RequestParam(value = "level", required = false) Integer level) {
        List<BaseOrgDO> res =  baseOrgInfoService.getOrgByCity(cityCode,level);
        if(res != null && res.size() > 0 ){
            return  success(res);
        }else{
            return success("该市未维护医院信息!");
        try {
            List<BaseOrgDO> res =  baseOrgInfoService.getOrgByCity(cityCode,level);
            if(res != null && res.size() > 0 ){
                return  success(res);
            }else{
                return success("该市未维护医院信息!");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -107,11 +116,16 @@ public class BaseInfoEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "orgCode", required = false) String orgCode,
            @ApiParam(name = "consultDeptFlag", value = "是否是就诊科室,1为查询门诊,不传为全部")
            @RequestParam(value = "consultDeptFlag", required = false) String consultDeptFlag)  {
        List<DictHospitalDeptDO> res =  hospitalDeptService.getHosDeptByCode(orgCode,consultDeptFlag);
        if(res != null && res.size() > 0 ){
            return  success(res);
        }else{
            return success("无法获取该机构的部门列表信息!");
        try {
            List<DictHospitalDeptDO> res =  hospitalDeptService.getHosDeptByCode(orgCode,consultDeptFlag);
            if(res != null && res.size() > 0 ){
                return  success(res);
            }else{
                return success("无法获取该机构的部门列表信息!");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -127,11 +141,16 @@ public class BaseInfoEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "orgCode", required = false) String orgCode,
            @ApiParam(name = "deptCode", value = "部门编码")
            @RequestParam(value = "deptCode", required = false) String deptCode) {
        List<BaseDoctorHospitalDO> res =  baseDoctorHosService.getDoctorByOrgAndDept(orgCode,deptCode);
        if(res != null && res.size() > 0 ){
            return  success(res);
        }else{
            return success("无法获取该机构科室下的医生信息!");
        try {
            List<BaseDoctorHospitalDO> res =  baseDoctorHosService.getDoctorByOrgAndDept(orgCode,deptCode);
            if(res != null && res.size() > 0 ){
                return  success(res);
            }else{
                return success("无法获取该机构科室下的医生信息!");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -144,11 +163,16 @@ public class BaseInfoEndpoint extends EnvelopRestEndpoint {
    public Envelop getJobBySaasId(
            @ApiParam(name = "saasId", value = "租户ID,当为空的情况下查询所有")
            @RequestParam(value = "saasId", required = false) String saasId)  {
        List<DictJobTitleDO> res= baseDictJobTitleService.getBySaasId(saasId);
        if(res != null && res.size() > 0 ){
            return  success(res);
        }else{
            return success("无法获取该机构的职称信息!");
        try {
            List<DictJobTitleDO> res= baseDictJobTitleService.getBySaasId(saasId);
            if(res != null && res.size() > 0 ){
                return  success(res);
            }else{
                return success("无法获取该机构的职称信息!");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -158,7 +182,12 @@ public class BaseInfoEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取街道信息", notes = "获取街道信息")
    public Envelop findByTown(@ApiParam(name = "town", value = "区级code")
                              @RequestParam(value = "town", required = true) String town)  {
        return success(baseStreetService.findByTown(town));
        try {
            return success(baseStreetService.findByTown(town));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @GetMapping(value = "/findWlyyHospital")

+ 46 - 16
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/config/DoctorServiceEndPoint.java

@ -49,7 +49,12 @@ public class DoctorServiceEndPoint extends EnvelopRestEndpoint {
            @ApiParam(name = "pageSize", value = "页码", required = true, defaultValue = "10")
            @RequestParam(value = "pageSize") int pageSize) throws Exception {
        return baseDoctorService.queryList(city,hospital,status,name,type,typeCode,dept,page,pageSize);
        try{
            return baseDoctorService.queryList(city,hospital,status,name,type,typeCode,dept,page,pageSize);
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -61,11 +66,16 @@ public class DoctorServiceEndPoint extends EnvelopRestEndpoint {
            @ApiParam(name = "typeCode", value = "分部,无不传")
            @RequestParam(value = "typeCode", required = false)String typeCode)throws Exception{
        Object object = baseDoctorService.queryById(doctorId,typeCode);
        if (null != object){
            return success("查询成功",object);
        try {
            Object object = baseDoctorService.queryById(doctorId,typeCode);
            if (null != object){
                return success("查询成功",object);
            }
            return failed("查询失败");
        }catch (Exception e){
            return failedException(e);
        }
        return failed("查询失败");
    }
@ -74,12 +84,17 @@ public class DoctorServiceEndPoint extends EnvelopRestEndpoint {
    public Envelop update(
            @ApiParam(name = "baseDoctorVo", value = "JSON数据", required = true)
            @RequestParam(value = "baseDoctorVo") String baseDoctorVo)throws Exception{
        JSONObject jsonObject = JSONObject.fromObject(baseDoctorVo);
        Boolean update = baseDoctorService.update(jsonObject);
        if (!update){
            return failed("保存失败,参数不可为空");
        try {
            JSONObject jsonObject = JSONObject.fromObject(baseDoctorVo);
            Boolean update = baseDoctorService.update(jsonObject);
            if (!update){
                return failed("保存失败,参数不可为空");
            }
            return success("保存成功");
        }catch (Exception e){
            return failedException(e);
        }
        return success("保存成功");
    }
    @PostMapping(value = BaseHospitalRequestMapping.DoctorSetting.updateList)
@ -87,9 +102,14 @@ public class DoctorServiceEndPoint extends EnvelopRestEndpoint {
    public Envelop updateList(
            @ApiParam(name = "baseDoctorVos", value = "JSON数据", required = true)
            @RequestParam(value = "baseDoctorVos") String baseDoctorVos)throws Exception{
        JSONArray jsonArray = JSONArray.fromObject(baseDoctorVos);
        Boolean update = baseDoctorService.updateList(jsonArray);
        return success("保存成功");
        try {
            JSONArray jsonArray = JSONArray.fromObject(baseDoctorVos);
            Boolean update = baseDoctorService.updateList(jsonArray);
            return success("保存成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -100,9 +120,14 @@ public class DoctorServiceEndPoint extends EnvelopRestEndpoint {
            @RequestParam(value = "doctorId", required = true) String doctorId,
            @ApiParam(name = "status", value = "状态")
            @RequestParam(value = "status", required = true) String status)throws Exception{
        baseDoctorService.updateStatus(doctorId,status);
        return success("修改成功");
        try {
            baseDoctorService.updateStatus(doctorId,status);
            return success("修改成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.DoctorSetting.updateDoctorPw)
@ -113,6 +138,11 @@ public class DoctorServiceEndPoint extends EnvelopRestEndpoint {
                                  @RequestParam(value = "pw", required = true)String pw,
                                  @ApiParam(name = "orgPw", value = "原密码")
                                  @RequestParam(value = "orgPw", required = true)String orgPw)throws Exception{
        return success(baseDoctorService.updateDoctorPw(id,pw,orgPw));
        try {
            return success(baseDoctorService.updateDoctorPw(id,pw,orgPw));
        }catch (Exception e){
            return failedException(e);
        }
    }
}

+ 39 - 24
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/ConsultPriceEndpoint.java

@ -41,28 +41,33 @@ public class ConsultPriceEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "json_data", value = "JSON数据", required = true, defaultValue = "15")
            @RequestParam(value = "json_data") String jsonData ) throws Exception {
        int flag = -1;
        WlyyHospitalConsultPriceDO wlyyHospitalConsultPriceDO = new WlyyHospitalConsultPriceDO();
        Map dataDetail  = JSONObject.fromObject(jsonData);
        String hospital = dataDetail.get("hospital").toString();
        // 获取到职称及服务对象列表,拆分成json数组,再进行处理
        String data = dataDetail.get("data") == "" ? "": dataDetail.get("data") .toString();
        JSONArray array = JSONArray.fromObject(data);
        if (array.size() > 0) {
        try {
            int flag = -1;
            WlyyHospitalConsultPriceDO wlyyHospitalConsultPriceDO = new WlyyHospitalConsultPriceDO();
            Map dataDetail  = JSONObject.fromObject(jsonData);
            String hospital = dataDetail.get("hospital").toString();
            // 获取到职称及服务对象列表,拆分成json数组,再进行处理
            String data = dataDetail.get("data") == "" ? "": dataDetail.get("data") .toString();
            JSONArray array = JSONArray.fromObject(data);
            if (array.size() > 0) {
                for (int i = 0; i < array.size(); i++) {
                JSONObject jsonObject = array.getJSONObject(i);
                wlyyHospitalConsultPriceDO = consultPriceService.saveConsultPrice(jsonObject,hospital);
                if(wlyyHospitalConsultPriceDO != null){
                    flag = 0;
                }else{
                    break;
                    JSONObject jsonObject = array.getJSONObject(i);
                    wlyyHospitalConsultPriceDO = consultPriceService.saveConsultPrice(jsonObject,hospital);
                    if(wlyyHospitalConsultPriceDO != null){
                        flag = 0;
                    }else{
                        break;
                    }
                }
            }
        }
        if(flag == 0){
            return success("新增咨费成功!");
        }else{
            return failed("新增咨费失败!");
            if(flag == 0){
                return success("新增咨费成功!");
            }else{
                return failed("新增咨费失败!");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -80,9 +85,14 @@ public class ConsultPriceEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<WlyyHospitalConsultPriceDO> wlyyHospitalConsultPriceDOS = consultPriceService.search(fields, filters, sorts, page, size);
        int count = (int) consultPriceService.getCount(filters);
        return success(wlyyHospitalConsultPriceDOS, count, page, size, WlyyHospitalConsultPriceVO.class);
        try {
            List<WlyyHospitalConsultPriceDO> wlyyHospitalConsultPriceDOS = consultPriceService.search(fields, filters, sorts, page, size);
            int count = (int) consultPriceService.getCount(filters);
            return success(wlyyHospitalConsultPriceDOS, count, page, size, WlyyHospitalConsultPriceVO.class);
        }catch (Exception e){
            return failedPageEnvelopException(e);
        }
    }
@ -93,8 +103,13 @@ public class ConsultPriceEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "id", value = "唯一标识ID")
            @RequestParam(value = "id", required = false) String id) {
        consultPriceService.deleteConsultPrice(id);
        return success("删除成功!");
        try {
            consultPriceService.deleteConsultPrice(id);
            return success("删除成功!");
        }catch (Exception e){
            return failedException(e);
        }
    }
}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 293 - 161
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java


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

@ -183,7 +183,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
								@ApiParam(name = "doctorName", value = "医生名字")
								@RequestParam(value = "doctorName",required = false) String doctorName
								)throws Exception{
		List<Map<String,Object>>  data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,status,payStatus,doctorName);
		
		/*if (data != null) {
			for (ConsultVO consult : data) {
@ -217,12 +217,18 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			}
		}*/
		
		Long total = imService.countConsultRecordByPatient(patient, id,type,title);
		
		JSONObject result = new JSONObject();
		result.put("total",total);
		result.put("list",data);
		return success(result);
		try {
			List<Map<String,Object>>  data = imService.findConsultRecordByPatient(patient, id,type, page,pagesize, title,status,payStatus,doctorName);
			Long total = imService.countConsultRecordByPatient(patient, id,type,title);
			JSONObject result = new JSONObject();
			result.put("total",total);
			result.put("list",data);
			return success(result);
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.isExistsUnfinishedConsult)
@ -233,12 +239,17 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient)throws Exception {
		
		if(StringUtils.isEmpty(patient)){
			patient= getUID();
		try {
			if(StringUtils.isEmpty(patient)){
				patient= getUID();
			}
			String consultCode = imService.getUnfinishedConsult(patient, doctor);
			return success("请求成功",consultCode);
		}catch (Exception e){
			return failedException(e);
		}
		
		String consultCode = imService.getUnfinishedConsult(patient, doctor);
		return success("请求成功",consultCode);
	}
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.isExistsUnfinishedOutpatient)
	@ApiOperation(value = "查询居民与某个医生是否存在未结束的专家咨询")
@ -248,12 +259,17 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = true) String patient)throws Exception {
		if(StringUtils.isEmpty(patient)){
			patient= getUID();
		}
		String consultCode = imService.getUnfinishedConsult2(patient, doctor);
		return success("请求成功",consultCode);
		try {
			if(StringUtils.isEmpty(patient)){
				patient= getUID();
			}
			String consultCode = imService.getUnfinishedConsult2(patient, doctor);
			return success("请求成功",consultCode);
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.participants)
@ -262,8 +278,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "sessionId", value = "会话ID")
			@RequestParam(value = "sessionId",required = true) String sessionId)throws Exception{
		
		JSONArray participants = imService.getSessions(sessionId);
		return success(participants);
		try {
			JSONArray participants = imService.getSessions(sessionId);
			return success(participants);
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getSessionMessage)
@ -279,8 +300,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "page",required = true) int page,
			@ApiParam(name = "pagesize", value = "分页数")
			@RequestParam(value = "pagesize",required = true) int pagesize)throws Exception{
		JSONArray messageArray = imService.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getUID());
		return success(messageArray);
		try {
			JSONArray messageArray = imService.getSessionMessage(sessionId, startMsgId, endMsgId, page, pagesize, getUID());
			return success(messageArray);
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.intoTopic)
@ -291,15 +317,20 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "patientCode", value = "居民CODE")
			@RequestParam(value = "patientCode",required = true) String patientCode
			){
		int result = imService.intoTopic(consult,patientCode,"");
		if(result==-1){
			return failed("该咨询不是进行中");
		}
		try {
			int result = imService.intoTopic(consult,patientCode,"");
			if(result==-1){
				return failed("该咨询不是进行中");
			}
//		org.json.JSONObject json = new org.json.JSONObject();
//		json.put("consult",consult);
//		json.put("content","进入咨询");
//		BusinessLogs.info(BusinessLogs.BusinessType.consult, getUID(), getRepUID(), json);
		return success("进入成功");
			return success("进入成功");
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.append)
@ -317,56 +348,61 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "wechat_appid",required = false) String wechat_appid,
			@ApiParam(name = "patientCode", value = "居民CODE")
			@RequestParam(value = "patientCode",required = false) String patientCode) throws Exception {
		List<String> failed = new ArrayList<>();
		
		//处理语音文件
		if(!org.springframework.util.StringUtils.isEmpty(wechat_appid)){
			
		try {
			List<String> failed = new ArrayList<>();
			//处理语音文件
			if(!org.springframework.util.StringUtils.isEmpty(wechat_appid)){
//			imService.getInputStream("1",wechat_appid);
			
			if(3 == type){//语音文件
				String voicepath = imService.fetchWxVoices(wechat_appid);
				logger.info("voice_path:"+voicepath);
				JSONObject obj = new JSONObject();
				String voiceurl = "";
				// 将临时语音拷贝到正式存储路径下
				if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
					if("xm_ihealth_wx".equals(wechat_appid)){
						logger.info("voice_wx_type:"+wechat_appid);
						voiceurl = fileUploadService.uploadWxVoice(voicepath);
				if(3 == type){//语音文件
					String voicepath = imService.fetchWxVoices(wechat_appid);
					logger.info("voice_path:"+voicepath);
					JSONObject obj = new JSONObject();
					String voiceurl = "";
					// 将临时语音拷贝到正式存储路径下
					if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
						if("xm_ihealth_wx".equals(wechat_appid)){
							logger.info("voice_wx_type:"+wechat_appid);
							voiceurl = fileUploadService.uploadWxVoice(voicepath);
//					uploadVO.setFullUri(map.get("accessory").toString());
					}else if ("xm_xzzx_wx".equalsIgnoreCase(wechat_appid)){
						voiceurl = fileUploadService.uploadWxVoiceToEntrance(remote_inner_url,voicepath);
						logger.info(voiceurl);
					}else {
						voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
						}else if ("xm_xzzx_wx".equalsIgnoreCase(wechat_appid)){
							voiceurl = fileUploadService.uploadWxVoiceToEntrance(remote_inner_url,voicepath);
							logger.info(voiceurl);
						}else {
							voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
						}
						obj.put("path", voiceurl);
						obj.put("times", times);
						content = obj.toString();
					}
					obj.put("path", voiceurl);
					obj.put("times", times);
					content = obj.toString();
				}
			}else if(2 == type){//图片文件
				String imagepath = imService.fetchWxImages(wechat_appid);
				logger.info("image_path:"+imagepath);
				JSONObject obj = new JSONObject();
				String imgeUrl = "";
				// 将临时语音拷贝到正式存储路径下
				if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
					if("xm_ihealth_wx".equals(wechat_appid)){
						logger.info("imge_wx_type:"+wechat_appid);
						imgeUrl = fileUploadService.uploadWxImage(imagepath);
				}else if(2 == type){//图片文件
					String imagepath = imService.fetchWxImages(wechat_appid);
					logger.info("image_path:"+imagepath);
					JSONObject obj = new JSONObject();
					String imgeUrl = "";
					// 将临时语音拷贝到正式存储路径下
					if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
						if("xm_ihealth_wx".equals(wechat_appid)){
							logger.info("imge_wx_type:"+wechat_appid);
							imgeUrl = fileUploadService.uploadWxImage(imagepath);
//					uploadVO.setFullUri(map.get("accessory").toString());
					}else{
						imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
						}else{
							imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
						}
						content = imgeUrl;
					}
					content = imgeUrl;
				}
			}else{}
				}else{}
			}
			failed = imService.append(consult,content,type,times,patientCode,wechat_appid);
			return success(failed);
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
		
		failed = imService.append(consult,content,type,times,patientCode,wechat_appid);
		return success(failed);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByHospitalAndDiseaseAndDept)
@ -407,19 +443,29 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	                                                     @RequestParam(value = "pagesize",required = false) Integer pagesize
	) throws Exception{
		logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
		return prescriptionService.findDoctorByHospitalAndDiseaseAndDept(iswork,patientid,
				orgCode,dept,
				diseaseKey,doctorNameKey,
				jobTitleNameKey,outpatientType,
				keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize);
		try {
			logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
			return prescriptionService.findDoctorByHospitalAndDiseaseAndDept(iswork,patientid,
					orgCode,dept,
					diseaseKey,doctorNameKey,
					jobTitleNameKey,outpatientType,
					keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize);
		}catch (Exception e){
			return failedMixEnvelopException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.Prescription.findHotDeptAndDiseaseDict)
	@ApiOperation(value = "获取常见疾病、热门部门、医生拒绝接诊原因 字典", notes = "获取常见疾病、热门部门、医生拒绝接诊原因 字典")
	public ListEnvelop findHotDeptAndDiseaseDict(@ApiParam(name = "dictName", value = "dictName")
	                                             @RequestParam(value = "dictName", required = true,defaultValue = "ONLINE_HOSPITAL_DEPT_350211A1002")String dictName)throws Exception{
		return success(prescriptionService.findHotDeptAndDiseaseDict(dictName));
		try {
			return success(prescriptionService.findHotDeptAndDiseaseDict(dictName));
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.add)
	@ApiOperation(value = "居民添加咨询接口", notes = "居民添加咨询接口")
@ -622,13 +668,18 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	public Envelop patientInfo(
			@ApiParam(name = "patient", value = "居民CODE")
			@RequestParam(value = "patient",required = false) String patient) throws Exception {
		BasePatientDO result = basePatientService.findByIdAndDel(patient);
		//---居民性别取身份证字段--
		result.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(result.getIdcard())));
		if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
			familyMemberService.saveYktFamily(patient);
		try {
			BasePatientDO result = basePatientService.findByIdAndDel(patient);
			//---居民性别取身份证字段--
			result.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(result.getIdcard())));
			if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
				familyMemberService.saveYktFamily(patient);
			}
			return success(result);
		}catch (Exception e){
			return failedException(e);
		}
		return success(result);
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.finish)
@ -716,7 +767,11 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	public Envelop getTopic(
			@ApiParam(name = "consult", value = "咨询CODE")
			@RequestParam(value = "consult",required = false) String consult)throws Exception {
		return success("请求成功",imService.getTopic(consult));
		try {
			return success("请求成功",imService.getTopic(consult));
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getConsultCodeByOutpatientId)
@ -724,7 +779,12 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	public Envelop getConsultCodeByOutpatientId(
			@ApiParam(name = "outpatientid", value = "复诊ID")
			@RequestParam(value = "outpatientid",required = true) String outpatientid)throws Exception {
		return success("请求成功",imService.getConsultCodeByOutpatientId(outpatientid));
		try {
			return success("请求成功",imService.getConsultCodeByOutpatientId(outpatientid));
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.evaluationByConsultCode)
@ -741,8 +801,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
//		if(StringUtils.isEmpty(scoreContent)){
//			scoreContent= "[{\"scoreType\":\"1\",\"score\":100,\"content\":\"\"},{\"scoreType\":\"2\",\"score\":80,\"content\":\"\"},{\"scoreType\":\"3\",\"score\":80,\"content\":\"\"},{\"scoreType\":\"4\",\"score\":0,\"content\":\"测试评语。。。。123123\"}]";
//		}
		imService.evaluationByConsultCode(consult,scoreContent,type,bannerList);
		return success("请求成功");
		try {
			imService.evaluationByConsultCode(consult,scoreContent,type,bannerList);
			return success("请求成功");
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.getEvaluationByConsultCode)
@ -753,8 +818,12 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
//		if(StringUtils.isEmpty(scoreContent)){
//			scoreContent= "[{\"scoreType\":\"1\",\"score\":100,\"content\":\"\"},{\"scoreType\":\"2\",\"score\":80,\"content\":\"\"},{\"scoreType\":\"3\",\"score\":80,\"content\":\"\"},{\"scoreType\":\"4\",\"score\":0,\"content\":\"测试评语。。。。123123\"}]";
//		}
		
		return success("请求成功",imService.getEvaluationByConsultCode(consult));
		try {
			return success("请求成功",imService.getEvaluationByConsultCode(consult));
		}catch (Exception e){
			return failedListEnvelopException(e);
		}
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.getSign)
@ -763,27 +832,32 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	                       @RequestParam(value = "pageUrl", required = true)String pageUrl,
	                       @ApiParam(name = "wxId", value = "微信id")
	                       @RequestParam(value = "wxId", required = true)String wxId) throws Exception {
		logger.info("pageUrl="+pageUrl);
		logger.info("wxId="+wxId);
		String ticket = wechatInfoService.getJsapi_ticketByToken(wxId);
		WxWechatDO wxWechatDO = wechatDao.findById(wxId);
		Map<Object, Object> map = new HashMap<Object, Object>();
		if (ticket != null) {
			String noncestr = UUID.randomUUID().toString();
			long timestamp = System.currentTimeMillis() / 1000;
			String url = pageUrl;
			logger.info("getSign.url="+url);
			String str = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "&timestamp=" + timestamp + "&url=" + url;
			logger.info("getSign.str="+str);
			// sha1加密
			String signature = SHA1(str);
			map.put("noncestr", noncestr);
			map.put("timestamp", timestamp);
			map.put("signature", signature);
			map.put("appid", wxWechatDO.getAppId());
			return success(PatientRequestMapping.Wechat.api_success,map);
		try {
			logger.info("pageUrl="+pageUrl);
			logger.info("wxId="+wxId);
			String ticket = wechatInfoService.getJsapi_ticketByToken(wxId);
			WxWechatDO wxWechatDO = wechatDao.findById(wxId);
			Map<Object, Object> map = new HashMap<Object, Object>();
			if (ticket != null) {
				String noncestr = UUID.randomUUID().toString();
				long timestamp = System.currentTimeMillis() / 1000;
				String url = pageUrl;
				logger.info("getSign.url="+url);
				String str = "jsapi_ticket=" + ticket + "&noncestr=" + noncestr + "&timestamp=" + timestamp + "&url=" + url;
				logger.info("getSign.str="+str);
				// sha1加密
				String signature = SHA1(str);
				map.put("noncestr", noncestr);
				map.put("timestamp", timestamp);
				map.put("signature", signature);
				map.put("appid", wxWechatDO.getAppId());
				return success(PatientRequestMapping.Wechat.api_success,map);
			}
			return failed(PatientRequestMapping.Wechat.api_error);
		}catch (Exception e){
			return failedException(e);
		}
		return failed(PatientRequestMapping.Wechat.api_error);
	}
	
	/**
@ -815,9 +889,14 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "导诊的咨询对话", notes = "导诊的咨询对话")
	public Envelop getPatientGuaidenceConsult(@ApiParam(name = "patientCode", value = "居民CODE")
	                       @RequestParam(value = "patientCode", required = true)String patientCode) throws Exception {
		String session_id = patientCode+"_guidance_14";
		session_id = imService.getPatientGuaidenceConsult(patientCode,session_id,null);
		return success(session_id);
		try {
			String session_id = patientCode+"_guidance_14";
			session_id = imService.getPatientGuaidenceConsult(patientCode,session_id,null);
			return success(session_id);
		}catch (Exception e){
			return failedException(e);
		}
	}
@ -827,13 +906,18 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
											  @RequestParam(value = "patientCode", required = true)String patientCode,
											  @ApiParam(name = "type", value = "type")
											  @RequestParam(value = "type", required = false)String type) throws Exception {
		String session_id = null;
		if (org.apache.commons.lang3.StringUtils.isNoneBlank(type)){
			session_id = patientCode+"_guidance_"+type;
		}
		Boolean re = imUtil.sessionIsExist(session_id);
		return success(re);
		try {
			String session_id = null;
			if (org.apache.commons.lang3.StringUtils.isNoneBlank(type)){
				session_id = patientCode+"_guidance_"+type;
			}
			Boolean re = imUtil.sessionIsExist(session_id);
			return success(re);
		}catch (Exception e){
			return failedException(e);
		}
	}
	
@ -845,8 +929,13 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	                                       @RequestParam(value = "userid", required = true) String userid,
	                                       @ApiParam(name = "olduserid", value = "删除的成员id")
	                                       @RequestParam(value = "olduserid", required = false) String olduserid)throws Exception{
		imService.updateParticipant(sessionid,userid,olduserid);
		return success("操作成功");
		try {
			imService.updateParticipant(sessionid,userid,olduserid);
			return success("操作成功");
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.patientGuaidenceAppend)
@ -871,66 +960,71 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "wechat_appid", value = "wechat_appid", defaultValue = "")
			@RequestParam(value = "wechat_appid", required = false) String wechat_appid
	)throws Exception{
		List<String> failed = new ArrayList<>();
		//处理语音文件
		if(!org.springframework.util.StringUtils.isEmpty(wechat_appid)){
		try {
			List<String> failed = new ArrayList<>();
			//处理语音文件
			if(!org.springframework.util.StringUtils.isEmpty(wechat_appid)){
//			imService.getInputStream("1",wechat_appid);
			if("3".equalsIgnoreCase(content_type)){//语音文件
				String voicepath = imService.fetchWxVoices(wechat_appid);
				logger.info("voice_path:"+voicepath);
				JSONObject obj = new JSONObject();
				String voiceurl = "";
				// 将临时语音拷贝到正式存储路径下
				if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
					if("xm_ihealth_wx".equals(wechat_appid)){
						logger.info("voice_wx_type:"+wechat_appid);
						voiceurl = fileUploadService.uploadWxVoice(voicepath);
				if("3".equalsIgnoreCase(content_type)){//语音文件
					String voicepath = imService.fetchWxVoices(wechat_appid);
					logger.info("voice_path:"+voicepath);
					JSONObject obj = new JSONObject();
					String voiceurl = "";
					// 将临时语音拷贝到正式存储路径下
					if (org.apache.commons.lang3.StringUtils.isNotEmpty(voicepath)) {
						if("xm_ihealth_wx".equals(wechat_appid)){
							logger.info("voice_wx_type:"+wechat_appid);
							voiceurl = fileUploadService.uploadWxVoice(voicepath);
//					uploadVO.setFullUri(map.get("accessory").toString());
					}else if ("xm_xzzx_wx".equalsIgnoreCase(wechat_appid)){
						voiceurl = fileUploadService.uploadWxVoiceToEntrance(remote_inner_url,voicepath);
						logger.info(voiceurl);
					}else {
						voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
						}else if ("xm_xzzx_wx".equalsIgnoreCase(wechat_appid)){
							voiceurl = fileUploadService.uploadWxVoiceToEntrance(remote_inner_url,voicepath);
							logger.info(voiceurl);
						}else {
							voiceurl = fileUtil.copyTempVoice(voicepath,fastdfs_file_url);
						}
						obj.put("path", voiceurl);
						obj.put("times", times);
						content = obj.toString();
					}
					obj.put("path", voiceurl);
					obj.put("times", times);
					content = obj.toString();
				}
			}else if("2".equalsIgnoreCase(content_type)){//图片文件
				String imagepath = imService.fetchWxImages(wechat_appid);
				logger.info("image_path:"+imagepath);
				JSONObject obj = new JSONObject();
				String imgeUrl = "";
				// 将临时语音拷贝到正式存储路径下
				if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
					if("xm_ihealth_wx".equals(wechat_appid)){
						logger.info("imge_wx_type:"+wechat_appid);
						imgeUrl = fileUploadService.uploadWxImage(imagepath);
				}else if("2".equalsIgnoreCase(content_type)){//图片文件
					String imagepath = imService.fetchWxImages(wechat_appid);
					logger.info("image_path:"+imagepath);
					JSONObject obj = new JSONObject();
					String imgeUrl = "";
					// 将临时语音拷贝到正式存储路径下
					if (org.apache.commons.lang3.StringUtils.isNotEmpty(imagepath)) {
						if("xm_ihealth_wx".equals(wechat_appid)){
							logger.info("imge_wx_type:"+wechat_appid);
							imgeUrl = fileUploadService.uploadWxImage(imagepath);
//					uploadVO.setFullUri(map.get("accessory").toString());
					}else{
						imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
						}else{
							imgeUrl = fileUtil.copyTempVoice(imagepath,fastdfs_file_url);
						}
						content = imgeUrl;
					}
					content = imgeUrl;
				}
			}else{
				}else{
				}
			}
			session_id = imService.getPatientGuaidenceConsult(sender_id,session_id,type);
			String result = imService.patientGuaidenceAppend(sender_id,sender_name,session_id,content_type,content,"1",extend);
			List<BaseDoctorRoleDO> doctorRoleDOS = doctorRoleDao.findByRoleCode("guidance");
			for (BaseDoctorRoleDO doctorRoleDO:doctorRoleDOS){
				System.out.println("发送外层SOCKET消息:通知医生导诊");
				JSONObject object = new JSONObject();
				object.put("socket_sms_type",13);
				object.put("relation_code",session_id);
				imService.sendWaiSocketMessage(sender_id,doctorRoleDO.getDoctorCode(),object.toString(),"1");
			}
		}
		session_id = imService.getPatientGuaidenceConsult(sender_id,session_id,type);
		String result = imService.patientGuaidenceAppend(sender_id,sender_name,session_id,content_type,content,"1",extend);
		List<BaseDoctorRoleDO> doctorRoleDOS = doctorRoleDao.findByRoleCode("guidance");
		for (BaseDoctorRoleDO doctorRoleDO:doctorRoleDOS){
			System.out.println("发送外层SOCKET消息:通知医生导诊");
			JSONObject object = new JSONObject();
			object.put("socket_sms_type",13);
			object.put("relation_code",session_id);
			imService.sendWaiSocketMessage(sender_id,doctorRoleDO.getDoctorCode(),object.toString(),"1");
		}
		return success(result);
			return success(result);
		}catch (Exception e){
			return failedException(e);
		}
	}
	
	

+ 30 - 25
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/ReservationSettingEndpoint.java

@ -36,36 +36,41 @@ public class ReservationSettingEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "json_data", value = "JSON数据", required = true, defaultValue = "15")
            @RequestParam(value = "json_data") String jsonData ) throws Exception {
        int flag = -1;
        WlyyHospitalReservationSettingDO wlyyHospitalReservationSettingDO = new WlyyHospitalReservationSettingDO();
        Map dataDetail  = JSONObject.fromObject(jsonData);
        Map baseInfo = new HashMap();
        String hospital = dataDetail.get("hospital").toString();
        baseInfo.put("city",dataDetail.get("city").toString());
        baseInfo.put("cityName",dataDetail.get("cityName").toString());
        baseInfo.put("town",dataDetail.get("town").toString());
        baseInfo.put("townName",dataDetail.get("townName").toString());
        baseInfo.put("hospital",dataDetail.get("hospital").toString());
        baseInfo.put("hospitalName",dataDetail.get("hospitalName").toString());
        // 获取到职称及服务对象列表,拆分成json数组,再进行处理
        String data = dataDetail.get("data") == "" ? "": dataDetail.get("data") .toString();
        JSONArray array = JSONArray.fromObject(data);
        if (array.size() > 0) {
        try {
            int flag = -1;
            WlyyHospitalReservationSettingDO wlyyHospitalReservationSettingDO = new WlyyHospitalReservationSettingDO();
            Map dataDetail  = JSONObject.fromObject(jsonData);
            Map baseInfo = new HashMap();
            String hospital = dataDetail.get("hospital").toString();
            baseInfo.put("city",dataDetail.get("city").toString());
            baseInfo.put("cityName",dataDetail.get("cityName").toString());
            baseInfo.put("town",dataDetail.get("town").toString());
            baseInfo.put("townName",dataDetail.get("townName").toString());
            baseInfo.put("hospital",dataDetail.get("hospital").toString());
            baseInfo.put("hospitalName",dataDetail.get("hospitalName").toString());
            // 获取到职称及服务对象列表,拆分成json数组,再进行处理
            String data = dataDetail.get("data") == "" ? "": dataDetail.get("data") .toString();
            JSONArray array = JSONArray.fromObject(data);
            if (array.size() > 0) {
                for (int i = 0; i < array.size(); i++) {
                JSONObject jsonObject = array.getJSONObject(i);
                    JSONObject jsonObject = array.getJSONObject(i);
                    wlyyHospitalReservationSettingDO = reservationSettingService.saveReverationSetting(jsonObject,baseInfo);
                if(wlyyHospitalReservationSettingDO != null){
                    flag = 0;
                }else{
                    break;
                    if(wlyyHospitalReservationSettingDO != null){
                        flag = 0;
                    }else{
                        break;
                    }
                }
            }
        }
        if(flag == 0){
            return success("新增服务配置成功!");
        }else{
            return failed("新增服务配置失败!");
            if(flag == 0){
                return success("新增服务配置成功!");
            }else{
                return failed("新增服务配置失败!");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }

+ 71 - 51
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/SysDictEndpoint.java

@ -41,35 +41,40 @@ public class SysDictEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "json_data", value = "JSON数据", required = true)
            @RequestParam(value = "json_data") String jsonData )  throws Exception {
        int flag = -1;
        Envelop envelop = new Envelop();
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = new WlyyHospitalSysDictDO();
        Map dataDetail  = JSONObject.fromObject(jsonData);
        String hospital = dataDetail.get("hospital") == "" ? "": dataDetail.get("hospital") .toString();
        String dictName = dataDetail.get("dictName") == "" ? "": dataDetail.get("dictName") .toString();
        String data = dataDetail.get("data") == "" ? "": dataDetail.get("data") .toString();
        JSONArray array = JSONArray.fromObject(data);
        if(array.size()>0) {
            for (int i = 0; i < array.size(); i++) {
                JSONObject jsonObject = array.getJSONObject(i);
                wlyyHospitalSysDictDO = sysDictService.saveConsultSetting(jsonObject, hospital, dictName);
                if (wlyyHospitalSysDictDO != null) {
                    flag = 0;
                    continue;
                } else {
                    break;
        try {
            int flag = -1;
            Envelop envelop = new Envelop();
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = new WlyyHospitalSysDictDO();
            Map dataDetail  = JSONObject.fromObject(jsonData);
            String hospital = dataDetail.get("hospital") == "" ? "": dataDetail.get("hospital") .toString();
            String dictName = dataDetail.get("dictName") == "" ? "": dataDetail.get("dictName") .toString();
            String data = dataDetail.get("data") == "" ? "": dataDetail.get("data") .toString();
            JSONArray array = JSONArray.fromObject(data);
            if(array.size()>0) {
                for (int i = 0; i < array.size(); i++) {
                    JSONObject jsonObject = array.getJSONObject(i);
                    wlyyHospitalSysDictDO = sysDictService.saveConsultSetting(jsonObject, hospital, dictName);
                    if (wlyyHospitalSysDictDO != null) {
                        flag = 0;
                        continue;
                    } else {
                        break;
                    }
                }
            }
            if (flag < 0) {
                return failed("配置新增失败!");
            } else {
                return success("配置新增成功!", wlyyHospitalSysDictDO);
                if (flag < 0) {
                    return failed("配置新增失败!");
                } else {
                    return success("配置新增成功!", wlyyHospitalSysDictDO);
                }
            }else{
                return failed("获取待更新配置项失败!");
            }
        }else{
            return failed("获取待更新配置项失败!");
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -87,18 +92,23 @@ public class SysDictEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "dictName", value = "字典名称", defaultValue = "")
            @RequestParam(value = "dictName", required = false) String dictName ) throws Exception {
        List<WlyyHospitalSysDictDO>  wlyyHospitalSysDictDOS = new ArrayList<WlyyHospitalSysDictDO>();
        wlyyHospitalSysDictDOS = sysDictService.findByHospitalAndDictName(hospital,dictName);
        Map res = new HashMap();
        res.put("hospital",hospital);
        res.put("dictName",dictName);
        if(wlyyHospitalSysDictDOS != null){
            for(WlyyHospitalSysDictDO wlyyHospitalSysDictDO : wlyyHospitalSysDictDOS){
                res.put(wlyyHospitalSysDictDO.getDictCode().toString(),wlyyHospitalSysDictDO.getDictValue().toString());
        try {
            List<WlyyHospitalSysDictDO>  wlyyHospitalSysDictDOS = new ArrayList<WlyyHospitalSysDictDO>();
            wlyyHospitalSysDictDOS = sysDictService.findByHospitalAndDictName(hospital,dictName);
            Map res = new HashMap();
            res.put("hospital",hospital);
            res.put("dictName",dictName);
            if(wlyyHospitalSysDictDOS != null){
                for(WlyyHospitalSysDictDO wlyyHospitalSysDictDO : wlyyHospitalSysDictDOS){
                    res.put(wlyyHospitalSysDictDO.getDictCode().toString(),wlyyHospitalSysDictDO.getDictValue().toString());
                }
                return success("查询配置信息成功!",res);
            }else{
                return failed("配置信息未存储,请先保存!");
            }
            return success("查询配置信息成功!",res);
        }else{
            return failed("配置信息未存储,请先保存!");
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -119,19 +129,24 @@ public class SysDictEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "dictCode", value = "字典项编码", defaultValue = "")
            @RequestParam(value = "dictCode", required = false) String dictCode ) throws Exception {
        ObjEnvelop objEnvelop = new ObjEnvelop();
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = new WlyyHospitalSysDictDO();
        wlyyHospitalSysDictDO = sysDictService.findByHospitalAndDictCode(hospital,dictCode);
        if(wlyyHospitalSysDictDO != null){
            objEnvelop.setObj(wlyyHospitalSysDictDO);
            objEnvelop.setStatus(200);
            objEnvelop.setMessage("查询配置信息成功!");
        }else{
            objEnvelop.setStatus(-1);
            objEnvelop.setMessage("对不起,未查询到相关的配置信息!");
        try {
            ObjEnvelop objEnvelop = new ObjEnvelop();
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO = new WlyyHospitalSysDictDO();
            wlyyHospitalSysDictDO = sysDictService.findByHospitalAndDictCode(hospital,dictCode);
            if(wlyyHospitalSysDictDO != null){
                objEnvelop.setObj(wlyyHospitalSysDictDO);
                objEnvelop.setStatus(200);
                objEnvelop.setMessage("查询配置信息成功!");
            }else{
                objEnvelop.setStatus(-1);
                objEnvelop.setMessage("对不起,未查询到相关的配置信息!");
            }
            return objEnvelop;
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }
        return objEnvelop;
    }
    
    @Override
@ -148,9 +163,14 @@ public class SysDictEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "dictName", value = "字典名称", required = true)
            @RequestParam(value = "dictName", required = true) String dictName ) throws Exception {
        List<Map<String, Object>> list = sysDictService.findByHosAndDict(hospital, dictName);
        return success("查询成功",list);
        try {
            List<Map<String, Object>> list = sysDictService.findByHosAndDict(hospital, dictName);
            return success("查询成功",list);
        }catch (Exception e){
            return failedException(e);
        }
    }
}

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

@ -44,8 +44,12 @@ public class PrivateDictEndpoint extends EnvelopRestEndpoint {
                                    @RequestParam(value = "dictCode", required = false) String dictCode,
                                   @ApiParam(name = "hospitalCode", value = "")
                                   @RequestParam(value = "hospitalCode", required = false) String hospitalCode){
        try {
            return success(privateDictService.findByHospitalCodeAndDictCode(dictCode));
        }catch (Exception e){
            return failedException(e);
        }
        return success(privateDictService.findByHospitalCodeAndDictCode(dictCode));
    }
    @PostMapping(value= BaseHospitalRequestMapping.PatientNoLogin.savePrivateDict)
@ -65,15 +69,25 @@ public class PrivateDictEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "hospitalName", required = false)String hospitalName,
            @ApiParam(name = "imgUrl", value = "imgUrl", required = false)
            @RequestParam(value = "imgUrl", required = false)String imgUrl)throws Exception {
        MixEnvelop mixEnvelop =privateDictService.addPrivateDict(id,dictCode,dictName,dictValue,hospitalCode,hospitalName,imgUrl);
        return mixEnvelop;
        try {
            MixEnvelop mixEnvelop =privateDictService.addPrivateDict(id,dictCode,dictName,dictValue,hospitalCode,hospitalName,imgUrl);
            return mixEnvelop;
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
    @ApiOperation("删除隐私策略")
    @GetMapping(value= BaseHospitalRequestMapping.PatientNoLogin.delPrivateDict)
    public MixEnvelop delPrivateDict(@ApiParam(name = "id", value = "id", required = true)
                                         @RequestParam(value = "id", required = true)String id){
        MixEnvelop mixEnvelop =privateDictService.deleteById(id);
        return mixEnvelop;
        try {
            MixEnvelop mixEnvelop =privateDictService.deleteById(id);
            return mixEnvelop;
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
    @ApiOperation("查询字典")
    @GetMapping(value= BaseHospitalRequestMapping.PatientNoLogin.findDict)
@ -90,21 +104,34 @@ public class PrivateDictEndpoint extends EnvelopRestEndpoint {
                                @ApiParam(name = "pageSize", value = "pageSize", required = false)
                                    @RequestParam(value = "pageSize", required = false)Integer pageSize){
        return wlyyHospitalSysDictService.findDictsByNameCode(modelName,name,code,value1,page,pageSize);
        try {
            return wlyyHospitalSysDictService.findDictsByNameCode(modelName,name,code,value1,page,pageSize);
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
    @ApiOperation("删除字典")
    @GetMapping(value= BaseHospitalRequestMapping.PatientNoLogin.delDict)
    public Envelop delDict(@ApiParam(name = "id", value = "id", required = true)
                                     @RequestParam(value = "id", required = true)String id){
        return success(wlyyHospitalSysDictService.deleteDictById(id));
        try {
            return success(wlyyHospitalSysDictService.deleteDictById(id));
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
    @ApiOperation("新增/修改字典")
    @GetMapping(value= BaseHospitalRequestMapping.PatientNoLogin.createOrUpdateDict)
    public Envelop createOrUpdateDict(@ApiParam(name = "json", value = "id", required = true)
                           @RequestParam(value = "json", required = true)String json) throws Exception{
        return success(wlyyHospitalSysDictService.updateOrCreateDict(json));
        try {
            return success(wlyyHospitalSysDictService.updateOrCreateDict(json));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.SystemMessage.searchMessagePageList)
@ -124,18 +151,23 @@ public class PrivateDictEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
        if(org.apache.commons.lang.StringUtils.isBlank(filters)){
            filters="del=1";
        }else{
            String doctorId = wlyyHospitalSysDictService.findByDoctorMappingCode(filters);
            filters="receiver="+doctorId+";del=1";
            if (StringUtils.isNotBlank(type)){
                filters = filters+";type="+type;
        try {
            if(org.apache.commons.lang.StringUtils.isBlank(filters)){
                filters="del=1";
            }else{
                String doctorId = wlyyHospitalSysDictService.findByDoctorMappingCode(filters);
                filters="receiver="+doctorId+";del=1";
                if (StringUtils.isNotBlank(type)){
                    filters = filters+";type="+type;
                }
            }
            List<SystemMessageDO> list  = systemMessageService.search(fields,filters,sorts,page,pageSize);
            int count = (int) systemMessageService.getCount(filters);
            return success(list, count, page, pageSize, SystemMessageDO.class);
        }catch (Exception e){
            return failedException(e);
        }
        List<SystemMessageDO> list  = systemMessageService.search(fields,filters,sorts,page,pageSize);
        int count = (int) systemMessageService.getCount(filters);
        return success(list, count, page, pageSize, SystemMessageDO.class);
    }
@ -147,7 +179,12 @@ public class PrivateDictEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "jsonParam", required = false) String jsonParam,
            @ApiParam(name = "jsonContent", value = "消息内容")
            @RequestParam(value = "jsonContent", required = false) String jsonContent)throws Exception{
        return success(systemMessageService.commenSystemMessage(jsonParam,jsonContent));
        try {
            return success(systemMessageService.commenSystemMessage(jsonParam,jsonContent));
        }catch (Exception e){
            return failedException(e);
        }
    }
}

+ 32 - 17
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/drugstore/BaseDrugStoreEndpoint.java

@ -41,14 +41,19 @@ public class BaseDrugStoreEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        List<BaseDrugStoreDO> baseProvinces = baseDrugStoreService.search(fields, filters, sorts, page, size);
        int count = (int)baseDrugStoreService.getCount(filters);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setDetailModelList(baseProvinces);
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setTotalCount(count);
        mixEnvelop.setPageSize(size);
        return mixEnvelop;
        try {
            List<BaseDrugStoreDO> baseProvinces = baseDrugStoreService.search(fields, filters, sorts, page, size);
            int count = (int)baseDrugStoreService.getCount(filters);
            MixEnvelop mixEnvelop = new MixEnvelop();
            mixEnvelop.setDetailModelList(baseProvinces);
            mixEnvelop.setCurrPage(page);
            mixEnvelop.setTotalCount(count);
            mixEnvelop.setPageSize(size);
            return mixEnvelop;
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.drugStoreManage.findDrugstoreByDistance)
    @ApiOperation(value = "药店距离查询")
@ -61,10 +66,15 @@ public class BaseDrugStoreEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "drugStoreName", required = false) String drugStoreName,
            @ApiParam(name = "hospitalName", value = "医院名称")
            @RequestParam(value = "hospitalName", required = false) String hospitalName) throws Exception {
        List<BaseDrugStoreDO> list = baseDrugStoreService.countDistanceListIncode(latitude,longitude,drugStoreName,hospitalName);
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setDetailModelList(list);
        return mixEnvelop;
        try {
            List<BaseDrugStoreDO> list = baseDrugStoreService.countDistanceListIncode(latitude,longitude,drugStoreName,hospitalName);
            MixEnvelop mixEnvelop = new MixEnvelop();
            mixEnvelop.setDetailModelList(list);
            return mixEnvelop;
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseRequestMapping.drugStoreManage.findDrugstoreById)
    @ApiOperation(value = "药店id查询")
@ -74,11 +84,16 @@ public class BaseDrugStoreEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "longitude", required = false) String longitude,
                                        @ApiParam(name = "id", value = "药店id")
                                     @RequestParam(value = "id", required = false) String id){
        BaseDrugStoreDO baseDrugStoreDO = baseDrugStoreService.getById(id,latitude,longitude);
        if (null!=baseDrugStoreDO){
            return success(baseDrugStoreDO);
        }else {
            return failed("查询失败");
        try {
            BaseDrugStoreDO baseDrugStoreDO = baseDrugStoreService.getById(id,latitude,longitude);
            if (null!=baseDrugStoreDO){
                return success(baseDrugStoreDO);
            }else {
                return failed("查询失败");
            }
        }catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }

+ 7 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/enterprise/EnterpriseController.java

@ -36,7 +36,13 @@ public class EnterpriseController extends EnvelopRestEndpoint {
            @RequestParam(value = "description")String description,
            @ApiParam(name = "url", value = "跳转链接", required = true)
            @RequestParam(value = "url")String url) throws Exception{
        return success(enterpriseService.sendTWMesBymobile( enterpriseId, mobile, title, description, url));
        try {
            return success(enterpriseService.sendTWMesBymobile( enterpriseId, mobile, title, description, url));
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedMixEnvelopException(e);
        }
    }
    @PostMapping(value = "/sendTWMesByDoctor")

+ 90 - 31
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseDoctorBGController.java

@ -42,14 +42,19 @@ public class BaseDoctorBGController extends EnvelopRestEndpoint {
                                 @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                             @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
                                 @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
        Integer curPage = (page-1)*pageSize;
        List<BaseDoctorBackgroundDO> list = baseDoctorBGService.getBackground(curPage,pageSize);
        if (list.size()>0){
            return success(list);
        }else {
            return failed("查询失败");
        }
        try {
            Integer curPage = (page-1)*pageSize;
            List<BaseDoctorBackgroundDO> list = baseDoctorBGService.getBackground(curPage,pageSize);
            if (list.size()>0){
                return success(list);
            }else {
                return failed("查询失败");
            }
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedException(e);
        }
    }
    @ApiOperation("保存医生选择的背景")
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.saveDoctorBG)
@ -57,11 +62,17 @@ public class BaseDoctorBGController extends EnvelopRestEndpoint {
                              @RequestParam(value = "doctor", required = false)String doctor,
                          @ApiParam(name = "id", value = "id", required = false)
                          @RequestParam(value = "id", required = false)String id){
        BaseDoctorDO baseDoctorDO = baseDoctorBGService.setDoctorBackground(doctor,id);
        if (null!=baseDoctorDO){
            return success("操作成功");
        }else {
            return failed("操作失败");
        try {
            BaseDoctorDO baseDoctorDO = baseDoctorBGService.setDoctorBackground(doctor,id);
            if (null!=baseDoctorDO){
                return success("操作成功");
            }else {
                return failed("操作失败");
            }
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedException(e);
        }
    }
    @ApiOperation("新增背景板")
@ -70,19 +81,31 @@ public class BaseDoctorBGController extends EnvelopRestEndpoint {
                          @RequestParam(value = "bgName", required = false)String bgName,
                          @ApiParam(name = "bgUrl", value = "bgUrl", required = false)
                          @RequestParam(value = "bgUrl", required = false)String bgUrl){
        BaseDoctorBackgroundDO baseDoctorBackgroundDO = baseDoctorBGService.createBackground(bgName,bgUrl);
        if (null!=baseDoctorBackgroundDO){
            return success("操作成功");
        }else {
            return failed("操作失败");
        try {
            BaseDoctorBackgroundDO baseDoctorBackgroundDO = baseDoctorBGService.createBackground(bgName,bgUrl);
            if (null!=baseDoctorBackgroundDO){
                return success("操作成功");
            }else {
                return failed("操作失败");
            }
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedException(e);
        }
    }
    @ApiOperation("删除背景板")
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.removeDoctorBG)
    public Envelop removeBg(@ApiParam(name = "id", value = "id", required = false)
                            @RequestParam(value = "id", required = false)String id){
         baseDoctorBGService.deleteBg(id);
        return success("操作成功");
        try {
            baseDoctorBGService.deleteBg(id);
            return success("操作成功");
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedException(e);
        }
    }
    @ApiOperation("修改背景板")
@ -93,11 +116,17 @@ public class BaseDoctorBGController extends EnvelopRestEndpoint {
                            @RequestParam(value = "bgName", required = false)String bgName,
                            @ApiParam(name = "baUrl", value = "baUrl", required = false)
                            @RequestParam(value = "baUrl", required = false)String baUrl){
        BaseDoctorBackgroundDO baseDoctorBackgroundDO = baseDoctorBGService.updateBackground(id,baUrl,bgName);
        if (null!=baseDoctorBackgroundDO){
            return success("操作成功");
        }else {
            return failed("操作失败");
        try {
            BaseDoctorBackgroundDO baseDoctorBackgroundDO = baseDoctorBGService.updateBackground(id,baUrl,bgName);
            if (null!=baseDoctorBackgroundDO){
                return success("操作成功");
            }else {
                return failed("操作失败");
            }
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedException(e);
        }
    }
@ -113,16 +142,28 @@ public class BaseDoctorBGController extends EnvelopRestEndpoint {
                                @RequestParam(value = "page", required = false)Integer page,
                            @ApiParam(name = "size", value = "size", required = false)
                                @RequestParam(value = "size", required = false)Integer size){
        List<Map<String,Object>> mapList = baseDoctorBGService.selectByDoctor(doctor,contentType,content,page,size);
        return success(mapList);
        try {
            List<Map<String,Object>> mapList = baseDoctorBGService.selectByDoctor(doctor,contentType,content,page,size);
            return success(mapList);
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedException(e);
        }
    }
    @ApiOperation("保存医生快捷回复")
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.saveDoctorMessage)
    public Envelop saveDoctorMessage(@ApiParam(name = "json", value = "json", required = true)
                                       @RequestParam(value = "json", required = true)String json) throws Exception{
        BaseDoctorMessageDO doctorMessageDO = objectMapper.readValue(json,BaseDoctorMessageDO.class);
        return success(baseDoctorBGService.saveDoctorMessage(doctorMessageDO));
        try {
            BaseDoctorMessageDO doctorMessageDO = objectMapper.readValue(json,BaseDoctorMessageDO.class);
            return success(baseDoctorBGService.saveDoctorMessage(doctorMessageDO));
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedException(e);
        }
    }
@ -130,14 +171,26 @@ public class BaseDoctorBGController extends EnvelopRestEndpoint {
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.setMessageHead)
    public Envelop setMessageHead(@ApiParam(name = "id", value = "id", required = true)
                                     @RequestParam(value = "id", required = true)String id) throws Exception{
        return success(baseDoctorBGService.setMessageHead(id));
        try {
            return success(baseDoctorBGService.setMessageHead(id));
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedException(e);
        }
    }
    @ApiOperation("获取医生快捷回复消息")
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.selectMessageById)
    public Envelop selectMessageById(@ApiParam(name = "id", value = "id", required = true)
                                  @RequestParam(value = "id", required = true)String id) throws Exception{
        return success(baseDoctorBGService.selectById(id));
        try {
            return success(baseDoctorBGService.selectById(id));
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedException(e);
        }
    }
@ -145,7 +198,13 @@ public class BaseDoctorBGController extends EnvelopRestEndpoint {
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.delDoctorMessage)
    public Envelop delDoctorMessage(@ApiParam(name = "id", value = "id", required = true)
                                  @RequestParam(value = "id", required = true)String id) throws Exception{
        return success(baseDoctorBGService.delDoctorMessage(id));
        try {
            return success(baseDoctorBGService.delDoctorMessage(id));
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.pushListWrite)
    @ApiOperation(value = "订单导出", notes = "订单导出")

+ 34 - 15
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseSuggestionController.java

@ -37,21 +37,31 @@ public class BaseSuggestionController extends EnvelopRestEndpoint {
                               @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
                            @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
        MixEnvelop mixEnvelop=baseSuggestionService.findSuggestionByType(type,userId,page,pageSize);
        return mixEnvelop;
        try {
            MixEnvelop mixEnvelop=baseSuggestionService.findSuggestionByType(type,userId,page,pageSize);
            return mixEnvelop;
        }catch (Exception e){
            System.out.println(e.getClass());
            return failedMixEnvelopException(e);
        }
    }
    @PostMapping(value= BaseHospitalRequestMapping.suggestion.saveSuggestion)
    @ApiOperation("新增反馈建议")
    public Envelop saveSuggestion(
            @ApiParam(name = "json", value = "Json数据", required = true)
            @RequestParam(value = "json", required = false)String json)throws Exception{
        BaseSuggestionDO baseSuggestionDO = toEntity(json, BaseSuggestionDO.class);
        BaseSuggestionDO result = baseSuggestionService.createSuggestion(baseSuggestionDO);
        if (null == result){
            return failed("新增失败");
        }
        return success("新增成功");
        try {
            BaseSuggestionDO baseSuggestionDO = toEntity(json, BaseSuggestionDO.class);
            BaseSuggestionDO result = baseSuggestionService.createSuggestion(baseSuggestionDO);
            if (null == result){
                return failed("新增失败");
            }
            return success("新增成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -64,12 +74,17 @@ public class BaseSuggestionController extends EnvelopRestEndpoint {
            @RequestParam(value = "content", required = false)String content,
            @ApiParam(name = "userId", value = "回复人id", required = true)
            @RequestParam(value = "userId", required = false)String userId)throws Exception{
        if (!StringUtils.isNoneBlank(userId)){
            userId= getUID();
        try {
            if (!StringUtils.isNoneBlank(userId)){
                userId= getUID();
            }
            String userName = getUNAME();
            baseSuggestionService.reponseSuggestion(id,content,userId,userName);
            return success("回复成功");
        }catch (Exception e){
            return failedException(e);
        }
        String userName = getUNAME();
        baseSuggestionService.reponseSuggestion(id,content,userId,userName);
        return success("回复成功");
    }
    @PostMapping(value= BaseHospitalRequestMapping.suggestion.findSuggestionById)
@ -77,7 +92,11 @@ public class BaseSuggestionController extends EnvelopRestEndpoint {
    public Envelop findSuggestionById(
            @ApiParam(name = "id", value = "建议id", required = true)
            @RequestParam(value = "id", required = true)String id) {
        BaseSuggestionDO baseSuggestionDO = baseSuggestionService.findSuggestionById(id);
        return success(baseSuggestionDO);
        try {
            BaseSuggestionDO baseSuggestionDO = baseSuggestionService.findSuggestionById(id);
            return success(baseSuggestionDO);
        }catch (Exception e){
            return failedException(e);
        }
    }
}

+ 70 - 41
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseSuggestionDictController.java

@ -32,32 +32,46 @@ public class BaseSuggestionDictController extends EnvelopRestEndpoint {
                                           @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
                                           @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
        MixEnvelop mixEnvelop=baseSuggestionDictService.findByNameAndDes(name,des,page,pageSize);
        return mixEnvelop;
        try {
            MixEnvelop mixEnvelop=baseSuggestionDictService.findByNameAndDes(name,des,page,pageSize);
            return mixEnvelop;
        } catch (Exception e){
            return failedMixEnvelopException(e);
        }
    }
    @PostMapping(value= BaseHospitalRequestMapping.suggestionDict.saveSuggestionType)
    @ApiOperation("新增反馈建议类型")
    public Envelop saveSuggestionType(
            @ApiParam(name = "json", value = "Json数据", required = true)
            @RequestParam(value = "json", required = false)String json)throws Exception{
        BaseSuggestionDictDO baseSuggestionDO = toEntity(json, BaseSuggestionDictDO.class);
        BaseSuggestionDictDO result = baseSuggestionDictService.createSuggestionType(baseSuggestionDO);
        if (null == result){
            return failed("新增失败");
        }
        return success("新增成功");
        try {
            BaseSuggestionDictDO baseSuggestionDO = toEntity(json, BaseSuggestionDictDO.class);
            BaseSuggestionDictDO result = baseSuggestionDictService.createSuggestionType(baseSuggestionDO);
            if (null == result){
                return failed("新增失败");
            }
            return success("新增成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
    @GetMapping(value= BaseHospitalRequestMapping.suggestionDict.delSuggestionType  )
    @ApiOperation("删除反馈建议类型")
    public Envelop delSuggestionType(
            @ApiParam(name = "id", value = "建议id", required = true)
            @RequestParam(value = "id", required = true)String id)throws Exception{
        boolean flag = baseSuggestionDictService.deleteSuggest(id);
        if (true==flag){
            return success("删除成功");
        }else {
            return failed("删除失败");
        try {
            boolean flag = baseSuggestionDictService.deleteSuggest(id);
            if (true==flag){
                return success("删除成功");
            }else {
                return failed("删除失败");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
    @PostMapping(value= BaseHospitalRequestMapping.suggestionDict.updateSuggestionType)
@ -71,32 +85,42 @@ public class BaseSuggestionDictController extends EnvelopRestEndpoint {
            @RequestParam(value = "suggestDes", required = false)String suggestDes,
            @ApiParam(name = "updateUser", value = "updateUser", required = false)
            @RequestParam(value = "updateUser", required = false)String updateUser)throws Exception {
        if (!StringUtils.isNoneBlank(updateUser)){
            updateUser = getUID();
        }
        String updateUserName = getUNAME();
        BaseSuggestionDictDO result = baseSuggestionDictService.updateSuggest(id,suggestName,suggestDes,updateUser,updateUserName);
        if (null == result) {
            return failed("更新失败,礼物不存在");
        try {
            if (!StringUtils.isNoneBlank(updateUser)){
                updateUser = getUID();
            }
            String updateUserName = getUNAME();
            BaseSuggestionDictDO result = baseSuggestionDictService.updateSuggest(id,suggestName,suggestDes,updateUser,updateUserName);
            if (null == result) {
                return failed("更新失败,礼物不存在");
            }
            return success("更新成功");
        }catch (Exception e){
            return failedException(e);
        }
        return success("更新成功");
    }
    @GetMapping(value= BaseHospitalRequestMapping.suggestionDict.upSuggestionType)
    @ApiOperation("上移")
    public Envelop upBanner(@ApiParam(name = "id", value = "id", required = true)
                            @RequestParam(value = "id", required = true)String id){
        BaseSuggestionDictDO baseSuggestionDictDO = new BaseSuggestionDictDO();
        String erroMessage = null;
        try {
            baseSuggestionDictDO = baseSuggestionDictService.upSuggestion(id);
        } catch (Exception e) {
            erroMessage = e.getMessage();
        }
        if (org.apache.commons.lang.StringUtils.isNotEmpty(erroMessage)){
            return failed("上移失败"+erroMessage);
        }else {
            return success("上移成功");
            BaseSuggestionDictDO baseSuggestionDictDO = new BaseSuggestionDictDO();
            String erroMessage = null;
            try {
                baseSuggestionDictDO = baseSuggestionDictService.upSuggestion(id);
            } catch (Exception e) {
                erroMessage = e.getMessage();
            }
            if (org.apache.commons.lang.StringUtils.isNotEmpty(erroMessage)){
                return failed("上移失败"+erroMessage);
            }else {
                return success("上移成功");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -104,17 +128,22 @@ public class BaseSuggestionDictController extends EnvelopRestEndpoint {
    @ApiOperation("下移")
    public Envelop downBanner(@ApiParam(name = "id", value = "id", required = true)
                              @RequestParam(value = "id", required = true)String id){
        BaseSuggestionDictDO baseSuggestionDictDO = new BaseSuggestionDictDO();
        String erroMessage = null;
        try {
            baseSuggestionDictDO = baseSuggestionDictService.downSuggestion(id);
        } catch (Exception e) {
            erroMessage = e.getMessage();
        }
        if (org.apache.commons.lang.StringUtils.isNotEmpty(erroMessage)){
            return failed("下移失败"+erroMessage);
        }else {
            return success("下移成功");
            BaseSuggestionDictDO baseSuggestionDictDO = new BaseSuggestionDictDO();
            String erroMessage = null;
            try {
                baseSuggestionDictDO = baseSuggestionDictService.downSuggestion(id);
            } catch (Exception e) {
                erroMessage = e.getMessage();
            }
            if (org.apache.commons.lang.StringUtils.isNotEmpty(erroMessage)){
                return failed("下移失败"+erroMessage);
            }else {
                return success("下移成功");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
}

+ 22 - 7
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/WlyyFamilyMemberController.java

@ -381,27 +381,42 @@ public class WlyyFamilyMemberController extends EnvelopRestEndpoint {
    @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();
            List<Map<String, Object>> list = new ArrayList<>();
            try {
                list = wlyyFamilyMemberService.findFamilyByPatientId(patientId);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            return success(list);
        }catch (Exception e){
            return failedException(e);
        }
        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);
        try {
            return wlyyFamilyMemberService.delMember(id);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @ApiOperation("获取单个亲属信息")
    @PostMapping(value = BaseHospitalRequestMapping.WlyyFamilyMember.findSingleMember)
    public Envelop findSingleMember(@ApiParam(name = "id", value = "id", required = false)
                                    @RequestParam(value = "id", required = false) String id) throws Exception {
        return success(wlyyFamilyMemberService.findMemberById(id));
        try {
            return success(wlyyFamilyMemberService.findMemberById(id));
        }catch (Exception e){
            return failedException(e);
        }
    }
    public boolean verifyCaptcha(String key,String text){
        boolean pass = false;

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

@ -45,21 +45,31 @@ public class BannerDoctorController extends EnvelopRestEndpoint {
                                  @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 =  Arrays.asList(bannerIds.split(","));
        try {
            ObjEnvelop objEnvelop = new ObjEnvelop();
            List<String> list = new ArrayList<>();
            if(StringUtils.isNotEmpty(bannerIds)){
                list =  Arrays.asList(bannerIds.split(","));
            }
            String patientId= getUID();
            objEnvelop = baseBannerDoctorService.bannerGive(patientId,list,content,doctor,doctorName,type,key,value);
            return objEnvelop;
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }
        String patientId= getUID();
        objEnvelop = baseBannerDoctorService.bannerGive(patientId,list,content,doctor,doctorName,type,key,value);
    return objEnvelop;
    }
    @ApiOperation("查询赠送锦旗")
    @PostMapping(value= BaseHospitalRequestMapping.DoctorBanner.getBanner)
    public Envelop getBanners(@ApiParam(name = "doctor", value = "doctor", required = false)
                                     @RequestParam(value = "doctor", required = false)String doctor){
        JSONObject jsonObject = baseBannerDoctorService.getDoctorBanners(doctor);
        return success(jsonObject);
        try {
            JSONObject jsonObject = baseBannerDoctorService.getDoctorBanners(doctor);
            return success(jsonObject);
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }
    }
    @ApiOperation("查询未读消息")
    @PostMapping(value= BaseHospitalRequestMapping.DoctorBanner.getMessageNotRead)
@ -69,8 +79,13 @@ public class BannerDoctorController extends EnvelopRestEndpoint {
                              @RequestParam(value = "page", required = false,defaultValue = "1")Integer page,
                              @ApiParam(name = "pageSize", value = "pageSize", required = false)
                                  @RequestParam(value = "pageSize", required = false,defaultValue = "10")Integer pageSize){
        JSONObject jsonObject = baseBannerDoctorService.getMessageNotRead(doctor,page,pageSize);
        return success(jsonObject);
        try {
            JSONObject jsonObject = baseBannerDoctorService.getMessageNotRead(doctor,page,pageSize);
            return success(jsonObject);
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }
    }
    @ApiOperation("修改消息已读状态")
    @PostMapping(value= BaseHospitalRequestMapping.DoctorBanner.changeIsRead)
@ -78,7 +93,12 @@ public class BannerDoctorController extends EnvelopRestEndpoint {
                              @RequestParam(value = "id", required = false)String id,
                                @ApiParam(name = "doctor", value = "doctor", required = false)
                                @RequestParam(value = "doctor", required = false)String doctor){
         baseBannerDoctorService.isRead(id,doctor);
        return success("success");
        try {
            baseBannerDoctorService.isRead(id,doctor);
            return success("success");
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }
    }
}

+ 54 - 40
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseBannerController.java

@ -34,7 +34,12 @@ public class BaseBannerController extends EnvelopRestEndpoint{
                                        @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
                                                   @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
            return baseBannerService.queryBannerByNameAndStatus(name,status,page,pageSize);
            try {
                return baseBannerService.queryBannerByNameAndStatus(name,status,page,pageSize);
            }catch (Exception e){
                return failedException(e);
            }
    }
    @PostMapping(value= BaseHospitalRequestMapping.BaseBannerssage.createBanner)
@ -42,12 +47,17 @@ public class BaseBannerController extends EnvelopRestEndpoint{
    public Envelop createBanner(
            @ApiParam(name = "json", value = "Json数据", required = true)
            @RequestParam(value = "json", required = false)String json)throws Exception{
        BaseBannerDO bannerDO = toEntity(json,BaseBannerDO.class);
        BaseBannerDO result = baseBannerService.creatBanner(bannerDO);
        if (null == result){
            return failed("新增失败");
        try {
            BaseBannerDO bannerDO = toEntity(json,BaseBannerDO.class);
            BaseBannerDO result = baseBannerService.creatBanner(bannerDO);
            if (null == result){
                return failed("新增失败");
            }
            return success("新增成功");
        }catch (Exception e){
            return failedException(e);
        }
        return success("新增成功");
    }
@ -64,23 +74,33 @@ public class BaseBannerController extends EnvelopRestEndpoint{
            @RequestParam(value = "status", required = false)String status,
            @ApiParam(name = "description", value = "description", required = false)
            @RequestParam(value = "description", required = false)String description)throws Exception {
        String updateUser = getUID();
        String updateUserName = getUNAME();
        BaseBannerDO result = baseBannerService.updateBanner(id,name,img,status,updateUser,updateUserName,description);
        if (null == result) {
            return failed("更新失败,礼物不存在");
        try {
            String updateUser = getUID();
            String updateUserName = getUNAME();
            BaseBannerDO result = baseBannerService.updateBanner(id,name,img,status,updateUser,updateUserName,description);
            if (null == result) {
                return failed("更新失败,礼物不存在");
            }
            return success("更新成功");
        }catch (Exception e){
            return failedException(e);
        }
        return success("更新成功");
    }
    @GetMapping(value= BaseHospitalRequestMapping.BaseBannerssage.deleteBanner)
    @ApiOperation("删除礼物信息")
    public Envelop deleteBanner(@ApiParam(name = "id", value = "id", required = true)
                                    @RequestParam(value = "id", required = true)String id){
        boolean flag = baseBannerService.deleteBanner(id);
        if (true==flag){
            return success("删除成功");
        }else {
            return failed("删除失败");
        try {
            boolean flag = baseBannerService.deleteBanner(id);
            if (true==flag){
                return success("删除成功");
            }else {
                return failed("删除失败");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -88,17 +108,11 @@ public class BaseBannerController extends EnvelopRestEndpoint{
    @ApiOperation("上移锦旗信息")
    public Envelop upBanner(@ApiParam(name = "id", value = "id", required = true)
                                @RequestParam(value = "id", required = true)String id){
        BaseBannerDO bannerDO = new BaseBannerDO();
        String erroMessage = null;
        try {
            bannerDO = baseBannerService.upBanner(id);
        } catch (Exception e) {
            erroMessage = e.getMessage();
        }
        if (StringUtils.isNotEmpty(erroMessage)){
            return failed("上移失败"+erroMessage);
        }else {
            BaseBannerDO bannerDO = baseBannerService.upBanner(id);
            return success("上移成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -106,17 +120,12 @@ public class BaseBannerController extends EnvelopRestEndpoint{
    @ApiOperation("下移锦旗信息")
    public Envelop downBanner(@ApiParam(name = "id", value = "id", required = true)
                                 @RequestParam(value = "id", required = true)String id){
        BaseBannerDO bannerDO = new BaseBannerDO();
        String erroMessage = null;
        try {
            bannerDO = baseBannerService.downBanner(id);
        } catch (Exception e) {
            erroMessage = e.getMessage();
        }
        if (StringUtils.isNotEmpty(erroMessage)){
            return failed("下移失败"+erroMessage);
        }else {
            BaseBannerDO bannerDO = baseBannerService.downBanner(id);
            return success("下移成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
    @GetMapping(value= BaseHospitalRequestMapping.BaseBannerssage.onOff)
@ -125,11 +134,16 @@ public class BaseBannerController extends EnvelopRestEndpoint{
                              @RequestParam(value = "id", required = true)String id,
                         @ApiParam(name = "status", value = "status", required = true)
                         @RequestParam(value = "status", required = true)String status){
       BaseBannerDO bannerDO = baseBannerService.onOff(id,status);
       if (null!=bannerDO.getId()){
           return success("开关切换成功");
       }else {
           return failed("开关失败");
       try {
           BaseBannerDO bannerDO = baseBannerService.onOff(id,status);
           if (null!=bannerDO.getId()){
               return success("开关切换成功");
           }else {
               return failed("开关失败");
           }
       }catch (Exception e){
           return failedException(e);
       }
    }

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

@ -40,10 +40,15 @@ public class BaseUserMsgController extends EnvelopRestEndpoint {
                                       @RequestParam(value = "contentId", required = false)String  contentId,
                                   @ApiParam(name = "isDoctor", value = "isDoctor", required = false)
                                       @RequestParam(value = "isDoctor", required = false)Integer  isDoctor){
        String patient = getUID();
        System.out.println("patient"+patient);
        baseUserMsgService.responseMessage(contentId,content,reciverId,patient,isDoctor);
        return success("回复成功" );
        try {
            String patient = getUID();
            System.out.println("patient"+patient);
            baseUserMsgService.responseMessage(contentId,content,reciverId,patient,isDoctor);
            return success("回复成功" );
        }catch (Exception e){
            return failedException(e);
        }
    }
    @ApiOperation("自身评论")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.leaveMessage)
@ -60,12 +65,17 @@ public class BaseUserMsgController extends EnvelopRestEndpoint {
                                   @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();
        ObjEnvelop objEnvelop = new ObjEnvelop();
        objEnvelop= baseUserMsgService.leaveMessage(content,reciverId,reciverName,senderId,type,key,value);
        return objEnvelop;
        try {
            String senderId = getUID();
            System.out.println("senderId"+senderId);
            //String senderName = getUNAME();
            ObjEnvelop objEnvelop = new ObjEnvelop();
            objEnvelop= baseUserMsgService.leaveMessage(content,reciverId,reciverName,senderId,type,key,value);
            return objEnvelop;
        }catch (Exception e){
            return failedObjEnvelopException(e);
        }
}
    @ApiOperation("医生评论展示")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.showMessage)
@ -83,17 +93,26 @@ public class BaseUserMsgController extends EnvelopRestEndpoint {
                                           @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                               @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
                                   @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
        return baseUserMsgService.getMessage(doctor,showAll,showAllType,beginTime,endTime,page,pageSize);
        try {
            return baseUserMsgService.getMessage(doctor,showAll,showAllType,beginTime,endTime,page,pageSize);
        }catch (Exception e){
            return failedException(e);
        }
    }
    @ApiOperation("医生评论展示")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.getSingleMessage)
    public Envelop getSingleMessage(@ApiParam(name = "id", value = "id", required = false)
                               @RequestParam(value = "id", required = false)String id){
        List<Map<String,Object>> list = baseUserMsgService.getSingle(id);
        if (list.size()>=0){
            return success(list);
        }else {
            return failed("查询失败");
        try {
            List<Map<String,Object>> list = baseUserMsgService.getSingle(id);
            if (list.size()>=0){
                return success(list);
            }else {
                return failed("查询失败");
            }
        }catch (Exception e){
            return failedException(e);
        }
    }
    @ApiOperation("在线复诊")
@ -106,10 +125,15 @@ public class BaseUserMsgController extends EnvelopRestEndpoint {
                                   @RequestParam(value = "content", required = false)String content,
                                   @ApiParam(name = "relationCode", value = "relationCode", required = false)
                                   @RequestParam(value = "relationCode", required = false)String relationCode){
        String senderId = getUID();
        String senderName = getUNAME();
        baseUserMsgService.onlineVisitMessage(content,reciverId,reciverName,senderId,senderName,relationCode);
        return success("留言成功" );
        try {
            String senderId = getUID();
            String senderName = getUNAME();
            baseUserMsgService.onlineVisitMessage(content,reciverId,reciverName,senderId,senderName,relationCode);
            return success("留言成功" );
        }catch (Exception e){
            return failedException(e);
        }
    }
    @ApiOperation("专家咨询")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.expertMessage)
@ -121,10 +145,15 @@ public class BaseUserMsgController extends EnvelopRestEndpoint {
                                   @RequestParam(value = "content", required = false)String content,
                                   @ApiParam(name = "relationCode", value = "relationCode", required = false)
                                   @RequestParam(value = "relationCode", required = false)String relationCode){
        String senderId = getUID();
        String senderName = getUNAME();
        baseUserMsgService.expertMessage(content,reciverId,reciverName,senderId,senderName,relationCode);
        return success("留言成功" );
        try {
            String senderId = getUID();
            String senderName = getUNAME();
            baseUserMsgService.expertMessage(content,reciverId,reciverName,senderId,senderName,relationCode);
            return success("留言成功" );
        }catch (Exception e){
            return failedException(e);
        }
    }
    @ApiOperation("获取评论")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.getMessage)
@ -132,7 +161,12 @@ public class BaseUserMsgController extends EnvelopRestEndpoint {
                                 @ApiParam(name = "relationCode", value = "relationCode", required = false)
                                 @RequestParam(value = "relationCode", required = false)String relationCode){
        return success(userMsgContentService.getAllMessage(relationCode));
        try {
            return success(userMsgContentService.getAllMessage(relationCode));
        }catch (Exception e){
            return failedException(e);
        }
    }
    @ApiOperation("获取评分")
    @PostMapping(value= BaseHospitalRequestMapping.UserMessage.getPoint)
@ -140,7 +174,12 @@ public class BaseUserMsgController extends EnvelopRestEndpoint {
            @ApiParam(name = "doctor", value = "doctor", required = false)
            @RequestParam(value = "doctor", required = false)String doctor){
        return success(userMsgContentService.countPoint(doctor));
        try {
            return success(userMsgContentService.countPoint(doctor));
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -153,7 +192,12 @@ public class BaseUserMsgController extends EnvelopRestEndpoint {
                               @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                               @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
                               @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize) throws ParseException {
        JSONObject jsonObject=userMsgContentService.showContentByDoctor(doctor,page,pageSize);
        return success(jsonObject);
        try {
            JSONObject jsonObject=userMsgContentService.showContentByDoctor(doctor,page,pageSize);
            return success(jsonObject);
        }catch (Exception e){
            return failedException(e);
        }
    }
}

+ 39 - 20
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/SystemMessageController.java

@ -39,12 +39,16 @@ public class SystemMessageController extends EnvelopRestEndpoint {
            @ApiParam(name = "jsonData", value = "Json数据", required = true)
            @RequestBody SystemMessageDO systemMessageDO)throws Exception{
        SystemMessageDO messageDO = systemMessageService.addMessage(systemMessageDO);
        if (null == messageDO){
            return failed("新增失败");
        }
        return success("新增成功");
        try {
            SystemMessageDO messageDO = systemMessageService.addMessage(systemMessageDO);
            if (null == messageDO){
                return failed("新增失败");
            }
            return success("新增成功");
        }catch (Exception e){
            return failedException(e);
        }
    }
@ -59,11 +63,16 @@ public class SystemMessageController extends EnvelopRestEndpoint {
            @ApiParam(name = "del", value = "del", required = false)
            @RequestParam(value = "del", required = false)String del)throws Exception{
        SystemMessageDO systemMessageDO = systemMessageService.updateMessage(id,read,del);
        if (null == systemMessageDO){
            return failed("更新失败,就诊消息不存在");
        try {
            SystemMessageDO systemMessageDO = systemMessageService.updateMessage(id,read,del);
            if (null == systemMessageDO){
                return failed("更新失败,就诊消息不存在");
            }
            return success("更新成功");
        }catch (Exception e){
            return failedException(e);
        }
        return success("更新成功");
    }
@ -82,14 +91,19 @@ public class SystemMessageController extends EnvelopRestEndpoint {
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
            @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
        if(StringUtils.isBlank(filters)){
            filters="del=1";
        }else{
            filters=filters+";del=1";
        try {
            if(StringUtils.isBlank(filters)){
                filters="del=1";
            }else{
                filters=filters+";del=1";
            }
            List<SystemMessageDO> list  = systemMessageService.search(fields,filters,sorts,page,pageSize);
            int count = (int) systemMessageService.getCount(filters);
            return success(list, count, page, pageSize, SystemMessageDO.class);
        }catch (Exception e){
            return failedException(e);
        }
        List<SystemMessageDO> list  = systemMessageService.search(fields,filters,sorts,page,pageSize);
        int count = (int) systemMessageService.getCount(filters);
        return success(list, count, page, pageSize, SystemMessageDO.class);
    }
@ -99,11 +113,16 @@ public class SystemMessageController extends EnvelopRestEndpoint {
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id", required = true)String id)throws Exception{
        SystemMessageDO systemMessageDO = systemMessageService.queryById(id);
        if (null == systemMessageDO){
            return failed("获取失败,线上就诊消息不存在");
        try {
            SystemMessageDO systemMessageDO = systemMessageService.queryById(id);
            if (null == systemMessageDO){
                return failed("获取失败,线上就诊消息不存在");
            }
            return success("获取成功",200,systemMessageDO);
        }catch (Exception e){
            return failedException(e);
        }
        return success("获取成功",200,systemMessageDO);
    }

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

@ -251,13 +251,16 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                                            @ApiParam(name = "pagesize", value = "分页大小")
                                                             @RequestParam(value = "pagesize",required = false) Integer pagesize
    ) throws Exception{
        logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
        return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork,patientid,
                orgCode,dept,
                diseaseKey,doctorNameKey,
                jobTitleNameKey,outpatientType,
                keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize);
        try {
            logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
            return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork,patientid,
                    orgCode,dept,
                    diseaseKey,doctorNameKey,
                    jobTitleNameKey,outpatientType,
                    keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize);
        } catch (Exception e){
            return  failedMixEnvelopException(e);
        }
    }
    @GetMapping("/testFrontQuery")
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
@ -294,13 +297,16 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                                            @ApiParam(name = "pagesize", value = "分页大小")
                                                            @RequestParam(value = "pagesize",required = false) Integer pagesize
    ) throws Exception{
        logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
        return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork,patientid,
                orgCode,dept,
                diseaseKey,doctorNameKey,
                jobTitleNameKey,outpatientType,
                keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize);
        try {
            logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
            return prescriptionService.findDoctorByHospitalAndDiseaseAndDept2(iswork,patientid,
                    orgCode,dept,
                    diseaseKey,doctorNameKey,
                    jobTitleNameKey,outpatientType,
                    keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize);
        } catch (Exception e){
            return  failedMixEnvelopException(e);
        }
    }
@ -308,7 +314,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取常见疾病、热门部门、医生拒绝接诊原因 字典", notes = "获取常见疾病、热门部门、医生拒绝接诊原因 字典")
    public ListEnvelop findHotDeptAndDiseaseDict(@ApiParam(name = "dictName", value = "dictName")
                                                 @RequestParam(value = "dictName", required = true,defaultValue = "ONLINE_HOSPITAL_DEPT_350211A1002")String dictName)throws Exception{
        return success(prescriptionService.findHotDeptAndDiseaseDict(dictName));
        try {
            return success(prescriptionService.findHotDeptAndDiseaseDict(dictName));
        } catch (Exception e){
            return  failedListEnvelopException(e);
        }
    }
@ -316,7 +327,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "居民获取当日就诊列表", notes = "居民获取当日就诊列表")
    public ListEnvelop getTodayOutpatinetList(@ApiParam(name = "patient", value = "居民ID")
                                              @RequestParam(value = "patient", required = true) String patient){
        return success(prescriptionService.getTodayOutpatinetList(patient,wxId));
        try {
            return success(prescriptionService.getTodayOutpatinetList(patient,wxId));
        } catch (Exception e){
            return  failedListEnvelopException(e);
        }
    }
@ -324,7 +340,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "就诊费用查询", notes = "就诊费用查询")
    public ListEnvelop findByDeptTypeCode(@ApiParam(name = "deptTypeCode", value = "6总部7金榜8夏禾")
                                          @RequestParam(value = "deptTypeCode", required = false)String deptTypeCode) throws Exception{
        return success(prescriptionService.findByDeptTypeCode(deptTypeCode));
        try {
            return success(prescriptionService.findByDeptTypeCode(deptTypeCode));
        } catch (Exception e){
            return  failedListEnvelopException(e);
        }
    }
@ -336,9 +356,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            @ApiParam(name = "dictName", value = "字典名称", required = true)
            @RequestParam(value = "dictName", required = true) String dictName ) throws Exception {
        List<Map<String, Object>> list = sysDictService.findByHosAndDict(hospital, dictName);
        return success("查询成功",list);
        try {
            List<Map<String, Object>> list = sysDictService.findByHosAndDict(hospital, dictName);
            return success("查询成功",list);
        } catch (Exception e){
            return  failedException(e);
        }
    }
@ -366,13 +390,15 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            @RequestParam(value = "doctor",required = true) String doctor,
            @ApiParam(name = "patient", value = "居民CODE")
            @RequestParam(value = "patient",required = true) String patient)throws Exception {
        if(StringUtils.isEmpty(patient)){
            patient= getUID();
        try {
            if(StringUtils.isEmpty(patient)){
                patient= getUID();
            }
            String consultCode = imService.getUnfinishedConsult(patient, doctor);
            return success("请求成功",consultCode);
        }catch (Exception e){
            return  failedException(e);
        }
        String consultCode = imService.getUnfinishedConsult(patient, doctor);
        return success("请求成功",consultCode);
    }
    /**
@ -387,11 +413,15 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            @RequestParam(value = "orgCode", required = false) String orgCode,
            @ApiParam(name = "consultDeptFlag", value = "是否是就诊科室,1为查询门诊,不传为全部")
            @RequestParam(value = "consultDeptFlag", required = false) String consultDeptFlag)  {
        List<DictHospitalDeptDO> res =  hospitalDeptService.getHosDeptByCode(orgCode,consultDeptFlag);
        if(res != null && res.size() > 0 ){
            return  success(res);
        }else{
            return success("无法获取该机构的部门列表信息!");
        try {
            List<DictHospitalDeptDO> res =  hospitalDeptService.getHosDeptByCode(orgCode,consultDeptFlag);
            if(res != null && res.size() > 0 ){
                return  success(res);
            }else{
                return success("无法获取该机构的部门列表信息!");
            }
        }catch (Exception e){
            return  failedException(e);
        }
    }
@ -404,11 +434,15 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    public Envelop getJobBySaasId(
            @ApiParam(name = "saasId", value = "租户ID,当为空的情况下查询所有")
            @RequestParam(value = "saasId", required = false) String saasId)  {
        List<DictJobTitleDO> res= baseDictJobTitleService.getBySaasId(saasId);
        if(res != null && res.size() > 0 ){
            return  success(res);
        }else{
            return success("无法获取该机构的职称信息!");
        try {
            List<DictJobTitleDO> res= baseDictJobTitleService.getBySaasId(saasId);
            if(res != null && res.size() > 0 ){
                return  success(res);
            }else{
                return success("无法获取该机构的职称信息!");
            }
        }catch (Exception e){
            return  failedException(e);
        }
    }
@ -417,7 +451,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取具体号源", notes = "获取具体号源")
    public ListEnvelop findWorkTimeInfo(@ApiParam(name = "id", value = "排班id")
                                        @RequestParam(value = "id", required = false)String id) {
        return success(prescriptionService.findWorkTimeInfo(id));
        try {
            return success(prescriptionService.findWorkTimeInfo(id));
        }catch (Exception e){
            return  failedListEnvelopException(e);
        }
    }
@ -426,50 +465,59 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    public ObjEnvelop findLevelOneDoctorUpcoming(@ApiParam(name = "doctor_idcard", value = "医生身份证")
                                                 @RequestParam(value = "doctor_idcard", required = true)String doctor_idcard){
        List<BaseDoctorDO> doctors = baseDoctorService.findByField("idcard",doctor_idcard);
        BaseDoctorDO doctor = null;
        JSONObject result = new JSONObject();
        if(!doctors.isEmpty()){
            doctor = doctors.get(0);
            //专家咨询
            Integer zjCount = imService.sessionCountByType(doctor.getId(),1,0);
            //全科医生求助专科
            Integer zjqzCount = imService.sessionCountByType(doctor.getId(),15,0);
    
            //专家咨询
            Integer unreadMessageCount = imService.SessionsUnreadMessageCount(doctor.getId(),"1");
            result.put("zjCount",zjCount+zjqzCount);//专家咨询数量
            result.put("zjUnreadMessageCount",unreadMessageCount);//专家咨询未读数
        }else{
            result.put("zjCount",0);//专家咨询数量
            result.put("zjUnreadMessageCount",0);//专家咨询未读数
        try {
            List<BaseDoctorDO> doctors = baseDoctorService.findByField("idcard",doctor_idcard);
            BaseDoctorDO doctor = null;
            JSONObject result = new JSONObject();
            if(!doctors.isEmpty()){
                doctor = doctors.get(0);
                //专家咨询
                Integer zjCount = imService.sessionCountByType(doctor.getId(),1,0);
                //全科医生求助专科
                Integer zjqzCount = imService.sessionCountByType(doctor.getId(),15,0);
                //专家咨询
                Integer unreadMessageCount = imService.SessionsUnreadMessageCount(doctor.getId(),"1");
                result.put("zjCount",zjCount+zjqzCount);//专家咨询数量
                result.put("zjUnreadMessageCount",unreadMessageCount);//专家咨询未读数
            }else{
                result.put("zjCount",0);//专家咨询数量
                result.put("zjUnreadMessageCount",0);//专家咨询未读数
            }
            return success("请求成功",result);
        }catch (Exception e){
            return  failedObjEnvelopException(e);
        }
        return success("请求成功",result);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.getUpcomingByDoctor)
    @ApiOperation(value = "获取医生待办详情", notes = "获取医生待办详情")
    public Envelop getUpcomingByDoctor(@ApiParam(name = "doctorIdcard", value = "doctorIdcard", required = true)
                                       @RequestParam(value = "doctorIdcard",required = true)String doctorIdcard){
        JSONObject result = new JSONObject();
        List<BaseDoctorDO> doctors = baseDoctorService.findDoctorsByIdcard(doctorIdcard);
        BaseDoctorDO doctor = new BaseDoctorDO();
        if(!doctors.isEmpty()){
            doctor = doctors.get(0);
        }else{
            return success("该身份证无法找到医生",-1);
        }
    
        //医生咨询
        Integer zxCount = imService.SessionsUnreadMessageCount(doctor.getId(), "1");
        Integer fzCount = imService.SessionsUnreadMessageCount(doctor.getId(), "9");
        Integer spCount = imService.SessionsUnreadMessageCount(doctor.getId(), "16");
        result.put("zxCount",zxCount);//专家咨询咨询数量
        result.put("fzCount",fzCount);//图文复诊数量
        result.put("spCount",spCount);//图文复诊数量
        result.put("totalCount",zxCount+fzCount+spCount);
        return success("请求成功",result);
        try {
            JSONObject result = new JSONObject();
            List<BaseDoctorDO> doctors = baseDoctorService.findDoctorsByIdcard(doctorIdcard);
            BaseDoctorDO doctor = new BaseDoctorDO();
            if(!doctors.isEmpty()){
                doctor = doctors.get(0);
            }else{
                return success("该身份证无法找到医生",-1);
            }
            //医生咨询
            Integer zxCount = imService.SessionsUnreadMessageCount(doctor.getId(), "1");
            Integer fzCount = imService.SessionsUnreadMessageCount(doctor.getId(), "9");
            Integer spCount = imService.SessionsUnreadMessageCount(doctor.getId(), "16");
            result.put("zxCount",zxCount);//专家咨询咨询数量
            result.put("fzCount",fzCount);//图文复诊数量
            result.put("spCount",spCount);//图文复诊数量
            result.put("totalCount",zxCount+fzCount+spCount);
            return success("请求成功",result);
        } catch (Exception e){
            return  failedException(e);
        }
    }
@ -483,33 +531,38 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @RequestMapping(value = "/getOpenidByCode", method = {RequestMethod.POST, RequestMethod.GET})
    @ResponseBody
    public Envelop getOpenidByCode(String code,@RequestParam(value = "patientId", required = false)String patientId) throws Exception {
        //通过redis获取openid, 获取不到,则调用微信接口去取
        String key = wxId+":code";
        String openid = redisTemplate.opsForValue().get(key);
        if(!StringUtils.isEmpty(openid)){
            return success(PatientRequestMapping.Wechat.api_success,openid);
        }
        openid = wechatInfoService.getOpenidByCode(code, wxId);
        if (!StringUtils.isEmpty(patientId)){
            List<BasePatientWechatDo> list = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patientId);
            if (list!=null&&list.size()>0){
                for (BasePatientWechatDo basePatientWechatDo:list){
        try {
            //通过redis获取openid, 获取不到,则调用微信接口去取
            String key = wxId+":code";
            String openid = redisTemplate.opsForValue().get(key);
            if(!StringUtils.isEmpty(openid)){
                return success(PatientRequestMapping.Wechat.api_success,openid);
            }
            openid = wechatInfoService.getOpenidByCode(code, wxId);
            if (!StringUtils.isEmpty(patientId)){
                List<BasePatientWechatDo> list = basePatientWechatDao.findByWechatIdAndPatientId(wxId,patientId);
                if (list!=null&&list.size()>0){
                    for (BasePatientWechatDo basePatientWechatDo:list){
                        basePatientWechatDo.setOpenid(openid);
                        basePatientWechatDao.save(basePatientWechatDo);
                    }
                }else {
                    BasePatientWechatDo basePatientWechatDo = new BasePatientWechatDo();
                    basePatientWechatDo.setPatientId(patientId);
                    basePatientWechatDo.setWechatId(wxId);
                    basePatientWechatDo.setCreateTime(new Date());
                    basePatientWechatDo.setOpenid(openid);
                    basePatientWechatDao.save(basePatientWechatDo);
                }
            }else {
                BasePatientWechatDo basePatientWechatDo = new BasePatientWechatDo();
                basePatientWechatDo.setPatientId(patientId);
                basePatientWechatDo.setWechatId(wxId);
                basePatientWechatDo.setCreateTime(new Date());
                basePatientWechatDo.setOpenid(openid);
                basePatientWechatDao.save(basePatientWechatDo);
            }
            }
            redisTemplate.opsForValue().set(key,openid);
            redisTemplate.expire(key,10, TimeUnit.SECONDS);
            return success(PatientRequestMapping.Wechat.api_success,openid);
        } catch (Exception e){
            return  failedException(e);
        }
        redisTemplate.opsForValue().set(key,openid);
        redisTemplate.expire(key,10, TimeUnit.SECONDS);
        return success(PatientRequestMapping.Wechat.api_success,openid);
    }
@ -761,7 +814,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "查询排班规则")
    public ObjEnvelop findWorkTimeRule(@ApiParam(name = "hospital", value = "医院code")
                                       @RequestParam(value = "hospital",required = true)String hospital) {
        return success(workTimeService.findWorkTimeRule(hospital));
        try {
            return success(workTimeService.findWorkTimeRule(hospital));
        } catch (Exception e){
            return  failedObjEnvelopException(e);
        }
    }
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.checkDoctorWork)
@ -770,7 +828,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "doctor",required = true)String doctor,
                                      @ApiParam(name = "ywCode", value = "业务code")
                                      @RequestParam(value = "ywCode",required = false)String ywCode) throws Exception{
        return success(workTimeService.checkDoctorWork(doctor,ywCode));
        try {
            return success(workTimeService.checkDoctorWork(doctor,ywCode));
        } catch (Exception e){
            return  failedObjEnvelopException(e);
        }
    }
@ -797,8 +860,7 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                return ObjEnvelop.getSuccess("获取面单信息成功",result);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError("获取面单信息失败,"+e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -823,18 +885,23 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    public Envelop queryByCode(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id", required = true)String id) throws Exception{
        KnowledgeArticleDO articleDO = knowledgeArticleService.retrieve(id);
        KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDO.getId(),getUID());
        if (knowledgeArticleUserDO!=null){
            articleDO.setIsUsed(knowledgeArticleUserDO.getUsed());
            articleDO.setKnowledgeArticleUserDO(knowledgeArticleUserDO);
        }
        List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(articleDO.getCreateUser());
        if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
            articleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
            articleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
        try {
            KnowledgeArticleDO articleDO = knowledgeArticleService.retrieve(id);
            KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(articleDO.getId(),getUID());
            if (knowledgeArticleUserDO!=null){
                articleDO.setIsUsed(knowledgeArticleUserDO.getUsed());
                articleDO.setKnowledgeArticleUserDO(knowledgeArticleUserDO);
            }
            List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(articleDO.getCreateUser());
            if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                articleDO.setHospitalName(doctorHospitalDOS.get(0).getOrgName());
                articleDO.setDeptName(doctorHospitalDOS.get(0).getDeptName());
            }
            return success(articleDO);
        }catch (Exception e) {
            return failedException(e);
        }
        return success(articleDO);
    }
@ -871,24 +938,38 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setAllCode)
    @ApiOperation(value = "生成所有医生二维码")
    public Envelop setAllCode() throws Exception{
        qrcodeService.makeAllSpecialistQrcode();
       return success("操作成功");
       try {
           qrcodeService.makeAllSpecialistQrcode();
           return success("操作成功");
       }catch (Exception e) {
           return failedException(e);
       }
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setQrCode)
    @ApiOperation(value = "生成医生二维码")
    public Envelop setQrCode(@ApiParam(name = "doctor", value = "doctor", required = true)
                                 @RequestParam(value = "doctor", required = true)String doctor) throws Exception{
        String uri = qrcodeService.makeSpecialistQrcode(doctor);
        return success("操作成功",uri);
        try {
            String uri = qrcodeService.makeSpecialistQrcode(doctor);
            return success("操作成功",uri);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setUrlCode)
    @ApiOperation(value = "生成链接推送")
    public Envelop setUrlCode(@ApiParam(name = "flag", value = "flag", required = true)
                             @RequestParam(value = "flag", required = true)String flag) throws Exception{
        String uri = qrcodeService.makeUrlQrcode(flag);
        return success("操作成功",uri);
        try {
            String uri = qrcodeService.makeUrlQrcode(flag);
            return success("操作成功",uri);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.querySettledRecord)
@ -909,9 +990,14 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "pageNo", required = false)String pageNo,
                                      @ApiParam(name = "pageSize", value = "分页大小", required = false)
                                          @RequestParam(value = "pageSize", required = false)String pageSize) throws Exception{
       String result = ylzPayService.querySettledRecord(cardNo,beginDate,endDate,queryType,billSn,traceNo,pageNo,pageSize);
       logger.info(result);
       return success("操作成功",result);
       try {
           String result = ylzPayService.querySettledRecord(cardNo,beginDate,endDate,queryType,billSn,traceNo,pageNo,pageSize);
           logger.info(result);
           return success("操作成功",result);
       }catch (Exception e) {
           return failedException(e);
       }
    }
@ -939,9 +1025,14 @@ 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 = payInfoNoticeService.paySuccessNotice(userName,idCard,phone,title,url,doctorName,total,miPay,selfPay,orderNo,remark);
        logger.info(result);
        return success("操作成功",result);
        try {
            String result = payInfoNoticeService.paySuccessNotice(userName,idCard,phone,title,url,doctorName,total,miPay,selfPay,orderNo,remark);
            logger.info(result);
            return success("操作成功",result);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    /**
     * 商户回调通知
@ -1290,7 +1381,11 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                   @RequestParam(value = "pageSize", required = false) Integer pageSize
    ) {
        return wlyyHttpLogService.findLog(startTime,endTime,interfaceName,patient,doctor,page,pageSize);
        try {
            return wlyyHttpLogService.findLog(startTime,endTime,interfaceName,patient,doctor,page,pageSize);
        } catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
@ -1300,22 +1395,28 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "doctorId", required = true)String doctorId,
                                         @ApiParam(name = "orgCode", value = "医院code")
                                         @RequestParam(value = "orgCode", required = true)String orgCode) throws Exception{
        JSONObject object = prescriptionService.selectHospitalInfo(doctorId,orgCode);
        String date = DateUtil.getStringDateShort();
        //服务评分
        JSONObject jsonObject = statisticsEsService.getScoreList(null,date,2,"350200","4");
        if (jsonObject!=null){
            com.alibaba.fastjson.JSONArray array  = jsonObject.getJSONArray("resultList");
            if (array!=null&&array.size()!=0){
                JSONObject object1 = array.getJSONObject(0);
                object.put("scoreRate",object1.getString("scoreRate"));
        try {
            JSONObject object = prescriptionService.selectHospitalInfo(doctorId,orgCode);
            String date = DateUtil.getStringDateShort();
            //服务评分
            JSONObject jsonObject = statisticsEsService.getScoreList(null,date,2,"350200","4");
            if (jsonObject!=null){
                com.alibaba.fastjson.JSONArray array  = jsonObject.getJSONArray("resultList");
                if (array!=null&&array.size()!=0){
                    JSONObject object1 = array.getJSONObject(0);
                    object.put("scoreRate",object1.getString("scoreRate"));
                }else {
                    object.put("scoreRate",null);
                }
            }else {
                object.put("scoreRate",null);
            }
        }else {
            object.put("scoreRate",null);
            return success(object);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
        return success(object);
    }
@ -1340,7 +1441,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                              @ApiParam(name = "endTime", value = "结束时间 yyyy-MM-dd hh:mm:ss")
                                                  @RequestParam(value = "endTime", required = false)String endTime) throws Exception{
        return success(prescriptionService.findOutpatientAndPatient(startTime,endTime));
        try {
            return success(prescriptionService.findOutpatientAndPatient(startTime,endTime));
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    /**
@ -1387,7 +1493,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "查询基础号别字典", notes = "查询基础号别字典")
    public ListEnvelop findDictLists() throws Exception{
        return success(baseDoctorService.findChargeDicts());
        try {
            return success(baseDoctorService.findChargeDicts());
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findWorkDoctorCount)
    @ApiOperation(value = "查询医生排版数量", notes = "查询医生排版数量")
@ -1397,20 +1508,34 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            @ApiParam(name = "orgCode", value = "医院code")
            @RequestParam(value = "orgCode", required = false)String orgCode) throws Exception{
        return success(prescriptionService.getWorkDoctorCount(nowTime,orgCode));
        try {
            return success(prescriptionService.getWorkDoctorCount(nowTime,orgCode));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findAllDict)
    @ApiOperation(value = "查询配置字典所有项", notes = "查询配置字典所有项")
    public ListEnvelop<WlyyHospitalSysDictDO> findAllDict() throws Exception{
        return success(prescriptionService.findAllDict());
        try {
            return success(prescriptionService.findAllDict());
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDictById)
    @ApiOperation(value = "根据id查询配置字典", notes = "根据id查询配置字典")
        public Envelop findDictById(@ApiParam(name = "dictId", value = "dictId")
                                                                      @RequestParam(value = "dictId", required = true)String dictId) throws Exception{
        return success(prescriptionService.findDictById(dictId));
        try {
            return success(prescriptionService.findDictById(dictId));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.updateDictById)
    @ApiOperation(value = "根据id修改配置字典", notes = "根据id修改配置字典")
@ -1419,14 +1544,24 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                  @ApiParam(name = "dictValue", value = "dictId")
                                  @RequestParam(value = "dictValue", required = true)String dictValue) throws Exception{
        return success(prescriptionService.updateDictById(dictId,dictValue));
        try {
            return success(prescriptionService.updateDictById(dictId,dictValue));
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDictByCode)
    @ApiOperation(value = "根据id修改配置字典", notes = "根据id修改配置字典")
    public ListEnvelop findDictByCode(@ApiParam(name = "dictCode", value = "dictCode")
                                  @RequestParam(value = "dictCode", required = true, defaultValue = "isDoctorWork")String dictCode) throws Exception{
        return success(prescriptionService.findSysByDictCode(dictCode));
        try {
            return success(prescriptionService.findSysByDictCode(dictCode));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientIM.getDoctorConsultCount)
    @ApiOperation(value = "医生端:查询会话视频邀请状态", notes = "医生端:查询会话视频邀请状态")
@ -1451,7 +1586,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                               @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                               @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
                               @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
        return baseUserMsgService.getMessage(doctor,showAll,showAllType,beginTime,endTime,page,pageSize);
        try {
            return baseUserMsgService.getMessage(doctor,showAll,showAllType,beginTime,endTime,page,pageSize);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.searchKnowledgePageList)
    @ApiOperation(value = "获取文章列表")
@ -1478,49 +1618,64 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
            @ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
            @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
        if(org.apache.commons.lang.StringUtils.isBlank(filters)){
            filters=filters+"del=1";
        }else{
            filters=filters+";del=1";
        }
        List<KnowledgeArticleDO> list  = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
        for (KnowledgeArticleDO knowledgeArticleDO:list){
            List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
            if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
                knowledgeArticleDO.setDeptName(doctorHospitalDO.getDeptName());
                knowledgeArticleDO.setHospitalName(doctorHospitalDO.getOrgName());
        try {
            if(org.apache.commons.lang.StringUtils.isBlank(filters)){
                filters=filters+"del=1";
            }else{
                filters=filters+";del=1";
            }
            KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(knowledgeArticleDO.getId(),getUID());
            if (knowledgeArticleUserDO!=null){
                if (knowledgeArticleUserDO.getUsed()!=null&&knowledgeArticleUserDO.getUsed()==1){
                    knowledgeArticleDO.setIsUsed(1);
            List<KnowledgeArticleDO> list  = knowledgeArticleService.search(fields,filters,sorts,page,pageSize);
            for (KnowledgeArticleDO knowledgeArticleDO:list){
                List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(knowledgeArticleDO.getCreateUser());
                if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                    BaseDoctorHospitalDO doctorHospitalDO = doctorHospitalDOS.get(0);
                    knowledgeArticleDO.setDeptName(doctorHospitalDO.getDeptName());
                    knowledgeArticleDO.setHospitalName(doctorHospitalDO.getOrgName());
                }
                KnowledgeArticleUserDO knowledgeArticleUserDO = knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(knowledgeArticleDO.getId(),getUID());
                if (knowledgeArticleUserDO!=null){
                    if (knowledgeArticleUserDO.getUsed()!=null&&knowledgeArticleUserDO.getUsed()==1){
                        knowledgeArticleDO.setIsUsed(1);
                    }
                }
            }
        }
        List<KnowledgeArticleDO> totals  = knowledgeArticleService.search(fields,filters,sorts);
            List<KnowledgeArticleDO> totals  = knowledgeArticleService.search(fields,filters,sorts);
        JSONObject result = new JSONObject();
        result.put("total",totals.size());
        result.put("detailModelList",list);
            JSONObject result = new JSONObject();
            result.put("total",totals.size());
            result.put("detailModelList",list);
        return success(result);
            return success(result);
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.popularityIncrease)
    @ApiOperation(value = "医生人气值增长")
    public Envelop popularityIncrease (
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", required = false) String doctor) throws Exception {
        BaseDoctorDO baseDoctorDO=baseDoctorService.popularityIncrease(doctor);
        return  success("操作成功",baseDoctorDO);
        try {
            BaseDoctorDO baseDoctorDO=baseDoctorService.popularityIncrease(doctor);
            return  success("操作成功",baseDoctorDO);
        } catch (Exception e) {
            return failedException(e);
        }
    }
    @ApiOperation("查询赠送锦旗")
    @PostMapping(value= BaseHospitalRequestMapping.DoctorBanner.getBanner)
    public Envelop getBanners(@ApiParam(name = "doctor", value = "doctor", required = false)
                              @RequestParam(value = "doctor", required = false)String doctor){
        JSONObject jsonObject = baseBannerDoctorService.getDoctorBanners(doctor);
        return success(jsonObject);
        try {
            JSONObject jsonObject = baseBannerDoctorService.getDoctorBanners(doctor);
            return success(jsonObject);
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByHospital)
    @ApiOperation(value = "查询机构底下部门", notes = "查询机构底下部门")
@ -1530,13 +1685,23 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "dept", required = false)String dept,
                                          @ApiParam(name = "consultDeptFlag", value = "1为查询开通服务部门")
                                          @RequestParam(value = "consultDeptFlag", required = false)String consultDeptFlag) {
        return success(prescriptionService.findDeptByHospital(orgCode,dept,consultDeptFlag));
        try {
            return success(prescriptionService.findDeptByHospital(orgCode,dept,consultDeptFlag));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.getArticleGroup)
    @ApiOperation(value = "查询分类")
    public MixEnvelop getGroup(){
        MixEnvelop envelop = knowledgeCategoryService.findAllGroup();
        return envelop;
        try {
            MixEnvelop envelop = knowledgeCategoryService.findAllGroup();
            return envelop;
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.findArticleByCategoryAndName)
@ -1552,8 +1717,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                                   @ApiParam(name = "pageSize", value = "分页大小)")
                                                   @RequestParam(value = "pageSize",required = false)Integer pageSize)throws Exception {
        MixEnvelop mixEnvelop=knowledgeArticleService.findArticleByCategoryAndName(categoryFirst,categorySecond,keyWords,page,pageSize);
        return mixEnvelop;
        try {
            MixEnvelop mixEnvelop=knowledgeArticleService.findArticleByCategoryAndName(categoryFirst,categorySecond,keyWords,page,pageSize);
            return mixEnvelop;
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findAllHospital)
    @ApiOperation(value = "查询所有机构", notes = "查询所有机构")
@ -1561,7 +1731,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                       @RequestParam(value = "level", required = false)Integer level,
                                       @ApiParam(name = "keyWord", value = "名字关键字")
                                       @RequestParam(value = "keyWord", required = false)String keyWord) {
        return success(prescriptionService.findAllHospital(level,keyWord));
        try {
            return success(prescriptionService.findAllHospital(level,keyWord));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.appointmentRevisitOnDoor)
    @ApiOperation(value = "上门复诊", notes = "上门复诊")
@ -1574,8 +1749,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                               @ApiParam(name = "chargeType", value = "预约实体json")
                                               @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisitOnDoor(outpatientJson,expressageJson,registerJson,chargeType);
        return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
        try {
            WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisitOnDoor(outpatientJson,expressageJson,registerJson,chargeType);
            return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
@ -1583,7 +1763,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findJobCategory)
    @ApiOperation(value = "查询所有业务分类", notes = "查询所有业务分类")
    public MixEnvelop findJobCategory() {
        return prescriptionService.findJobCategory();
        try {
            return prescriptionService.findJobCategory();
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
@ -1603,11 +1788,16 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                    @RequestParam(value = "page", required = false)Integer page,
                                    @ApiParam(name = "pageSize", value = "每页大小")
                                        @RequestParam(value = "pageSize", required = false)Integer pageSize) throws Exception {
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            prescriptionService.savePayStatusByHis(patientId);
        try {
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                prescriptionService.savePayStatusByHis(patientId);
            }
            logger.info("同步数据成功");
            return  prescriptionService.getNatRecords(patientId,id,payStatus,appointmentTime,isSuccess,page,pageSize);
        } catch (Exception e) {
            return failedMixEnvelopException(e);
        }
        logger.info("同步数据成功");
        return  prescriptionService.getNatRecords(patientId,id,payStatus,appointmentTime,isSuccess,page,pageSize);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findBaseAddress)
    @ApiOperation(value = "查询地址", notes = "查询地址")
@ -1617,7 +1807,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                    @RequestParam(value = "parentName", required = false)String parentName ){
        return  success(prescriptionService.findBaseAddress(addressFlag,parentName));
        try {
            return  success(prescriptionService.findBaseAddress(addressFlag,parentName));
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping("/testsms")
    public void testsms(String mobile ,String contet){
@ -1625,8 +1820,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    }
    @GetMapping("/smsToDoctor")
    public Envelop sentMessageRemindSms(@RequestParam(value = "consult", required = true)String consult){
        ConsultDo consultDo = consultDao.findOne(consult);
        return  success(systemMessageService.sendDoctorRemindSms(consultDo));
        try {
            ConsultDo consultDo = consultDao.findOne(consult);
            return  success(systemMessageService.sendDoctorRemindSms(consultDo));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    /**
     * 充值卡一支付
@ -1667,7 +1866,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "根据身份证号查询医生", notes = "根据身份证号查询医生")
    public Envelop findDoctorByIdCard(@ApiParam(name = "idCard", value = "身份证号")
                                      @RequestParam(value = "idCard", required = false)String idCard) {
        return success(prescriptionService.findByIdCard(idCard));
        try {
            return success(prescriptionService.findByIdCard(idCard));
        }catch (Exception e) {
            return failedException(e);
        }
    }
@ -1677,8 +1881,13 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "id", required = false)String id,
                                      @ApiParam(name = "channelId", value = "渠道id")
                                      @RequestParam(value = "channelId", required = false)String channelId) {
        prescriptionService.updateChannelId(id,channelId);
        return success("保存成功");
        try {
            prescriptionService.updateChannelId(id,channelId);
            return success("保存成功");
        }catch (Exception e) {
            return failedException(e);
        }
    }
@ -1779,7 +1988,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                                           @RequestParam(value = "page", required = false)Integer page,
                                       @ApiParam(name = "pageSize", value = "")
                                           @RequestParam(value = "pageSize", required = false)Integer pageSize) {
        return businessOrderService.findYktCardCharge(startTime,endTime,orderNo,yktOrderNo,patientName,idCard,medicard,status,page,pageSize);
        try {
            return businessOrderService.findYktCardCharge(startTime,endTime,orderNo,yktOrderNo,patientName,idCard,medicard,status,page,pageSize);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    /**
@ -1799,15 +2013,20 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String index,
            @RequestParam(required = false) String lowCode) {
        //新版与旧版统计适配
        JSONObject result = new JSONObject();
        try {
            result = statisticsEsService.getConsultHead(startDate, endDate, area, level, index,lowCode);
            //新版与旧版统计适配
            JSONObject result = new JSONObject();
            try {
                result = statisticsEsService.getConsultHead(startDate, endDate, area, level, index,lowCode);
            } catch (Exception e) {
                e.printStackTrace();
            }
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
        return success(result);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Statistics.scheduleHead)
@ -1819,14 +2038,19 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String index) {
        JSONObject result = new JSONObject();
        try {
            result= statisticsEsService.getScheduleTotal(startDate, endDate,index,level,area);
        } catch (Exception e) {
            e.printStackTrace();
        }
            JSONObject result = new JSONObject();
            try {
                result= statisticsEsService.getScheduleTotal(startDate, endDate,index,level,area);
            } catch (Exception e) {
                e.printStackTrace();
            }
        return success(result);
            return success(result);
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }

+ 27 - 6
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/NationalDrugDictEndpoint.java

@ -25,8 +25,14 @@ public class NationalDrugDictEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "保存药品字典接口")
    public ObjEnvelop saveNationalDrug(@ApiParam(name = "jsonData", value = "药品json串")
                                       @RequestParam(name = "jsonData", required = true) String jsonData) throws Exception {
        BaseNationalDrugDictDO nationalDrugDictDO = objectMapper.readValue(jsonData, BaseNationalDrugDictDO.class);
        return success(nationalDrugDictService.saveNationalDrug(nationalDrugDictDO));
        try {
            BaseNationalDrugDictDO nationalDrugDictDO = objectMapper.readValue(jsonData, BaseNationalDrugDictDO.class);
            return success(nationalDrugDictService.saveNationalDrug(nationalDrugDictDO));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getNationalDrugList)
@ -43,7 +49,12 @@ public class NationalDrugDictEndpoint extends EnvelopRestEndpoint {
                                          @RequestParam(name = "page", required = false) Integer page,
                                          @ApiParam(name = "pageSize", value = "页面大小")
                                          @RequestParam(name = "pageSize", required = false) Integer pageSize) throws Exception {
        return nationalDrugDictService.getNationalDrugList(name, number, hospital, status, page, pageSize);
        try {
            return nationalDrugDictService.getNationalDrugList(name, number, hospital, status, page, pageSize);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateNationalDrugStatus)
@ -52,14 +63,24 @@ public class NationalDrugDictEndpoint extends EnvelopRestEndpoint {
                                       @RequestParam(name = "id", required = true) Integer id,
                                            @ApiParam(name = "status", value = "状态", required = true)
                                               @RequestParam(name = "status") Integer status){
        nationalDrugDictService.updateNationalDrugStatus(id,status);
        return success();
        try {
            nationalDrugDictService.updateNationalDrugStatus(id,status);
            return success();
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getNationalDrugById)
    @ApiOperation(value = "根据id获取药品字典")
    public ObjEnvelop getNationalDrugById(@ApiParam(name = "id", value = "药品id")
                                          @RequestParam(name = "id", required = true) Integer id) {
        return success(nationalDrugDictService.getNationalDrugById(id));
        try {
            return success(nationalDrugDictService.getNationalDrugById(id));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
}

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

@ -31,6 +31,7 @@ import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
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.im.util.ImUtil;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.restmodel.base.area.BaseCityVO;
import com.yihu.jw.restmodel.base.area.BaseCommitteeVO;
@ -144,6 +145,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @Value("${qywx.url}")
    private String qywxUrl;
    @Autowired
    public ImUtil imUtil;
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientList)
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录")
@ -159,22 +162,27 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                              @RequestParam(value = "cardNo",required = false)String cardNo,
                                          @ApiParam(name = "flag", value = "标识", required = false)
                                              @RequestParam(value = "flag",required = false)String flag) throws Exception {
        if(StringUtils.isNoneBlank(startTime)){
            startTime = startTime+" 00:00:00";
        }
        if(StringUtils.isNoneBlank(endTime)){
            endTime =endTime+" 23:59:59";
        }
        List<WlyyOutpatientVO> vos = new ArrayList<>();
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm,cardNo);
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            vos = tnPrescriptionService.findOutpatientList(patient, cardNo,startTime, endTime, demoFlag,ksdm,flag);
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
        return success(vos);
        try {
            if(StringUtils.isNoneBlank(startTime)){
                startTime = startTime+" 00:00:00";
            }
            if(StringUtils.isNoneBlank(endTime)){
                endTime =endTime+" 23:59:59";
            }
            List<WlyyOutpatientVO> vos = new ArrayList<>();
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm,cardNo);
            }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
                vos = tnPrescriptionService.findOutpatientList(patient, cardNo,startTime, endTime, demoFlag,ksdm,flag);
            }else {
                return ListEnvelop.getError("尚未开发!");
            }
            return success(vos);
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientInfo)
@ -183,15 +191,20 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "patient",required = false) String patient,
                                         @ApiParam(name = "conNo", value = "就诊次数")
                                         @RequestParam(value = "conNo",required = false) String conNo)throws Exception{
        WlyyOutpatientVO obj = new WlyyOutpatientVO();
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            obj = prescriptionService.findOutpatientInfo(patient,conNo);
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            obj = tnPrescriptionService.findOutpatientInfo(patient,conNo,demoFlag,null);
        }else {
            return ObjEnvelop.getError("尚未开发!");
        try {
            WlyyOutpatientVO obj = new WlyyOutpatientVO();
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                obj = prescriptionService.findOutpatientInfo(patient,conNo);
            }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
                obj = tnPrescriptionService.findOutpatientInfo(patient,conNo,demoFlag,null);
            }else {
                return ObjEnvelop.getError("尚未开发!");
            }
            return success(obj);
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
        return success(obj);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOriginPrescriptionList)
@ -205,16 +218,21 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "admNo",required = false) String admNo,
            @ApiParam(name = "realOrder", value = "处方号")
            @RequestParam(value = "realOrder",required = false) String realOrder) throws Exception {
        List<WlyyPrescriptionVO> obj = new ArrayList<>();
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            obj= prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            obj= tnPrescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
        return success(obj);
        try {
            List<WlyyPrescriptionVO> obj = new ArrayList<>();
            if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
                obj= prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
            }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
                obj= tnPrescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
            }else {
                return ListEnvelop.getError("尚未开发!");
            }
            return success(obj);
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOriginPrescription)
@ -228,8 +246,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "admNo",required = false) String admNo,
            @ApiParam(name = "realOrder", value = "处方号", required = false)
            @RequestParam(value = "realOrder",required = false) String realOrder) throws Exception {
        WlyyPrescriptionVO obj = prescriptionService.findOriginPrescription(registerSn, patNo, admNo,realOrder, demoFlag);
        return success(obj);
        try{
            WlyyPrescriptionVO obj = prescriptionService.findOriginPrescription(registerSn, patNo, admNo,realOrder, demoFlag);
            return success(obj);
        } catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionList)
@ -246,7 +269,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                                                  @RequestParam(value = "page", required = false)Integer page,
                                                                                  @ApiParam(name = "size", value = "每页大小")
                                                                                  @RequestParam(value = "size", required = true) Integer size) {
        return prescriptionService.findPrescriptionList(patient,status,startTime,endTime,page,size,wxId);
        try {
            return prescriptionService.findPrescriptionList(patient,status,startTime,endTime,page,size,wxId);
        } catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findReOutpatientList)
@ -265,7 +293,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                                              @RequestParam(value = "page", required = false)Integer page,
                                                                              @ApiParam(name = "size", value = "每页大小")
                                                                              @RequestParam(value = "size", required = true) Integer size) {
        return prescriptionService.findReOutpatientList(patient,status,startTime,endTime,outpatientType,page,size);
        try {
            return prescriptionService.findReOutpatientList(patient,status,startTime,endTime,outpatientType,page,size);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findReOutpatientInfo)
@ -274,16 +307,25 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                           @RequestParam(value = "outpatientId", required = true) String outpatientId,
                                           @ApiParam(name = "prescriptionId", value = "处方ID")
                                           @RequestParam(value = "prescriptionId", required = false) String prescriptionId)throws Exception{
        com.alibaba.fastjson.JSONObject obj =  prescriptionService.findReOutpatientInfo(outpatientId,prescriptionId,wxId);
        return success(obj);
        try {
            com.alibaba.fastjson.JSONObject obj =  prescriptionService.findReOutpatientInfo(outpatientId,prescriptionId,wxId);
            return success(obj);
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionInfo)
    @ApiOperation(value = "获取所有居民相关信息,续方信息,物流信息,药品信息(单条)", notes = "获取所有居民相关信息,续方信息,物流信息,药品信息(单条)")
    public ObjEnvelop<Map<String,Object>> findPrescriptionInfo(@ApiParam(name = "prescriptionId", value = "续方明细")
                                                               @RequestParam(value = "prescriptionId", required = false) String prescriptionId) {
        
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.findPrescriptionInfo(prescriptionId));
        try {
            return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.findPrescriptionInfo(prescriptionId));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkPrescription)
@ -291,7 +333,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop<Boolean> checkPrescription(@ApiParam(name = "patient", value = "续方明细")
                                                 @RequestParam(value = "patient", required = false) String patient) {
        
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.checkPrescription(patient));
        try {
            return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.checkPrescription(patient));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.cancelPrescription)
@ -299,14 +346,23 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop<Boolean> cancelPrescription(@ApiParam(name = "prescriptionId", value = "续方ID")
                                                  @RequestParam(value = "prescriptionId", required = false) String prescriptionId) {
        
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.cancelPrescription(prescriptionId));
        try {
            return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.cancelPrescription(prescriptionId));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientCard)
    @ApiOperation(value = "查询患者就诊卡", notes = "查询患者就诊卡")
    public ListEnvelop findPatientCard(@ApiParam(name = "patient", value = "居民Code")
                                       @RequestParam(value = "patient", required = true)String patient)throws Exception {
        return success(prescriptionService.findPatientCard(patient));
        try {
            return success(prescriptionService.findPatientCard(patient));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkOutpatient)
@ -317,7 +373,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "flag", required = false)boolean flag,
                                      @ApiParam(name = "outpatientType", value = "1在线复诊 2 协同 3 专家咨询")
                                          @RequestParam(value = "outpatientType", required = false)String outpatientType)throws Exception{
        return success(prescriptionService.checkOutpatient(patient,wxId,flag,outpatientType));
        try {
            return success(prescriptionService.checkOutpatient(patient,wxId,flag,outpatientType));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findAllHospital)
@ -326,7 +387,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                       @RequestParam(value = "level", required = false)Integer level,
                                       @ApiParam(name = "keyWord", value = "名字关键字")
                                       @RequestParam(value = "keyWord", required = false)String keyWord) {
        return success(prescriptionService.findAllHospital(level,keyWord));
        try {
            return success(prescriptionService.findAllHospital(level,keyWord));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByHospital)
@ -337,7 +403,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "dept", required = false)String dept,
                                          @ApiParam(name = "consultDeptFlag", value = "1为查询开通服务部门")
                                          @RequestParam(value = "consultDeptFlag", required = false)String consultDeptFlag) {
        return success(prescriptionService.findDeptByHospital(orgCode,dept,consultDeptFlag));
        try {
            return success(prescriptionService.findDeptByHospital(orgCode,dept,consultDeptFlag));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -347,7 +418,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "orgCode", required = true)String orgCode,
                                          @ApiParam(name = "deptCode", value = "部门code")
                                          @RequestParam(value = "deptCode", required = true)String deptCode) {
        return prescriptionService.findDeptDesc(orgCode,deptCode);
        try {
            return prescriptionService.findDeptDesc(orgCode,deptCode);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
@ -357,7 +433,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                   @RequestParam(value = "orgCode", required = true)String orgCode,
                                        @ApiParam(name = "keyName", value = "关键字")
                                        @RequestParam(value = "keyName", required = false)String keyName) {
        return prescriptionService.findDeptByOrgCode(orgCode,keyName);
        try {
            return prescriptionService.findDeptByOrgCode(orgCode,keyName);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByKeyWord)
@ -368,7 +449,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "page",required = true) Integer page,
                                         @ApiParam(name = "pagesize", value = "分页大小")
                                         @RequestParam(value = "pagesize",required = true) Integer pagesize) {
        return success(prescriptionService.findDeptByKeyWord(keyWord,page,pagesize));
        try {
            return success(prescriptionService.findDeptByKeyWord(keyWord,page,pagesize));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByHospitalAndDept)
@ -391,7 +477,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                   @RequestParam(value = "key", required = false)String key,
                                                   @ApiParam(name = "consultStatus", value = "是否在线")
                                                   @RequestParam(value = "consultStatus", required = false)String consultStatus) {
        return success(prescriptionService.findDoctorByHospitalAndDept(orgCode,dept,chargeType,doctorCode,outpatientType,startDate,endDate,key,consultStatus));
        try {
            return success(prescriptionService.findDoctorByHospitalAndDept(orgCode,dept,chargeType,doctorCode,outpatientType,startDate,endDate,key,consultStatus));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.appointmentRevisit)
@ -405,47 +495,50 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @ApiParam(name = "chargeType", value = "预约实体json")
                                         @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
        if (wlyyOutpatientDO!=null&&null==wlyyOutpatientDO.getId()&&!wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("3")){
            ObjEnvelop objEnvelop =new ObjEnvelop();
            String msg = "";
            if (1==wlyyOutpatientDO.getRemindCount()){
                msg = "自取";
        try {
            WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
            if (wlyyOutpatientDO!=null&&null==wlyyOutpatientDO.getId()&&!wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("3")){
                ObjEnvelop objEnvelop =new ObjEnvelop();
                String msg = "";
                if (1==wlyyOutpatientDO.getRemindCount()){
                    msg = "自取";
                }else {
                    msg = "快递配送";
                }
                objEnvelop.setMessage("您已经选择过"+msg+"方式,请勿修改");
                objEnvelop.setStatus(300);
                return objEnvelop;
            }else {
                msg = "快递配送";
            }
            objEnvelop.setMessage("您已经选择过"+msg+"方式,请勿修改");
            objEnvelop.setStatus(300);
            return objEnvelop;
        }else {
            BaseDoctorDO doctorDO = baseDoctorDao.findById(wlyyOutpatientDO.getDoctor());
            //发送系统消息
            SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
            //发送IM消息
            hospitalSystemMessageService.sendImMessage(systemMessageDO);
                BaseDoctorDO doctorDO = baseDoctorDao.findById(wlyyOutpatientDO.getDoctor());
                //发送系统消息
                SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
                //发送IM消息
                hospitalSystemMessageService.sendImMessage(systemMessageDO);
            //发送医生抢单消息
            if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
                hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
            }
            if(!"zsyy".equals(qywxId) && !"xm_xzzx_wx".equals(qywxId)){
                //发送厦门i健康智能推送
                try{
                    if (doctorDO!=null&&"3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                        String wxurl = wlyyUrl+"/im/common/message/sendDoctorTemplateByDoctorIdcard?sessionId=1_1&sessionType=1&from=1&content=1&businessType=new&doctor_idcard="+doctorDO.getIdcard()+"&patientName="+URLEncoder.encode(wlyyOutpatientDO.getPatientName())+"&url=1";
                        logger.info("发送厦门i健康智能推送url:"+wxurl);
                        wlyyBusinessService.sendDoctorTemplateByDoctorIdcard(wxurl);
                //发送医生抢单消息
                if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
                    hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
                }
                if(!"zsyy".equals(qywxId) && !"xm_xzzx_wx".equals(qywxId)){
                    //发送厦门i健康智能推送
                    try{
                        if (doctorDO!=null&&"3".equalsIgnoreCase(wlyyOutpatientDO.getOutpatientType())){
                            String wxurl = wlyyUrl+"/im/common/message/sendDoctorTemplateByDoctorIdcard?sessionId=1_1&sessionType=1&from=1&content=1&businessType=new&doctor_idcard="+doctorDO.getIdcard()+"&patientName="+URLEncoder.encode(wlyyOutpatientDO.getPatientName())+"&url=1";
                            logger.info("发送厦门i健康智能推送url:"+wxurl);
                            wlyyBusinessService.sendDoctorTemplateByDoctorIdcard(wxurl);
                        }
                    }catch (Exception e){
                        logger.info("发送厦门i健康智能失败"+e.toString());
                    }
                }catch (Exception e){
                    logger.info("发送厦门i健康智能失败"+e.toString());
                }
            }
            return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
                return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
            }
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getICD10)
@ -525,7 +618,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @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));
        try{
            return success(prescriptionService.deletePrescription(id));
        }catch (Exception e) {
            return failedException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.makeDiagnosis)
@ -583,7 +682,6 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(result);
    }
    
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findExpressageList)
    @ApiOperation(value = "获取订单列表", notes = "获取订单列表")
    public MixEnvelop findExpressageList(@ApiParam(name = "status", value = "流程状态,多状态用‘,’分割")
@ -600,7 +698,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "page", required = false)Integer page,
                                         @ApiParam(name = "size", value = "每页大小")
                                         @RequestParam(value = "size", required = false)Integer size) {
        return prescriptionService.findExpressageList(status,oneselfPickupFlg,nameKey,startTime,endTime,page,size,wxId);
        try {
            return prescriptionService.findExpressageList(status,oneselfPickupFlg,nameKey,startTime,endTime,page,size,wxId);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.setMailno)
@ -609,7 +712,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                @RequestParam(value = "mailno", required = false)String mailno,
                                @ApiParam(name = "expressageId", value = "订单id")
                                @RequestParam(value = "expressageId", required = false)String expressageId) {
        return success(prescriptionService.setMailno(mailno,expressageId));
        try{
            return success(prescriptionService.setMailno(mailno,expressageId));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.pushListWrite)
@ -637,7 +746,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "就诊费用查询", notes = "就诊费用查询")
    public ListEnvelop findByDeptTypeCode(@ApiParam(name = "deptTypeCode", value = "6总部7金榜8夏禾")
                                          @RequestParam(value = "deptTypeCode", required = false)String deptTypeCode) throws Exception{
        return success(prescriptionService.findByDeptTypeCode(deptTypeCode));
        try {
            return success(prescriptionService.findByDeptTypeCode(deptTypeCode));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getCardInfo)
@ -674,7 +788,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @ApiParam(name = "size", value = "每页大小")
                                         @RequestParam(value = "size", required = true)Integer size) {
        
        return success(prescriptionService.findDoctorWithWork(orgCode,dept,chargeType,doctorCode,outpatientType,startDate,endDate,key,consultStatus,page,size,ywCode));
        try {
            return success(prescriptionService.findDoctorWithWork(orgCode,dept,chargeType,doctorCode,outpatientType,startDate,endDate,key,consultStatus,page,size,ywCode));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorWithMouthWork)
@ -696,7 +815,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                              @ApiParam(name = "size", value = "每页大小")
                                              @RequestParam(value = "size", required = true)Integer size) {
        
        return success(prescriptionService.findDoctorWithMouthWork(orgCode,dept,chargeType,date,nameKey,iswork,page,size));
        try {
            return success(prescriptionService.findDoctorWithMouthWork(orgCode,dept,chargeType,date,nameKey,iswork,page,size));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    
@ -704,7 +827,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取具体号源", notes = "获取具体号源")
    public ListEnvelop findWorkTimeInfo(@ApiParam(name = "id", value = "排班id")
                                        @RequestParam(value = "id", required = false)String id) {
        return success(prescriptionService.findWorkTimeInfo(id));
        try {
            return success(prescriptionService.findWorkTimeInfo(id));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorInfo)
    @ApiOperation(value = "获取医生信息", notes = "获取医生信息")
@ -714,7 +842,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "withWork", required = false)String withWork,
                                     @ApiParam(name = "patient", value = "患者code")
                                         @RequestParam(value = "patient", required = false)String patient){
        return success(prescriptionService.findDoctorInfo(doctor,withWork,patient));
        try {
            return success(prescriptionService.findDoctorInfo(doctor,withWork,patient));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateDoctorInfo)
@ -751,7 +883,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(prescriptionService.updateDoctorInfo(id, img,background,expertise, visitHospital, visitHospitalName, visitDept, visitDeptName, backgroundId,name,sex,learning,introduce,photo));
        } catch (Exception e) {
            e.printStackTrace();
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
    
@ -759,7 +891,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取医生基本信息信息", notes = "获取医生基本信息信息")
    public ObjEnvelop findDoctorBaseInfo(@ApiParam(name = "doctor", value = "医生code")
                                         @RequestParam(value = "doctor", required = true)String doctor){
        return success(prescriptionService.findDoctorBaseInfo(doctor));
        try {
            return success(prescriptionService.findDoctorBaseInfo(doctor));
        }catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.cancelOutPatient)
@ -783,38 +921,56 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                consultTeamDao.save(consultTeamDo);
            }
        }*/
        try {
            String consultCode = imService.getConsultCodeByOutpatientId(outPatientId);
            System.out.println("consultCode"+consultCode);
            if(StringUtils.isNoneBlank(consultCode)) {
                ConsultDo consultDo = consultDao.findByRelationCode(outPatientId);
                if(null!=consultDo){
                    imService.cancelRevisit(consultCode, consultDo.getPatient(), 1);
        try{
            try {
                String consultCode = imService.getConsultCodeByOutpatientId(outPatientId);
                System.out.println("consultCode"+consultCode);
                if(StringUtils.isNoneBlank(consultCode)) {
                    ConsultDo consultDo = consultDao.findByRelationCode(outPatientId);
                    if(null!=consultDo){
                        imService.cancelRevisit(consultCode, consultDo.getPatient(), 1);
                    }
                }
            }
            if ("xm_zsyy_wx".equalsIgnoreCase(wxId)){
                String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+outPatientId;
                prescriptionService.sendZsMsgFlow("OL_WZ_CANCEL",outPatientId,"",msgUrl,"取消问诊(用户)");
                if ("xm_zsyy_wx".equalsIgnoreCase(wxId)){
                    String msgUrl="https://hlwyy.xmzsh.com/ims-wx/index.html#/returnVisit/record?outpatientId="+outPatientId;
                    prescriptionService.sendZsMsgFlow("OL_WZ_CANCEL",outPatientId,"",msgUrl,"取消问诊(用户)");
                }
            }catch (Exception e){
                System.out.println("居民取消复诊失败");
                e.printStackTrace();
            }
        }catch (Exception e){
            System.out.println("居民取消复诊失败");
            return success(prescriptionService.cancelOutPatient(outPatientId,cancelType,cancelValue,cancelRemark,1,wxId));
        }catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
        return success(prescriptionService.cancelOutPatient(outPatientId,cancelType,cancelValue,cancelRemark,1,wxId));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCancelReasonList)
    @ApiOperation(value = "获取居民取消原因字典", notes = "获取居民取消原因字典")
    public ListEnvelop findCancelReasonList(){
        return success(prescriptionService.findCancelReasonList());
        try {
            return success(prescriptionService.findCancelReasonList());
        }catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findFastRegisterDate)
    @ApiOperation(value = "獲取快速咨詢時間", notes = "獲取快速咨詢時間")
    public ListEnvelop findFastRegisterDate(){
        return success(prescriptionService.findFastRegisterDate());
        try {
            return success(prescriptionService.findFastRegisterDate());
        }catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByTimeSlot)
@ -823,7 +979,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "startTime", required = false)String startTime,
                                      @ApiParam(name = "endTime", value = "结束时间")
                                      @RequestParam(value = "endTime", required = false)String endTime) {
        return success(prescriptionService.findByTimeSlot(startTime,endTime));
        try {
            return success(prescriptionService.findByTimeSlot(startTime,endTime));
        }catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    
    
@ -837,21 +999,37 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                 @RequestParam(value = "startDate", required = false)String startDate,
                                                 @ApiParam(name = "endDate", value = "yyyy-MM-dd")
                                                 @RequestParam(value = "endDate", required = false)String endDate) {
        return success(prescriptionService.findDoctorWorkTimeByMonth(doctor,date,startDate,endDate));
        try {
            return success(prescriptionService.findDoctorWorkTimeByMonth(doctor,date,startDate,endDate));
        }catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findWorkRule)
    @ApiOperation(value = "查询排班规则", notes = "查询排班规则")
    public ListEnvelop findWorkRule(@ApiParam(name = "hospital", value = "医生code")
                                    @RequestParam(value = "hospital", required = true)String hospital) {
        return success(prescriptionService.findWorkRule("Scheduling",hospital));
        try {
            return success(prescriptionService.findWorkRule("Scheduling",hospital));
        }catch (Exception e) {
            e.printStackTrace();
            return failedListEnvelopException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.updateWorkRule)
    @ApiOperation(value = "保存排班规则", notes = "保存排班规则")
    public ObjEnvelop updateWorkRule(@ApiParam(name = "workRoleJsons", value = "排班规则json")
                                     @RequestParam(value = "workRoleJsons", required = true)String workRoleJsons) {
        return success(prescriptionService.updateWorkRule(workRoleJsons));
        try {
            return success(prescriptionService.updateWorkRule(workRoleJsons));
        }catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorWorkTimeJson)
@ -864,7 +1042,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                             @RequestParam(value = "workTimeJson", required = true)String workTimeJson,
                                             @ApiParam(name = "date", value = "yyyy-MM,支持‘,’分割")
                                             @RequestParam(value = "date", required = false)String date)throws Exception {
        return success(prescriptionService.saveDoctorWorkTimeJson(type,codes,workTimeJson,date));
        try {
            return success(prescriptionService.saveDoctorWorkTimeJson(type,codes,workTimeJson,date));
        }catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
    }
@ -879,7 +1062,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return success(prescriptionService.doctorSaveWorkTimeJson(codes,workTimeJson,date));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -893,7 +1076,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return success(prescriptionService.doctorUpdateWorkTimeJson(workTimeJson,codes));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.deleteWorkTime)
@ -903,7 +1086,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return success(prescriptionService.deleteWorkTime(code));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -916,7 +1099,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @PostMapping(value = "test2")
    @ApiOperation(value = "test2", notes = "test2")
    public Envelop test(String no)throws Exception {
        return success(prescriptionService.test2(no));
        try {
            return success(prescriptionService.test2(no));
        } catch (Exception e) {
            return failedException(e);
        }
    }
    
    @PostMapping(value = "/sendMes")
@ -987,7 +1174,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取居民信息接口", notes = "获取居民信息接口")
    public ObjEnvelop findPatientInfo(@ApiParam(name = "patient", value = "居民ID")
                                      @RequestParam(value = "patient", required = true)String patient){
        return success(prescriptionService.findPatientInfo(patient));
        try {
            return success(prescriptionService.findPatientInfo(patient));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
        
    }
@ -1025,22 +1216,33 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "city", required = false)String city,
                                      @ApiParam(name = "cityName", value = "市名称")
                                          @RequestParam(value = "cityName", required = false)String cityName){
        return success(prescriptionService.updatePatientInfo(patient,name,idcard,ssc,sex,town,townName,committeeCode,committeeName,address,photo,mobile,province,provinceName,city,cityName));
        try {
            return success(prescriptionService.updatePatientInfo(patient,name,idcard,ssc,sex,town,townName,committeeCode,committeeName,address,photo,mobile,province,provinceName,city,cityName));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveDoctorOnlineWork)
    @ApiOperation(value = "保存在线排班", notes = "保存在线排班")
    public Envelop saveDoctorOnlineWork(@ApiParam(name = "onlineWorkJson", value = "保存在线排班json")
                                        @RequestParam(value = "onlineWorkJson", required = true)String onlineWorkJson)throws Exception {
        return prescriptionService.saveDoctorOnlineWork(onlineWorkJson);
        try {
            return prescriptionService.saveDoctorOnlineWork(onlineWorkJson);
        }catch (Exception e) {
            return failedException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.delDoctorOnlineWork)
    @ApiOperation(value = "删除在线排班", notes = "删除在线排班")
    public Envelop delDoctorOnlineWork(@ApiParam(name = "id", value = "保存在线排班ID")
                                       @RequestParam(value = "id", required = true)String id)throws Exception {
        return prescriptionService.delDoctorOnlineWork(id);
        try {
            return prescriptionService.delDoctorOnlineWork(id);
        }catch (Exception e) {
            return failedException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorOnlineWorkList)
@ -1051,7 +1253,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                @RequestParam(value = "startDate", required = true)String startDate,
                                                @ApiParam(name = "endDate", value = "结束时间,YYYY-MM-dd")
                                                @RequestParam(value = "endDate", required = true)String endDate)throws Exception {
        return success(prescriptionService.findDoctorOnlineWorkList(doctor,startDate,endDate));
        try {
            return success(prescriptionService.findDoctorOnlineWorkList(doctor,startDate,endDate));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.cooperativeOutpatient)
@ -1062,19 +1269,24 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                            @RequestParam(value = "registerJson", required = false)String registerJson,
                                            @ApiParam(name = "chargeType", value = "号别")
                                            @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.cooperativeOutpatient(outpatientJson,registerJson,chargeType);
        
        //构建系统消息
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
        //发送系统消息
        hospitalSystemMessageService.sendImMessage(systemMessageDO);
        
        //发送医生抢单消息
        if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
            hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
        try {
            WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.cooperativeOutpatient(outpatientJson,registerJson,chargeType);
            //构建系统消息
            SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
            //发送系统消息
            hospitalSystemMessageService.sendImMessage(systemMessageDO);
            //发送医生抢单消息
            if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
                hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
            }
            return success(wlyyOutpatientDO);
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
        
        return success(wlyyOutpatientDO);
    }
    
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.saveOutpatientDoctor)
@ -1085,7 +1297,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                           @RequestParam(value = "registerJson", required = false)String registerJson,
                                           @ApiParam(name = "chargeType", value = "号别")
                                           @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        return success(prescriptionService.saveOutpatientDoctor(outpatientJson,registerJson,chargeType));
        try {
            return success(prescriptionService.saveOutpatientDoctor(outpatientJson,registerJson,chargeType));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkOauthQRCode)
@ -1111,7 +1327,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                       @RequestParam(value = "page", required = true)Integer page,
                                       @ApiParam(name = "size", value = "每页大小")
                                       @RequestParam(value = "size", required = true)Integer size) {
        return prescriptionService.findByGeneralDoctor(generalDoctor,startDate,endDate,status,sort,page,size,wxId);
        try {
            return prescriptionService.findByGeneralDoctor(generalDoctor,startDate,endDate,status,sort,page,size,wxId);
        }catch (Exception e) {
            return failedException(e);
        }
    }
    
    
@ -1119,7 +1339,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "全科医生首页统计信息", notes = "全科医生首页统计信息")
    public ObjEnvelop findGeneralDoctorInfo(@ApiParam(name = "generalDoctor", value = "全科医生")
                                            @RequestParam(value = "generalDoctor", required = true)String generalDoctor) {
        return success(prescriptionService.findGeneralDoctorInfo(generalDoctor));
        try {
            return success(prescriptionService.findGeneralDoctorInfo(generalDoctor));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.sendWlyyOutpatientMes)
@ -1143,7 +1367,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "居民获取当日就诊列表", notes = "居民获取当日就诊列表")
    public ListEnvelop getTodayOutpatinetList(@ApiParam(name = "patient", value = "居民ID")
                                              @RequestParam(value = "patient", required = true) String patient){
        return success(prescriptionService.getTodayOutpatinetList(patient,wxId));
        try{
            return success(prescriptionService.getTodayOutpatinetList(patient,wxId));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDoctorMapping)
@ -1152,7 +1380,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                       @RequestParam(value = "doctor", required = true)String doctor,
                                       @ApiParam(name = "orgCode", value = "机构code")
                                       @RequestParam(value = "orgCode", required = true)String orgCode){
        return success(prescriptionService.getDoctorMapping(doctor,orgCode));
        try {
            return success(prescriptionService.getDoctorMapping(doctor,orgCode));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
        
    }
    
@ -1183,14 +1416,23 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "查询处方日志", notes = "查询处方日志")
    public ListEnvelop findPrescriptionLogByPreId(@ApiParam(name = "prescriptionCode", value = "处方code")
                                                  @RequestParam(value = "prescriptionCode", required = true)String prescriptionCode)throws Exception{
        return success(prescriptionLogService.findPrescriptionLogByPreId(prescriptionCode));
        try{
            return success(prescriptionLogService.findPrescriptionLogByPreId(prescriptionCode));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByPrescriptionCodeByStatus)
    @ApiOperation(value = "查询处方流程", notes = "查询处方流程")
    public ListEnvelop findByPrescriptionCodeByStatus(@ApiParam(name = "prescriptionCode", value = "处方code")
                                                      @RequestParam(value = "prescriptionCode", required = true)String prescriptionCode)throws Exception{
        return success(prescriptionLogService.findByPrescriptionCodeByStatus(prescriptionCode));
        try {
            return success(prescriptionLogService.findByPrescriptionCodeByStatus(prescriptionCode));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.xzzxFindByPartsCode)
    @ApiOperation(value = "心脏查询部位字典", notes = "心脏查询部位字典")
@ -1278,7 +1520,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取医生简介")
    public ObjEnvelop getDoctorIntroduction(@ApiParam(name = "doctor", value = "医生编码")
                                            @RequestParam(value = "doctor",required = false) String doctor)throws Exception{
        return success(prescriptionService.getDoctorIntroduction(doctor));
        try {
            return success(prescriptionService.getDoctorIntroduction(doctor));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByDict)
@ -1287,7 +1534,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                  @RequestParam(value = "name", required = true)String name,
                                  @ApiParam(name = "hospital", value = "医生code")
                                  @RequestParam(value = "hospital", required = true)String hospital) {
        return success(prescriptionService.findByDict(name,hospital));
        try {
            return success(prescriptionService.findByDict(name,hospital));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getPatientAccetokenByIdcard)
@ -1400,7 +1652,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                        @RequestParam(value = "chargeType",required = false)String chargeType,
                                        @ApiParam(name = "dept", value = "科室")
                                            @RequestParam(value = "dept",required = false)String dept) {
        return success(prescriptionService.findDoctorByName(hospital,name,chargeType,dept));
        try {
            return success(prescriptionService.findDoctorByName(hospital,name,chargeType,dept));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptWithDoctorWorkTime)
@ -1413,14 +1669,23 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                                  @RequestParam(value = "page",required = false)Integer page,
                                                  @ApiParam(name = "pagesize", value = "每页大小")
                                                  @RequestParam(value = "pagesize",required = false)Integer pagesize) {
        return success(prescriptionService.findDeptWithDoctorWorkTime(hospital,keyWord,page,pagesize));
        try {
            return success(prescriptionService.findDeptWithDoctorWorkTime(hospital,keyWord,page,pagesize));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.findWorkTimeRule)
    @ApiOperation(value = "查询排班规则")
    public ObjEnvelop findWorkTimeRule(@ApiParam(name = "hospital", value = "医院code")
                                       @RequestParam(value = "hospital",required = true)String hospital) {
        return success(workTimeService.findWorkTimeRule(hospital));
        try {
            return success(workTimeService.findWorkTimeRule(hospital));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.saveWorkTimeRule)
@ -1429,7 +1694,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                       @RequestParam(value = "workTimeRuleJson",required = true)String workTimeRuleJson,
                                       @ApiParam(name = "isDoctorWorkJson", value = "判断是否排班json数据")
                                       @RequestParam(value = "isDoctorWorkJson",required = false)String isDoctorWorkJson) throws Exception{
        return success(workTimeService.saveWorkTimeRule(workTimeRuleJson,isDoctorWorkJson));
        try {
            return success(workTimeService.saveWorkTimeRule(workTimeRuleJson,isDoctorWorkJson));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    
@ -1439,7 +1709,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "doctor",required = true)String doctor,
                                      @ApiParam(name = "ywCode", value = "业务code")
                                      @RequestParam(value = "ywCode",required = false) String ywCode) throws Exception{
        return success(workTimeService.checkDoctorWork(doctor,ywCode));
        try {
            return success(workTimeService.checkDoctorWork(doctor,ywCode));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.importDoctorWork)
@ -1451,45 +1725,50 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                        @ApiParam(name = "dateMoth", value = "年-月,格式:2020-03")
                                        @RequestParam(value = "dateMoth",required = true)String dateMoth,
                                        HttpServletRequest request)throws Exception{
        request.setCharacterEncoding("UTF-8");
        DoctorWorkTimeExcelReader reader = new DoctorWorkTimeExcelReader();
        reader.read(file);
        
        if("-1".equals(reader.getCode())) {
            ListEnvelop envelop = new ListEnvelop();
            envelop.setStatus(-1);
            envelop.setMessage("目前仅支持200位医生同时导入!");
            return envelop;
        }
        
        List<DoctorWorkTimeMainExcelDO> errorLs = reader.getErrorLs();
        List<DoctorWorkTimeMainExcelDO> correctLs = reader.getCorrectLs();
        if(errorLs!=null&&errorLs.size()>0){
            ListEnvelop envelop = new ListEnvelop();
            envelop.setStatus(-1);
            envelop.setMessage("格式错误!");
            envelop.setDetailModelList(errorLs);
            return envelop;
        }
        
        Map<String,Object> rs = workTimeService.getExcelWorkInfo(correctLs,dateMoth,hospital);
        List<DoctorWorkTimeMainExcelDO> error = (List<DoctorWorkTimeMainExcelDO>)rs.get("error");
        Integer errorTotal = (Integer) rs.get("errorTotal");
        Integer succTotal = (Integer) rs.get("succTotal");
        
        if(error!=null&&error.size()>0){
        try {
            request.setCharacterEncoding("UTF-8");
            DoctorWorkTimeExcelReader reader = new DoctorWorkTimeExcelReader();
            reader.read(file);
            if("-1".equals(reader.getCode())) {
                ListEnvelop envelop = new ListEnvelop();
                envelop.setStatus(-1);
                envelop.setMessage("目前仅支持200位医生同时导入!");
                return envelop;
            }
            List<DoctorWorkTimeMainExcelDO> errorLs = reader.getErrorLs();
            List<DoctorWorkTimeMainExcelDO> correctLs = reader.getCorrectLs();
            if(errorLs!=null&&errorLs.size()>0){
                ListEnvelop envelop = new ListEnvelop();
                envelop.setStatus(-1);
                envelop.setMessage("格式错误!");
                envelop.setDetailModelList(errorLs);
                return envelop;
            }
            Map<String,Object> rs = workTimeService.getExcelWorkInfo(correctLs,dateMoth,hospital);
            List<DoctorWorkTimeMainExcelDO> error = (List<DoctorWorkTimeMainExcelDO>)rs.get("error");
            Integer errorTotal = (Integer) rs.get("errorTotal");
            Integer succTotal = (Integer) rs.get("succTotal");
            if(error!=null&&error.size()>0){
                ListEnvelop envelop = new ListEnvelop();
                envelop.setStatus(-1);
                envelop.setMessage(succTotal+"位医生,更新成功!"+","+errorTotal+"位医生,身份信息错误!更新失败!");
                envelop.setDetailModelList(error);
                return envelop;
            }
            ListEnvelop envelop = new ListEnvelop();
            envelop.setStatus(-1);
            envelop.setMessage(succTotal+"位医生,更新成功!"+","+errorTotal+"位医生,身份信息错误!更新失败!");
            envelop.setStatus(200);
            envelop.setMessage("导入成功!"+succTotal+"位医生排班数据!");
            envelop.setDetailModelList(error);
            return envelop;
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
        
        ListEnvelop envelop = new ListEnvelop();
        envelop.setStatus(200);
        envelop.setMessage("导入成功!"+succTotal+"位医生排班数据!");
        envelop.setDetailModelList(error);
        return envelop;
    }
    
    
@ -1612,7 +1891,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectStatusById(id));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -1630,7 +1909,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectListStatus(relationCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
    
@ -1700,7 +1979,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                            @RequestParam(value = "page",required = false)Integer page,
                                            @ApiParam(name = "pagesize", value = "每页大小")
                                            @RequestParam(value = "pagesize",required = false)Integer pagesize) {
        return success(prescriptionService.selectByCondition(hospital,dept,status,startTime,endTime,nameinfo,page,pagesize,wxId));
        try {
            return success(prescriptionService.selectByCondition(hospital,dept,status,startTime,endTime,nameinfo,page,pagesize,wxId));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    
    @PostMapping(value= BaseHospitalRequestMapping.Prescription.updateStatus)
@ -1714,7 +1997,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            prescriptionService.updateStatus(prescriptionId,status);
            return ObjEnvelop.getSuccess("ok",null);
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
    
@ -1736,7 +2019,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            prescriptionService.updateMailNoById(id,mailNo);
            return ObjEnvelop.getSuccess("ok",null);
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
    
@ -1835,7 +2118,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            //String operate,String operateName,String reason,Integer status,String prescriptionId
            return ObjEnvelop.getSuccess("ok",prescriptionService.savePrescriptionCheck(operate,reason,status,prescriptionId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
    
@ -1856,7 +2139,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            
            return ObjEnvelop.getSuccess("ok",prescriptionService.findPrescriptionCheck(prescriptionId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
    
@ -1876,7 +2159,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            
            return ObjEnvelop.getSuccess("ok",prescriptionService.selectByPrescriptionId(prescriptionId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
    
@ -1892,7 +2175,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            prescriptionService.deleteById(flag,id);
            return ObjEnvelop.getSuccess("ok",null);
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -1906,7 +2189,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getSuccess("ok",businessOrderService.selectOrderTime(relationCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -1945,7 +2228,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return ObjEnvelop.getSuccess("ok",prescriptionService.findByPrescriptionId(prescriptionId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -1995,7 +2278,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return ObjEnvelop.getSuccess("ok",prescriptionService.readOutPatient(registerSn));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -2013,7 +2296,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return ObjEnvelop.getSuccess("ok",prescriptionService.readOutPatientXml(registerSn));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -2030,7 +2313,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            }
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -2043,7 +2326,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return ObjEnvelop.getSuccess("ok",prescriptionService.outpmedicaldoc(patient));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -2061,7 +2344,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                return ObjEnvelop.getSuccess("ok",prescriptionService.getPatInfoDataXml(opid,recSn));
            }
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -2088,7 +2371,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return ObjEnvelop.getSuccess("ok",prescriptionService.writeOutPatient(registerSn,chiefComplaint,hpi,elapsemhis,bodycheck,assistanTcheck,doctor,doctorName));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -2116,7 +2399,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            }
            return prescriptionService.findPatientAllPrescription(keyName,status,page,size,patient,isSelectDrug,consumerflag);
        } catch (Exception e) {
            return PageEnvelop.getError(e.getMessage(),-1);
            return failedPageEnvelopException(e);
        }
    }
@ -2131,7 +2414,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return prescriptionService.findDrugAddress(outpatientId,longitude,dimension);
        } catch (Exception e) {
            return MixEnvelop.getError(e.getMessage());
            return failedMixEnvelopException(e);
        }
    }
@ -2145,8 +2428,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseCommitteeDO> baseProvinces = baseCommitteeService.search(fields, filters, sorts);
        return success(baseProvinces, BaseCommitteeVO.class);
        try {
            List<BaseCommitteeDO> baseProvinces = baseCommitteeService.search(fields, filters, sorts);
            return success(baseProvinces, BaseCommitteeVO.class);
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -2159,8 +2447,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseTownDO> baseTowns = baseTownService.search(fields, filters, sorts);
        return success(baseTowns, BaseTownVO.class);
        try{
            List<BaseTownDO> baseTowns = baseTownService.search(fields, filters, sorts);
            return success(baseTowns, BaseTownVO.class);
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -2173,8 +2466,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseProvinceDO> baseProvinces = baseProvinceService.search(fields, filters, sorts);
        return success(baseProvinces, BaseProvinceVO.class);
        try {
            List<BaseProvinceDO> baseProvinces = baseProvinceService.search(fields, filters, sorts);
            return success(baseProvinces, BaseProvinceVO.class);
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findCity)
@ -2186,8 +2484,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BaseCityDO> baseCitys = baseCityService.search(fields, filters, sorts);
        return success(baseCitys, BaseCityVO.class);
        try {
            List<BaseCityDO> baseCitys = baseCityService.search(fields, filters, sorts);
            return success(baseCitys, BaseCityVO.class);
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    /**
     * 获取诊间支付url
@ -2223,7 +2526,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    public MixEnvelop findCity (
            @ApiParam(name = "patientCode", value = "居民code")
            @RequestParam(value = "patientCode", required = false) String patientCode) throws Exception {
      return   prescriptionService.findPatientOpenId(patientCode);
      try {
          return   prescriptionService.findPatientOpenId(patientCode);
      } catch (Exception e) {
          return failedMixEnvelopException(e);
      }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.updatePayStatus)
@ -2250,7 +2558,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            }
            return ObjEnvelop.getSuccess("ok",businessOrderDO);
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -2263,7 +2571,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return ObjEnvelop.getSuccess("ok",patientMappingService.findPatientNoByPatientCode(code));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.popularityIncrease)
@ -2271,8 +2579,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    public Envelop popularityIncrease (
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", required = false) String doctor) throws Exception {
        BaseDoctorDO baseDoctorDO=baseDoctorInfoService.popularityIncrease(doctor);
        return  success("操作成功",baseDoctorDO);
        try {
            BaseDoctorDO baseDoctorDO=baseDoctorInfoService.popularityIncrease(doctor);
            return  success("操作成功",baseDoctorDO);
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.xzzxSelectExamApply)
    @ApiOperation(value = "检查项目查询接口")
@ -2379,7 +2692,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "icd10Name", value = "诊断名称")
            @RequestParam(value = "icd10Name",defaultValue = "") String icd10Name) throws Exception {
        return prescriptionService.updatePatientDiagnosis(outpatientId,icd10,icd10Name);
        try {
            return prescriptionService.updatePatientDiagnosis(outpatientId,icd10,icd10Name);
        }catch (Exception e) {
            return failedException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.delHisPrescriptionByHisNo)
    @ApiOperation(value = "删除his处方信息")
@ -2419,7 +2737,11 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "pageSize",value = "页大小")
            @RequestParam(value = "pageSize",defaultValue = "",required = false) Integer pageSize) throws Exception {
        return prescriptionService.prescriptionManage(keyWord,doctorId,startTime,endTime,checkStatus,status,page,pageSize);
        try {
            return prescriptionService.prescriptionManage(keyWord,doctorId,startTime,endTime,checkStatus,status,page,pageSize);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.disablePrescription)
    @ApiOperation(value = "作废处方")
@ -2707,8 +3029,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "pageSize", required = false) Integer pageSize) throws Exception {
        try {
            return prescriptionService.getNatAppointmentList(realOrder, name, hospitalFlag, mobile, idcard, payStatus, medicare, createTimeStart, createTimeEnd, appointmentTimeStart,appointmentTimeEnd,isSuccess, page, pageSize,orderNo);
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }catch (Exception e) {
            return failedException(e);
        }
    }

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

@ -58,27 +58,41 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "startTime",required = false) String startTime,
                                          @ApiParam(name = "endTime", value = "结束时间")
                                          @RequestParam(value = "endTime",required = false) String endTime) throws Exception{
        if(page==null){
            page = 1;
        }
        if(size==null){
            size = 10;
        try {
            if(page==null){
                page = 1;
            }
            if(size==null){
                size = 10;
            }
            return success(ykyyEntranceService.vlisReportMasterlist(patient, page, size,startTime,endTime));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
        return success(ykyyEntranceService.vlisReportMasterlist(patient, page, size,startTime,endTime));
    }
    @GetMapping(value = "vlisReportMasterDetail")
    @ApiOperation(value = "检验信息明细")
    public ObjEnvelop vlisReportMasterDetail(@ApiParam(name = "reportId", value = "报告id")
                                         @RequestParam(value = "reportId",required = true) String reportId)throws Exception{
        return success(ykyyEntranceService.vlisReportMasterDetail(reportId));
        try {
            return success(ykyyEntranceService.vlisReportMasterDetail(reportId));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = "vpacsReportDetail")
    @ApiOperation(value = "检查信息明细")
    public ObjEnvelop vpacsReportDetail(@ApiParam(name = "reportId", value = "报告id")
                                             @RequestParam(value = "reportId",required = true) String reportId)throws Exception{
        return success(ykyyEntranceService.vpacsReportDetail(reportId));
        try {
            return success(ykyyEntranceService.vpacsReportDetail(reportId));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = "vpacsReportList")
@ -89,13 +103,18 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                            @RequestParam(value = "page",required = false) Integer page,
                                            @ApiParam(name = "size", value = "页面大小")
                                            @RequestParam(value = "size",required = false) Integer size) throws Exception{
        if(page==null){
            page = 1;
        }
        if(size==null){
            size = 10;
        try {
            if(page==null){
                page = 1;
            }
            if(size==null){
                size = 10;
            }
            return success(ykyyEntranceService.vpacsReportList(patient, page, size));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
        return success(ykyyEntranceService.vpacsReportList(patient, page, size));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientList)
@ -110,19 +129,29 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                              @RequestParam(value = "ksdm",required = false) String ksdm,
                                                      @ApiParam(name = "cardNo", value = "就诊卡号")
                                                      @RequestParam(value = "cardNo",required = false) String cardNo) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient,cardNo, startTime, endTime, demoFlag,ksdm);
        return success(vos);
        try {
            List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient,cardNo, startTime, endTime, demoFlag,ksdm);
            return success(vos);
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.synDoctorInfo)
    @ApiOperation(value = " 同步医生")
    public ObjEnvelop synDoctorInfo(@ApiParam(name = "idcard", value = "身份证")
                                         @RequestParam(value = "idcard",required = false) String idcard)throws Exception{
        ObjEnvelop obj =  new ObjEnvelop();
        prescriptionService.synDoctorInfo(idcard);
        obj.setStatus(200);
        obj.setMessage("同步成功");
        return success(obj);
        try {
            ObjEnvelop obj =  new ObjEnvelop();
            prescriptionService.synDoctorInfo(idcard);
            obj.setStatus(200);
            obj.setMessage("同步成功");
            return success(obj);
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
@ -135,8 +164,13 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "conNo",required = false) String conNo,
                                         @ApiParam(name = "ksdm", value = "科室编号")
                                             @RequestParam(value = "ksdm",required = false) String ksdm)throws Exception{
        WlyyOutpatientVO obj = prescriptionService.findOutpatientInfo(patient,conNo,demoFlag,ksdm);
        return success(obj);
        try {
            WlyyOutpatientVO obj = prescriptionService.findOutpatientInfo(patient,conNo,demoFlag,ksdm);
            return success(obj);
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOriginPrescriptionList)
@ -150,8 +184,13 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "admNo",required = false) String admNo,
            @ApiParam(name = "realOrder", value = "处方号")
            @RequestParam(value = "realOrder",required = false) String realOrder) throws Exception {
        List<WlyyPrescriptionVO> obj = prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
        return success(obj);
        try {
            List<WlyyPrescriptionVO> obj = prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
            return success(obj);
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -166,20 +205,22 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @ApiParam(name = "chargeType", value = "预约实体json")
                                         @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
        if (wlyyOutpatientDO!=null&&null==wlyyOutpatientDO.getId()&&!wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("3")){
            ObjEnvelop objEnvelop =new ObjEnvelop();
            String msg = "";
            if (1==wlyyOutpatientDO.getRemindCount()){
                msg = "自取";
            }else {
                msg = "快递配送";
        try {
            WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
            if (wlyyOutpatientDO!=null&&null==wlyyOutpatientDO.getId()&&!wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("3")){
                ObjEnvelop objEnvelop =new ObjEnvelop();
                String msg = "";
                if (1==wlyyOutpatientDO.getRemindCount()){
                    msg = "自取";
                }else {
                    msg = "快递配送";
                }
                objEnvelop.setMessage("您已经选择过"+msg+"方式,请勿修改");
                objEnvelop.setStatus(300);
                return objEnvelop;
            }
            objEnvelop.setMessage("您已经选择过"+msg+"方式,请勿修改");
            objEnvelop.setStatus(300);
            return objEnvelop;
        }
        SystemMessageDO systemMessageDO = commenPrescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
            SystemMessageDO systemMessageDO = commenPrescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
       /* //发送系统消息
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO);
        //发送IM消息
@ -190,7 +231,10 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
            hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
        }*/
        return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
            return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
@ -206,7 +250,12 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "groupNo", required = false)String groupNo,
                                         @ApiParam(name = "oupatienId", value = "门诊Id")
                                             @RequestParam(value = "oupatienId", required = false)String oupatienId)throws Exception {
        return success(prescriptionService.getDrugDictionary(drugNo,pyKey,winNo,groupNo,oupatienId));
        try {
            return success(prescriptionService.getDrugDictionary(drugNo,pyKey,winNo,groupNo,oupatienId));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -216,14 +265,24 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                  @RequestParam(value = "pyKey", required = false)String pyKey,
                                  @ApiParam(name = "drugNo", value = "药品编码")
                                  @RequestParam(value = "drugNo", required = false)String drugNo)throws Exception {
        return success(prescriptionService.getDrugUse(drugNo,pyKey,demoFlag));
        try {
            return success(prescriptionService.getDrugUse(drugNo,pyKey,demoFlag));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getDrugFrequency)
    @ApiOperation(value = "获取用药频次", notes = "获取用药频次")
    public ListEnvelop getDrugFrequency()throws Exception {
        return success(prescriptionService.getDrugFrequency(demoFlag));
        try {
            return success(prescriptionService.getDrugFrequency(demoFlag));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getInspectionDictionary)
@ -234,20 +293,33 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                               @RequestParam(value = "winNo", required = false)String winNo,
                                               @ApiParam(name = "codes", value = "检查检验收费码codes,用逗号分割")
                                               @RequestParam(value = "codes", required = false)String codes)throws Exception{
        return success(prescriptionService.getInspectionDictionary(pyKey,codes,winNo));
        try {
            return success(prescriptionService.getInspectionDictionary(pyKey,codes,winNo));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientCard)
    @ApiOperation(value = "查询患者就诊卡", notes = "查询患者就诊卡")
    public ListEnvelop findPatientCard(@ApiParam(name = "patient", value = "居民Code")
                                       @RequestParam(value = "patient", required = true)String patient)throws Exception {
        return success(prescriptionService.findPatientCard(patient));
        try {
            return success(prescriptionService.findPatientCard(patient));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.synYkIcd10)
    @ApiOperation(value = "同步眼科icd10", notes = "同步眼科icd10")
    public ListEnvelop findPatientCard()throws Exception {
        return success(prescriptionService.synYkICD10());
        try {
            return success(prescriptionService.synYkICD10());
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -264,7 +336,7 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return success("ok",prescriptionService.savePrescriptionOrder(code,price,tradeType,wxId,appletCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -272,7 +344,12 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取ICD10诊断编码", notes = "获取ICD10诊断编码")
    public ListEnvelop getICD10(@ApiParam(name = "pyKey", value = "拼音关键字")
                                @RequestParam(value = "pyKey", required = false)String pyKey)throws Exception {
        return success(prescriptionService.getICD10(pyKey,demoFlag));
        try {
            return success(prescriptionService.getICD10(pyKey,demoFlag));
        } catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -284,7 +361,7 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return success("ok",businessOrderService.yktAppPayJson(relationCode));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return failedObjEnvelopException(e);
        }
    }
@ -296,7 +373,7 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
        try {
            return success("ok",ykyyEntranceService.findInfoBysql(sql));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
            return  failedObjEnvelopException(e);
        }
    }
@ -310,7 +387,12 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                        @ApiParam(name = "deptName", value = "deptName")
                                            @RequestParam(value = "deptName", required = false)String deptName)throws Exception {
        return success("ok",ykyyEntranceService.findDeptByYq(orgCode,deptCode,deptName));
        try {
            return success("ok",ykyyEntranceService.findDeptByYq(orgCode,deptCode,deptName));
        }catch (Exception e) {
            return  failedListEnvelopException(e);
        }
    }
}

+ 5 - 5
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java

@ -61,12 +61,12 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
            }else {
                result= statisticsEsService.getOutPatientLine(startDate, endDate, area, level, index, interval,level2_type);
            }
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
        return success(result);
    }
@ -93,11 +93,11 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
        JSONObject result = new JSONObject();
        try {
            result= statisticsEsService.getPrescriptionLine(startDate, endDate, area, level, index, interval,level2_type);
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return failedObjEnvelopException(e);
        }
        return success(result);
    }
    /**
     *

+ 120 - 24
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/survey/SurveyEndpoint.java

@ -35,8 +35,13 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "问题-查询字典")
    public ListEnvelop findSurveyLabel(@ApiParam(name = "name", value = "1.surveyLabel 标签;2.surveyScreenLabel 问卷类型")
                                       @RequestParam(value = "name",required = true) String name) throws Exception {
        List<WlyyHospitalSysDictVO> vos = surveyService.findSurveyLabel(name);
        return success(vos);
        try {
            List<WlyyHospitalSysDictVO> vos = surveyService.findSurveyLabel(name);
            return success(vos);
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyQuestion)
@ -51,14 +56,22 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                          @RequestParam(value = "page",required = true)Integer page,
                                         @ApiParam(name = "size", value = "每页大小")
                                          @RequestParam(value = "size",required = true)Integer size) throws Exception {
        return surveyService.findSurveyQuestion(title,creater,questionType,page,size);
        try {
            return surveyService.findSurveyQuestion(title,creater,questionType,page,size);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findBySurveyId)
    @ApiOperation(value = "问题-获取问卷问题详情(单条)")
    public ObjEnvelop findBySurveyId(@ApiParam(name = "surveyId", value = "问卷Id")
                                     @RequestParam(value = "surveyId",required = true) String surveyId) throws Exception {
        return success(surveyService.findBySurveyId(surveyId));
        try {
            return success(surveyService.findBySurveyId(surveyId));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.saveSurveyQuestion)
@ -67,7 +80,12 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "sqjsons",required = true)String sqjsons,
                                         @ApiParam(name = "sqOptionJson", value = "选项实体列表json")
                                         @RequestParam(value = "sqOptionJson",required = false)String sqOptionJson) throws Exception {
        return success(surveyService.saveSurveyQuestion(sqjsons,sqOptionJson));
        try {
            return success(surveyService.saveSurveyQuestion(sqjsons,sqOptionJson));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.updataSurveyQuestion)
@ -76,14 +94,22 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                           @RequestParam(value = "sqjson",required = true)String sqjson,
                                           @ApiParam(name = "sqOptionJson", value = "选项实体列表json")
                                           @RequestParam(value = "sqOptionJson",required = false)String sqOptionJson) throws Exception {
        return success(surveyService.updataSurveyQuestion(sqjson,sqOptionJson));
        try {
            return success(surveyService.updataSurveyQuestion(sqjson,sqOptionJson));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.delSurveyQuestion)
    @ApiOperation(value = "问题-批量删除")
    public ObjEnvelop delSurveyQuestion(@ApiParam(name = "ids", value = "问题实体ID,逗号分割")
                                        @RequestParam(value = "ids",required = true)String ids) throws Exception {
        return success(surveyService.delSurveyQuestion(ids));
        try {
            return success(surveyService.delSurveyQuestion(ids));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
@ -99,7 +125,12 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                              @RequestParam(value = "page",required = true)Integer page,
                                          @ApiParam(name = "size", value = "每页大小")
                                              @RequestParam(value = "size",required = true)Integer size) throws Exception {
        return surveyService.findSurveyTemplate( title, creater,label, page, size);
        try {
            return surveyService.findSurveyTemplate( title, creater,label, page, size);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyTemplateById)
@ -108,7 +139,11 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                             @RequestParam(value = "tempId",required = true) String tempId,
                                             @ApiParam(name = "userCode", value = "当前用户id")
                                             @RequestParam(value = "userCode",required = false) String userCode ) throws Exception {
        return success(surveyService.findSurveyTemplateById(tempId,userCode));
        try {
            return success(surveyService.findSurveyTemplateById(tempId,userCode));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.saveSurveyTemplate)
@ -123,14 +158,22 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "labelJson",required = false)String labelJson,
                                         @ApiParam(name = "labelInspJson", value = "模板筛查标签json")
                                         @RequestParam(value = "labelInspJson",required = false)String labelInspJson) throws Exception {
        return success(surveyService.saveSurveyTemplate(tempJson,tempQJson,tempOpJson,labelJson,labelInspJson));
        try {
            return success(surveyService.saveSurveyTemplate(tempJson,tempQJson,tempOpJson,labelJson,labelInspJson));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.delSurveyTemplate)
    @ApiOperation(value = "模板-删除模板")
    public ObjEnvelop delSurveyTemplate(@ApiParam(name = "tempId", value = "模板实体json")
                                        @RequestParam(value = "tempId",required = true)String tempId) throws Exception {
        return success(surveyService.delSurveyTemplate(tempId));
        try {
            return success(surveyService.delSurveyTemplate(tempId));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    //=================调查问卷居民查询\答题
@ -140,7 +183,11 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "tempId",required = true)String tempId,
                                     @ApiParam(name = "sdJsons", value = "部门与科室关系json")
                                     @RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
        return success(surveyService.saveSurveyDept(tempId,sdJsons));
        try {
            return success(surveyService.saveSurveyDept(tempId,sdJsons));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @PostMapping(value = BaseHospitalRequestMapping.WlyySurvey.saveDeptSurvey)
@ -149,14 +196,23 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "dept",required = true)String dept,
                                     @ApiParam(name = "sdJsons", value = "部门与科室关系json")
                                     @RequestParam(value = "sdJsons",required = false)String sdJsons)throws Exception {
        return success(surveyService.saveDeptSurvey(dept,sdJsons));
        try {
            return success(surveyService.saveDeptSurvey(dept,sdJsons));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyByDept)
    @ApiOperation(value = "模板-查询部门下发放的问卷")
    public ListEnvelop findSurveyByDept(@ApiParam(name = "dept", value = "科室")
                                        @RequestParam(value = "dept",required = true)String dept)throws Exception {
        return success(surveyService.findSurveyByDept(dept));
        try {
            return success(surveyService.findSurveyByDept(dept));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -166,14 +222,22 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                                  @RequestParam(value = "dept",required = true)String dept,
                                                  @ApiParam(name = "patient", value = "居民code")
                                                  @RequestParam(value = "patient",required = true)String patient)throws Exception {
        return success(surveyService.findSurveyByDeptAndPatient(dept,patient));
        try {
            return success(surveyService.findSurveyByDeptAndPatient(dept,patient));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findDeptBySurvey)
    @ApiOperation(value = "模板-查询模板下的科室")
    public ListEnvelop findDeptBySurvey(@ApiParam(name = "tempId", value = "模板ID")
                                        @RequestParam(value = "tempId",required = true)String tempId)throws Exception {
        return success(surveyService.findDeptBySurvey(tempId));
        try {
            return success(surveyService.findDeptBySurvey(tempId));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
@ -183,7 +247,11 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "suJson",required = true)String suJson,
                                     @ApiParam(name = "suaJsons", value = "答案集合json")
                                     @RequestParam(value = "suaJsons",required = true)String suaJsons)throws Exception {
        return success(surveyService.saveSurveyAnswer(suJson, suaJsons));
        try {
            return success(surveyService.saveSurveyAnswer(suJson, suaJsons));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findAnswerBySurveyTempCode)
@ -194,14 +262,23 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                                  @RequestParam(value = "tempId",required = true)String tempId,
                                                  @ApiParam(name = "surverUserId", value = "答题批次号")
                                                  @RequestParam(value = "surverUserId",required = false)String surverUserId)throws Exception {
        return success(surveyService.findAnswerBySurveyTempCode(surverUserId,patient,tempId));
        try {
            return success(surveyService.findAnswerBySurveyTempCode(surverUserId,patient,tempId));
        }catch (Exception e) {
            return failedListEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyTemplateResult)
    @ApiOperation(value = "统计-查询问题情况")
    public ObjEnvelop findSurveyTemplateResult(@ApiParam(name = "tempId", value = "模板ID")
                                                @RequestParam(value = "tempId",required = true)String tempId)throws Exception {
        return success(surveyService.findSurveyTemplateResult(tempId));
        try {
            return success(surveyService.findSurveyTemplateResult(tempId));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findQuestionInfoList)
@ -220,7 +297,12 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                           @RequestParam(value = "page",required = true)Integer page,
                                           @ApiParam(name = "size", value = "每页大小")
                                           @RequestParam(value = "size",required = true)Integer size)throws Exception {
        return surveyService.findQuestionInfoList(comment,temId,content,tempQuestionCode,tempOptionCode,page, size);
        try {
            return surveyService.findQuestionInfoList(comment,temId,content,tempQuestionCode,tempOptionCode,page, size);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findAnswerList)
    @ApiOperation(value = "统计-综合查询问题答案")
@ -236,7 +318,12 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "page",required = true)Integer page,
                                     @ApiParam(name = "size", value = "每页大小")
                                     @RequestParam(value = "size",required = true)Integer size)throws Exception {
        return surveyService.findAnswerList(tempId,patient,patientName,title,page,size);
        try {
            return surveyService.findAnswerList(tempId,patient,patientName,title,page,size);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    //=================
@ -254,7 +341,11 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                     @RequestParam(value = "page",required = true,defaultValue = "1")Integer page,
                               @ApiParam(name = "pageSize", value = "每页大小",defaultValue = "10")
                                     @RequestParam(value = "pageSize",required = true,defaultValue = "10")Integer pageSize)throws Exception {
        return businessService.getUsedList(title,doctor,labelCode,used,page,pageSize);
        try {
            return businessService.getUsedList(title,doctor,labelCode,used,page,pageSize);
        }catch (Exception e) {
            return failedMixEnvelopException(e);
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.setUsed)
@ -266,7 +357,12 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
                                     @ApiParam(name = "doctor", value = "医生id")
                                     @RequestParam(value = "doctor",required = false) String doctor)throws Exception {
        businessService.setUsed(tempId,used,doctor);
        return success("操作成功");
        try {
            businessService.setUsed(tempId,used,doctor);
            return success("操作成功");
        }catch (Exception e) {
            return failedException(e);
        }
    }
}

+ 17 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/tnyy/TnyyController.java

@ -31,7 +31,12 @@ public class TnyyController extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取部门信息", notes = "获取部门信息")
    public ObjEnvelop getDeptInfo(@ApiParam(name = "code", value = "code", required = false)
                                  @RequestParam(value = "code",required = false)String code)throws Exception{
        return ObjEnvelop.getSuccess("ok",tnyyEntranceService.updateTnyyDept());
        try {
            return ObjEnvelop.getSuccess("ok",tnyyEntranceService.updateTnyyDept());
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
@ -39,14 +44,23 @@ public class TnyyController extends EnvelopRestEndpoint {
    @ApiOperation(value = "获取医生信息", notes = "获取医生信息")
    public ObjEnvelop updateTnyyDoctor(@ApiParam(name = "idcard", value = "idcard", required = false)
                                  @RequestParam(value = "idcard",required = false)String idcard)throws Exception{
        return ObjEnvelop.getSuccess("ok",tnyyEntranceService.updateTnyyDoctor(idcard));
        try {
            return ObjEnvelop.getSuccess("ok",tnyyEntranceService.updateTnyyDoctor(idcard));
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
    @GetMapping(value = "/synYkICD10")
    @ApiOperation(value = "获取icd10信息", notes = "获取icd10信息")
    public ObjEnvelop synYkICD10()throws Exception{
        return ObjEnvelop.getSuccess("ok",prescriptionService.synYkICD10());
        try {
            return ObjEnvelop.getSuccess("ok",prescriptionService.synYkICD10());
        }catch (Exception e) {
            return failedObjEnvelopException(e);
        }
    }
}

+ 7 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/version/VersionEndpoint.java

@ -34,6 +34,8 @@ public class VersionEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "app升级")
    public Envelop appVersion(String code, double version) {
        try{
            AppVersionDO temp = versionsService.findVersionByCode(code);
            if (temp == null) {
                return Envelop.getError( "无效的APP类型失败!");
@ -55,6 +57,10 @@ public class VersionEndpoint extends EnvelopRestEndpoint {
                map.put("size", temp.getSize());
                return success("读取版本号成功!", map);
            }
        }catch (Exception e) {
            return failedException(e);
        }
    }
}