Bläddra i källkod

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

liubing 3 år sedan
förälder
incheckning
855ce6b320
26 ändrade filer med 1339 tillägg och 65 borttagningar
  1. 14 0
      business/base-service/src/main/java/com/yihu/jw/gateway/dao/GcClientDetailsDao.java
  2. 11 0
      business/base-service/src/main/java/com/yihu/jw/gateway/dao/GcHttpLogDao.java
  3. 25 0
      business/base-service/src/main/java/com/yihu/jw/gateway/dao/GcTokenDao.java
  4. 11 0
      business/base-service/src/main/java/com/yihu/jw/gateway/dao/GcTokenLogDao.java
  5. 39 0
      business/base-service/src/main/java/com/yihu/jw/gateway/service/GcClientDetailsService.java
  6. 101 0
      business/base-service/src/main/java/com/yihu/jw/gateway/service/GcTokenService.java
  7. 1 6
      business/base-service/src/main/java/com/yihu/jw/thirdUpload/service/AchnsDoctorRecordService.java
  8. 0 2
      business/base-service/src/main/java/com/yihu/jw/thirdUpload/service/UpAppointmentOnlineService.java
  9. 58 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  10. 4 4
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/article/KnowledgeArticleDictDao.java
  11. 4 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuManageEndpoint.java
  12. 35 13
      svr/svr-base/src/main/java/com/yihu/jw/base/service/menu/BaseMenuManageService.java
  13. 1 1
      svr/svr-base/src/main/resources/bootstrap.yml
  14. 559 35
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/admin/AdminDoorCoachOrderController.java
  15. 2 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java
  16. 1 1
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/admin/AdminDoorCoachOrderService.java
  17. 7 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java
  18. 12 0
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java
  19. 83 0
      svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/OneNetUtil.java
  20. 143 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/gateway/GcTokenController.java
  21. 98 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/gateway/model/BaseResultModel.java
  22. 33 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/gateway/model/GcClientDetailsModel.java
  23. 51 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/gateway/model/GcTokenModel.java
  24. 39 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/gateway/model/ResultOneModel.java
  25. 1 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/thirdUpload/ThirdUploadEndpoint.java
  26. 6 0
      svr/svr-internet-hospital/src/main/resources/application.yml

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

@ -0,0 +1,14 @@
package com.yihu.jw.gateway.dao;
import com.yihu.jw.entity.iot.gateway.GcClientDetails;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/17.
 */
public interface GcClientDetailsDao extends PagingAndSortingRepository<GcClientDetails, Long>, JpaSpecificationExecutor<GcClientDetails> {
    @Query("from GcClientDetails where appId=?1 and del=1")
    GcClientDetails findByAppid(String appid);
}

+ 11 - 0
business/base-service/src/main/java/com/yihu/jw/gateway/dao/GcHttpLogDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.gateway.dao;
import com.yihu.jw.entity.iot.gateway.GcHttpLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/17.
 */
public interface GcHttpLogDao extends PagingAndSortingRepository<GcHttpLog, Long>, JpaSpecificationExecutor<GcHttpLog> {
}

+ 25 - 0
business/base-service/src/main/java/com/yihu/jw/gateway/dao/GcTokenDao.java

@ -0,0 +1,25 @@
package com.yihu.jw.gateway.dao;
import com.yihu.jw.entity.iot.gateway.GcToken;
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;
/**
 * Created by chenweida on 2017/8/17.
 */
public interface GcTokenDao extends PagingAndSortingRepository<GcToken, Long>, JpaSpecificationExecutor<GcToken> {
    @Query("update GcToken g set g.del=0 where g.appid=?1 and g.del=1")
    @Modifying
    void updateDel(String appid);
    @Query("from GcToken where accesstoken=?1")
    GcToken findByToken(String token);
    @Query("from GcToken where appid=?1 and outTime >= now()")
    List<GcToken> findByAppId(String token);
}

+ 11 - 0
business/base-service/src/main/java/com/yihu/jw/gateway/dao/GcTokenLogDao.java

@ -0,0 +1,11 @@
package com.yihu.jw.gateway.dao;
import com.yihu.jw.entity.iot.gateway.GcTokenLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/8/17.
 */
public interface GcTokenLogDao extends PagingAndSortingRepository<GcTokenLog, Long>, JpaSpecificationExecutor<GcTokenLog> {
}

+ 39 - 0
business/base-service/src/main/java/com/yihu/jw/gateway/service/GcClientDetailsService.java

@ -0,0 +1,39 @@
package com.yihu.jw.gateway.service;
import com.yihu.jw.entity.iot.gateway.GcClientDetails;
import com.yihu.jw.gateway.dao.GcClientDetailsDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import static com.sun.xml.internal.ws.util.JAXWSUtils.getUUID;
/**
 * Created by chenweida on 2017/8/17.
 */
@Service
public class GcClientDetailsService{
    @Autowired
    private GcClientDetailsDao gtClientDetailsDao;
    public GcClientDetails findByAppId(String appid) {
        return gtClientDetailsDao.findByAppid(appid);
    }
    @Transactional
    public GcClientDetails createClientDetails(String appUri,String createUserName,String creatieUser,String remark) throws Exception{
        GcClientDetails gcClientDetails = new GcClientDetails();
        gcClientDetails.setAppId(getUUID());
        gcClientDetails.setAppSecret(getUUID());
        gcClientDetails.setAppUri(appUri);
        gcClientDetails.setCreateUserName(createUserName);
        gcClientDetails.setCreatieUser(creatieUser);
        gcClientDetails.setCreatieTime(new Date());
        gcClientDetails.setDel(1);
        gcClientDetails.setRemark(remark);
        return gtClientDetailsDao.save(gcClientDetails);
    }
}

+ 101 - 0
business/base-service/src/main/java/com/yihu/jw/gateway/service/GcTokenService.java

@ -0,0 +1,101 @@
package com.yihu.jw.gateway.service;
import com.yihu.jw.entity.iot.gateway.GcToken;
import com.yihu.jw.entity.iot.gateway.GcTokenLog;
import com.yihu.jw.gateway.dao.GcTokenDao;
import com.yihu.jw.gateway.dao.GcTokenLogDao;
import com.yihu.jw.util.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
 * Created by chenweida on 2017/8/17.
 */
@Service
public class GcTokenService {
    @Autowired
    private GcTokenLogDao tokenLogDao;
    @Autowired
    private GcTokenDao tokenDao;
    /**
     * 根据appid生成token
     *
     * @param appid
     * @param appSecret
     * @return
     */
    @Transactional
    public GcToken createToken(String appid, String appSecret, String ip, String overTime,Integer tokenTime) {
        try {
            //把该用户之前有效的token设置为无效
            tokenDao.updateDel(appid);
            //创新新的appId
            Date date = new Date();
            String token = UUID.randomUUID().toString();
            GcToken gc = new GcToken();
            gc.setAppid(appid);
            gc.setCreateTime(date);
            //2小时过期
            if(StringUtils.isEmpty(overTime)){
                if(tokenTime==null){
                    tokenTime=2;
                }
                gc.setOutTime(DateUtil.getNextMin(date, tokenTime*60));
            }else{
                gc.setOutTime(DateUtil.strToDate(overTime));
            }
            gc.setAccesstoken(token);
            gc.setDel(1);
            tokenDao.save(gc);
            //保存日志
            GcTokenLog gcTokenLog = new GcTokenLog();
            gcTokenLog.setAppIp(appid);
            gcTokenLog.setCreateTime(new Date());
            gcTokenLog.setAppIp(ip);
            gcTokenLog.setMessage("创建token");
            gcTokenLog.setAccesstoken(token);
            gcTokenLog.setFlag(1);
            tokenLogDao.save(gcTokenLog);
            return gc;
        } catch (Exception e) {
            //保存失败日志
            GcTokenLog gcTokenLog = new GcTokenLog();
            gcTokenLog.setAppIp(appid);
            gcTokenLog.setCreateTime(new Date());
            gcTokenLog.setAppIp(ip);
            gcTokenLog.setMessage("创建token");
            gcTokenLog.setFlag(0);
            tokenLogDao.save(gcTokenLog);
        }
        return null;
    }
    /**
     * 根据token获取GcToken对象
     * @param token
     * @return
     */
    public GcToken getToken(String token) {
        return tokenDao.findByToken(token);
    }
    public List<GcToken> findByAppId(String appid){
        return tokenDao.findByAppId(appid);
    }
}

+ 1 - 6
business/base-service/src/main/java/com/yihu/jw/thirdUpload/service/AchnsDoctorRecordService.java

@ -1,12 +1,7 @@
package com.yihu.jw.thirdUpload.service;
package com.yihu.jw.thirdUpload.service;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.dict.BaseFrequencyDictDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.thirdUpload.AchnsDoctorRecordDO;
import com.yihu.jw.entity.thirdUpload.AchnsDoctorRecordDO;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportVO;
import com.yihu.jw.thirdUpload.AchnsDoctorRecordDao;
import com.yihu.jw.thirdUpload.AchnsDoctorRecordDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;

+ 0 - 2
business/base-service/src/main/java/com/yihu/jw/thirdUpload/service/UpAppointmentOnlineService.java

@ -1,9 +1,7 @@
package com.yihu.jw.thirdUpload.service;
package com.yihu.jw.thirdUpload.service;
import com.yihu.jw.entity.thirdUpload.UpAppointmentOnlineDO;
import com.yihu.jw.entity.thirdUpload.UpAppointmentOnlineDO;
import com.yihu.jw.entity.thirdUpload.UpnsDoctorRecordDO;
import com.yihu.jw.thirdUpload.UpAppointmentOnlineDao;
import com.yihu.jw.thirdUpload.UpAppointmentOnlineDao;
import com.yihu.jw.thirdUpload.UpnsDoctorRecordDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;

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

@ -1519,4 +1519,62 @@ public class BaseHospitalRequestMapping {
        //发送微信模版消息
        //发送微信模版消息
        public static final String sendWxTemple = "/sendWxTemple";
        public static final String sendWxTemple = "/sendWxTemple";
    }
    }
    /*
     *   监管平台请求地址
     */
    public static class UpWebTherapySupserviceInfo{
        /*请求前缀*/
        public static final String PREFIX = "/open/gc/regulatory";
        //保存医师唯一标识
        public static final String SAVEACHNS = "/saveAchns";
        //删除医师唯一标识
        public static final String DELETEACHNS = "/deleteAchns";
        //查询医师唯一标识
        public static final String FINDACHNSBYCREATETIME = "/findAchnsByCreateTime";
        //待插入
        //保存网络咨询服务信息
        public static final String SAVENSOLINEASK = "/saveNsOlineAsk";
        //删除网络咨询服务信息
        public static final String DELETESOLINEASK = "/deleteNsOlineAsk";
        //查询网络咨询服务信息
        public static final String FINDNSOLINEASK = "/findNsOlineAsk";
        //保存网络诊疗服务信息
        public static final String SAVENSONLINEMED = "/saveNsonlinemed";
        //删除网络诊疗服务信息
        public static final String DELETENSONLINEMED = "/deleteNsonlinemed";
        //查询网络诊疗服务信息
        public static final String FINDSONLINEMED = "/findNsonlinemed";
        //保存电子处方单信息
        public static final String SAVEPRESCRIPTION = "/savePrescription";
        //删除电子处方单信息
        public static final String DELETEPRESCRIPTION = "/deletePrescription";
        //查询电子处方单信息
        public static final String FINDPRESCRIPTION = "/findPrescription";
        //保存电子处方药品明细信息
        public static final String SAVEPRESCRIPTIONDRUG = "savePrescriptionDrug";
        //删除电子处方单信息
        public static final String DELETEPRESCRIPTIONDRUG = "/deletePrescriptionDrug";
        //查询电子处方单信息
        public static final String FINDPRESCRIPTIONDRUG = "/findPrescriptionDrug";
    }
}
}

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

@ -31,10 +31,10 @@ public interface KnowledgeArticleDictDao extends PagingAndSortingRepository<Know
	@Query("select count(*) from KnowledgeArticleDictDO a where a.del=1 and a.categoryFirst = ?1 and a.releaseStatus=1 ")
	@Query("select count(*) from KnowledgeArticleDictDO a where a.del=1 and a.categoryFirst = ?1 and a.releaseStatus=1 ")
	Integer getCountByCategoryFirst(String category);
	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 order by  a.releaseTime desc ")
	List<KnowledgeArticleDictDO> findByCategorySecondAndPage(String category,Pageable pageRequest);
	@Query(" select count(*) from KnowledgeArticleDictDO a where a.del=1 and  a.categorySecond IN (?1) and a.releaseStatus=1")
	Integer getCountByCategorySecond(List<String> category);
	@Query("select a from KnowledgeArticleDictDO a where a.del=1 and  a.categorySecond IN ( ?1 ) and a.releaseStatus=1 order by  a.releaseTime desc ")
	List<KnowledgeArticleDictDO> findByCategorySecondAndPage(List<String> category,Pageable pageRequest);
}
}

+ 4 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/menu/BaseMenuManageEndpoint.java

@ -110,9 +110,11 @@ public class BaseMenuManageEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "parentId", value = "parentId", required = false)
            @ApiParam(name = "parentId", value = "parentId", required = false)
            @RequestParam(value = "parentId",required = false) String parentId,
            @RequestParam(value = "parentId",required = false) String parentId,
            @ApiParam(name = "name", value = "name", required = false)
            @ApiParam(name = "name", value = "name", required = false)
            @RequestParam(value = "name",required = false) String name) {
            @RequestParam(value = "name",required = false) String name,
            @ApiParam(name = "status", value = "status", required = false)
            @RequestParam(value = "status",required = false) Integer status) {
        try {
        try {
            return success(menuService.findMenuDictByKey(parentId, name));
            return success(menuService.findMenuDictByKey(parentId, name,status));
        }catch (Exception e){
        }catch (Exception e){
            return failedException(e);
            return failedException(e);
        }
        }

+ 35 - 13
svr/svr-base/src/main/java/com/yihu/jw/base/service/menu/BaseMenuManageService.java

@ -71,7 +71,7 @@ public class BaseMenuManageService {
        }
        }
    }
    }
    //菜单词典查询
    //菜单词典查询
    public List<Map<String,Object>> findMenuDictByKey(String parentId, String name){
    public List<Map<String,Object>> findMenuDictByKey(String parentId, String name,Integer status){
        String sql = "select t.id as \"id\", " +
        String sql = "select t.id as \"id\", " +
                " t.parent_id as \"parentId\", " +
                " t.parent_id as \"parentId\", " +
                " t.name as \"name\", " +
                " t.name as \"name\", " +
@ -118,6 +118,11 @@ public class BaseMenuManageService {
            sql+=" and t.name like '%"+name+"%'";
            sql+=" and t.name like '%"+name+"%'";
            sqlParent+=" and t.name like '%"+name+"%'";
            sqlParent+=" and t.name like '%"+name+"%'";
        }
        }
        if (status!=null){
            sql += " and t.status = '"+status+"' ";
            sqlParent+=" and t.status = '"+status+"' " ;
        }
        sql+=" order by t.parent_id asc ,t.menu_sort asc ";
        sql+=" order by t.parent_id asc ,t.menu_sort asc ";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        List<Map<String,Object>> listParent = hibenateUtils.createSQLQuery(sqlParent);
        List<Map<String,Object>> listParent = hibenateUtils.createSQLQuery(sqlParent);
@ -141,7 +146,9 @@ public class BaseMenuManageService {
            }
            }
            for (Map<String,Object> mapchild:list){
            for (Map<String,Object> mapchild:list){
                if (mapchild.get("parentId").toString().equalsIgnoreCase(map.get("id").toString())){
                if (mapchild.get("parentId").toString().equalsIgnoreCase(map.get("id").toString())){
                   Integer articleChildNum= knowledgeArticleDictDao.getCountByCategorySecond(mapchild.get("id").toString());
                    List<String> list1 = new ArrayList<>();
                    list1.add(mapchild.get("id").toString());
                   Integer articleChildNum= knowledgeArticleDictDao.getCountByCategorySecond(list1);
                    mapchild.put("articleNum",articleChildNum);
                    mapchild.put("articleNum",articleChildNum);
                    for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:effect){
                    for (WlyyHospitalSysDictDO wlyyHospitalSysDictDO:effect){
                        if (mapchild.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
                        if (mapchild.get("status").toString().equalsIgnoreCase(wlyyHospitalSysDictDO.getDictCode())){
@ -481,11 +488,21 @@ public class BaseMenuManageService {
                " m.bg_img as \"bgImg\"," +
                " m.bg_img as \"bgImg\"," +
                " m.menu_title as \"menuTitle\"," +
                " m.menu_title as \"menuTitle\"," +
                " m.describtion as \"describtion\"," +
                " m.describtion as \"describtion\"," +
                " t.style_name as \"styleName\" " +
                " t.style_name as \"styleName\", " +
                " m.parent_id as \"parentId\" " +
                " from base_menu_show t left join " +
                " from base_menu_show t left join " +
                " base_menu_dict m on t.menu_id= m.id" +
                " 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 ";
                " where t.is_del ='1' order by t.model_id asc ,t.menu_sort asc ";
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql);
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql);
        for (Map<String,Object> map:list){
            if (map.get("parentId")!=null){
                String parentId = map.get("parentId").toString();
                BaseMenuDictDO parentDo= baseMenuDictDao.findOne(parentId);
                if (parentDo!=null){
                    map.put("parentName",parentDo.getName());
                }
            }
        }
        String sqlLink =" select t.id as \"id\", " +
        String sqlLink =" select t.id as \"id\", " +
                " t.model_id as \"modelId\", " +
                " t.model_id as \"modelId\", " +
@ -517,6 +534,7 @@ public class BaseMenuManageService {
                map.put("childList",child);
                map.put("childList",child);
            }
            }
        }
        }
        return listModel;
        return listModel;
    }
    }
@ -635,26 +653,30 @@ public class BaseMenuManageService {
                " t.menu_img as \"menuImg\"  " +
                " t.menu_img as \"menuImg\"  " +
                "from base_menu_dict t  where 1=1 and t.is_del ='1' ";
                "from base_menu_dict t  where 1=1 and t.is_del ='1' ";
        if (StringUtils.isNoneBlank(parentId)){
        if (StringUtils.isNoneBlank(parentId)){
            String str[]=parentId.split(",");
            String parentIds = "";
            for (int i=0;i<str.length;i++){
                parentIds +="'"+str[i]+"',";
            }
            parentIds.substring(0,parentIds.length()-1);
            sql+=" and t.parent_id in ("+parentIds+") ";
            sql+=" and t.parent_id='"+parentId+"' ";
        }
        }
        if (status!=null){
        if (status!=null){
            sql+=" and t.status="+status+"";
            sql+=" and t.status="+status+"";
        }
        }
        sql+="order by t.menu_sort asc";
        sql+=" order by t.menu_sort asc";
        System.out.print("sql"+sql);
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql);
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql);
        return list;
        return list;
    }
    }
    public MixEnvelop findArticleByMenuId(String menuId,Integer page,Integer pageSize){
    public MixEnvelop findArticleByMenuId(String menuId,Integer page,Integer pageSize){
        Pageable pageRequest = new PageRequest(page-1,pageSize);
        Pageable pageRequest = new PageRequest(page-1,pageSize);
        List<KnowledgeArticleDictDO> list=knowledgeArticleDictDao.findByCategorySecondAndPage(menuId,pageRequest);
        Integer count = knowledgeArticleDictDao.getCountByCategorySecond(menuId);
        List<String> menuIds = new ArrayList<>();
        if (StringUtils.isNoneBlank(menuId)){
            String str[]= menuId.split(",");
            for (int i=0;i<str.length;i++){
                menuIds.add(str[i]);
            }
        }
        System.out.print("menuId"+menuId);
        List<KnowledgeArticleDictDO> list=knowledgeArticleDictDao.findByCategorySecondAndPage(menuIds,pageRequest);
        Integer count = knowledgeArticleDictDao.getCountByCategorySecond(menuIds);
        MixEnvelop mixEnvelop = new MixEnvelop();
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setTotalCount(count);
        mixEnvelop.setTotalCount(count);
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setDetailModelList(list);

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

@ -117,7 +117,7 @@ spring:
  cloud:
  cloud:
    config:
    config:
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}
      uri: ${wlyy-spring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy-spring.config.label:jwdev}
      label: ${wlyy-spring.config.label:master}
---
---
spring:
spring:

+ 559 - 35
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/admin/AdminDoorCoachOrderController.java

@ -4,19 +4,28 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.endpoint.BaseController;
import com.yihu.jw.care.service.admin.AdminDoorCoachOrderService;
import com.yihu.jw.care.service.admin.AdminDoorCoachOrderService;
import com.yihu.jw.care.service.consult.ConsultTeamService;
import com.yihu.jw.care.service.doorCoach.DoctorDoorCoachOrderService;
import com.yihu.jw.care.service.doorCoach.DoctorDoorCoachOrderService;
import com.yihu.jw.care.service.doorCoach.PatientDoorCoachOrderService;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachConclusionDO;
import com.yihu.jw.entity.care.doorCoach.BaseDoorCoachOrderDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.ResponseContant;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.ArrayList;
import java.util.List;
import java.util.List;
import java.util.Map;
/***
/***
 * @ClassName: AdminDoorCoachOrderController
 * @ClassName: AdminDoorCoachOrderController
@ -24,17 +33,402 @@ import java.util.List;
 * @Auther: shi kejing
 * @Auther: shi kejing
 * @Date: 2021/8/31 14:38
 * @Date: 2021/8/31 14:38
 */
 */
//@RequestMapping(value = "/admin/doorCoach/serviceOrder", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RestController
@RestController
@RequestMapping(value = "/admin/doorCoach/serviceOrder", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RequestMapping(value = "/open/noLogin", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "管理员调度大屏")
@Api(description = "管理员调度大屏")
public class AdminDoorCoachOrderController extends EnvelopRestEndpoint {
public class AdminDoorCoachOrderController extends EnvelopRestEndpoint {
    @Autowired
    private PatientDoorCoachOrderService patientDoorCoachOrderService;
    @Autowired
    @Autowired
    private DoctorDoorCoachOrderService doctorDoorCoachOrderService;
    private DoctorDoorCoachOrderService doctorDoorCoachOrderService;
    @Autowired
    @Autowired
    private AdminDoorCoachOrderService adminDoorCoachOrderService;
    private ImService imService;
    @Autowired
    private ConsultTeamService consultTeamService;
    private BaseController baseController = new BaseController();
    private BaseController baseController = new BaseController();
    @Autowired
    private AdminDoorCoachOrderService adminDoorCoachOrderService;
    @GetMapping(value = "getServiceDynamic")
    @ApiOperation(value = "管理员调度实时动态")
    public String getServiceDynamic(
            @ApiParam(name = "page", value = "分页大小", required = true) @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true) @RequestParam(value = "size") int size) {
        try{
            return baseController.write(200,"查询成功","data",adminDoorCoachOrderService.getServiceDynamic(page,size));
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @PostMapping(value = "proxyCreate")
    @ApiOperation(value = "创建上门预约咨询--医生代预约")
    public String create(@ApiParam(name = "jsonData", value = "Json数据", required = true) @RequestParam String jsonData) {
        try{
            JSONObject result = patientDoorCoachOrderService.proxyCreate(jsonData,getUID());
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error(-1, result.getString(ResponseContant.resultMsg));
            }
            return baseController.write(200, "提交成功!","orderId",result.getString("orderId"));
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @GetMapping("/getDoorOrderNum")
    @ApiOperation(value = "获取医生待服务工单数量")
    public String getDoorOrderNum(
            @ApiParam(name = "doctor", value = "医生codedoctor")
            @RequestParam(value = "doctor", required = true) String doctor) {
        try {
            return  baseController.write(200, "获取成功", "data",doctorDoorCoachOrderService.getDoorOrderNum(doctor));
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @GetMapping(value = "queryDoctorListNotStopped")
    @ApiOperation(value = "服务人员列表(可接单状态的医生列表)")
    public String queryDoctorListWithNotStopped(
            @ApiParam(name = "hospital", value = "机构code", required = true) @RequestParam(value = "hospital") String hospital,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1") @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15") @RequestParam(value = "size") int size) {
        try{
            doctorDoorCoachOrderService.initDoorStatus(hospital);
            JSONObject result = patientDoorCoachOrderService.queryDoctorListWithNotStopped(hospital,page, size);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error(-1,result.getString(ResponseContant.resultMsg));
            }
            int count = result.getIntValue(ResponseContant.count);
            JSONObject object = new JSONObject();
            object.put("total",count);
            object.put("detailModelList",result.get(ResponseContant.resultMsg));
            object.put("currPage",page);
            object.put("pageSize",size);
            return baseController.write(200,"查询成功","data",object);
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @PostMapping(value = "sendOrderToDoctor")
    @ApiOperation(value = "调度员给医生派单")
    public String sendOrderToDoctor(
            @ApiParam(name = "orderId", value = "工单id") @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "remark", value = "调度员备注") @RequestParam(value = "remark", required = false) String remark,
            @ApiParam(name = "dispatcher", value = "调度员code") @RequestParam(value = "dispatcher", required = true) String dispatcher,
            @ApiParam(name = "dispathcherName", value = "调度员姓名") @RequestParam(value = "dispathcherName", required = true) String dispathcherName,
            @ApiParam(name = "doctor", value = "医生code") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = false) String doctorJobName) {
        try{
            JSONObject result = patientDoorCoachOrderService.sendOrderToDoctor(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error( -1,result.getString(ResponseContant.resultMsg));
            }
            return baseController.write(200,"派单成功","data",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @PostMapping(value = "transferOrder")
    @ApiOperation(value = "医生转派单")
    public String transferOrder(
            @ApiParam(name = "orderId", value = "工单id") @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "remark", value = "当前医生备注") @RequestParam(value = "remark", required = false) String remark,
            @ApiParam(name = "dispatcher", value = "当前医生code") @RequestParam(value = "dispatcher", required = true) String dispatcher,
            @ApiParam(name = "dispathcherName", value = "当前医生姓名") @RequestParam(value = "dispathcherName", required = true) String dispathcherName,
            @ApiParam(name = "doctor", value = "医生code") @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(name = "doctorName", value = "医生姓名") @RequestParam(value = "doctorName", required = true) String doctorName,
            @ApiParam(name = "doctorJobName", value = "医生职称") @RequestParam(value = "doctorJobName", required = false) String doctorJobName) {
        try{
            JSONObject result = patientDoorCoachOrderService.transferOrder(orderId, remark,dispatcher,dispathcherName, doctor, doctorName ,doctorJobName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error( -1,result.getString(ResponseContant.resultMsg));
            }
            return baseController.write(200,"派单成功","data",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @PostMapping("acceptOrder")
    @ApiOperation(value = "接单")
    public String acceptOrder(
            @ApiParam(value = "工单id", name = "orderId", required = true) @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "医生职称code", name = "jobCode", required = false) @RequestParam(value = "jobCode", required = false) String jobCode,
            @ApiParam(value = "医生职称", name = "jobCodeName", required = false) @RequestParam(value = "jobCodeName", required = false) String jobCodeName,
            @ApiParam(value = "医院级别", name = "hospitalLevel", required = false) @RequestParam(value = "hospitalLevel",defaultValue = "4",required = false) int hospitalLevel) {
        try {
            doctorDoorCoachOrderService.acceptOrder(orderId,jobCode,jobCodeName,hospitalLevel);
            return baseController.write(200, "操作成功");
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping("refuse")
    @ApiOperation(value = "拒单")
    public String refuseOrder(
            @ApiParam(value = "工单id", name = "orderId", required = true)
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "拒绝原因", name = "reason", required = false)
            @RequestParam(value = "reason", required = false) String reason) {
        try {
            doctorDoorCoachOrderService.refuseOrder(getUID(),orderId, reason);
            return baseController.write(200, "操作成功");
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping(value = "cancelOrder")
    @ApiOperation(value = "取消工单")
    public String cancelOrder(
            @ApiParam(name = "orderId", value = "工单id") @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "type", value = "取消类型:1-调度员主动取消,2-居民取消, 3-医生取消") @RequestParam(value = "type", required = true) int type,
            @ApiParam(name = "reason", value = "取消理由") @RequestParam(value = "reason", required = false) String reason,
            @ApiParam(name = "dispatcher", value = "取消工单的调度员(只允许调度员来操作)") @RequestParam(value = "dispatcher", required = false) String dispatcher,
            @ApiParam(name = "dispathcherName", value = "调度员姓名") @RequestParam(value = "dispathcherName", required = false) String dispatcherName) {
        try{
            JSONObject result = patientDoorCoachOrderService.cancelOrder(orderId, type, reason,dispatcher,dispatcherName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error(-1,result.getString(ResponseContant.resultMsg));
            }
            return baseController.write(200,"取消成功","data",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @PostMapping("signIn")
    @ApiOperation(value = "上门预约签到")
    public String signIn(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "签到时间", name = "signTime")
            @RequestParam(value = "signTime", required = false) String signTime,
            @ApiParam(value = "签到方式:1-定位,2-扫码,3-拍照,4-二维码", name = "signWay")
            @RequestParam(value = "signWay", required = false) Integer signWay,
            @ApiParam(value = "签到地址", name = "signLocation")
            @RequestParam(value = "signLocation", required = false) String signLocation,
            @ApiParam(value = "签到照片", name = "signImg")
            @RequestParam(value = "signImg", required = false) String signImg,
            @ApiParam(value = "二维码内容", name = "twoDimensionalCode")
            @RequestParam(value = "twoDimensionalCode", required = false) String twoDimensionalCode) {
        try {
            BaseDoorCoachOrderDO baseDoorCoachOrderDO = doctorDoorCoachOrderService.signIn(orderId, signTime, signWay, signLocation, signImg,twoDimensionalCode,getUID());
            if (baseDoorCoachOrderDO != null){
                return baseController.write(200, "操作成功", "data", baseDoorCoachOrderDO);
            }else {
                return baseController.error(-1,"扫码签到失败");
            }
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping("updateDoorConclusion")
    @ApiOperation("编辑保存服务工单小结")
    public String updateDoorConclusion(
            @ApiParam(value = "工单id", name = "orderId",required = true)
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "服务附件,至少一张,至多3张", name = "conclusionImg",required = false)
            @RequestParam(value = "conclusionImg", required = false) String conclusionImg,
            @ApiParam(value = "服务小结", name = "conclusion",required = false)
            @RequestParam(value = "conclusion", required = false) String conclusion,
            @ApiParam(value = "服务小结是否登记,1跳过登记;2-登记", name = "conclusionStatus")
            @RequestParam(value = "conclusionStatus", required = false,defaultValue = "2") Integer conclusionStatus) {
        try {
            BaseDoorCoachConclusionDO doorConclusion = doctorDoorCoachOrderService.updateDoorConclusion(orderId,conclusion,conclusionImg,conclusionStatus);
            return baseController.write(200, "保存成功", "data", doorConclusion);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @GetMapping("getDoorConclusion")
    @ApiOperation("获取服务工单小结")
    public String getDoorConclusion(
            @ApiParam(value = "医生code", name = "doctor")
            @RequestParam(value = "doctor", required = false) String doctor,
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = false) String orderId) {
        try {
            // 没有提供工单id的情况下,默认代入上一次服务信息记录
            if (StringUtils.isEmpty(orderId)) {
                orderId = doctorDoorCoachOrderService.getOrderIdByDoctor(doctor);
                if (StringUtils.isBlank(orderId)) {
                    return baseController.error(-1, "获取失败,该医生暂无工单" );
                }
            }
            // 根据orderId查询工单小结表
            BaseDoorCoachConclusionDO doorConclusion = doctorDoorCoachOrderService.getDoorConclusion(orderId);
            return baseController.write(200, "获取成功", "data", doorConclusion);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping("saveOrderFinishByDoctor")
    @ApiOperation(value = "确认完成工单")
    public String saveOrderFinishByDoctor(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "确认结束服务方式 1-电子签名,2-手持身份证拍照", name = "finishWay")
            @RequestParam(value = "finishWay", required = false) Integer finishWay,
            @ApiParam(value = "确认结束服务照片", name = "finishImg")
            @RequestParam(value = "finishImg", required = false) String finishImg) {
        try {
            return baseController.write(200, "获取成功", "data", doctorDoorCoachOrderService.saveOrderFinishByDoctor(orderId, finishWay, finishImg));
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping("updateArrivingTime")
    @ApiOperation(value = "修改预计到达时间")
    public String updateArrivingTime(
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(value = "医生预计到达时间", name = "arrivingTime")
            @RequestParam(value = "arrivingTime", required = true) String arrivingTime) {
        try {
            BaseDoorCoachOrderDO baseDoorCoachOrderDO = doctorDoorCoachOrderService.updateArrivingTime(orderId, arrivingTime);
            return baseController.write(200, "修改成功", "data", baseDoorCoachOrderDO);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @GetMapping("/topStatusBarNum")
    @ApiOperation(value = "顶部状态栏订单分类tab")
    public String topStatusBarNum(
            @ApiParam(name = "doctor", value = "医生code")
            @RequestParam(value = "doctor", required = true) String doctor) {
        try {
            Map<String, Integer> map = doctorDoorCoachOrderService.getNumGroupByStatus(doctor);
            return baseController.write(200, "获取成功", "data", map);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @RequestMapping(value = "message/getWaitingMessages",method = RequestMethod.GET)
    @ApiOperation("调度员获取服务工单待接单列表")
    public String getWaitingMessages(
            @ApiParam(name = "message",value = "消息对象")
            @RequestParam(value = "message")String message,
            @ApiParam(name="types",value="消息类型")
            @RequestParam(value="types",required = true) String types,
            @ApiParam(name="page",value="第几页",defaultValue = "1")
            @RequestParam(value="page",required = true) String page,
            @ApiParam(name="pageSize",value="",defaultValue = "10")
            @RequestParam(value="pageSize",required = true) String pageSize){
        if (org.apache.commons.lang3.StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
        if (page.equals("0")) {
            page = "1";
        }
        String[] split = org.apache.commons.lang3.StringUtils.split(types, ",");
        List<Integer> typeList = new ArrayList<>();
        for (String s : split) {
            typeList.add(Integer.valueOf(s));
        }
        SystemMessageDO message1 = new SystemMessageDO();
        com.alibaba.fastjson.JSONObject object = JSON.parseObject(message);
        message1.setOver(object.getString("over"));
        message1.setIsRead(object.get("read")+"");
        message1.setReceiver(getUID());
        try {
            org.json.JSONObject waitingMessages = doctorDoorCoachOrderService.getWaitingMessages(message1, types, Integer.valueOf(page), Integer.valueOf(pageSize));
            return baseController.write(200, "查询成功","data",waitingMessages);
        }catch (Exception e){
            return baseController.errorResult(e);
        }
    }
    @GetMapping("/getDoorOrderList")
    @ApiOperation(value = "服务工单列表")
    public String getDoorOrderList(
            @ApiParam(value = "工单服务编号", name = "orderId",required = false)
            @RequestParam(value = "orderId", required = false) String orderId,
            @ApiParam(value = "居民姓名", name = "patientName",required = false)
            @RequestParam(value = "patientName", required = false) String patientName,
            @ApiParam(value = "联系方式", name = "patientPhone",required = false)
            @RequestParam(value = "patientPhone", required = false) String patientPhone,
            @ApiParam(value = "服务机构", name = "hospitalCode",required = false)
            @RequestParam(value = "hospitalCode", required = false) String hospitalCode,
            @ApiParam(value = "工单状态", name = "status",required = false)
            @RequestParam(value = "status", required = false) Integer[] status,
            @ApiParam(value = "创建时间开始,格式(yyyy-MM-dd mm:dd:ss)", name = "createTimeStart",required = false)
            @RequestParam(value = "createTimeStart", required = false) String createTimeStart,
            @ApiParam(value = "创建时间结束,格式(yyyy-MM-dd mm:dd:ss)", name = "createTimeEnd",required = false)
            @RequestParam(value = "createTimeEnd", required = false) String createTimeEnd,
            @ApiParam(value = "服务医生的名称", name = "serverDoctorName",required = false)
            @RequestParam(value = "serverDoctorName", required = false) String serverDoctorName,
            @ApiParam(value = "医生的code", name = "doctorCode",required = false)
            @RequestParam(value = "doctorCode", required = false) String doctorCode,
            @ApiParam(value = "角色0、医生,1、管理员", name = "isManage",required = false)
            @RequestParam(value = "isManage", required = false) String isManage,
            @ApiParam(value = "发起类型(1本人发起 2家人待预约 3医生代预约)", name = "type")
            @RequestParam(value = "type", required = false) Integer type,
            @ApiParam(value = "页码", name = "page",defaultValue = "1",required = true)
            @RequestParam(value = "page", required = true) Integer page,
            @ApiParam(value = "每页数目", name = "pageSize",defaultValue = "10",required = true)
            @RequestParam(value = "pageSize", required = true) Integer pageSize) {
        try {
            if(StringUtils.isEmpty(isManage)){
                isManage = baseController.getCurrentRoleIsManange();
            }
            if("0".equals(isManage)){
                if(StringUtils.isEmpty(doctorCode)){
                    doctorCode=getUID();
                }
            }else if ("1".equals(isManage) && StringUtils.isBlank(hospitalCode)){
                //如果是管理员并且未筛选机构,就默认展示其管理下所有机构
                String level = baseController.getCurrentRoleLevel();
                String currentRoleCode = baseController.getCurrentRoleCode();
                if(level.equals("2")) {
                    //市管理员
                    hospitalCode = currentRoleCode.substring(0, currentRoleCode.length() - 2) + "%";
                }else if(level.equals("3")){
                    //区管理员
                    hospitalCode = currentRoleCode + "%";
                }else if (level.equals("4")){
                    //机构管理员
                    hospitalCode = currentRoleCode;
                }
            }else if(StringUtils.isNotBlank(hospitalCode) && hospitalCode.length() < 10 ){
                hospitalCode += "%";
            }
            StringBuffer ss = new StringBuffer();
            if (status != null && status.length > 0){
                int statusLength = status.length;
                for (int i =0 ; i < statusLength ; i++){
                    ss .append(status[i]);
                    if (i<statusLength-1){
                        ss.append(",");
                    }
                }
            }else {
                ss = null;
            }
            JSONObject result = doctorDoorCoachOrderService.getDoorOrderList(orderId,patientName,patientPhone,hospitalCode,
                    ss,createTimeStart,createTimeEnd,serverDoctorName,doctorCode,page,pageSize, type);
            return baseController.write(200, "获取成功","data",result);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @GetMapping(value = "queryBriefList")
    @GetMapping(value = "queryBriefList")
    @ApiOperation(value = "调度员查询工单列表")
    @ApiOperation(value = "调度员查询工单列表")
@ -63,6 +457,7 @@ public class AdminDoorCoachOrderController extends EnvelopRestEndpoint {
        }catch (Exception e){
        }catch (Exception e){
            return baseController.errorResult(e);
            return baseController.errorResult(e);
        }
        }
    }
    }
    @GetMapping(value = "queryDoctorList")
    @GetMapping(value = "queryDoctorList")
@ -95,53 +490,182 @@ public class AdminDoorCoachOrderController extends EnvelopRestEndpoint {
        }catch (Exception e){
        }catch (Exception e){
            return baseController.errorResult(e);
            return baseController.errorResult(e);
        }
        }
    }
    }
    @RequestMapping(value = "message/getWaitingMessages",method = RequestMethod.GET)
    @ApiOperation("调度员获取服务工单待接单列表")
    public String getWaitingMessages(
            @ApiParam(name = "message",value = "消息对象")
            @RequestParam(value = "message")String message,
            @ApiParam(name="types",value="消息类型")
            @RequestParam(value="types",required = true) String types,
            @ApiParam(name="page",value="第几页",defaultValue = "1")
            @RequestParam(value="page",required = true) String page,
            @ApiParam(name="pageSize",value="",defaultValue = "10")
            @RequestParam(value="pageSize",required = true) String pageSize){
        if (org.apache.commons.lang3.StringUtils.isBlank(pageSize)) {
            pageSize = "10";
    @GetMapping("getByOrderId")
    @ApiOperation(value = "根据工单id获取相应的工单,如果为空,则获取该医生当前最新一条的工单")
    public String getByOrderId(
            @ApiParam(value = "医生code", name = "doctor")
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(value = "工单id", name = "orderId")
            @RequestParam(value = "orderId", required = false) String orderId) {
        try {
            // 没有提供工单id的情况下,则获取该医生当前最新一条的工单
            if (StringUtils.isEmpty(orderId)) {
                // 根据接单医生code获取最近一次服务orderId
                orderId = doctorDoorCoachOrderService.getOrderIdByDoctor(doctor);
                if (StringUtils.isBlank(orderId)) {
                    return baseController.error(-1, "获取失败, 该医生暂无工单" );
                }
            }
            // 根据orderId获取工单信息
            BaseDoorCoachOrderDO baseDoorCoachOrderDO = doctorDoorCoachOrderService.getDoorServiceOrderById(orderId);
            return baseController.write(200, "获取成功", "data", baseDoorCoachOrderDO);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
        }
        if (page.equals("0")) {
            page = "1";
    }
    @PostMapping(value = "payOrder")
    @ApiOperation(value = "医生确认付款")
    public ObjEnvelop payOrder(
            @ApiParam(name = "orderId", value = "工单id") @RequestParam(value = "orderId", required = true) String orderId,
            @ApiParam(name = "payWay", value = "支付方式:1-微信支付,2-线下支付") @RequestParam(value = "payWay", required = false,defaultValue = "2") int payWay) {
        try {
            return ObjEnvelop.getSuccess("操作成功",doctorDoorCoachOrderService.payOrder(orderId, payWay));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
        }
        String[] split = org.apache.commons.lang3.StringUtils.split(types, ",");
        List<Integer> typeList = new ArrayList<>();
        for (String s : split) {
            typeList.add(Integer.valueOf(s));
    }
    /**
     * 获取服务项目
     *
     * @param hospital
     * @return
     */
    @GetMapping("selectItemsByHospital")
    @ApiOperation(value = "获取服务项目")
    public String selectItemsByHospital(
            @ApiParam(value = "机构code", name = "hospital")
            @RequestParam(value = "hospital", required = false) String hospital,
            @ApiParam(value = "服务项目名称", name = "serverItemName")
            @RequestParam(value = "serverItemName", required = false) String serverItemName) {
        try {
            return baseController.write(200, "获取成功","dara",patientDoorCoachOrderService.selectItemsByHospital(hospital,serverItemName));
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
        }
        SystemMessageDO message1 = new SystemMessageDO();
        com.alibaba.fastjson.JSONObject object = JSON.parseObject(message);
        message1.setOver(object.getString("over"));
        message1.setIsRead(object.get("read")+"");
        message1.setReceiver(getUID());
    }
    @PostMapping("/initDoorStatus")
    @ApiOperation(value = "初始化医生分派订单开关状态")
    public String initDoorStatus() {
        try {
        try {
            org.json.JSONObject waitingMessages = doctorDoorCoachOrderService.getWaitingMessages(message1, types, Integer.valueOf(page), Integer.valueOf(pageSize));
            return baseController.write(200, "查询成功","data",waitingMessages);
            doctorDoorCoachOrderService.initDoorStatus(null);
            return baseController.success("成功");
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @GetMapping("/getDispatchOrderSwitch")
    @ApiOperation(value = "获取医生分派订单开关状态")
    public String getDispatchOrderSwitch(
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", required = true) String doctor) {
        try {
            String status = doctorDoorCoachOrderService.findDispatchStatusByDoctor(doctor);
            return baseController.write(200, "获取成功", "data", status);
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping("/dispatchOrderSwitch")
    @ApiOperation(value = "分派订单开关修改")
    public String dispatchOrderSwitch(
            @ApiParam(name = "doctor", value = "医生code")
            @RequestParam(value = "doctor", required = true) String doctor,
            @ApiParam(value = "开关值,5关闭 1开启", name = "value")
            @RequestParam(value = "value", required = true) Integer value) {
        try {
            doctorDoorCoachOrderService.updateDispatchStatusByDoctor(doctor, value);
            return baseController.write(200, "修改成功");
        } catch (Exception e) {
            return baseController.errorResult(e);
        }
    }
    @PostMapping(value = "dispatcherIntoTopic")
    @ApiOperation(value = "调度员进入会话")
    public ObjEnvelop dispatcherIntoTopic(
            @ApiParam(name = "orderId", value = "工单id", required = true) @RequestParam String orderId,
            @ApiParam(name = "hospitalName", value = "机构名称", required = true) @RequestParam String hospitalName,
            @ApiParam(name = "dispatcher", value = "调度员code", required = true) @RequestParam String dispatcher,
            @ApiParam(name = "dispatcherName", value = "调度员姓名", required = true) @RequestParam  String dispatcherName
    ) {
        try{
            JSONObject result = patientDoorCoachOrderService.dispatcherIntoTopic(orderId,hospitalName,dispatcher,dispatcherName);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return ObjEnvelop.getError(result.getString(ResponseContant.resultMsg));
            }
            return ObjEnvelop.getSuccess("转接成功",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @RequestMapping(value = "/urlAnalysis",produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    @ApiOperation("门牌解析上门地址")
    @ResponseBody
    public String urlAnalysis(@ApiParam(name = "url", value = "地址解析", defaultValue = "")
                              @RequestParam(value = "url", required = true)String url)throws Exception {
        try {
            return baseController.write(200, "操作成功!","data",doctorDoorCoachOrderService.urlAnalysis(url));
        }catch (Exception e){
        }catch (Exception e){
            //日志文件中记录异常信息
            //返回接口异常信息处理结果
            return baseController.errorResult(e);
            return baseController.errorResult(e);
        }
        }
    }
    }
    @GetMapping(value = "getServiceDynamic")
    @ApiOperation(value = "管理员调度实时动态")
    public String getServiceDynamic(
            @ApiParam(name = "page", value = "分页大小", required = true) @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true) @RequestParam(value = "size") int size) {
    @GetMapping(value = BaseHospitalRequestMapping.DodtorIM.getConsultInfoAndPatientInfo)
    @ApiOperation(value = "获取咨询问题,图片,居民信息", notes = "获取咨询问题,图片,居民信息")
    public ObjEnvelop getConsultInfoAndPatientInfo(
            @ApiParam(name = "consult", value = "咨询CODE")
            @RequestParam(value = "consult",required = false) String consult,
            @ApiParam(name = "patientCode", value = "居民COEE")
            @RequestParam(value = "patientCode",required = false) String patientCode){
        try {
            return ObjEnvelop.getSuccess("请求成功", imService.getConsultInfoAndPatientInfo(consult, patientCode));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @RequestMapping(value = "queryByConsultCode",method = RequestMethod.GET)
    @ApiOperation("根据咨询code查询关联业务项详情")
    public ObjEnvelop queryByConsultCode(@ApiParam(name = "code", value = "咨询code") @RequestParam(value = "code", required = true) String code,
                                         @ApiParam(name = "type", value = "咨询类型") @RequestParam(value = "type", required = true) Integer type){
        try{
        try{
            return baseController.write(200,"查询成功","data",adminDoorCoachOrderService.getServiceDynamic(page,size));
            JSONObject detail = consultTeamService.queryByConsultCode(code,type);
            return ObjEnvelop.getSuccess("查询成功", detail.get("data"));
        }catch (Exception e){
            return failedObjEnvelopException2(e);
        }
    }
    @PostMapping(value = "updateOrderCardInfo")
    @ApiOperation(value = "更新预约简要信息")
    public String updateOrderCardInfo(
            @ApiParam(name = "jsonData", value = "json数据") @RequestParam(value = "jsonData", required = true) String jsonData) {
        try{
            JSONObject result = patientDoorCoachOrderService.updateOrderCardInfo(jsonData);
            if (result.getIntValue(ResponseContant.resultFlag) == ResponseContant.fail) {
                return baseController.error(-1,result.getString(ResponseContant.resultMsg));
            }
            return baseController.write(200,"保存成功","data",result.get(ResponseContant.resultMsg));
        }catch (Exception e){
        }catch (Exception e){
            return baseController.errorResult(e);
            return baseController.errorResult(e);
        }
        }
    }
    }
}
}

+ 2 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/family/FamilyMemberEndpoint.java

@ -383,6 +383,8 @@ public class FamilyMemberEndpoint extends EnvelopRestEndpoint {
                return failed( "验证码已过期,请重新获取验证码",-1);
                return failed( "验证码已过期,请重新获取验证码",-1);
            }else if (result == -7) {
            }else if (result == -7) {
                return failed( "您或家人性别信息未填写无法添加成员",-1);
                return failed( "您或家人性别信息未填写无法添加成员",-1);
            }else if (result == -8) {
                return failed( "不能添加非老人亲属类型的成员",-1);
            } else {
            } else {
                return success( "添加成功");
                return success( "添加成功");
            }
            }

+ 1 - 1
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/admin/AdminDoorCoachOrderService.java

@ -23,7 +23,7 @@ public class AdminDoorCoachOrderService {
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    public List<Map<String , Object>> getServiceDynamic(Integer page,Integer size){
    public List<Map<String , Object>> getServiceDynamic(Integer page,Integer size){
        size = (page-1)*size;
        page = (page-1)*size;
        String sql = "SELECT * FROM base_admin_service_dynamic ORDER BY create_time DESC LIMIT "+page+","+size+"";
        String sql = "SELECT * FROM base_admin_service_dynamic ORDER BY create_time DESC LIMIT "+page+","+size+"";
        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String , Object>> list = jdbcTemplate.queryForList(sql);
        return list;
        return list;

+ 7 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/family/PatientFamilyMemberService.java

@ -856,6 +856,13 @@ public class PatientFamilyMemberService extends BaseJpaService<BasePatientFamily
            patientDao.save(m);
            patientDao.save(m);
        }
        }
        member = m.getId();
        member = m.getId();
        if(archiveType==3){
            if(m.getArchiveType()==null){
                m.setArchiveType(archiveType);
            }else if(m.getArchiveType()!=3){
                return -8;
            }
        }
        return addMemberFamily(p, m, patient, member, relation);
        return addMemberFamily(p, m, patient, member, relation);
    }
    }

+ 12 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -135,6 +135,18 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
    public JSONObject findPatientById(String patientId,String isCapacity) throws Exception{
    public JSONObject findPatientById(String patientId,String isCapacity) throws Exception{
        JSONObject res = new JSONObject();
        JSONObject res = new JSONObject();
        BasePatientDO patientDO = patientDao.findById(patientId);
        BasePatientDO patientDO = patientDao.findById(patientId);
        if(patientDO.getArchiveType()!=null&&patientDO.getArchiveType()==3){
            //老人亲属
            String sql = "SELECT p.* from base_patient p, base_patient_family_member m " +
                    "WHERE p.id = m.family_member  and m.patient = '"+patientId+"' and p.del = '1' " +
                    "ORDER BY p.login_date desc LIMIT 1";
            List<BasePatientDO> patientDOs = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(BasePatientDO.class));
            res.put("agentPatient",patientDO);
            patientDO = patientDOs.get(0);
            patientId = patientDO.getId();
        }else{
            res.put("agentPatient",null);
        }
        if (patientDO.getArchiveStatus()!=null){
        if (patientDO.getArchiveStatus()!=null){
            patientDO.setArchiveStatusName(dictService.fingByNameAndCode(ConstantUtil.DICT_ARCHIVESTATUS,String.valueOf(patientDO.getArchiveStatus())));
            patientDO.setArchiveStatusName(dictService.fingByNameAndCode(ConstantUtil.DICT_ARCHIVESTATUS,String.valueOf(patientDO.getArchiveStatus())));
        }
        }

+ 83 - 0
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/util/OneNetUtil.java

@ -0,0 +1,83 @@
package com.yihu.jw.care.util;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/9/2
 * @Description:
 */
public class OneNetUtil {
    private static final String MasterAPIkey ="Da0iDvhQ5H8OD6phWq=tMubBcBw=";
    private static final String access_key  ="WikrY0Zy/BB308DZhplru4Mc65OijFqH35nMEh4xre0=";
    public static String assembleToken(String version, String resourceName, String expirationTime, String signatureMethod, String accessKey)
            throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException {
        StringBuilder sb = new StringBuilder();
        String res = URLEncoder.encode(resourceName, "UTF-8");
        String sig = URLEncoder.encode(generatorSignature(version, resourceName, expirationTime
                , accessKey, signatureMethod), "UTF-8");
        sb.append("version=")
                .append(version)
                .append("&res=")
                .append(res)
                .append("&et=")
                .append(expirationTime)
                .append("&method=")
                .append(signatureMethod)
                .append("&sign=")
                .append(sig);
        return sb.toString();
    }
    public static String generatorSignature(String version, String resourceName, String expirationTime, String accessKey, String signatureMethod)
            throws NoSuchAlgorithmException, InvalidKeyException {
        String encryptText = expirationTime + "\n" + signatureMethod + "\n" + resourceName + "\n" + version;
        String signature;
        byte[] bytes = HmacEncrypt(encryptText, accessKey, signatureMethod);
        signature = Base64.getEncoder().encodeToString(bytes);
        return signature;
    }
    public static byte[] HmacEncrypt(String data, String key, String signatureMethod)
            throws NoSuchAlgorithmException, InvalidKeyException {
        //根据给定的字节数组构造一个密钥,第二参数指定一个密钥算法的名称
        SecretKeySpec signinKey = null;
        signinKey = new SecretKeySpec(Base64.getDecoder().decode(key),
                "Hmac" + signatureMethod.toUpperCase());
        //生成一个指定 Mac 算法 的 Mac 对象
        Mac mac = null;
        mac = Mac.getInstance("Hmac" + signatureMethod.toUpperCase());
        //用给定密钥初始化 Mac 对象
        mac.init(signinKey);
        //完成 Mac 操作
        return mac.doFinal(data.getBytes());
    }
    public enum SignatureMethod {
        SHA1, MD5, SHA256;
    }
    public static void main(String[] args) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException {
        String version = "2018-10-31";
        String resourceName = "mqs/A1EB10110CFA9E06D6209E40C4A6D7976";
        String expirationTime = System.currentTimeMillis() / 1000 + 100 * 24 * 60 * 60 + "";
        String signatureMethod = SignatureMethod.SHA1.name().toLowerCase();
        String accessKey = "KuF3NT/jUBJ62LNBB/A8XZA9CqS3Cu79B/ABmfA1UCw=";
        String token = assembleToken(version, resourceName, expirationTime, signatureMethod, accessKey);
        System.out.println("Authorization:" + token);
    }
}

+ 143 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/gateway/GcTokenController.java

@ -0,0 +1,143 @@
package com.yihu.jw.hospital.endpoint.gateway;
import com.yihu.jw.entity.iot.gateway.GcClientDetails;
import com.yihu.jw.entity.iot.gateway.GcHttpLog;
import com.yihu.jw.entity.iot.gateway.GcToken;
import com.yihu.jw.gateway.dao.GcHttpLogDao;
import com.yihu.jw.gateway.service.GcClientDetailsService;
import com.yihu.jw.gateway.service.GcTokenService;
import com.yihu.jw.hospital.endpoint.gateway.model.BaseResultModel;
import com.yihu.jw.hospital.endpoint.gateway.model.GcClientDetailsModel;
import com.yihu.jw.hospital.endpoint.gateway.model.GcTokenModel;
import com.yihu.jw.hospital.endpoint.gateway.model.ResultOneModel;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.jw.util.common.IpUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONObject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Date;
import java.util.List;
/**
 * Created by chenweida on 2017/8/17.
 * 对外的网关
 */
@Controller
@RequestMapping(value = IotRequestMapping.Common.openThird, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody
@Api(description = "token相关服务")
public class GcTokenController {
    @Autowired
    private GcTokenService gcTokenService;
    @Autowired
    private GcClientDetailsService clientDetailsService;
    @Autowired
    private GcHttpLogDao httpLogDao;
    @Value("${interceptor.accesstoken.time}")
    private Integer tokenTime;
    @ApiOperation("获取accesstoken")
    @RequestMapping(value = "accesstoken", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    public ResultOneModel<GcTokenModel> getToken(
            @ApiParam(name = "appid", value = "appid", required = true) @RequestParam(required = true, value = "appid") String appid,
            @ApiParam(name = "appSecret", value = "appSecret", required = true) @RequestParam(required = true, value = "appSecret") String appSecret,
            @ApiParam(name = "过期时间 yyyy-MM-dd", value = "overTime", required = false) @RequestParam(required = false, value = "overTime") String overTime,
            HttpServletRequest request) {
        String ip = "";
        try {
            ip = IpUtil.getIpAddress(request);
            //查询appId 的token是否过期
            GcToken gcToken = new GcToken();
            List<GcToken> gcTokenList = gcTokenService.findByAppId(appid);
            if(gcTokenList == null || gcTokenList.size() == 0){
                //得到用户
                GcClientDetails clientDetails = clientDetailsService.findByAppId(appid);
                if (clientDetails == null) {
                    ResultOneModel resultOneModel = new ResultOneModel(null);
                    resultOneModel.setStatus(BaseResultModel.statusEm.error_Appid.getCode());
                    resultOneModel.setMessage(BaseResultModel.statusEm.error_Appid.getMessage());
                    saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.statusEm.error_Appid.getMessage());
                    return resultOneModel;
                }
                //判断appSecret
                if (!appSecret.equals(clientDetails.getAppSecret())) {
                    ResultOneModel resultOneModel = new ResultOneModel(null);
                    resultOneModel.setStatus(BaseResultModel.statusEm.error_AppSecret.getCode());
                    resultOneModel.setMessage(BaseResultModel.statusEm.error_AppSecret.getMessage());
                    saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.statusEm.error_Appid.getMessage());
                    return resultOneModel;
                }
                //生成token
                try {
                    gcToken = gcTokenService.createToken(appid, appSecret, IpUtil.getIpAddress(request),overTime,tokenTime);
                    saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), new JSONObject(gcToken).toString(), gcToken.getAccesstoken(), request.getRequestURI(), 1, "成功");
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }else {
                gcToken = gcTokenList.get(0);
            }
            GcTokenModel gcTokenModel = new GcTokenModel();
            BeanUtils.copyProperties(gcToken, gcTokenModel);
            gcTokenModel.setOutTime(gcToken.getOutTime().getTime());
            return new ResultOneModel(gcTokenModel);
        } catch (Exception e) {
            saveHttpLog(ip, new JSONObject(request.getParameterMap()).toString(), "", "", request.getRequestURI(), 0, BaseResultModel.statusEm.login_system_error.getMessage());
            return new ResultOneModel(BaseResultModel.statusEm.login_system_error.getCode(), BaseResultModel.statusEm.login_system_error.getMessage());
        }
    }
    @ApiOperation("生成appId,appSecret")
    @RequestMapping(value = "createGcClientDetails", method = RequestMethod.POST)
    public ResultOneModel<GcClientDetailsModel> createClientDetails(
            @ApiParam(name = "appUri", value = "appUri", required = false) @RequestParam(required = false, value = "appUri") String appUri,
            @ApiParam(name = "createUserName", value = "createUserName", required = false) @RequestParam(required = false, value = "createUserName") String createUserName,
            @ApiParam(name = "creatieUser", value = "creatieUser", required = false) @RequestParam(required = false, value = "creatieUser") String creatieUser,
            @ApiParam(name = "remark", value = "remark", required = false) @RequestParam(required = false, value = "remark") String remark
    ){
        try {
            GcClientDetails gcClientDetails = clientDetailsService.createClientDetails(appUri,createUserName,creatieUser,remark);
            if(gcClientDetails==null){
                return new ResultOneModel(BaseResultModel.statusEm.login_system_error.getCode(), BaseResultModel.statusEm.login_system_error.getMessage());
            }
            GcClientDetailsModel gcClientDetailsModel = new GcClientDetailsModel();
            BeanUtils.copyProperties(gcClientDetails, gcClientDetailsModel);
            return new ResultOneModel(gcClientDetailsModel);
        }catch (Exception e) {
            return new ResultOneModel(BaseResultModel.statusEm.login_system_error.getCode(), BaseResultModel.statusEm.login_system_error.getMessage());
        }
    }
    private void saveHttpLog(String ip, String input, String output, String token, String method, Integer flag, String message) {
        GcHttpLog gcHttpLog = new GcHttpLog();
        gcHttpLog.setCreateTime(new Date());
        gcHttpLog.setIp(ip);
        gcHttpLog.setInput(input);
        if(output.length() > 3000) {
            output = output.substring(0, 3000);
        }
        gcHttpLog.setOutput(output);
        gcHttpLog.setToken(token);
        gcHttpLog.setMethod(method);
        gcHttpLog.setFlag(flag);
        gcHttpLog.setMessage(message);
        httpLogDao.save(gcHttpLog);
    }
}

+ 98 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/gateway/model/BaseResultModel.java

@ -0,0 +1,98 @@
package com.yihu.jw.hospital.endpoint.gateway.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel("返回实体")
public class BaseResultModel {
    @ApiModelProperty(value = "状态", required = false, access = "response")
    protected Integer status = statusEm.success.getCode();
    @ApiModelProperty(value = "信息", required = false, access = "response")
    protected String message = "成功";
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public enum statusEm {
        success(10000, "请求成功"),//请求成功
        error_Appid(40004, "appid不存在"),//appid不存在
        error_AppSecret(40001, "AppSecret不存在"),//AppSecret不存在
        token_out_effect(-9002, "无效的token"),//token无效
        token_no_power(-9003, "用户没权限"),// 没权限 包括未授权 或者uri错误
        token_out_time(-9004, "accesstoken已过期"),//token无效
        token_null(-9005, "accesstoken为空"),// 没权限 包括未授权 或者uri错误
        error_params(-10000, "请求失败 参数错误"),//请求失败 参数错误
        error_no_ip(-10010, "请求失败,获取IP失败"),//请求失败,获取IP失败
        login_system_error(-10020, "系统异常"),
        login_publickey_error(-10030, "获取公钥失败"),
        file_upload_error(-10040, "文件上传失败"),
        find_error(-10050, "查询失败"),
        opera_error(-10060, "操作失败"),
        no_openid(-30000,"用户openId为空无法发送"),
        login_account_error(-20010, "账号不存在"),
        login_password_error(-20020, "密码错误"),
        login_IMEI_error(-20030, "获取imei失败");
        ;
        statusEm(Integer code, String message) {
            this.code = code;
            this.message = message;
        }
        private Integer code;
        private String message;
        public Integer getCode() {
            return code;
        }
        public void setCode(Integer code) {
            this.code = code;
        }
        public String getMessage() {
            return message;
        }
        public void setMessage(String message) {
            this.message = message;
        }
    }
    public BaseResultModel() {
    }
    public BaseResultModel(String message) {
        this.message = message;
    }
    public BaseResultModel(Integer status, String message) {
        this.status = status;
        this.message = message;
    }
}

+ 33 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/gateway/model/GcClientDetailsModel.java

@ -0,0 +1,33 @@
package com.yihu.jw.hospital.endpoint.gateway.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * GtClientDetails entity. @author MyEclipse Persistence Tools
 */
@ApiModel(description = "")
public class GcClientDetailsModel{
    // Fields
    @ApiModelProperty(value = "appId", required = false, access = "response")
    private String appId;
    @ApiModelProperty(value = "appSecret", required = false, access = "response")
    private String appSecret;
    public String getAppId() {
        return appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    public String getAppSecret() {
        return appSecret;
    }
    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }
}

+ 51 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/gateway/model/GcTokenModel.java

@ -0,0 +1,51 @@
package com.yihu.jw.hospital.endpoint.gateway.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by chenweida on 2017/8/17.
 */
@ApiModel(description = "")
public class GcTokenModel {
    @ApiModelProperty(value = "请求凭证", required = false, access = "response")
    private String accesstoken;
    @ApiModelProperty(value = "创建时间", required = false, access = "response")
    private Date createTime;
    @ApiModelProperty(value = "过期时间", required = false, access = "response")
    private Long outTime;
    public String getAccesstoken() {
        return accesstoken;
    }
    public void setAccesstoken(String accesstoken) {
        this.accesstoken = accesstoken;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    /*public Date getOutTime() {
        return outTime;
    }
    public void setOutTime(Date outTime) {
        this.outTime = outTime;
    }*/
    public Long getOutTime() {
        return outTime;
    }
    public void setOutTime(Long outTime) {
        this.outTime = outTime;
    }
}

+ 39 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/gateway/model/ResultOneModel.java

@ -0,0 +1,39 @@
package com.yihu.jw.hospital.endpoint.gateway.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2017/8/17.
 * 对外放回的实体
 */
@ApiModel("返回的实体类")
public class ResultOneModel<T> extends BaseResultModel {
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private T result;
    public T getResult() {
        return result;
    }
    public void setResult(T result) {
        this.result = result;
    }
    public ResultOneModel(T result) {
        this.result = result;
    }
    public ResultOneModel() {
    }
    public ResultOneModel(Integer code, String message) {
        super(code, message);
    }
    public ResultOneModel(Integer status, String message, T result) {
        super(status, message);
        this.result = result;
    }
}

+ 1 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/thirdUpload/ThirdUploadEndpoint.java

@ -25,7 +25,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.List;
@RestController
@RestController
@RequestMapping(value = BaseRegulatoryRequestMapping.UpWebTherapySupserviceInfo.PREFIX)     //请求地址前缀  /regulatory
@RequestMapping(value = BaseHospitalRequestMapping.UpWebTherapySupserviceInfo.PREFIX)     //请求地址前缀  /regulatory
@Api(value = "监管平台数据增删改查", description = "监管平台数据增删改查", tags = {"监管平台数据增删改查"})
@Api(value = "监管平台数据增删改查", description = "监管平台数据增删改查", tags = {"监管平台数据增删改查"})
public class ThirdUploadEndpoint extends EnvelopRestEndpoint {
public class ThirdUploadEndpoint extends EnvelopRestEndpoint {
    @Autowired
    @Autowired

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

@ -74,6 +74,12 @@ fast-dfs:
configDefault: # 默认配置
configDefault: # 默认配置
  saasId: xmjkzl_saasId
  saasId: xmjkzl_saasId
##拦截器开关
interceptor:
  accesstoken:
    status: 1 ###  1开启 0 关闭
    time: 2 ##对外接的accesstoken生命周期 2小时
---
---
spring:
spring:
  profiles: jwdev
  profiles: jwdev