瀏覽代碼

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

Shi Kejing 4 年之前
父節點
當前提交
c36c898a63
共有 92 個文件被更改,包括 4517 次插入581 次删除
  1. 12 0
      business/base-service/pom.xml
  2. 4 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorMessageDao.java
  3. 9 4
      business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java
  4. 136 0
      business/base-service/src/main/java/com/yihu/jw/file_upload/FileManageService.java
  5. 19 5
      business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/service/BaseDoctorBGService.java
  6. 4 0
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseBannerDoctorDao.java
  7. 2 1
      business/base-service/src/main/java/com/yihu/jw/hospital/message/dao/BaseUserMessageDao.java
  8. 331 107
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerDoctorService.java
  9. 116 23
      business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseUserMsgService.java
  10. 7 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java
  11. 2 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java
  12. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionExpressageDao.java
  13. 14 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionSignDao.java
  14. 72 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PayInfoNoticeService.java
  15. 341 83
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  16. 14 6
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  17. 50 30
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java
  18. 152 45
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  19. 10 0
      business/base-service/src/main/java/com/yihu/jw/hospital/suggest/dao/BaseSuggestionDao.java
  20. 16 0
      business/base-service/src/main/java/com/yihu/jw/hospital/suggest/dao/BaseSuggestionDictDao.java
  21. 184 0
      business/base-service/src/main/java/com/yihu/jw/hospital/suggest/service/BaseSuggestionDictService.java
  22. 99 0
      business/base-service/src/main/java/com/yihu/jw/hospital/suggest/service/BaseSuggestionService.java
  23. 3 9
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java
  24. 123 25
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  25. 103 1
      business/base-service/src/main/java/com/yihu/jw/order/pay/ylz/YlzPayService.java
  26. 15 0
      business/base-service/src/main/java/com/yihu/jw/utils/AdminException.java
  27. 47 0
      business/base-service/src/main/java/com/yihu/jw/utils/FileUtil.java
  28. 96 0
      business/base-service/src/main/java/com/yihu/jw/utils/Pkis/PKIServiceProxy.java
  29. 481 0
      business/base-service/src/main/java/com/yihu/jw/utils/Pkis/PKIServiceSoapBindingStub.java
  30. 19 0
      business/base-service/src/main/java/com/yihu/jw/utils/Pkis/PKIService_PortType.java
  31. 16 0
      business/base-service/src/main/java/com/yihu/jw/utils/Pkis/PKIService_Service.java
  32. 142 0
      business/base-service/src/main/java/com/yihu/jw/utils/Pkis/PKIService_ServiceLocator.java
  33. 26 0
      business/base-service/src/main/java/com/yihu/jw/utils/sfutils/MyErrorCode.java
  34. 16 16
      business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java
  35. 30 30
      business/es-service/src/main/java/com/yihu/jw/es/util/ElasticsearchUtil.java
  36. 122 23
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  37. 2 1
      business/im-service/src/main/java/com/yihu/jw/im/util/ImUtil.java
  38. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/IntegerIdentityEntity.java
  39. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  40. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorMessageDO.java
  41. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/version/AppVersionDO.java
  42. 8 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyInspectionDO.java
  43. 11 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  44. 15 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java
  45. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageLogDO.java
  46. 64 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionSignDO.java
  47. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkEmrJcsqDO.java
  48. 1 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkMsYj01DO.java
  49. 8 8
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkMsYj02DO.java
  50. 201 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/suggest/BaseSuggestionDO.java
  51. 84 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/suggest/BaseSuggestionDictDO.java
  52. 11 1
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanDO.java
  53. 94 0
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/RehabilitationTemplateDetailDO.java
  54. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  55. 29 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  56. 73 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/MutilFileInfo.java
  57. 9 7
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyHisPrescriptionVO.java
  58. 14 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/web/ListEnvelop.java
  59. 33 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  60. 9 6
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  61. 32 21
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java
  62. 15 5
      svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java
  63. 17 0
      svr/svr-base/src/main/java/com/yihu/jw/base/util/ExceptionHandler.java
  64. 23 0
      svr/svr-base/src/main/java/com/yihu/jw/base/util/ExceptionResult.java
  65. 1 1
      svr/svr-base/src/main/resources/application.yml
  66. 1 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/MqSdkController.java
  67. 16 11
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  68. 2 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/Application.java
  69. 74 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/DoctorTimeOutTipsJob.java
  70. 27 17
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/PrescriptionStatusUpdateService.java
  71. 129 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/util/AutoTimeOutRemind.java
  72. 29 1
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java
  73. 8 4
      svr/svr-internet-hospital-job/src/main/resources/application.yml
  74. 3 1
      svr/svr-internet-hospital-job/src/main/resources/system.properties
  75. 18 8
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  76. 3 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  77. 68 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/file_upload/FileUploadEndpoint.java
  78. 7 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseDoctorBGController.java
  79. 83 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseSuggestionController.java
  80. 120 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseSuggestionDictController.java
  81. 17 11
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BannerDoctorController.java
  82. 15 8
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/message/BaseUserMsgController.java
  83. 133 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  84. 38 17
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  85. 13 7
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  86. 2 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java
  87. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/WlyyDeviceService.java
  88. 3 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/controller/rehabilitation/RehabilitationPlanController.java
  89. 6 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/RehabilitationServiceItemDao.java
  90. 5 4
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationManageService.java
  91. 40 14
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/service/rehabilitation/RehabilitationPlanService.java
  92. 47 0
      svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/vo/TemplateDetailVo.java

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

@ -179,6 +179,18 @@
            <artifactId>lombok</artifactId>
            <version>1.18.8</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.4</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.google.code.kaptcha</groupId>
            <artifactId>kaptcha</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <build>

+ 4 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorMessageDao.java

@ -22,4 +22,8 @@ public interface BaseDoctorMessageDao extends PagingAndSortingRepository<BaseDoc
    List<BaseDoctorMessageDO> findByDoctorAndDel(String doctor,Pageable pageRequest);
    @Query("from BaseDoctorMessageDO d where  d.del ='1' and d.id=?1 ")
    BaseDoctorMessageDO findByIdAndDel(String id);
}

+ 9 - 4
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java

@ -203,11 +203,16 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
            }else {
                for (int i=0;i<list.size();i++){
                    if (i == 0 ){
                        disease.append(list.get(i).get("diseaseName"));
                        code.append(list.get(i).get("diseaseCode"));
                        if (list.get(i).get("diseaseName")!=null){
                            disease.append(list.get(i).get("diseaseName"));
                            code.append(list.get(i).get("diseaseCode"));
                        }
                    }else {
                        disease.append(","+list.get(i).get("diseaseName"));
                        code.append(","+list.get(i).get("diseaseCode"));
                        if (list.get(i).get("diseaseName")!=null){
                            disease.append(","+list.get(i).get("diseaseName"));
                            code.append(","+list.get(i).get("diseaseCode"));
                        }
                    }
                }
                list.get(0).put("diseaseName",disease);

+ 136 - 0
business/base-service/src/main/java/com/yihu/jw/file_upload/FileManageService.java

@ -0,0 +1,136 @@
package com.yihu.jw.file_upload;
import com.yihu.jw.restmodel.MutilFileInfo;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.utils.FileUtil;
import org.apache.commons.io.FileUtils;
import org.hibernate.service.spi.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@Service
public class FileManageService {
    private static final Logger logger = LoggerFactory.getLogger(FileManageService.class);
    private String basePath = "/usr/local" ;
    private String fileUrl ="" ;
    /**
     * 分块上传
     * 第一步:获取RandomAccessFile,随机访问文件类的对象
     * 第二步:调用RandomAccessFile的getChannel()方法,打开文件通道 FileChannel
     * 第三步:获取当前是第几个分块,计算文件的最后偏移量
     * 第四步:获取当前文件分块的字节数组,用于获取文件字节长度
     * 第五步:使用文件通道FileChannel类的 map()方法创建直接字节缓冲器  MappedByteBuffer
     * 第六步:将分块的字节数组放入到当前位置的缓冲区内  mappedByteBuffer.put(byte[] b);
     * 第七步:释放缓冲区
     * 第八步:检查文件是否全部完成上传
     * @param param
     * @return
     * @throws IOException
     */
    public String chunkUploadByMappedByteBuffer(MutilFileInfo param) throws IOException {
        if(param.getTaskId() == null || "".equals(param.getTaskId())){
            param.setTaskId(UUID.randomUUID().toString());
        }
        boolean copflag =false;
        /**
         * basePath是我的路径,可以替换为你的
         * 1:原文件名改为UUID
         * 2:创建临时文件,和源文件一个路径
         * 3:如果文件路径不存在重新创建
         */
        String fileName = param.getFile().getOriginalFilename();
         //fileName.substring(fileName.lastIndexOf(".")) 这个地方可以直接写死 写成你的上传路径
        String tempFileName = param.getTaskId() + fileName.substring(fileName.lastIndexOf(".")) + "_tmp";
        String filePath = basePath+"/original";
        File fileDir = new File(filePath);
        if(!fileDir.exists()){
            fileDir.mkdirs();
        }
        File tempFile = new File(filePath,tempFileName);
        //第一步
        RandomAccessFile raf = new RandomAccessFile(tempFile,"rw");
        //第二步
        FileChannel fileChannel = raf.getChannel();
        //第三步
        long offset = param.getChunk() * param.getSize();
        //第四步
        byte[] fileData = param.getFile().getBytes();
        //第五步
        MappedByteBuffer mappedByteBuffer = fileChannel.map(FileChannel.MapMode.READ_WRITE,offset,fileData.length);
        //第六步
        mappedByteBuffer.put(fileData);
        //第七步
        FileUtil.freedMappedByteBuffer(mappedByteBuffer);
        fileChannel.close();
        raf.close();
        //第八步
        boolean isComplete = checkUploadStatus(param,fileName,filePath);
        if(isComplete){
            renameFile(tempFile,fileName);
            return filePath+"/"+fileName;
        }else {
            return "unCompelete";
        }
    }
    /**
     * 文件重命名
     * @param toBeRenamed   将要修改名字的文件
     * @param toFileNewName 新的名字
     * @return
     */
    public boolean renameFile(File toBeRenamed, String toFileNewName) {
        //检查要重命名的文件是否存在,是否是文件
        if (!toBeRenamed.exists() || toBeRenamed.isDirectory()) {
            return false;
        }
        String p = toBeRenamed.getParent();
        File newFile = new File(p + File.separatorChar + toFileNewName);
        //修改文件名
        return toBeRenamed.renameTo(newFile);
    }
    /**
     * 检查文件上传进度
     * @return
     */
    public boolean checkUploadStatus(MutilFileInfo param,String fileName,String filePath) throws IOException {
        File confFile = new File(filePath,fileName+".conf");
        RandomAccessFile confAccessFile = new RandomAccessFile(confFile,"rw");
        //设置文件长度
        confAccessFile.setLength(param.getChunkTotal());
        //设置起始偏移量
        confAccessFile.seek(param.getChunk());
        //将指定的一个字节写入文件中 127,
        confAccessFile.write(Byte.MAX_VALUE);
        byte[] completeStatusList = FileUtils.readFileToByteArray(confFile);
        byte isComplete = Byte.MAX_VALUE;
            //这一段逻辑有点复杂,看的时候思考了好久,创建conf文件文件长度为总分片数,每上传一个分块即向conf文件中写入一个127,那么没上传的位置就是默认的0,已上传的就是Byte.MAX_VALUE 127
        for(int i = 0; i<completeStatusList.length && isComplete==Byte.MAX_VALUE; i++){
            // 按位与运算,将&两边的数转为二进制进行比较,有一个为0结果为0,全为1结果为1  eg.3&5  即 0000 0011 & 0000 0101 = 0000 0001   因此,3&5的值得1。
            isComplete = (byte)(isComplete & completeStatusList[i]);
            System.out.println("check part " + i + " complete?:" + completeStatusList[i]);
        }
        if(isComplete == Byte.MAX_VALUE){
             //如果全部文件上传完成,删除conf文件
            confFile.delete();
            return true;
        }
        return false;
    }
}

+ 19 - 5
business/base-service/src/main/java/com/yihu/jw/hospital/doctor/dao/service/BaseDoctorBGService.java

@ -86,14 +86,14 @@ public class BaseDoctorBGService extends BaseJpaService<BaseDoctorBackgroundDO,
     */
    public List<Map<String,Object>> selectByDoctor(String doctor, Integer contentType, String content, Integer page, Integer size){
        String sql = "select id as \"id\", doctor as \"doctor\",doctor_name as \"doctorName\",content_type as \"contentType\"," +
                "content as \"content\" , content_desc as \"contentDesc\",is_sort as \"isSort\",del as \"del\" " +
                " from base_doctor_message whre del=1 and doctor='"+doctor+"' ";
                "content as \"content\" , content_desc as \"contentDesc\",is_sort as \"isSort\",del as \"del\",extend as \"extend\"  " +
                " from base_doctor_message where del=1 and doctor='"+doctor+"' ";
        if (contentType!=null){
            sql +=" and content_type= "+contentType;
        }
        if (StringUtils.isNotBlank(content)){
            sql +=" and content like '%"+content+"%'v";
            sql +=" and content like '%"+content+"%' ";
        }
        sql +=" order by is_sort desc ";
@ -114,7 +114,11 @@ public class BaseDoctorBGService extends BaseJpaService<BaseDoctorBackgroundDO,
            List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
            Integer isSort=0;
            if (maps!=null&&maps.size()!=0){
                isSort = Integer.parseInt(maps.get(0).get("total").toString());
                if (maps.get(0).get("total")!=null){
                    isSort = Integer.parseInt(maps.get(0).get("total").toString())+1;
                }else {
                    isSort=isSort+1;
                }
            }else {
                isSort=isSort+1;
            }
@ -139,7 +143,12 @@ public class BaseDoctorBGService extends BaseJpaService<BaseDoctorBackgroundDO,
        List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
        Integer isSort=0;
        if (maps!=null&&maps.size()!=0){
            isSort = Integer.parseInt(maps.get(0).get("total").toString());
            if (maps.get(0).get("total")!=null){
                isSort = Integer.parseInt(maps.get(0).get("total").toString())+1;
            }else {
                isSort=isSort+1;
            }
        }else {
            isSort=isSort+1;
        }
@ -160,4 +169,9 @@ public class BaseDoctorBGService extends BaseJpaService<BaseDoctorBackgroundDO,
    }
    public BaseDoctorMessageDO selectById(String id){
        return doctorMessageDao.findByIdAndDel(id);
    }
}

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

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

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

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

文件差異過大導致無法顯示
+ 331 - 107
business/base-service/src/main/java/com/yihu/jw/hospital/message/service/BaseBannerDoctorService.java


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

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

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

@ -34,11 +34,17 @@ public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatient
    @Query("from WlyyOutpatientDO a where a.generalDoctor = ?1 and a.registerDate >=?2 and a.registerDate <=?3 and a.status = ?4 and a.doctor is not null order by registerDate ASC")
    List<WlyyOutpatientDO> findByGeneralDoctor(String generalDoctor, Date startDate,Date endDate,String status);
    List<WlyyOutpatientDO> findByStatus(String status);
    @Query("from WlyyOutpatientDO a where a.status in(1,2) and a.payStatus = 1")
    List<WlyyOutpatientDO> findByStatus();
    List<WlyyOutpatientDO> findByDoctorAndCreateTimeAndPatientCancelRemark(String doctor,Date createTime,String patientCancelRemark);
    @Query("select count(id) from  WlyyOutpatientDO a where a.outpatientType = ?1 and a.doctor = ?2 and a.admDate >=?3 and a.admDate <=?4")
    Integer countByTime(String type,String doctor,Date startTime,Date endTime);
    @Query("from WlyyOutpatientDO a where a.status = 0 and a.payStatus = 1 and (a.remindCount<?1 or a.remindCount is null)")
    List<WlyyOutpatientDO> findWaitingOutpatient(Integer remindCount);
    /*@Query("from WlyyOutpatientDO a where a.patient = ?1 and a.outpatientType = 1")
    List<WlyyOutpatientDO> findOutpatientByPatientAndStatus(String patient);*/
}

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

@ -34,6 +34,8 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    List<WlyyPrescriptionDO> findById(String id);
    WlyyPrescriptionDO findByRealOrder(String realOrder);
    List<WlyyPrescriptionDO> findByRealOrderList(String realOrder);
    
    WlyyPrescriptionDO findByAdmNoAndRealOrder(String admno,String realOrder);

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

@ -23,4 +23,7 @@ public interface PrescriptionExpressageDao extends PagingAndSortingRepository<Wl
    @Modifying
    @Query("update WlyyPrescriptionExpressageDO p set p.mailno=?2  where p.id=?1")
    void updateMailNoById(String id, String mailno);
    @Query("from WlyyPrescriptionExpressageDO p where p.outpatientId=?1 and p.oneselfPickupFlg = 1 order by p.createTime desc")
    List<WlyyPrescriptionExpressageDO> findByOutpatientIdAndOneSelfPick(String outpatientId);
}

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

@ -0,0 +1,14 @@
package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionSignDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wangzhinan on 2020/5/18
 */
public interface PrescriptionSignDao extends PagingAndSortingRepository<WlyyPrescriptionSignDO, String>, JpaSpecificationExecutor<WlyyPrescriptionSignDO> {
}

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

@ -0,0 +1,72 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.order.pay.utils.PayLogService;
import com.yihu.jw.util.http.HttpClientUtil;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.PrintWriter;
import java.io.StringWriter;
@Service
public class PayInfoNoticeService {
    @Value("${hospital.url}")
    private String serverUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * 支付成功提醒
     * @param userName 用户名 (不能为空)
     * @param idCard 身份证 (能为空)
     * @param phone 推送人手机号 (不能为空)
     * @param title 推送标题 (不能为空)
     * @param url 支付链接   (不能为空)
     * @param doctorName 就诊医生 (不能为空)
     * @param total 总费用 (不能为空)
     * @param miPay 医保支付 (不能为空)
     * @param selfPay 个人支付 (不能为空)
     * @param orderNo 单据号 (不能为空)
     * @param remark 备注 (不能为空)
     * @return
     * @throws Exception
     */
    public String paySuccessNotice(String userName,String idCard,String phone,String title,String url,
                                   String doctorName,String total,String miPay,String selfPay,String orderNo,String remark) {
        url = "https://172.16.1.34";
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("userName", userName);
        jsonObject.put("idCard", idCard);
        jsonObject.put("phone", phone);
        jsonObject.put("title", title);
        jsonObject.put("url", serverUrl);
        jsonObject.put("doctorName", doctorName);
        jsonObject.put("total", total);
        jsonObject.put("miPay", miPay);
        jsonObject.put("selfPay", selfPay);
        jsonObject.put("orderNo", orderNo);
        jsonObject.put("remark", remark);
        String responseMsg = httpClientUtil.sendPost(url + "/interface/paySuccessNoticePush.htm", jsonObject.toJSONString());
        JSONObject result = new JSONObject();
        String respCode = "";
        if (responseMsg != null) {
            result = JSONObject.parseObject(responseMsg);
            respCode = result.get("respCode").toString();
        }
        return respCode;
    }
}

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

@ -42,6 +42,7 @@ import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
@ -75,12 +76,15 @@ import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.utils.Pkis.PKIService_PortType;
import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.dao.WxPushLogDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.enterprise.EnterpriseService;
import com.yihu.jw.wechat.service.BaseSensitiveFilterWordsService;
import com.yihu.jw.wechat.service.WxAccessTokenService;
import com.yihu.mysql.query.BaseJpaService;
@ -111,7 +115,9 @@ import java.io.IOException;
import java.io.OutputStream;
import java.lang.Boolean;
import java.math.BigDecimal;
import java.net.URL;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.*;
/**
@ -246,6 +252,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private BaseBannerDoctorDao baseBannerDoctorDao;
    @Autowired
    private BaseDrugStoreDao baseDrugStoreDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private PrescriptionSignDao prescriptionSignDao;
    @Autowired
    private EnterpriseService enterpriseService;
@ -266,14 +279,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     * @throws Exception
     */
    public List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag) throws Exception {
    public List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag,String ksdm) throws Exception {
        logger.info("findOutpatientList patient:" + patient);
        String patNo = patientMappingService.findHisPatNoByPatient(patient);
        if (StringUtils.isBlank(patNo)) {
            return null;
        }
        logger.info("findOutpatientList patNo " + patNo);
        return entranceService.BS30025(patNo, null, startTime, endTime, demoFlag);
        return entranceService.BS30025(patNo, null, startTime, endTime, demoFlag,ksdm);
    }
    /**
@ -290,7 +303,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            return null;
        }
        logger.info("findOutpatientList patNo:" + patNo);
        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo, conNo, null, null, demoFlag);
        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo, conNo, null, null, demoFlag,null);
        if (list != null && list.size() > 0) {
            WlyyOutpatientVO outpatientVO = list.get(0);
@ -313,7 +326,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
        logger.info("findOriginPrescriptionList: registerSn:" + registerSn + " patient" + patient + " patNo:" + patNo + " realOrder:" + realOrder + " admNo:" + admNo);
        return entranceService.BS16017(registerSn, realOrder, patNo, admNo, demoFlag);
        List<WlyyPrescriptionVO> prescriptionVOS = entranceService.BS16017(registerSn, realOrder, patNo, admNo, demoFlag);
        for (WlyyPrescriptionVO prescriptionVO:prescriptionVOS){
            WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO = readOutPatientXml(registerSn);//电子病历
            prescriptionVO.setWlyyPrescriptionEmrDO(wlyyPrescriptionEmrDO);
        }
        return prescriptionVOS;
    }
    /**
@ -485,6 +503,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("patientCancelValue", outpatientDO.getPatientCancelValue());
        rs.put("patientCancelRemark", outpatientDO.getPatientCancelRemark());
        rs.put("operator",outpatientDO.getOperator());
        rs.put("status",outpatientDO.getStatus());
        rs.put("createTime",DateUtil.dateToStrLong(outpatientDO.getCreateTime()));
        //居民详情
        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
        rs.put("patientName", basePatientDO.getName());
@ -772,8 +792,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     * @throws Exception
     */
    @Transactional
    public WlyyOutpatientDO appointmentRevisit(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception {
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
@ -790,7 +810,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (outpatientDO.getRegisterDate() == null) {
            outpatientDO.setRegisterDate(new Date());
        }
        WlyyPrescriptionExpressageDO previous = checkOutPatientPre(outpatientDO.getPatient());
        //2.物流信息
        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class);
        if (null!=previous.getId()&&previous.getOneselfPickupFlg()!=expressageDO.getOneselfPickupFlg()){
            WlyyOutpatientDO wlyyOutpatientDO = new WlyyOutpatientDO();
            wlyyOutpatientDO.setRemindCount(previous.getOneselfPickupFlg());
            return wlyyOutpatientDO;
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("WX_MONEY");
        Double price = 0.0;
@ -806,25 +833,27 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        businessOrderService.recharge(outpatient.getId(), "复诊-诊查费", "2", "复诊-诊查费", patientDO.getId(), patientDO.getName(), outpatient.getDoctor(), price);
        BusinessOrderDO businessOrderDO = businessOrderService.recharge(outpatient.getId(), "复诊-诊查费", "2", "复诊-诊查费", patientDO.getId(), patientDO.getName(), outpatient.getDoctor(), price);
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        WlyyPatientRegisterTimeDO wlyyPatientRegisterTimeDO =new WlyyPatientRegisterTimeDO();
        try {
            //如果是视频预约咨询
            if (StringUtils.isNotBlank(registerJson)) {
                registerTimeDO = objectMapper.readValue(registerJson, WlyyPatientRegisterTimeDO.class);
                registerTimeDO.setOutpatientId(outpatient.getId());
                registerTimeDO.setCreateTime(new Date());
                patientRegisterTimeDao.save(registerTimeDO);
                wlyyPatientRegisterTimeDO = patientRegisterTimeDao.save(registerTimeDO);
            }
        } catch (Exception e) {
            throw new RuntimeException("号源已经被预约,请选择其他号源");
        }
        //2.物流信息
        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class);
        if (0==expressageDO.getOneselfPickupFlg()){
            if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                String drugCode= expressageDO.getHospitalCode()==null?"5550":expressageDO.getHospitalCode();
                expressageDO.setHospitalCode(drugCode);
            }
            System.out.println("进入物流信息");
            expressageDO.setDel(1);
            expressageDO.setCreateTime(new Date());
@ -854,10 +883,41 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //3.创建候诊室
        createRoom(outpatient, chargeType);
        String content = "向您发起了图文复诊,点击查看";
        return outpatient;
    }
    public WlyyPrescriptionExpressageDO checkOutPatientPre(String patientId) throws ParseException {
        String sql = "select t.id as \"id\",t.adm_no as \"admNo\",t.create_time as \"createTime\" from wlyy_outpatient t where 1=1";
        String startDate = DateUtil.getStringDateShort()+" 00:00:00";
        String endDate = DateUtil.getStringDateShort()+" 23:59:59";
        if ("xm_zsyy_wx".equalsIgnoreCase(wechatId)){
            sql+=" and t.create_time >= '" +startDate+"' "+
                    " and t.create_time <= '" +endDate+"' ";
        }else if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
            sql+=" and  t.create_time >= to_char('"+startDate+"','yyyy-mm-dd hh:mm:ss')\n" +
                    "and t.create_time < to_char('"+endDate+"','yyyy-mm-dd hh:mm:ss')";
        }else {
            sql+=" and  t.create_time >= to_char('"+startDate+"','yyyy-mm-dd hh:mm:ss')\n" +
                    "and t.create_time < to_char('"+endDate+"','yyyy-mm-dd hh:mm:ss')";
        }
        if (StringUtils.isNoneBlank(patientId)){
            sql+=" and t.patient = '"+patientId+"'";
        }
        sql +=" and t.outpatient_type = 1  order by t.create_time desc";
        System.out.println(sql);
        List<Map<String,Object>> listPrescript = hibenateUtils.createSQLQuery(sql);
        WlyyPrescriptionExpressageDO wlyyPrescriptionExpressageDO = new WlyyPrescriptionExpressageDO();
        if (listPrescript!=null&&listPrescript.size()>=1){
            Map<String,Object> mapPrescript = listPrescript.get(0);
            String outPatientId = mapPrescript.get("id").toString();
            List<WlyyPrescriptionExpressageDO> list =  prescriptionExpressageDao.findByOutpatientId(outPatientId);
            if(list!=null&&list.size()!=0){
                wlyyPrescriptionExpressageDO = list.get(0);
            }
        }
        return wlyyPrescriptionExpressageDO;
    }
    /**
     * 创建候诊室
@ -1431,7 +1491,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " JOIN base_doctor_role r ON r.doctor_code = d.id " +
                " WHERE  " +
                " h.org_code = '" + orgCode + "'" +
                " AND r.role_code ='specialist'";
                " AND r.role_code ='specialist' and d.del=1 ";
        if (StringUtils.isNotBlank(chargeType)) {
            if ("all".equalsIgnoreCase(chargeType)) {
                //不过滤号别
@ -1496,7 +1556,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " JOIN base_doctor_role r ON r.doctor_code = d.id " +
                " WHERE  " +
                " h.org_code = '" + orgCode + "'" +
                " AND r.role_code ='specialist'";
                " AND r.role_code ='specialist' and d.del=1 ";
        if (StringUtils.isNotBlank(chargeType)) {
            if ("all".equalsIgnoreCase(chargeType)) {
                //不过滤号别
@ -1592,12 +1652,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                outpatientDao.save(outpatientDO);
                //调用电子病历注册
                manageType = 2;
                registDianziBingli(outpatientDO, basePatientDO, manageType, registerDO.getRegisterNo(), registerDO.getConNo());
                try {
                    registDianziBingli(outpatientDO, basePatientDO, manageType, registerDO.getRegisterNo(), registerDO.getConNo());
                }catch (Exception e){
                    e.printStackTrace();
                }
                return res;
            }
        }
        //下载银医通
        net.sf.json.JSONObject object1 = entranceService.qutpatientBalance(outpatientDO.getCardNo(), demoFlag);
        logger.info("下载银医通");
        net.sf.json.JSONObject rs = entranceService.BS10111(outpatientDO.getCardNo(), doctorMappingDO.getMappingCode(), outpatientDO.getDept(), null, outpatientDO.getWinNo(), demoFlag);
        net.sf.json.JSONObject res = rs.getJSONObject("resquest");
        logger.info("挂号结果 res: " + res.toString());
@ -1714,7 +1779,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "<CardNO>" + outpatientDO.getCardNo() + "</CardNO>\n" +
                "<PatientName>" + basePatientDO.getName() + "</PatientName>" +
                "<SexCode>" + basePatientDO.getSex() + "</SexCode>";
        if (1 == basePatientDO.getSex()) {
        if (basePatientDO.getSex()!=null&&1 == basePatientDO.getSex()) {
            _xmlStr = _xmlStr + "<Sex>男</Sex>";
        } else {
            _xmlStr = _xmlStr + "<Sex>女</Sex>";
@ -1995,7 +2060,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param diagnosisJson
     * @return
     */
    public Map<String, Object> makeDiagnosis(String outPatientId, String advice, String type, String infoJsons, String diagnosisJson, String inspectionJson, String emrJson) throws Exception {
    public Map<String, Object> makeDiagnosis(String outPatientId,String prescriptionId, String advice, String type, String infoJsons, String diagnosisJson, String inspectionJson, String emrJson) throws Exception {
        Map<String, Object> result = new HashedMap();
@ -2006,26 +2071,28 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //========================处方操作=============================================================
        //创建处方记录
        List<WlyyPrescriptionDO> prescriptionDOs = prescriptionDao.findByOutpatientId(outPatientId);
        WlyyPrescriptionDO prescriptionDO = null;
        if (prescriptionDOs != null && prescriptionDOs.size() > 0) {
            prescriptionDO = prescriptionDOs.get(0);
        } else {
            prescriptionDO = new WlyyPrescriptionDO();
        WlyyPrescriptionDO  prescriptionDO= new WlyyPrescriptionDO();
        /*List<WlyyPrescriptionDO> prescriptionDOs = prescriptionDao.findByOutpatientId(outPatientId);*/
        List<WlyyPrescriptionDO> wlyyPrescriptionDO1 = new ArrayList<>();
        if(StringUtils.isNotBlank(prescriptionId)){
            wlyyPrescriptionDO1 = prescriptionDao.findById(prescriptionId);
            prescriptionDO =wlyyPrescriptionDO1.get(0);
        }else{
            prescriptionDO.setOutpatientId(outPatientId);
            prescriptionDO.setType(1);
            prescriptionDO.setDept(outpatientDO.getDept());
            prescriptionDO.setCreateTime(new Date());
            prescriptionDO.setStatus(10);
            prescriptionDO.setPatientCode(outpatientDO.getPatient());
            prescriptionDO.setPatientName(outpatientDO.getPatientName());
            prescriptionDO.setDoctor(outpatientDO.getDoctor());
            prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
            prescriptionDO.setPayStatus(0);
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
                prescriptionDO.setAdmNo(outpatientDO.getAdmNo());
            }
        }
        prescriptionDO.setType(1);
        prescriptionDO.setDept(outpatientDO.getDept());
        prescriptionDO.setCreateTime(new Date());
        prescriptionDO.setStatus(10);
        prescriptionDO.setPatientCode(outpatientDO.getPatient());
        prescriptionDO.setPatientName(outpatientDO.getPatientName());
        prescriptionDO.setDoctor(outpatientDO.getDoctor());
        prescriptionDO.setDoctorName(outpatientDO.getDoctorName());
        prescriptionDO.setPayStatus(0);
        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
            prescriptionDO.setAdmNo(outpatientDO.getAdmNo());
        }
        WlyyPrescriptionDO prescription = prescriptionDao.save(prescriptionDO);
        //========================处方操作结束=============================================================
@ -2080,7 +2147,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            savePrescriptionCheck(prescription.getDoctor(), "开具处方", 5, prescription.getId());
        }
        if (prescriptionDOs != null && prescriptionDOs.size() > 0) {
        if (wlyyPrescriptionDO1 != null && wlyyPrescriptionDO1.size() > 0) {
            savePrescriptionCheck(prescription.getDoctor(), "处方修改", 3, prescription.getId());
        }
@ -2136,16 +2203,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if (StringUtils.isNotBlank(inspectionJson)) {
                List<WlyyInspectionDO> inspections = (List<WlyyInspectionDO>) com.alibaba.fastjson.JSONArray.parseArray(inspectionJson, WlyyInspectionDO.class);
                for (WlyyInspectionDO ins : inspections) {
                    YkEmrJcsqDO ykEmrJcsqDO =new YkEmrJcsqDO();
                    ins.setDel(1);
                    ins.setCreateTime(new Date());
                    ins.setPrescriptionId(prescription.getId());
                    ins.setOutpatientId(outPatientId);
                }
                //保存检查检验。
                wlyyInspectionDao.save(inspections);
                //计算检查检验费用
                prescription.setInspectFee(getInsFee(inspections));
            }
@ -2177,6 +2244,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                result.put("code", 1);
                result.put("mes", "诊断完成");
                result.put("prescriptionId",prescription.getId());
                return result;
            } else if (wechatId.equalsIgnoreCase("xm_zsyy_wx")) {
                Double price = prescription.getDrugFee();
@ -2187,6 +2255,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                Map<String, Object> result1 = new HashedMap();
                result1.put("code", 1);
                result1.put("mes", "开方提交成功");
                result1.put("prescriptionId",prescription.getId());
                return result1;
            } else if (wechatId.equalsIgnoreCase("xm_xzzx_wx")) {
                Double price = prescription.getDrugFee();
@ -2197,10 +2266,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                Map<String, Object> result1 = new HashedMap();
                result1.put("code", 1);
                result1.put("mes", "开方提交成功");
                result1.put("prescriptionId",prescription.getId());
                return result1;
            }else {
                result.put("code", 1);
                result.put("mes", "诊断完成");
                result.put("prescriptionId",prescription.getId());
                return result;
            }
@ -2210,6 +2281,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            outpatientDao.save(outpatientDO);
            result.put("code", 1);
            result.put("mes", "诊断完成");
            result.put("prescriptionId",prescription.getId());
            return result;
        }
@ -3489,12 +3561,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                if ("1".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                    data.put("type", "9");
                    msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个图文复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "doctorRefuseRemind", "");
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "9", "doctorRefuseRemind", cancelRemark);
                }
                if ("2".equalsIgnoreCase(wlyyOutpatientDO.getType())) {
                    data.put("type", "16");
                    msg += wlyyOutpatientDO.getPatientName() + ",您好! 您有一个视频复诊已被医生取消,取消原因:" + cancelValue + "。取消说明:" + cancelRemark + "。";
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "doctorRefuseRemind", "");
                    sendWxTemplateMsg(wechatId, wlyyOutpatientDO.getId(),null, "16", "doctorRefuseRemind", cancelRemark);
                }
                data.put("msg", msg);
                messageDO.setData(data.toString());
@ -3585,26 +3657,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        String remark = "";
        if ("doctorRefuseRemind".equalsIgnoreCase(titelType)) {
            if ("9".equals(type)) {
                contentMsg = "您的图文复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                contentMsg = "医生已取消您的复诊申请,取消原因:"+remindMsg;
                first = outpatientDO.getPatientName() + ",您好!您的图文复诊已取消";
            }
            if ("16".equals(type)) {
                contentMsg = "您的视频复诊订单已被医生取消,您可重新发起。由于订单取消将不做扣费处理";
                contentMsg = "医生已取消您的复诊申请,取消原因:"+remindMsg;
                first = outpatientDO.getPatientName() + ",您好!您的视频复诊已取消";
            }
            logger.info("doctorRefuseRemind医生拒诊入参:outpatientId="+outpatientId);
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
        } else if("outPatientTimeOutRemind".equalsIgnoreCase(titelType)) {
            contentMsg = "您邀请的医师暂无应答,您可以选择继续等待或者取消邀请。";
            first = outpatientDO.getPatientName() + ",您好!";
            logger.info("outPatientTimeOutRemind:outpatientId="+outpatientId+"contentMsg"+contentMsg);
            msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
        } else if ("payRemind".equalsIgnoreCase(titelType)) {
            if ("9".equals(type)) {
                contentMsg = "您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个图文复诊订单待支付,请及时支付。";
                contentMsg = "请您先完成预交金充值发起在线问诊,点击详情进行预交金充值,如您已完成请忽略本条信息。";//您有一个图文复诊订单待支付,点击完成支付,如您已支付请忽略本条信息
                first = outpatientDO.getPatientName() + ",您好!您有一笔未完成的在线问诊订单,请及时处理。";//您有一个图文复诊订单待支付,请及时支付。
                msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
                logger.info("图文复诊订单待支付微信消息模板推送开始");
            } else if ("16".equals(type)) {
                contentMsg = "您有一个视频复诊订单待支付,点击完成支付,如您已支付请忽略本条信息";
                first = outpatientDO.getPatientName() + ",您好!您有一个视频复诊订单待支付,请及时支付。";
                contentMsg = "请您先完成预交金充值发起在线问诊,点击详情进行预交金充值,如您已完成请忽略本条信息。";//您有一个视频复诊订单待支付,点击完成支付,如您已支付请忽略本条信息
                first = outpatientDO.getPatientName() + ",您好!您有一笔未完成的在线问诊订单,请及时处理。";//您有一个视频复诊订单待支付,请及时支付。
                msgUrl="/ims-wx/index.html#/returnVisit/record?outpatientId="+outpatientId;
                logger.info("视频复诊订单待支付微信消息模板推送开始");
            }
@ -3624,7 +3701,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            first = outpatientDO.getPatientName() + ",您好! 医生已为您开具处方,请及时支付。";
            contentMsg = "医生已为您开具处方,请及时支付。";
            remark = "点击完成支付,如您已支付请忽略本条信息";
            msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId;
            msgUrl="/ims-wx/index.html#/returnVisit/prescriptionDetail?outpatientId="+outpatientId+"&id="+remindMsg;
            logger.info("处方支付微信消息模板推送开始");
        } else if ("msgRemind".equalsIgnoreCase(titelType)) {
            first = outpatientDO.getPatientName() + ",您好!";
@ -3717,6 +3794,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                //发起微信消息模板推送
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("眼科微信消息模板推送 医生拒诊开始");
            }else if("outPatientTimeOutRemind".equals(titelType)){
                //就诊等待过长提示
                scene="jzddgcts";
                WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId, "template_outpatient_timeout_remind", scene, 1);
                BeanUtils.copyProperties(config, newConfig);
                newConfig.setUrl(newConfig.getUrl() + "" + outpatientDO.getId());
                logger.info("就诊等待过长提示");
            } else if ("payRemind".equalsIgnoreCase(titelType)) {
                scene = "zxzfts";
                //就诊支付
@ -3893,7 +3977,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else if ("xm_xzzx_wx".equalsIgnoreCase(wxId)) {
            String responseMsg="";
            String prefix="https://www.xmheart.com";
            //String prefix="https://www.xmheart.com";
            String prefix = "https://ih.xmheart.com";
            if(StringUtils.isNotEmpty(outpatientId)){
                responseMsg = xzzxEntranceService.sendXCXMes(wxId,
                        patientDO.getId(),
@ -3915,16 +4000,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        prefix+msgUrl,
                        "wx53f6bb4ac081d840");
            }
            logger.info("url="+prefix+msgUrl);
            String msg="first:"+first+"contentMsg:"+contentMsg+"remark:"+remark;
            logger.info("发送的信息="+msg);
            logger.info("XZZX_Msg_" + titelType + "=" + responseMsg);
        } else if ("xm_zsyy_wx".equalsIgnoreCase(wxId)) {
            if ("prescriptionPayRemind".equalsIgnoreCase(titelType)){
                return;
            }
            String responseMsg="";
            String prefix="https://hlwyy.xmzsh.com";
            if(StringUtils.isNotEmpty(outpatientId)){
@ -3937,6 +4019,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        contentMsg,
                        remark
                );
                System.out.println("结束发送模板消息");
            }
            if (consultTeam!=null&&consPatientDO!=null){
                responseMsg = entranceService.ehospitalNotice(
@ -4584,7 +4667,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " Left join ( select count(id) as total,doctor from wlyy_outpatient where status = 3 GROUP BY doctor ) a on a.doctor = d.id ";
        Map<String, Object> params = new HashedMap();
        Date date = new Date();
        sql+="LEFT JOIN (SELECT  COUNT(t1.doctor) as workTotal, t1.doctor FROM  wlyy_doctor_work_time t1   WHERE   " +
                "t1.start_time <=:startTime  AND t1.end_time >=:endTime GROUP BY t1.doctor) dw ON dw.doctor=d.id ";
        params.put("startTime", date);
        params.put("endTime", date);
        if ("1".equalsIgnoreCase(isAttention)) {
            sql += " join base_doctor_patient_follow follow on follow.doctor = d.id and follow.patient ='" + patientid + "' ";
        }
@ -4603,9 +4691,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            sql += " JOIN wlyy_doctor_work_time wk on wk.doctor = d.id ";
        }
        sql += " WHERE  1=1 ";
        Map<String, Object> params = new HashedMap();
        sql += " WHERE  1=1 ";
        if (StringUtils.isBlank(chargType)) {
            sql += " AND d.charge_type is not null ";
@ -4621,7 +4708,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(iswork) && "1".equals(iswork)) {
            logger.info("iswork:" + iswork);
            Date date = new Date();
            sql += " AND (" +
                    " EXISTS ( " +
                    " SELECT " +
@ -4697,9 +4783,32 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        sql += " and d.del='1' order by a.total " + consutlSort;
        sql += " and d.del='1' order by dw.workTotal desc,d.consult_status DESC,a.total " + consutlSort;
        String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t";
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize);
        for (Map<String,Object> map:list){
            String doctor = map.get("id").toString();
            //查询医生各项评价平均分
            String sqlscore = "SELECT " +
                    "AVG(a.score) AS \"score\"," +
                    "a.score_type AS \"score_type\" " +
                    "FROM base_evaluate a,base_evaluate_score b " +
                    "WHERE " +
                    "a.relation_code=b.id " +
                    "AND b.doctor='" + doctor + "' " +
                    "GROUP BY a.score_type ORDER BY  a.score_type ASC ";
            List<Map<String, Object>> listscore = jdbcTemplate.queryForList(sqlscore);
            Double doctorScore = new Double("0");
            if (listscore != null && listscore.size() > 0) {
                for (Map<String, Object> _listscore : listscore) {
                    doctorScore += Double.parseDouble(_listscore.get("score").toString());
                }
            }
            doctorScore = doctorScore / 3;
            map.put("doctorScore", doctorScore);
        }
        List<Map<String, Object>> listCount = hibenateUtils.createSQLQuery(sqlCount, params);
        Long count = 0L;
        if(listCount!=null){
@ -5552,19 +5661,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     *
     * @param admNo     门诊唯一号
     * @param realOrder 处方号
     * @return
     * @
     */
    public Object getSFExpressInfo(String admNo, String realOrder, String wxId) throws Exception {
        //根据门诊唯一号取就诊记录
//        List<WlyyOutpatientDO> wlyyOutpatientDOs = outpatientDao.findByAdmNo(admNo);
        WlyyPrescriptionDO wlyyPrescriptionDOS = prescriptionDao.findByAdmNoAndRealOrder(admNo, realOrder);
        List<WlyyPrescriptionDO> wlyyPrescriptionDOList = prescriptionDao.findByRealOrderList(realOrder);
        Object result = "";
        System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null=" + wlyyPrescriptionDOS != null);
        if (wlyyPrescriptionDOS != null) {
        System.out.println("获取顺丰物流面单信息:wlyyPrescriptionDOS != null=" + wlyyPrescriptionDOList != null);
        if (wlyyPrescriptionDOList != null&&wlyyPrescriptionDOList.size()!=0) {
            WlyyPrescriptionDO wlyyPrescriptionDOS = wlyyPrescriptionDOList.get(0);
            List<WlyyPrescriptionExpressageDO> expressageDOList = sfexpressService.findByField("outpatientId", wlyyPrescriptionDOS.getOutpatientId());
            WlyyPrescriptionExpressageDO sfexpress_obj = null;
            System.out.println("获取顺丰物流面单信息:CollectionUtils.isEmpty(expressageDOList)=" + CollectionUtils.isEmpty(expressageDOList));
@ -5574,7 +5682,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                System.out.println("获取顺丰物流面单信息:1");
                sfexpress_obj = expressageDOList.get(0);
                System.out.println("获取顺丰物流面单信息:2");
                BasePatientDO basePatientDO = basePatientDao.findById(wlyyPrescriptionDOS.getPatientCode());
                //如果该处方的快递单号已生成,则说明已经下单成功,不需要重复下单,直接返回面单信息
                System.out.println("获取顺丰物流面单信息:3");
                if (org.apache.commons.lang.StringUtils.isNotBlank(sfexpress_obj.getMailno())) {
@ -5603,9 +5710,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    System.out.println("获取顺丰物流面单信息:6");
                }
                wlyyPrescriptionDOS.setStatus(32);
                prescriptionDao.save(wlyyPrescriptionDOS);
                for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOList){
                    prescriptionDO.setStatus(32);
                    prescriptionDao.save(prescriptionDO);
                }
                if (sfexpress_obj != null && StringUtils.isNoneBlank(sfexpress_obj.getMailno())) {
                    com.alibaba.fastjson.JSONObject object = sfexpressService.postSFOrderQueryService(sfexpress_obj);
                    System.out.println("获取顺丰物流面单信息7-1"+object.toJSONString());
@ -6754,7 +6862,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param name
     * @return
     */
    public List<Map<String, Object>> findDoctorByName(String hospital, String name, String chargeType) {
    public List<Map<String, Object>> findDoctorByName(String hospital, String name, String chargeType,String dept) {
        String sql = "SELECT " +
                " d.id AS \"id\", " +
                " d.name AS \"name\"" +
@ -6769,6 +6877,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (StringUtils.isNotBlank(hospital)) {
            sql += " AND h.org_code ='" + hospital + "'";
        }
        if(StringUtils.isNotBlank(dept)){
            sql+= " AND h.dept_code = '"+dept+"'";
        }
        if (StringUtils.isNotBlank(chargeType)) {
            if ("all".equals(chargeType)) {
@ -7043,7 +7154,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionId, 1);
                    List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionId, 1);
                    DoctorMappingDO doctorMappingDO = doctorMappingService.findMappingCode(outpatientDO.getDoctor(), outpatientDO.getHospital());
                    List<WlyyPrescriptionExpressageDO> expressageDOS = prescriptionExpressageDao.findByOutpatientId(outpatientDO.getId());
                    //his处方拼接开方条件
                    com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
                    for (WlyyPrescriptionInfoDO info : infoDOS) {
@ -7054,12 +7165,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                        //设置his药品查询条件
                        setInspectionParam(jsonData, doctorMappingDO, outpatientDO, wlyyPrescriptionDO, ins, outpatientDO.getIcd10());
                    }
                    if (expressageDOS!=null&&expressageDOS.size()!=0){
                        WlyyPrescriptionExpressageDO prescriptionExpressageDO = expressageDOS.get(0);
                        if (prescriptionExpressageDO!=null&&prescriptionExpressageDO.getOneselfPickupFlg()==0){
                            for (int i=0;i<jsonData.size();i++){
                                com.alibaba.fastjson.JSONObject object = jsonData.getJSONObject(i);
                                object.put("selfDelivered",0);
                            }
                        }else if (prescriptionExpressageDO!=null&&prescriptionExpressageDO.getOneselfPickupFlg()==1){
                            for (int i=0;i<jsonData.size();i++){
                                com.alibaba.fastjson.JSONObject object = jsonData.getJSONObject(i);
                                object.put("selfDelivered",1);
                            }
                        }
                    }
                    Map<String, Object> map = sendHisDiagnosis(jsonData, outpatientDO, wlyyPrescriptionDO);
                    //处方签名
                    logger.info("处方签名");
                    SOF_SignDataWithExtraInfo(wlyyPrescriptionDO);
                    //同步电子病历
                    WlyyPrescriptionEmrDO prescriptionEmrDO = prescriptionEmrDao.findEmrByPrescriptionId(prescriptionId);
                    if (prescriptionEmrDO != null) {
                        String doctorId = doctorMappingDO.getMappingCode();
                        String doctorName = doctorMappingDO.getDoctorName();
                        logger.info("电子病历签名");
                        SOF_SignDataWithExtraInfoEmr(prescriptionEmrDO);
                        writeOutPatient(outpatientDO.getRegisterNo(), prescriptionEmrDO.getComplaint(), prescriptionEmrDO.getMedicalHistory(), prescriptionEmrDO.getPastHistory(), prescriptionEmrDO.getPhysicalExamination(), prescriptionEmrDO.getAssistExamination(), doctorId, doctorName);
                    }
                    if (map.get("code").toString().equalsIgnoreCase("1")) {
@ -7136,7 +7266,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)) {
                ykyyService.pushNotificationToYktPatient(patient.getYktId(), messageDO.getTitle(), data.get("msg").toString());
            }
            sendWxTemplateMsg(wxId, outpatientDO.getId(), null,"", "prescriptionPayRemind", "");
            sendWxTemplateMsg(wxId, outpatientDO.getId(), null,"", "prescriptionPayRemind", wlyyPrescriptionDO.getId());
        } else {
            wlyyPrescriptionDO.setId(prescriptionId);
            wlyyPrescriptionDO.setCheckStatus(status);
@ -7538,7 +7668,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     * @throws Exception
     */
    public com.alibaba.fastjson.JSONObject outpatient(String patient) throws Exception {
    public net.sf.json.JSON outpatient(String patient) throws Exception {
        PatientMappingDO mappingDO = patientMappingDao.findByPatient(patient);
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_OUTPATIENT_URL");
@ -7562,8 +7692,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        XMLSerializer xmlSerializer = new XMLSerializer();
        net.sf.json.JSON json = xmlSerializer.read(returnValue);
        logger.info("返回json" + json);
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(json.toString());
        return object;
        return json;
    }
@ -7573,7 +7702,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     * @throws Exception
     */
    public com.alibaba.fastjson.JSONObject outpmedicaldoc(String patient) throws Exception {
    public net.sf.json.JSON outpmedicaldoc(String patient) throws Exception {
        PatientMappingDO mappingDO = patientMappingDao.findByPatient(patient);
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_OUTPATIENT_URL");
@ -7597,12 +7726,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        XMLSerializer xmlSerializer = new XMLSerializer();
        net.sf.json.JSON json = xmlSerializer.read(returnValue);
        logger.info("返回json" + json);
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(json.toString());
        return object;
        return json;
    }
    public com.alibaba.fastjson.JSONObject getPatInfoDataXml(String opid,String recSn) throws Exception {
    public net.sf.json.JSON getPatInfoDataXml(String opid,String recSn) throws Exception {
        String url = "";
        WlyyHospitalSysDictDO wlyyHospitalSysDictDO = hospitalSysDictDao.findById("HAI_TAI_OUTPATIENT_URL");
@ -7617,19 +7745,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        String returnValue = "";
        Map<String, String> params = new HashedMap();
        params.put("type", "getPatInfoDataXml");
        params.put("data", data);
        returnValue = com.yihu.jw.utils.WebserviceUtil.post(url,
                "http://business.htemr.haitaiinc.com",
                "manageEmrDataAll",
                "getPatInfoDataXml",
                params);
        logger.info("门诊病历列表信息,返回值xmlstr:" + returnValue);
        XMLSerializer xmlSerializer = new XMLSerializer();
        net.sf.json.JSON json = xmlSerializer.read(returnValue);
        logger.info("返回json" + json);
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(json.toString());
        return object;
        return json;
    }
    public String writeOutPatient(String registerSn, String chiefComplaint, String hpi, String elapsemhis, String bodycheck, String assistanTcheck, String doctorId, String doctorName) throws Exception {
@ -8079,4 +8205,136 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_find, res);
    }
    /**
     * 处方签名
     * @param prescriptionDO
     * @throws Exception
     */
    public void SOF_SignDataWithExtraInfo(WlyyPrescriptionDO prescriptionDO) throws Exception {
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
        BaseDoctorDO doctorDO = baseDoctorDao.findById(prescriptionDO.getDoctor());
        BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode());
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
        PKIService_ServiceLocator locator = new PKIService_ServiceLocator();
        URL portAddress = new URL("http://192.0.33.91:8080/pkis/services/v1?wsdl");
        PKIService_PortType service = locator.getPKIServiceImplPort(portAddress);
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
        List<WlyyPrescriptionInfoDO> infoDOS = prescriptionInfoDao.findByPrescriptionId(prescriptionDO.getId(), 1);
        List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(prescriptionDO.getId(), 1);
        //his处方拼接开方条件
        com.alibaba.fastjson.JSONArray jsonData = new com.alibaba.fastjson.JSONArray();
        for (WlyyPrescriptionInfoDO info : infoDOS) {
            //设置his药品查询条件
            setInfoJsonParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, info, outpatientDO.getIcd10());
        }
        for (WlyyInspectionDO ins : inspectionDOS) {
            //设置his药品查询条件
            setInspectionParam(jsonData, doctorMappingDO, outpatientDO, prescriptionDO, ins, outpatientDO.getIcd10());
        }
        // 1.1.1 服务端签名(带取证查询扩展信息)
        // inData 参数
        String inData = jsonData.toJSONString();
        inData = org.apache.commons.codec.binary.Base64.encodeBase64String(inData.getBytes("gbk"));
        // extInfo  参数
        String idCardNo = "123502004266006872;"+doctorDO.getIdcard();
        Map<String, String> extInfoMap = new HashMap<String, String>();
        extInfoMap.put("busSys", "ZhongJianXinLianHLWYY");
        extInfoMap.put("doctorNo", doctorMappingDO!=null?doctorMappingDO.getMappingCode():null);
        extInfoMap.put("doctorName", doctorMappingDO!=null?doctorMappingDO.getDoctorName():null);
        extInfoMap.put("deptName", "部门");
        extInfoMap.put("patientName", patientDO!=null?patientDO.getName():null);
        extInfoMap.put("patientSex", patientDO!=null?IdCardUtil.getSexForIdcard(patientDO.getIdcard()):null);
        extInfoMap.put("hospitalNo", wlyyOutpatientDO!=null?wlyyOutpatientDO.getOriginAdmNo():null);
        extInfoMap.put("hospitalNumber",  wlyyOutpatientDO!=null?wlyyOutpatientDO.getOriginConNo():null);
        extInfoMap.put("diagnostic", wlyyOutpatientDO!=null?wlyyOutpatientDO.getIcd10Name():null);
        String extInfo = org.apache.commons.codec.binary.Base64.encodeBase64String(JSON.toJSONString(extInfoMap).getBytes("GBK"));
        String result = service.SOF_SignDataWithExtraInfo(idCardNo, inData, extInfo);
        logger.info("请求返参"+result);
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
        if ("1000".equalsIgnoreCase(object.getString("code"))){
            com.alibaba.fastjson.JSONArray array = com.alibaba.fastjson.JSONArray.parseArray(object.getString("data"));
            for (int i=0;i<array.size();i++){
                com.alibaba.fastjson.JSONObject jsonObject = array.getJSONObject(i);
                String signData = jsonObject.getString("signData");
                String signResult = jsonObject.getString("signResult");
                String certData = jsonObject.getString("certData");
                WlyyPrescriptionSignDO prescriptionSignDO = new WlyyPrescriptionSignDO();
                prescriptionSignDO.setCertData(certData);
                prescriptionSignDO.setPrescriptionId(prescriptionDO.getId());
                prescriptionSignDO.setSignData(signData);
                prescriptionSignDO.setSignResult(signResult);
                prescriptionSignDO.setCreateTime(new Date());
                prescriptionSignDO.setUpdateTime(new Date());
                prescriptionSignDao.save(prescriptionSignDO);
            }
            prescriptionDO.setSignFlag(1);
        }
    }
    /**
     * 电子病历签名
     * @param prescriptionEmrDO
     * @throws Exception
     */
    public void SOF_SignDataWithExtraInfoEmr(WlyyPrescriptionEmrDO prescriptionEmrDO) throws Exception {
        WlyyPrescriptionDO prescriptionDO = prescriptionDao.findOne(prescriptionEmrDO.getPrescriptionId());
        DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(prescriptionDO.getDoctor());
        BaseDoctorDO doctorDO = baseDoctorDao.findById(prescriptionDO.getDoctor());
        BasePatientDO patientDO = basePatientDao.findById(prescriptionDO.getPatientCode());
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(prescriptionDO.getOutpatientId());
        PKIService_ServiceLocator locator = new PKIService_ServiceLocator();
        URL portAddress = new URL("http://192.0.33.91:8080/pkis/services/v1?wsdl");
        PKIService_PortType service = locator.getPKIServiceImplPort(portAddress);
        //电子病历签名
        com.alibaba.fastjson.JSONObject jsonData = new com.alibaba.fastjson.JSONObject();
        jsonData.put("CHIEF_COMPLAINT",prescriptionEmrDO.getComplaint());
        jsonData.put("HPI",prescriptionEmrDO.getMedicalHistory());
        jsonData.put("ELAPSEMHIS",prescriptionEmrDO.getPastHistory());
        jsonData.put("BODYCHECK",prescriptionEmrDO.getPhysicalExamination());
        jsonData.put("ASSISTANTCHECK",prescriptionEmrDO.getAssistExamination());
        // 1.1.1 服务端签名(带取证查询扩展信息)
        // inData 参数
        String inData = jsonData.toJSONString();
        inData = org.apache.commons.codec.binary.Base64.encodeBase64String(inData.getBytes("gbk"));
        // extInfo  参数
        String idCardNo = "123502004266006872;"+doctorDO.getIdcard();
        Map<String, String> extInfoMap = new HashMap<String, String>();
        extInfoMap.put("busSys", "ZhongJianXinLianHLWYY");
        extInfoMap.put("doctorNo", doctorMappingDO!=null?doctorMappingDO.getMappingCode():null);
        extInfoMap.put("doctorName", doctorMappingDO!=null?doctorMappingDO.getDoctorName():null);
        extInfoMap.put("deptName", "部门");
        extInfoMap.put("patientName", patientDO!=null?patientDO.getName():null);
        extInfoMap.put("patientSex", patientDO!=null?IdCardUtil.getSexForIdcard(patientDO.getIdcard()):null);
        extInfoMap.put("hospitalNo", wlyyOutpatientDO!=null?wlyyOutpatientDO.getOriginAdmNo():null);
        extInfoMap.put("hospitalNumber",  wlyyOutpatientDO!=null?wlyyOutpatientDO.getOriginConNo():null);
        extInfoMap.put("diagnostic", wlyyOutpatientDO!=null?wlyyOutpatientDO.getIcd10Name():null);
        String extInfo = org.apache.commons.codec.binary.Base64.encodeBase64String(JSON.toJSONString(extInfoMap).getBytes("GBK"));
        String result = service.SOF_SignDataWithExtraInfo(idCardNo, inData, extInfo);
        logger.info("请求返参"+result);
        com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(result);
        if ("1000".equalsIgnoreCase(object.getString("code"))){
            com.alibaba.fastjson.JSONArray array = com.alibaba.fastjson.JSONArray.parseArray(object.getString("data"));
            for (int i=0;i<array.size();i++){
                com.alibaba.fastjson.JSONObject jsonObject = array.getJSONObject(i);
                String signData = jsonObject.getString("signData");
                String signResult = jsonObject.getString("signResult");
                String certData = jsonObject.getString("certData");
                WlyyPrescriptionSignDO prescriptionSignDO = new WlyyPrescriptionSignDO();
                prescriptionSignDO.setCertData(certData);
                prescriptionSignDO.setPrescriptionId(prescriptionDO.getId());
                prescriptionSignDO.setSignData(signData);
                prescriptionSignDO.setSignResult(signResult);
                prescriptionSignDO.setCreateTime(new Date());
                prescriptionSignDO.setUpdateTime(new Date());
                prescriptionSignDO.setRelationCode(prescriptionEmrDO.getId());
                prescriptionSignDao.save(prescriptionSignDO);
            }
            prescriptionDO.setSignFlag(1);
        }
    }
}

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

@ -35,6 +35,7 @@ import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -106,14 +107,14 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     * @throws Exception
     */
    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag)throws Exception{
    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag,String ksdm)throws Exception{
        logger.info("findOutpatientList patient:"+patient);
        String patNo =patientMappingService.findYkyyPatNoByPatient(patient,demoFlag);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
        logger.info("findOutpatientList patNo "+patNo);
        return ykyyEntranceService.BS30025(patNo,null,startTime,endTime,demoFlag);
        return ykyyEntranceService.BS30025(patNo,null,startTime,endTime,demoFlag,ksdm);
    }
@ -136,14 +137,14 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     * @throws Exception
     */
    public  WlyyOutpatientVO findOutpatientInfo(String patient,String conNo, boolean demoFlag)throws Exception{
    public  WlyyOutpatientVO findOutpatientInfo(String patient,String conNo, boolean demoFlag,String ksdm)throws Exception{
        logger.info("findOutpatientList patient:"+patient);
        String patNo =patientMappingService.findYkyyPatNoByPatient(patient,demoFlag);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
        logger.info("findOutpatientList patNo "+patNo);
        List<WlyyOutpatientVO> wlyyOutpatientVOS = ykyyEntranceService.BS30025(patNo,conNo,null,null,demoFlag);
        List<WlyyOutpatientVO> wlyyOutpatientVOS = ykyyEntranceService.BS30025(patNo,conNo,null,null,demoFlag,ksdm);
        if (wlyyOutpatientVOS!=null&&wlyyOutpatientVOS.size()!=0){
            WlyyOutpatientVO outpatientVO = wlyyOutpatientVOS.get(0);
            BasePatientDO patientDO = basePatientDao.findById(patient);
@ -312,7 +313,14 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     `pack_quantity` int(11) DEFAULT NULL COMMENT '包装数量',
     PRIMARY KEY (`id`),
     */
    public JSONArray getDrugDictionary(String chargeCode, String pyKey, String winNo, String groupNo) throws Exception {
    public JSONArray getDrugDictionary(String chargeCode, String pyKey, String winNo, String groupNo,String oupatientId) throws Exception {
        String hisCode = "";
        if (StringUtils.isNotEmpty(oupatientId)){
            List<WlyyPrescriptionExpressageDO> wlyyPrescriptionExpressageDOS = prescriptionExpressageDao.findByOutpatientIdAndOneSelfPick(oupatientId);
            if (wlyyPrescriptionExpressageDOS.size()>0){
                hisCode = wlyyPrescriptionExpressageDOS.get(0).getHospitalCode();
            }
        }
        JSONArray mapList = new JSONArray();
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
@ -339,7 +347,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            jsonObject.put("py_code","WSSB12ZS");
            mapList.add(jsonObject);
        }else {
            mapList = ykyyEntranceService.findYkYpxx(chargeCode, null, null, pyKey,groupNo);
            mapList = ykyyEntranceService.findYkYpxx(chargeCode, null, null, pyKey,hisCode);
        }
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){

+ 50 - 30
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/EntranceService.java

@ -1,6 +1,7 @@
package com.yihu.jw.hospital.prescription.service.entrance;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
@ -36,7 +37,6 @@ import net.sf.json.JSONArray;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -359,11 +359,15 @@ public class EntranceService {
                                wlyyPrescriptionInfoVO.setDispDeposite(null != jsonObjectBody.get("DISP_DEPOSITE") ? jsonObjectBody.get("DISP_DEPOSITE").toString() : "");
                                wlyyPrescriptionInfoVO.setDosage(null != jsonObjectBody.get("YPYL00") ? jsonObjectBody.get("YPYL00").toString() : "");
                                wlyyPrescriptionInfoVO.setQuantity(null != jsonObjectBody.get("DRUG_QTY") ? jsonObjectBody.get("DRUG_QTY").toString() : "");
                                wlyyPrescriptionInfoVO.setUnit(null != jsonObjectBody.get("UNIT") ? jsonObjectBody.get("UNIT").toString() : "");
                                wlyyPrescriptionInfoVO.setUnitName(null != jsonObjectBody.get("DCYYDW") ? jsonObjectBody.get("DCYYDW").toString() : "");
                                wlyyPrescriptionInfoVO.setUsageName(null != jsonObjectBody.get("YPPL00") ? jsonObjectBody.get("YPPL00").toString() : "");
                                wlyyPrescriptionInfoVO.setSupplyName(null != jsonObjectBody.get("YPYF00") ? jsonObjectBody.get("YPYF00").toString() : "");
                                wlyyPrescriptionInfoVO.setDays(null != jsonObjectBody.get("days") ? jsonObjectBody.get("days").toString() : "");
                                wlyyPrescriptionInfoVO.setUsageCode(null != jsonObjectBody.get("YPPLCODE") ? jsonObjectBody.get("YPPLCODE").toString() : "");
                                wlyyPrescriptionInfoVO.setSupplyCode(null != jsonObjectBody.get("YPYFCODE") ? jsonObjectBody.get("YPYFCODE").toString() : "");
                                wlyyPrescriptionInfoVO.setDays(null != jsonObjectBody.get("drug_win") ? jsonObjectBody.get("drug_win").toString() : "");
                                wlyyPrescriptionInfoVO.setFrequency(null != jsonObjectBody.get("frequency") ? jsonObjectBody.get("frequency").toString() : "");
                                wlyyPrescriptionInfoVO.setGroupNo(null != jsonObjectBody.get("DISP_DEPOSITE") ? jsonObjectBody.get("DISP_DEPOSITE").toString() : "");
                                //规格
                                wlyyPrescriptionInfoVO.setSpecification(null != jsonObjectBody.get("DRUG_SPEC") ? jsonObjectBody.get("DRUG_SPEC").toString() : "");
                                wlyyPrescriptionInfoVO.setDel(1);
@ -554,7 +558,8 @@ public class EntranceService {
     * @return
     * @throws Exception
     */
    public List<WlyyOutpatientVO> BS30025(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag) throws Exception {
    public List<WlyyOutpatientVO> BS30025(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag ,String ksdm) throws Exception {
        System.out.println("ksdm="+ksdm);
        String fid = BS30025;
        logger.info("EntranceService " + fid + " PAT_NO :" + PAT_NO + " conNo:" + conNo + " startTime:" + startTime + " endTime:" + endTime);
@ -583,6 +588,9 @@ public class EntranceService {
            if (StringUtils.isNotBlank(endTime)) {
                sbs.append("<query compy=\"&lt;\" item=\"CON_DATE\" splice=\"and\" value=\"'" + endTime + "'\"/>");
            }
            if (StringUtils.isNotBlank(ksdm)) {
                sbs.append("<query compy=\"=\" item=\"ADM_SPEC\" splice=\"and\" value=\"'" + ksdm + "'\"/>");
            }
            sbs.append("<order item=\"CON_DATE\" sort=\"desc\"/>");
            //查询信息结束
            sbs.append("</MsgInfo></ESBEntry>");
@ -592,8 +600,7 @@ public class EntranceService {
        }
        JSONArray jsonArray = ConvertUtil.convertListEnvelopInRow(resp);
        if (null == jsonArray) {
            return null;
        }
            return null;        }
        List<WlyyOutpatientVO> wlyyOutpatientVOS = new ArrayList<>();
        WlyyOutpatientVO wlyyOutpatientVO;
        for (Object object : jsonArray) {
@ -977,6 +984,10 @@ public class EntranceService {
                if (StringUtils.isNotBlank(vo.getFixationfluid())) {
                    sbs.append(" fixationfluid=\"" + vo.getFixationfluid() + "\"");
                }
                logger.info("判断自取或者快递标识"+vo.getSelfDelivered());
                if (StringUtils.isNotBlank(vo.getSelfDelivered())){
                    sbs.append(" self_delivered=\"" + vo.getSelfDelivered() + "\"");
                }
                sbs.append("/>");
            }
            sbs.append("</root>]]></Msg><startNum>1</startNum></MsgInfo></ESBEntry>");
@ -1759,6 +1770,7 @@ public class EntranceService {
            resp = MqSdkUtil.xml2jsonArrayRootRowMS02003(resp);
        }
        net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(resp);
        logger.info("获取医生数据"+jsonObject.toString());
        if (null != jsonObject && "1".equals(jsonObject.get("code").toString())) {
            JSONArray jsonObjectMgsInfo = (JSONArray) jsonObject.get("MsgInfo");
            if (null != jsonObjectMgsInfo) {
@ -1791,40 +1803,48 @@ public class EntranceService {
                                //保存医生信息
                                BaseDoctorDO baseDoctorDO = new BaseDoctorDO();
                                String idCard = null == jsonObjectBody.get("Card_Id") ? "" : jsonObjectBody.get("Card_Id").toString();
                                baseDoctorDO.setIdcard(idCard);
                                baseDoctorDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
                                baseDoctorDO.setSex(Integer.valueOf(IdCardUtil.getSexForIdcard(idCard)));
                                baseDoctorDO.setLocked(0);
                                baseDoctorDO.setEnabled(1);
                                List<BaseDoctorDO> baseDoctorDOS = baseDoctorDao.findByIdcard(idCard);
                                if (baseDoctorDOS!=null&&baseDoctorDOS.size()!=0){
                                    baseDoctorDO=baseDoctorDOS.get(0);
                                }else {
                                    baseDoctorDO.setIdcard(idCard);
                                    baseDoctorDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idCard));
                                    baseDoctorDO.setSex(Integer.valueOf(IdCardUtil.getSexForIdcard(idCard)));
                                    baseDoctorDO.setLocked(0);
                                    baseDoctorDO.setEnabled(1);
                                    String disableFlag = null == jsonObjectBody.get("Disable_Flag") ? "" : jsonObjectBody.get("Disable_Flag").toString();
                                    //互联网医院:1停用,0使用  转 i健康:1正常,0作废
                                    baseDoctorDO.setDel("1".equals(disableFlag) ? "0" : "1");
                                    baseDoctorDO.setMobile("0");
                                    baseDoctorDO.setName(doctorName);
                                    baseDoctorDO.setIsFamous(0);
                                    baseDoctorDO.setCreateTime(new Date());
                                    baseDoctorDO.setUpdateTime(new Date());
                                    if (StringUtils.isNotBlank(idCard)) {
                                        baseDoctorDO.setSalt(PwdUtil.randomString(5));
                                        try {
                                            baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex(baseDoctorDO.getIdcard().substring(baseDoctorDO.getIdcard().length() - 6) + "{" + baseDoctorDO.getSalt() + "}"));
                                        } catch (Exception e) {
                                            logger.error(e.getMessage() + "docotr=" + doctorCode + ";idcard=" + baseDoctorDO.getIdcard());
                                        }
                                    } else {
                                        baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex("123456" + "{" + baseDoctorDO.getSalt() + "}"));
                                    }
                                }
                                //拼音码
                                baseDoctorDO.setSpell(null == jsonObjectBody.get("PinYin_Code") ? "" : jsonObjectBody.get("PinYin_Code").toString());
                                String disableFlag = null == jsonObjectBody.get("Disable_Flag") ? "" : jsonObjectBody.get("Disable_Flag").toString();
                                //互联网医院:1停用,0使用  转 i健康:1正常,0作废
                                baseDoctorDO.setDel("1".equals(disableFlag) ? "0" : "1");
                                //姓名
                                doctorName = null == jsonObjectBody.get("Emp_Name") ? "" : jsonObjectBody.get("Emp_Name").toString();
                                //号别
                                baseDoctorDO.setChargeType(chareType);
                                if (StringUtils.isNotBlank(idCard)) {
                                    baseDoctorDO.setSalt(PwdUtil.randomString(5));
                                    try {
                                        baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex(baseDoctorDO.getIdcard().substring(baseDoctorDO.getIdcard().length() - 6) + "{" + baseDoctorDO.getSalt() + "}"));
                                    } catch (Exception e) {
                                        logger.error(e.getMessage() + "docotr=" + doctorCode + ";idcard=" + baseDoctorDO.getIdcard());
                                    }
                                } else {
                                    baseDoctorDO.setPassword(com.yihu.utils.security.MD5.md5Hex("123456" + "{" + baseDoctorDO.getSalt() + "}"));
                                }
                                baseDoctorDO.setName(doctorName);
                                baseDoctorDO.setIsFamous(0);
                                baseDoctorDO.setCreateTime(new Date());
                                baseDoctorDO.setUpdateTime(new Date());
                                baseDoctorDO.setMobile("0");
                                baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
                                //根据医生和机构判断数据是否存在,若不存在则在mapping中追加记录
                                List<DoctorMappingDO> doctorMappingDOS = doctorMappingDao.findByDoctorAndOrgCode(baseDoctorDO.getId(), "350211A1002");
                                if (!(null != doctorMappingDOS && doctorMappingDOS.size() > 0)) {
                                    DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
                                    doctorMappingDao.delete(doctorMappingDOS);
                                    doctorMappingDO.setDoctor(baseDoctorDO.getId());
                                    doctorMappingDO.setDoctorName(doctorName);
                                    doctorMappingDO.setMappingCode(doctorCode);
@ -1837,6 +1857,7 @@ public class EntranceService {
                                String deptCode = null == jsonObjectBody.get("Dept_Code") ? "" : jsonObjectBody.get("Dept_Code").toString();
                                List<BaseDoctorHospitalDO> baseDoctorHospitalDOS = baseDoctorHospitalDao.findByOrgCodeAndDeptCodeAndDoctorCode("350211A1002", deptCode, baseDoctorDO.getId());
                                if (!(null != baseDoctorHospitalDOS && baseDoctorHospitalDOS.size() > 0)) {
                                    baseDoctorHospitalDao.delete(baseDoctorHospitalDOS);
                                    BaseDoctorHospitalDO baseDoctorHospitalDO = new BaseDoctorHospitalDO();
                                    baseDoctorHospitalDO.setOrgCode("350211A1002");
                                    baseDoctorHospitalDO.setOrgName("厦门大学附属中山医院");
@ -1988,6 +2009,7 @@ public class EntranceService {
        jsonObject.put("url", url);
        jsonObject.put("content", content);
        jsonObject.put("contentString", contentString);
        System.out.println(serverUrl);
        String responseMsg = httpClientUtil.sendPost(serverUrl + "/interface/ehospitalNoticePush.htm", jsonObject.toString());
        logger.info("ehospitalNoticePushResult:" + responseMsg);
        return responseMsg;
@ -2700,6 +2722,4 @@ public class EntranceService {
}

+ 152 - 45
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -27,10 +27,7 @@ import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.dict.YkDictIcd10Dao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
@ -46,6 +43,7 @@ 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.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -134,9 +132,13 @@ public class YkyyEntranceService {
    private DictDoctorDutyDao dictDoctorDutyDao;
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @Autowired
    private WlyyInspectionDao wlyyInspectionDao;
    @Autowired
    private YkyyService ykyyService;
    @Autowired
    private PrescriptionEmrDao prescriptionEmrDao;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
@ -385,7 +387,7 @@ public class YkyyEntranceService {
     * @return
     * @throws Exception
     */
    public List<WlyyOutpatientVO> BS30025(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag) throws Exception {
    public List<WlyyOutpatientVO> BS30025(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag,String ksdm) throws Exception {
        String fid = "BS30025";
        logger.info("EntranceService " + fid + " PAT_NO :" + PAT_NO + " conNo:" + conNo + " startTime:" + startTime + " endTime:" + endTime);
@ -434,7 +436,7 @@ public class YkyyEntranceService {
            jsonArray.add(jsonObject);
            jsonArray.add(jsonObject2);
        }else {
            jsonArray = findV_ZKSG_HZCX_HIS(patientMappingDO.getMappingCode(),conNo,startTime,endTime);
            jsonArray = findV_ZKSG_HZCX_HIS(patientMappingDO.getMappingCode(),conNo,startTime,endTime,ksdm);
        }
        //查找眼科数据
        if (jsonArray.size() == 0) {
@ -486,7 +488,7 @@ public class YkyyEntranceService {
                JSONArray array = findV_ZKSG_JCCX(PAT_NO,wlyyOutpatientVO.getAdmNo(),demoFlag);
                for (int j=0;j<array.size();j++){
                    JSONObject object = array.getJSONObject(j);
                    String ksdm = object.getString("ksdm");//科室代码
                    String ksdm1 = object.getString("ksdm");//科室代码
                    String fymc = object.getString("fymc");//费用名称
                    String fydj = object.getString("fydj");//单价
                    String fysl = object.getString("fysl");//数量
@ -496,7 +498,7 @@ public class YkyyEntranceService {
                    WlyyInspectionVO wlyyInspectionVO = new WlyyInspectionVO();
                    wlyyInspectionVO.setName(fymc);
                    wlyyInspectionVO.setDeptName(zxks);
                    wlyyInspectionVO.setDept(ksdm);
                    wlyyInspectionVO.setDept(ksdm1);
                    wlyyInspectionVO.setQuantity(Integer.parseInt(fysl));
                    inspectionVOList.add(wlyyInspectionVO);
                }
@ -556,7 +558,7 @@ public class YkyyEntranceService {
     * HIS就诊患者历史查询
     * @throws Exception
     */
    public JSONArray findV_ZKSG_HZCX_HIS(String brid,String conNo,String startTime,String endTime) throws Exception{
    public JSONArray findV_ZKSG_HZCX_HIS(String brid,String conNo,String startTime,String endTime,String ksdm) throws Exception{
        String sql = "SELECT to_char(h.KSSJ ,'yyyy/MM/dd hh24:mi:ss' ) as KSSJ,h.BRID,h.BRXM,h.SJHM,h.JZKH,h.SFZH,h.BRXZ,h.YSDM,h.KDYS" +
                ",h.KSDM,h.KSMC,h.ZDMC,h.JZXH from V_ZKSG_HZCX_HIS h WHERE h.BRID = "+brid+" ";
        if(!StringUtil.isBlank(conNo)){
@ -567,6 +569,8 @@ public class YkyyEntranceService {
        }
        if(!StringUtil.isBlank(endTime)){
            sql += " and h.KSSJ <= to_date('"+endTime+"', 'YYYY-MM-DD HH24:MI:SS')";
        }if(!StringUtil.isBlank(ksdm)){
            sql += " and h.KSDM = " + ksdm;
        }
        sql += " order by h.KSSJ desc";
@ -1636,13 +1640,48 @@ public class YkyyEntranceService {
            synPrescriptionDiagnosis(prescriptionVO,code,demoFlag);
            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            List<WlyyInspectionDO> inspectionDOS = wlyyInspectionDao.findByPrescriptionId(code,1);
            synPrecriptionHis(prescriptionVO,code);
            //同步检查检验
            synInspect(inspectionDOS);
        }
        return wlyyPrescriptionDOs.toString();
    }
    //同步检查检验
    public void  synInspect(List<WlyyInspectionDO> inspectionDOS) throws Exception {
        System.out.println("进入同步");
        List<YkEmrJcsqDO> ykEmrJcsqDOS = new ArrayList<>();
        String doctor = null;
        String patient = null;
        String admNo= null;
        if (inspectionDOS!=null&&inspectionDOS.size()!=0){
            WlyyInspectionDO inspectionDO = inspectionDOS.get(0);
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(inspectionDO.getOutpatientId());
            doctor=outpatientDO.getDoctor();
            patient=outpatientDO.getPatient();
            admNo = outpatientDO.getAdmNo();
        }
        for (WlyyInspectionDO wlyyInspectionDO:inspectionDOS){
            YkEmrJcsqDO ykEmrJcsqDO = new YkEmrJcsqDO();
            ykEmrJcsqDO.setJzhm(wlyyInspectionDO.getOutpatientId());
            ykEmrJcsqDO.setJzxh(Integer.parseInt(admNo));
            ykEmrJcsqDO.setXmid(Integer.valueOf(wlyyInspectionDO.getCode()));
            ykEmrJcsqDO.setJcxm(wlyyInspectionDO.getName());
            ykEmrJcsqDO.setXmdj(Integer.parseInt(wlyyInspectionDO.getChargeAmount()));
            ykEmrJcsqDO.setSqsl(wlyyInspectionDO.getQuantity());
            ykEmrJcsqDO.setJclx(Integer.valueOf(wlyyInspectionDO.getCheckPart()));
            ykEmrJcsqDO.setXmdw(wlyyInspectionDO.getTotalUnit());
            ykEmrJcsqDOS.add(ykEmrJcsqDO);
        }
        //同步his
        logger.info("开始同步检查检验");
        this.outPatientOrder(ykEmrJcsqDOS,false,doctor,patient);
    }
    /**
     * 根据身份证查找his医生
     * @param idcard
@ -2241,8 +2280,8 @@ public class YkyyEntranceService {
    }
    //根据组套项目id查询组套明细
    public JSONArray findZtmxByid(String ztId) throws Exception{
        String sql = "select t.ztid as \"ztid\",t.xmdm as \"xmdm\"," +
                "t.xmmc as \"xmmc\",t.mrsl as \"mrsl\",t.zxks as \"zxks\"" +
        String sql = "select t.ztid as \"ztid\",t.xmdm as \"code\"," +
                "t.xmmc as \"name\",t.mrsl as \"quantity\",t.zxks as \"dept\"" +
                "from portal_his.emr_ztmx@ykzxtest t where 1=1";
        if (StringUtils.isNotEmpty(ztId)){
            sql += " and t.ztid = '"+ztId+"'";
@ -2265,9 +2304,9 @@ public class YkyyEntranceService {
    }
    //查询诊疗项目视图
    public JSONArray findZlxm(String itemName) throws Exception{
        String sql = "select t.item_code as \"itemCode\",t.item_name as \"itemName\"," +
                "t.price as \"price\",t.total_unit as \"totalUnit\"," +
                "t.zxks as \"zxks\" from VEMR_ORDER_ITEM t where 1=1";
        String sql = "select t.item_code as \"code\",t.item_name as \"name\"," +
                "t.price as \"chargeAmount\",t.total_unit as \"totalUnit\"," +
                "t.zxks as \"dept\" from VEMR_ORDER_ITEM t where 1=1";
        if (StringUtils.isNotEmpty(itemName)){
            sql+=" and t.ITEM_NAME like '%"+itemName+"%'";
        }
@ -2288,7 +2327,7 @@ public class YkyyEntranceService {
    }
    //查询诊疗项目明细视图
    public JSONArray findZlxmMx(String zlxmId) throws Exception{
        String sql = "select t.zlxmid as \"zlxmid\",t.fyxh as \"fyxh\",t.fysl \"fysl\"" +
        String sql = "select t.zlxmid as \"code\",t.fyxh as \"fyxh\",t.fysl \"quantity\"" +
                " from VEMR_ORDER_ITEM_MX t where 1=1";
        if (StringUtils.isNotEmpty(zlxmId)){
            sql+=" and t.zlxmid = '"+zlxmId+"'";
@ -2330,25 +2369,20 @@ public class YkyyEntranceService {
        return array;
    }
    //门诊开单操作
    public String outPatientOrder(String jsonDate,Boolean demoFlag,String doctor,String patient) throws Exception{
        List<YkEmrJcsqDO> surveys = EntityUtils.jsonToList(jsonDate, YkEmrJcsqDO.class);
    public String outPatientOrder(List<YkEmrJcsqDO> surveys,Boolean demoFlag,String doctor,String patient) throws Exception{
        DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
        PatientMappingDO patientMappingDO =new PatientMappingDO();
        if (StringUtils.isNotEmpty(doctor)){
        if (StringUtils.isNoneBlank(doctor)){
            doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        }
        if(StringUtils.isNotEmpty(patient)){
            patientMappingDO = patientMappingDao.findByPatient(patient);
        }
        BasePatientDO patientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        System.out.println();
        Integer brxb = 0;
        String brxm = "";
        Date csny =null;
        Integer brnl =0;
        String doctorHis="";
        Integer kdks = 0;
        Integer brid=0;
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
@ -2357,6 +2391,7 @@ public class YkyyEntranceService {
            brxm = json.getString("brxm");
            csny = json.getDate("csny");
            brnl = this.getBrnl(csny);
            brid=json.getInteger("brid");
        }
        //操作医生信息
        JSONArray jsonArray1 = findHisDoctor(doctorMappingDO.getIdcard());
@ -2364,13 +2399,9 @@ public class YkyyEntranceService {
            JSONObject json = jsonArray1.getJSONObject(0);
            doctorHis=json.getString("code");
        }
        // 同一个医生同一个病人,一天一条挂号记录。
        JSONArray ja = fingHlwGhmx(patientMappingDO.getMappingCode(),doctorMappingDO.getMappingCode());
        if (surveys!=null){
            for (YkEmrJcsqDO ykEmrJcsqDO:surveys){
                if (demoFlag){
                    ykEmrJcsqDO.setBrid(brid);
                    ykEmrJcsqDO.setJjbz(0);
                    ykEmrJcsqDO.setJczt(1);
                    ykEmrJcsqDO.setZfbz(0);
@ -2381,16 +2412,6 @@ public class YkyyEntranceService {
                    ykEmrJcsqDO.setKdys(doctorHis);
                    ykEmrJcsqDO.setBrks(114);
                    ykEmrJcsqDO.setTjys(doctorHis);
                }else {
                    ykEmrJcsqDO.setJjbz(0);
                    ykEmrJcsqDO.setJczt(1);
                    ykEmrJcsqDO.setZfbz(0);
                    ykEmrJcsqDO.setQxbz(0);
                    ykEmrJcsqDO.setBrxb(1);
                    ykEmrJcsqDO.setBrxm("测试病人");
                    ykEmrJcsqDO.setBrnl(18);
                    ykEmrJcsqDO.setKdys("测试医生");
                }
            }
            String jsonString = JSONObject.toJSONString(surveys);
            Map<String,Object> params = new HashedMap();
@ -2402,16 +2423,19 @@ public class YkyyEntranceService {
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            if (status!=null&&status == 200){
                return rs.toString();
            }else {
                return "failed";
            JSONArray array= new JSONArray();
            if (status==200){
                array = rs.getJSONArray("detailModelList");
                if(array.size()>0){
                    return "success";
                }else {
                    return "failed";
                }
            }
            return "faild";
        }else {
            return "failed";
        }
    }
   //查询检查单
   public JSONArray findOrder()throws Exception{
@ -2434,6 +2458,7 @@ public class YkyyEntranceService {
       }
       return array;
   }
   //根据病人出生年月计算病人年龄
   public Integer getBrnl(Date date){
       Calendar cal = Calendar.getInstance();
       if (cal.before(date)) {
@ -2462,4 +2487,86 @@ public class YkyyEntranceService {
       return age;
   }
    public String outPatientOrderYk(String jsonDate,Boolean demoFlag,String doctor,String patient) throws Exception{
        List<YkEmrJcsqDO> surveys = EntityUtils.jsonToList(jsonDate,YkEmrJcsqDO.class);
        DoctorMappingDO doctorMappingDO = new DoctorMappingDO();
        if (StringUtils.isNotEmpty(doctor)){
            doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
        }
        PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01",patient,"1");
        Integer brxb = 0;
        String brxm = "";
        Date csny =null;
        Integer brnl =0;
        String doctorHis="";
        Integer kdks = 0;
        Integer brid=0;
        JSONArray jsonArray = findHisPatient(patientMedicareCardDO.getCode(),demoFlag);
        if(jsonArray!=null&&jsonArray.size()>0){
            //获取居民信息
            JSONObject json = jsonArray.getJSONObject(0);
            brxb = json.getInteger("brxb");
            brxm = json.getString("brxm");
            csny = json.getDate("csny");
            brnl = this.getBrnl(csny);
            brid=json.getInteger("brid");
        }
        //操作医生信息
        JSONArray jsonArray1 = findHisDoctor(doctorMappingDO.getIdcard());
        if(jsonArray1!=null&&jsonArray1.size()>0){
            JSONObject json = jsonArray1.getJSONObject(0);
            doctorHis=json.getString("code");
        }
        if (surveys!=null){
            for (YkEmrJcsqDO ykEmrJcsqDO:surveys){
                ykEmrJcsqDO.setBrid(brid);
                ykEmrJcsqDO.setJjbz(0);
                ykEmrJcsqDO.setJczt(1);
                ykEmrJcsqDO.setZfbz(0);
                ykEmrJcsqDO.setQxbz(0);
                ykEmrJcsqDO.setBrxb(brxb);
                ykEmrJcsqDO.setBrxm(brxm);
                ykEmrJcsqDO.setBrnl(brnl);
                ykEmrJcsqDO.setKdys(doctorHis);
                ykEmrJcsqDO.setBrks(114);
                ykEmrJcsqDO.setTjys(doctorHis);
            }
            String jsonString = JSONObject.toJSONString(surveys);
            Map<String,Object> params = new HashedMap();
            params.put("json",jsonString);
            params.put("table","ykEmrJcsqDO");
            logger.info("ykEmrJcsqDO:"+jsonString);
            HttpResponse response = HttpUtils.doGet(orderUrl,params);
            String content = response.getContent();
            logger.info("response:"+content);
            JSONObject rs = JSON.parseObject(content);
            Integer status = rs.getInteger("status");
            JSONArray array= new JSONArray();
            if (status==200){
                array = rs.getJSONArray("detailModelList");
                if(array.size()>0){
                    return "success";
                }else {
                    return "failed";
                }
            }
            return "faild";
        }else {
            return "failed";
        }
    }
    //获取上一次的电子病例
    public List<WlyyPrescriptionEmrDO>  getPrevious(String patientId){
        List<WlyyPrescriptionDO> list =  prescriptionDao.findByPatientCode(patientId);
        String emrId = "";
        List<WlyyPrescriptionEmrDO> result = new ArrayList<>();
        if (list.size()>0){
            for (WlyyPrescriptionDO wlyyPrescriptionDO:list){
                WlyyPrescriptionEmrDO wlyyPrescriptionEmrDO= prescriptionEmrDao.findOne(wlyyPrescriptionDO.getId());
                result.add(wlyyPrescriptionEmrDO);
            }
        }
        return result;
    }
}

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

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

+ 16 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/suggest/dao/BaseSuggestionDictDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.hospital.suggest.dao;
import com.yihu.jw.entity.hospital.suggest.BaseSuggestionDO;
import com.yihu.jw.entity.hospital.suggest.BaseSuggestionDictDO;
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 BaseSuggestionDictDao extends PagingAndSortingRepository<BaseSuggestionDictDO, String>, JpaSpecificationExecutor<BaseSuggestionDictDO> {
    @Query( value = "select max(t.is_sort) AS \"zuida\" from base_suggestions_dict t",nativeQuery = true)
    Integer getMaxSort();
    @Query( value = "select min(t.is_sort) AS \"zuixiao\" from base_suggestions_dict t",nativeQuery = true)
    Integer getMinSort();
}

+ 184 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/suggest/service/BaseSuggestionDictService.java

@ -0,0 +1,184 @@
package com.yihu.jw.hospital.suggest.service;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.suggest.BaseSuggestionDO;
import com.yihu.jw.entity.hospital.suggest.BaseSuggestionDictDO;
import com.yihu.jw.hospital.suggest.dao.BaseSuggestionDictDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class BaseSuggestionDictService extends BaseJpaService<BaseSuggestionDictDO, BaseSuggestionDictDao> {
    @Autowired
    private BaseSuggestionDictDao baseSuggestionDictDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    /**
     * 建议类型上移
     * @param
     * @return
     * @throws Exception
     */
    public BaseSuggestionDictDO upSuggestion(String id) throws Exception{
        BaseSuggestionDictDO baseSuggestionDictDO = baseSuggestionDictDao.findOne(id);
        int maxSort = baseSuggestionDictDao.getMaxSort();
        int sort = 0;
        if(null!=baseSuggestionDictDO){
            sort = baseSuggestionDictDO.getIsSort();
        }
        if (maxSort==sort){
            throw new Exception("不能上移");
        }
        String sql = "select t.id AS \"id\" from base_suggestions_dict t where t.is_sort > "+sort+" order by t.is_sort asc ";
        System.out.println(sql);
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
        BaseSuggestionDictDO upPrevious = new BaseSuggestionDictDO();
        if (list.size()>0){
            String prviousBannerId = list.get(0).get("id").toString();
            upPrevious =baseSuggestionDictDao.findOne(prviousBannerId);
        }
        //交换sort值
        baseSuggestionDictDO.setIsSort(upPrevious.getIsSort());
        upPrevious.setIsSort(sort);
        baseSuggestionDictDao.save(baseSuggestionDictDO);
        baseSuggestionDictDao.save(upPrevious);
        return baseSuggestionDictDO;
    }
    /**
     * 建议类型下移
     * @param
     * @return
     * @throws Exception
     */
    public BaseSuggestionDictDO downSuggestion(String id) throws Exception{
        BaseSuggestionDictDO baseSuggestionDictDO = baseSuggestionDictDao.findOne(id);
        int minSort = baseSuggestionDictDao.getMinSort();
        int sort = 0;
        if(null!=baseSuggestionDictDO){
            sort = baseSuggestionDictDO.getIsSort();
        }
        if (minSort==sort){
            throw new Exception("不能下移");
        }
        String sql = " select id AS \"id\" from base_suggestions_dict where is_sort < "+sort+" order by is_sort desc ";
        List<Map<String,Object>> list=hibenateUtils.createSQLQuery(sql,1,1);
        BaseSuggestionDictDO downPrevious = new BaseSuggestionDictDO();
        if (list.size()>0){
            String prviousId = list.get(0).get("id").toString();
            downPrevious =baseSuggestionDictDao.findOne(prviousId);
        }
        //交换sort值
        baseSuggestionDictDO.setIsSort(downPrevious.getIsSort());
        downPrevious.setIsSort(sort);
        baseSuggestionDictDao.save(baseSuggestionDictDO);
        baseSuggestionDictDao.save(downPrevious);
        return baseSuggestionDictDO;
    }
    /**
     * 建议类型新增
     * @param
     * @return
     * @throws Exception
     */
    public BaseSuggestionDictDO createSuggestionType(BaseSuggestionDictDO baseSuggestionDictDO){
        String sql = "select max(is_sort) as \"isSort\" from base_suggestions_dict";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        Map<String,Object> map = list.get(0);
        int sort = 0;
        if (null!=map.get("isSort")){
            if(null!=map){
                sort = Integer.valueOf(map.get("isSort").toString());
            }
        }
        baseSuggestionDictDO.setIsSort(sort+1);
        baseSuggestionDictDO.setIsDel(1);
        baseSuggestionDictDO.setUpdateTime(new Date());
        baseSuggestionDictDO.setCreateTime(new Date());
        BaseSuggestionDictDO result =  baseSuggestionDictDao.save(baseSuggestionDictDO);
        return result;
    }
    /**
     * 更新
     * @param
     * @return
     * @throws Exception
     */
    public BaseSuggestionDictDO updateSuggest(String id,String suggestName,String suggestDes,String updateUser,String updateUserName){
        BaseSuggestionDictDO baseSuggestionDictDO = baseSuggestionDictDao.findOne(id);
        if (null == baseSuggestionDictDO){
            return null;
        }
        if (!StringUtil.isEmpty(suggestName)){
            baseSuggestionDictDO.setSuggestName(suggestName);
            baseSuggestionDictDO.setUpdateTime(new Date());
        }
        if (!StringUtil.isEmpty(suggestDes)){
            baseSuggestionDictDO.setSuggestDescribe(suggestDes);
        }
        if (!StringUtil.isEmpty(updateUser)){
            baseSuggestionDictDO.setUpdateUser(updateUser);
        }
        if (!StringUtil.isEmpty(updateUserName)){
            baseSuggestionDictDO.setUpdateUser(updateUserName);
        }
        baseSuggestionDictDao.save(baseSuggestionDictDO);
        return baseSuggestionDictDO;
    }
    /**
     * 删除
     * @param
     * @return
     * @throws Exception
     */
    public Boolean deleteSuggest(String id){
        BaseSuggestionDictDO baseSuggestionDictDO = baseSuggestionDictDao.findOne(id);
        if (null == baseSuggestionDictDO){
            return false;
        }
        baseSuggestionDictDao.delete(id);
        return true;
    }
    /*
    *   根据建议名称 或者描述查询
    *
     */
    public MixEnvelop findByNameAndDes(String name, String des, Integer page, Integer pageSize){
        String sql = "select t.id as\"id\",t.suggest_name as\"suggestName\",t.suggest_describe as\"suggestDescribe\"," +
                "t.is_del as\"isDel\",t.is_sort as\"isSort\",t.create_time as\"createTime\",t.update_time as \"updateTime\"" +
                " from base_suggestions_dict t where 1=1 and t.is_del = 1";
        if(StringUtils.isNotEmpty(name)){
            sql+=" and t.suggest_name like '%"+name+"%'";
        }
        if(StringUtils.isNotEmpty(des)){
            sql+=" and t.suggest_describe like '%"+des+"%'";
        }
        sql+= " order by t.is_sort asc";
        List<Map<String,Object>> list= hibenateUtils.createSQLQuery(sql,page,pageSize);
        for (Map<String,Object> map:list){
            String createTime= map.get("createTime").toString();
            String updateTime = map.get("updateTime").toString();
            map.put("createTime", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
            map.put("updateTime",DateUtil.dateToStrLong(DateUtil.strToDateLong(updateTime)));
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setTotalCount(list.size());
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setCurrPage(page);
        return mixEnvelop;
    }
}

+ 99 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/suggest/service/BaseSuggestionService.java

@ -0,0 +1,99 @@
package com.yihu.jw.hospital.suggest.service;
import com.yihu.jw.entity.hospital.suggest.BaseSuggestionDO;
import com.yihu.jw.entity.hospital.suggest.BaseSuggestionDictDO;
import com.yihu.jw.hospital.suggest.dao.BaseSuggestionDao;
import com.yihu.jw.hospital.suggest.dao.BaseSuggestionDictDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.util.date.DateUtil;
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.stereotype.Service;
import javax.persistence.criteria.CriteriaBuilder;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class BaseSuggestionService extends BaseJpaService<BaseSuggestionDO, BaseSuggestionDao> {
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private BaseSuggestionDao baseSuggestionDao;
    @Autowired
    private BaseSuggestionDictDao baseSuggestionDictDao;
    /**
     * 新增反馈建议
     * @param
     * @return
     * @throws Exception
     */
    public BaseSuggestionDO createSuggestion(BaseSuggestionDO baseSuggestionDO){
        baseSuggestionDO.setUpdateTime(new Date());
        baseSuggestionDO.setCreateTime(new Date());
        baseSuggestionDO.setIsDel(1);
        baseSuggestionDO.setSuggestStatus(0);
        BaseSuggestionDO result =  baseSuggestionDao.save(baseSuggestionDO);
        return result;
    }
    /**
     * 建议查看
     * @param
     * @return
     * @throws Exception
     */
    public MixEnvelop findSuggestionByType(String type,String senderId, Integer page, Integer pageSize){
        String sql = "select a.id as\"id\",a.suggest_id as\"suggestId\",a.suggest_content as\"suggestContent\",a.suggest_img_url as\"suggestImgUrl\"," +
                "a.suggest_user_id as\"suggestUserId\",a.user_client as \"userClient\",a.user_type as \"userType\"," +
                "a.suggest_user_name as\"suggestUserName\",a.suggest_user_phone as\"suggestUserPhone\",a.create_time as\"createTime\"," +
                "a.update_time as\"updateTime\",a.suggest_status as \"suggestStatus\"," +
                "b.suggest_name as\"suggestName\",b.suggest_describe as\"suggestSescribe\" from base_suggestion a ," +
                "base_suggestions_dict b where a.suggest_id = b.id and a.is_del = 1" ;
        if(StringUtils.isNoneBlank(type)){
            sql+=" and a.suggest_id = '"+type+"'";
        }if (StringUtils.isNoneBlank(senderId)){
            sql+=" and a.suggest_user_id = '"+senderId+"'";
        }
        sql+=" order by a.create_time desc";
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        for (Map<String,Object> map:list){
            String createTime= map.get("createTime").toString();
            String updateTime = map.get("updateTime").toString();
            map.put("createTime", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
            map.put("updateTime",DateUtil.dateToStrLong(DateUtil.strToDateLong(updateTime)));
        }
        MixEnvelop mixEnvelop = new MixEnvelop();
        mixEnvelop.setCurrPage(page);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setTotalCount(list.size());
        mixEnvelop.setDetailModelList(list);
        return mixEnvelop;
    }
    //回复反馈
    public void reponseSuggestion(String id,String responseContent,String userId,String userName){
        BaseSuggestionDO baseSuggestionDO = baseSuggestionDao.findOne(id);
        if (null!=baseSuggestionDO){
            baseSuggestionDO.setManagerRes(responseContent);
            baseSuggestionDO.setResUser(userId);
            baseSuggestionDO.setResUserName(userName);
            baseSuggestionDO.setSuggestStatus(1);
        }
        baseSuggestionDao.save(baseSuggestionDO);
    }
    //查看单条
    public BaseSuggestionDO findSuggestionById(String id){
        BaseSuggestionDO baseSuggestionDO = baseSuggestionDao.findOne(id);
        BaseSuggestionDictDO baseSuggestionDictDO = baseSuggestionDictDao.findOne(baseSuggestionDO.getSuggestId());
        baseSuggestionDO.setSuggestName(baseSuggestionDictDO.getSuggestName());
        return baseSuggestionDO;
    }
}

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

@ -14,7 +14,6 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.dict.BaseDeptDict;
import com.yihu.jw.entity.hospital.dict.BaseSuperviseDataDict;
import com.yihu.jw.entity.hospital.dict.BaseSuperviseDict;
import com.yihu.jw.entity.hospital.jgpt.HospitalImgDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.internet.dao.HospitalImgDao;
import com.yihu.jw.internet.dao.IntUpErrorLogDao;
@ -24,19 +23,15 @@ import com.yihu.jw.internet.entity.InternetUpLogDO;
import com.yihu.jw.internet.wsapi.Wsapi;
import com.yihu.jw.internet.wsapi.WsapiProxy;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.ImgUtils;
import com.yihu.jw.utils.JSONUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.encode.AESUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import nu.xom.jaxen.function.IdFunction;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -45,7 +40,6 @@ import org.springframework.util.LinkedCaseInsensitiveMap;
import sun.misc.BASE64Encoder;
import java.io.*;
import java.math.BigDecimal;
import java.net.URL;
import java.util.Date;
import java.util.List;
@ -98,7 +92,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
    public String orgSub ;
    public String imgUrl;
    static String imgPath =File.separator+"usr"+File.separator+"local"+File.separator+"hospital"+File.separator+"svr-internet-hospital-job"+File.separator+"img"+File.separator;
    static String imgPath =File.separator+"usr"+File.separator+"local"+File.separator+"ehr"+File.separator+"svr-internet-hospital-job"+File.separator+"img"+File.separator;
    public ObjectMapper objectMapper;
@ -358,7 +352,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                jb.put("docimg", "");
                jb.put("id_card", info.get("idcard")== null ? "0":info.get("idcard"));
                jb.put("sex", info.get("sex")== null ? "0":info.get("sex"));
                jb.put("birthday", info.get("birthday")  == null?"1900-01-01": DateUtil.dateToStrLong((Date)info.get("birthday")));
                jb.put("birthday", info.get("birthday")  == null?"1900-01-01": DateUtil.dateToStrShort((Date)info.get("birthday")));
                jb.put("subject", dept.length>=1?dept[0]:"");
                jb.put("subject_name",dept.length>=2?dept[1]:"");
                jb.put("belong_dept",jb.getString("dept_code"));
@ -1346,7 +1340,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
        return resInfo;
    }
    // 12.在线诊疗服务信息-过程图片上传     --- 完成
    // 12.服务信息-过程图片上传     --- 完成
    public String upNsOnlineImg(String startDate, String endDate,String keyId) throws Exception {
        getBaseSurperviseDict();
        String url = getUrl();

+ 123 - 25
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

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

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

@ -2,15 +2,20 @@ package com.yihu.jw.order.pay.ylz;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.order.pay.utils.PayLogService;
import com.yihu.jw.util.common.QrcodeUtil;
import com.yihu.jw.utils.ByteToInputStream;
import com.ylzinfo.onepay.sdk.HisOnepayClient;
import com.ylzinfo.onepay.sdk.OnepayClient;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.domain.ext.*;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,6 +38,8 @@ public class YlzPayService {
    @Autowired
    private PayLogService logService;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    /**
@ -262,6 +269,13 @@ public class YlzPayService {
        String encryptType = oauthYlzConfigDO.getEncType();
        HisOnepayClient onepayClient = new HisOnepayClient(onepayUrl, appId, appSecret, signType, encryptType);
        JSONObject jsonObject = new JSONObject();
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("EXAMFREE");
        Double free = 0.0;
        if (hospitalSysDictDO!=null){
            free = Double.parseDouble(fee)+Integer.parseInt(hospitalSysDictDO.getDictValue());
        }else {
            free = Double.parseDouble(fee);
        }
        try {
            jsonObject.put("cardType",cardType);//卡类型01 社保卡 06 临时卡
            jsonObject.put("cardNo",cardNo);//卡号
@ -275,7 +289,7 @@ public class YlzPayService {
            jsonObject.put("applyDepaName",applyDepaName);//申请科室名称
            jsonObject.put("applyDoctorName",applyDoctorName);//申请医生姓名
            jsonObject.put("recipeTime",recipeTime);//处方时间yyyyMMddHHmmss
            jsonObject.put("fee",fee);//总费用
            jsonObject.put("fee",free);//总费用
            jsonObject.put("recipeNum",recipeNum);//处方数
            System.out.println("推送模板消息参数"+jsonObject.toJSONString());
            //jsonObject.put("extra")
@ -549,4 +563,92 @@ public class YlzPayService {
    }
//============================================预交金充值 end======================================================
    /**
     * 查看线上结算记录
     *
     * @param cardNo 卡号,多个按逗号隔开
     * @param beginDate 开始时间(可空) yyyyMMdd:20200818
     * @param endDate 结束时间(可空) yyyyMMdd:20200818
     * @param queryType online:(不为空)记录明细一起返回,下面两个参数的合体;onlineRecord:查询结算记录 onlineRecordDetail:查询结算明细
     * @param billSn    当 queryType = onlineRecordDetail billsn和traceno必有值
     * @param traceNo
     * @param pageNo
     * @param pageSize
     * @return
     */
    public String querySettledRecord(String cardNo,String beginDate,String endDate,String queryType,String billSn,String traceNo,String pageNo,String pageSize ){
        Boolean isSuccess = true;
        String jsonObject = null;
        String error = null;
        RequestParams requestParams = new RequestParams();
        try {
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        String onepayUrl = oauthYlzConfigDO.getUrl();
        String signType=oauthYlzConfigDO.getSignType();
        String encryptType = oauthYlzConfigDO.getEncType();
        requestParams.setAppId(appId);
        requestParams.setTimestamp(DateUtil.getCurrentDateTime());
        requestParams.setSignType(signType);
        requestParams.setEncryptType(encryptType);
        requestParams.setTimestamp(DateUtil.getCurrentDateTime());
        //分页参数
        if(StringUtils.isNotBlank(queryType)&&"online".equalsIgnoreCase(queryType)){
            JSONObject pageParam = new JSONObject();
            pageParam.put("pageNo",pageNo);
            pageParam.put("pageSize",pageSize);
            requestParams.setPageParam(pageParam);
        }
        JSONObject params = new JSONObject();
        if (StringUtils.isBlank(cardNo)||StringUtils.isBlank(queryType)){
            return "cardNo或者queryType不能为空";
        }
        if (queryType.equalsIgnoreCase("onlineRecordDetail")){
            if(StringUtils.isBlank(billSn)||StringUtils.isBlank(traceNo)){
                return "billSn和traceNo不能为空";
            }
        }
        params.put("cardNo",cardNo);
        params.put("queryType",queryType);
        if (StringUtils.isNotBlank(beginDate)){
            params.put("beginDate",beginDate);
        }if (StringUtils.isNotBlank(endDate)){
            params.put("endDate",endDate);
        }
        if (StringUtils.isNotBlank(billSn)){
            params.put("billSn",billSn);
        }
        if (StringUtils.isNotBlank(traceNo)){
            params.put("traceNo",traceNo);
        }
        requestParams.setParam(params);
        requestParams.setTransType("hop.query.settle");
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(onepayUrl, appId, appSecret, signType, encryptType);
        ResponseParams<JSONObject> respnse = onepayClient.execute(requestParams);
        if (respnse.getRespCode().equals("000000")){
            jsonObject = JSON.toJSONString(respnse);
            System.out.println(jsonObject);
        }else {
            isSuccess = false;
            jsonObject = JSON.toJSONString(respnse);
            error = "请求失败,返回结果:" + respnse.getRespCode() + "," + respnse.getRespMsg();
        }
        } catch (Exception e) {
            e.printStackTrace();
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            e.printStackTrace(pw);
            error = sw.toString();
        }
        logService.saveHttpLog(isSuccess, "hop.trade.query", "查看线上结算记录", "POST", null,JSON.toJSONString(requestParams), jsonObject, error,logService.shoppatType);
        return jsonObject;
    }
}

+ 15 - 0
business/base-service/src/main/java/com/yihu/jw/utils/AdminException.java

@ -0,0 +1,15 @@
package com.yihu.jw.utils;
import com.yihu.jw.utils.sfutils.MyErrorCode;
public class AdminException extends RuntimeException {
    private MyErrorCode exceptionEnum;
    public AdminException(MyErrorCode exceptionEnum) {
        this.exceptionEnum = exceptionEnum;
    }
    public MyErrorCode getMyErrorCode() {
        return exceptionEnum;
    }
}

+ 47 - 0
business/base-service/src/main/java/com/yihu/jw/utils/FileUtil.java

@ -0,0 +1,47 @@
package com.yihu.jw.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import java.nio.MappedByteBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
public class FileUtil {
    private static final Logger logger = LoggerFactory.getLogger(FileUtil.class);
    /**
     * 在MappedByteBuffer释放后再对它进行读操作的话就会引发jvm crash,在并发情况下很容易发生
     * 正在释放时另一个线程正开始读取,于是crash就发生了。所以为了系统稳定性释放前一般需要检 查是否还有线程在读或写
     * @param mappedByteBuffer
     */
    public static void freedMappedByteBuffer(final MappedByteBuffer mappedByteBuffer) {
        try {
            if (mappedByteBuffer == null) {
                return;
            }
            mappedByteBuffer.force();
            AccessController.doPrivileged(new PrivilegedAction<Object>() {
                @Override
                public Object run() {
                    try {
                        Method getCleanerMethod = mappedByteBuffer.getClass().getMethod("cleaner", new Class[0]);
                        //可以访问private的权限
                        getCleanerMethod.setAccessible(true);
                        //在具有指定参数的 方法对象上调用此 方法对象表示的底层方法
                        sun.misc.Cleaner cleaner = (sun.misc.Cleaner) getCleanerMethod.invoke(mappedByteBuffer,
                                new Object[0]);
                        cleaner.clean();
                    } catch (Exception e) {
                        logger.error("clean MappedByteBuffer error!!!", e);
                    }
                    logger.info("clean MappedByteBuffer completed!!!");
                    return null;
                }
            });
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

+ 96 - 0
business/base-service/src/main/java/com/yihu/jw/utils/Pkis/PKIServiceProxy.java

@ -0,0 +1,96 @@
package com.yihu.jw.utils.Pkis;
public class PKIServiceProxy implements PKIService_PortType {
  private String _endpoint = null;
  private PKIService_PortType pKIService_PortType = null;
  
  public PKIServiceProxy() {
    _initPKIServiceProxy();
  }
  
  public PKIServiceProxy(String endpoint) {
    _endpoint = endpoint;
    _initPKIServiceProxy();
  }
  
  private void _initPKIServiceProxy() {
    try {
      pKIService_PortType = (new PKIService_ServiceLocator()).getPKIServiceImplPort();
      if (pKIService_PortType != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)pKIService_PortType)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)pKIService_PortType)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (pKIService_PortType != null)
      ((javax.xml.rpc.Stub)pKIService_PortType)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public PKIService_PortType getPKIService_PortType() {
    if (pKIService_PortType == null)
      _initPKIServiceProxy();
    return pKIService_PortType;
  }
  
  public String SOF_LoginAuthentication(String certData, String inData, String signData) throws java.rmi.RemoteException{
    if (pKIService_PortType == null)
      _initPKIServiceProxy();
    return pKIService_PortType.SOF_LoginAuthentication(certData, inData, signData);
  }
  
  public String SOF_SignDataWithExtraInfo(String idCardNo, String inData, String extInfo) throws java.rmi.RemoteException{
    if (pKIService_PortType == null)
      _initPKIServiceProxy();
    return pKIService_PortType.SOF_SignDataWithExtraInfo(idCardNo, inData, extInfo);
  }
  
  public String SOF_SignData(String idCardNo, String inData) throws java.rmi.RemoteException{
    if (pKIService_PortType == null)
      _initPKIServiceProxy();
    return pKIService_PortType.SOF_SignData(idCardNo, inData);
  }
  
  public String SOF_VerifySignedData(String certData, String inData, String signData) throws java.rmi.RemoteException{
    if (pKIService_PortType == null)
      _initPKIServiceProxy();
    return pKIService_PortType.SOF_VerifySignedData(certData, inData, signData);
  }
  
  public String SOF_LoginWithAccountInfo(String sys, String accountType, String account, String password) throws java.rmi.RemoteException{
    if (pKIService_PortType == null)
      _initPKIServiceProxy();
    return pKIService_PortType.SOF_LoginWithAccountInfo(sys, accountType, account, password);
  }
  
  public String SOF_GetCertInfoByType(String certData, int type) throws java.rmi.RemoteException{
    if (pKIService_PortType == null)
      _initPKIServiceProxy();
    return pKIService_PortType.SOF_GetCertInfoByType(certData, type);
  }
  
  public String SOF_GetCertInfoByOid(String certData, String oid) throws java.rmi.RemoteException{
    if (pKIService_PortType == null)
      _initPKIServiceProxy();
    return pKIService_PortType.SOF_GetCertInfoByOid(certData, oid);
  }
  
  public String SOF_GenRandom(int len) throws java.rmi.RemoteException{
    if (pKIService_PortType == null)
      _initPKIServiceProxy();
    return pKIService_PortType.SOF_GenRandom(len);
  }
  
  
}

+ 481 - 0
business/base-service/src/main/java/com/yihu/jw/utils/Pkis/PKIServiceSoapBindingStub.java

@ -0,0 +1,481 @@
/**
 * PKIServiceSoapBindingStub.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */
package com.yihu.jw.utils.Pkis;
public class PKIServiceSoapBindingStub extends org.apache.axis.client.Stub implements PKIService_PortType {
    private java.util.Vector cachedSerClasses = new java.util.Vector();
    private java.util.Vector cachedSerQNames = new java.util.Vector();
    private java.util.Vector cachedSerFactories = new java.util.Vector();
    private java.util.Vector cachedDeserFactories = new java.util.Vector();
    static org.apache.axis.description.OperationDesc [] _operations;
    static {
        _operations = new org.apache.axis.description.OperationDesc[8];
        _initOperationDesc1();
    }
    private static void _initOperationDesc1(){
        org.apache.axis.description.OperationDesc oper;
        org.apache.axis.description.ParameterDesc param;
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("SOF_LoginAuthentication");
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "certData"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "inData"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "signData"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        oper.setReturnClass(String.class);
        oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
        oper.setUse(org.apache.axis.constants.Use.LITERAL);
        _operations[0] = oper;
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("SOF_SignDataWithExtraInfo");
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "idCardNo"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "inData"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "extInfo"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        oper.setReturnClass(String.class);
        oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
        oper.setUse(org.apache.axis.constants.Use.LITERAL);
        _operations[1] = oper;
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("SOF_VerifySignedData");
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "certData"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "inData"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "signData"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        oper.setReturnClass(String.class);
        oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
        oper.setUse(org.apache.axis.constants.Use.LITERAL);
        _operations[2] = oper;
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("SOF_SignData");
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "idCardNo"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "inData"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        oper.setReturnClass(String.class);
        oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
        oper.setUse(org.apache.axis.constants.Use.LITERAL);
        _operations[3] = oper;
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("SOF_LoginWithAccountInfo");
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "sys"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "accountType"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "account"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "password"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        oper.setReturnClass(String.class);
        oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
        oper.setUse(org.apache.axis.constants.Use.LITERAL);
        _operations[4] = oper;
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("SOF_GetCertInfoByType");
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "certData"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "type"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"), int.class, false, false);
        oper.addParameter(param);
        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        oper.setReturnClass(String.class);
        oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
        oper.setUse(org.apache.axis.constants.Use.LITERAL);
        _operations[5] = oper;
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("SOF_GetCertInfoByOid");
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "certData"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "oid"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false);
        param.setOmittable(true);
        oper.addParameter(param);
        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        oper.setReturnClass(String.class);
        oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
        oper.setUse(org.apache.axis.constants.Use.LITERAL);
        _operations[6] = oper;
        oper = new org.apache.axis.description.OperationDesc();
        oper.setName("SOF_GenRandom");
        param = new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "len"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"), int.class, false, false);
        oper.addParameter(param);
        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
        oper.setReturnClass(String.class);
        oper.setReturnQName(new javax.xml.namespace.QName("", "return"));
        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
        oper.setUse(org.apache.axis.constants.Use.LITERAL);
        _operations[7] = oper;
    }
    public PKIServiceSoapBindingStub() throws org.apache.axis.AxisFault {
         this(null);
    }
    public PKIServiceSoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
         this(service);
         super.cachedEndpoint = endpointURL;
    }
    public PKIServiceSoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
        if (service == null) {
            super.service = new org.apache.axis.client.Service();
        } else {
            super.service = service;
        }
        ((org.apache.axis.client.Service)super.service).setTypeMappingVersion("1.2");
    }
    protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
        try {
            org.apache.axis.client.Call _call = super._createCall();
            if (super.maintainSessionSet) {
                _call.setMaintainSession(super.maintainSession);
            }
            if (super.cachedUsername != null) {
                _call.setUsername(super.cachedUsername);
            }
            if (super.cachedPassword != null) {
                _call.setPassword(super.cachedPassword);
            }
            if (super.cachedEndpoint != null) {
                _call.setTargetEndpointAddress(super.cachedEndpoint);
            }
            if (super.cachedTimeout != null) {
                _call.setTimeout(super.cachedTimeout);
            }
            if (super.cachedPortName != null) {
                _call.setPortName(super.cachedPortName);
            }
            java.util.Enumeration keys = super.cachedProperties.keys();
            while (keys.hasMoreElements()) {
                String key = (String) keys.nextElement();
                _call.setProperty(key, super.cachedProperties.get(key));
            }
            return _call;
        }
        catch (Throwable _t) {
            throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
        }
    }
    public String SOF_LoginAuthentication(String certData, String inData, String signData) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[0]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("SOF_LoginAuthentication");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("http://webservice.platform.jhsec.com.cn/", "SOF_LoginAuthentication"));
        setRequestHeaders(_call);
        setAttachments(_call);
 try {        Object _resp = _call.invoke(new Object[] {certData, inData, signData});
        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (String) _resp;
            } catch (Exception _exception) {
                return (String) org.apache.axis.utils.JavaUtils.convert(_resp, String.class);
            }
        }
  } catch (org.apache.axis.AxisFault axisFaultException) {
  throw axisFaultException;
}
    }
    public String SOF_SignDataWithExtraInfo(String idCardNo, String inData, String extInfo) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[1]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("SOF_SignDataWithExtraInfo");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("http://webservice.platform.jhsec.com.cn/", "SOF_SignDataWithExtraInfo"));
        setRequestHeaders(_call);
        setAttachments(_call);
 try {        Object _resp = _call.invoke(new Object[] {idCardNo, inData, extInfo});
        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (String) _resp;
            } catch (Exception _exception) {
                return (String) org.apache.axis.utils.JavaUtils.convert(_resp, String.class);
            }
        }
  } catch (org.apache.axis.AxisFault axisFaultException) {
  throw axisFaultException;
}
    }
    public String SOF_VerifySignedData(String certData, String inData, String signData) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[2]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("SOF_VerifySignedData");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("http://webservice.platform.jhsec.com.cn/", "SOF_VerifySignedData"));
        setRequestHeaders(_call);
        setAttachments(_call);
 try {        Object _resp = _call.invoke(new Object[] {certData, inData, signData});
        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (String) _resp;
            } catch (Exception _exception) {
                return (String) org.apache.axis.utils.JavaUtils.convert(_resp, String.class);
            }
        }
  } catch (org.apache.axis.AxisFault axisFaultException) {
  throw axisFaultException;
}
    }
    public String SOF_SignData(String idCardNo, String inData) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[3]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("SOF_SignData");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("http://webservice.platform.jhsec.com.cn/", "SOF_SignData"));
        setRequestHeaders(_call);
        setAttachments(_call);
 try {        Object _resp = _call.invoke(new Object[] {idCardNo, inData});
        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (String) _resp;
            } catch (Exception _exception) {
                return (String) org.apache.axis.utils.JavaUtils.convert(_resp, String.class);
            }
        }
  } catch (org.apache.axis.AxisFault axisFaultException) {
  throw axisFaultException;
}
    }
    public String SOF_LoginWithAccountInfo(String sys, String accountType, String account, String password) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[4]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("SOF_LoginWithAccountInfo");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("http://webservice.platform.jhsec.com.cn/", "SOF_LoginWithAccountInfo"));
        setRequestHeaders(_call);
        setAttachments(_call);
 try {        Object _resp = _call.invoke(new Object[] {sys, accountType, account, password});
        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (String) _resp;
            } catch (Exception _exception) {
                return (String) org.apache.axis.utils.JavaUtils.convert(_resp, String.class);
            }
        }
  } catch (org.apache.axis.AxisFault axisFaultException) {
  throw axisFaultException;
}
    }
    public String SOF_GetCertInfoByType(String certData, int type) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[5]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("SOF_GetCertInfoByType");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("http://webservice.platform.jhsec.com.cn/", "SOF_GetCertInfoByType"));
        setRequestHeaders(_call);
        setAttachments(_call);
 try {        Object _resp = _call.invoke(new Object[] {certData, new Integer(type)});
        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (String) _resp;
            } catch (Exception _exception) {
                return (String) org.apache.axis.utils.JavaUtils.convert(_resp, String.class);
            }
        }
  } catch (org.apache.axis.AxisFault axisFaultException) {
  throw axisFaultException;
}
    }
    public String SOF_GetCertInfoByOid(String certData, String oid) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[6]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("SOF_GetCertInfoByOid");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("http://webservice.platform.jhsec.com.cn/", "SOF_GetCertInfoByOid"));
        setRequestHeaders(_call);
        setAttachments(_call);
 try {        Object _resp = _call.invoke(new Object[] {certData, oid});
        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (String) _resp;
            } catch (Exception _exception) {
                return (String) org.apache.axis.utils.JavaUtils.convert(_resp, String.class);
            }
        }
  } catch (org.apache.axis.AxisFault axisFaultException) {
  throw axisFaultException;
}
    }
    public String SOF_GenRandom(int len) throws java.rmi.RemoteException {
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call _call = createCall();
        _call.setOperation(_operations[7]);
        _call.setUseSOAPAction(true);
        _call.setSOAPActionURI("SOF_GenRandom");
        _call.setEncodingStyle(null);
        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
        _call.setOperationName(new javax.xml.namespace.QName("http://webservice.platform.jhsec.com.cn/", "SOF_GenRandom"));
        setRequestHeaders(_call);
        setAttachments(_call);
 try {        Object _resp = _call.invoke(new Object[] {new Integer(len)});
        if (_resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)_resp;
        }
        else {
            extractAttachments(_call);
            try {
                return (String) _resp;
            } catch (Exception _exception) {
                return (String) org.apache.axis.utils.JavaUtils.convert(_resp, String.class);
            }
        }
  } catch (org.apache.axis.AxisFault axisFaultException) {
  throw axisFaultException;
}
    }
}

+ 19 - 0
business/base-service/src/main/java/com/yihu/jw/utils/Pkis/PKIService_PortType.java

@ -0,0 +1,19 @@
/**
 * PKIService_PortType.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */
package com.yihu.jw.utils.Pkis;
public interface PKIService_PortType extends java.rmi.Remote {
    public String SOF_LoginAuthentication(String certData, String inData, String signData) throws java.rmi.RemoteException;
    public String SOF_SignDataWithExtraInfo(String idCardNo, String inData, String extInfo) throws java.rmi.RemoteException;
    public String SOF_SignData(String idCardNo, String inData) throws java.rmi.RemoteException;
    public String SOF_VerifySignedData(String certData, String inData, String signData) throws java.rmi.RemoteException;
    public String SOF_LoginWithAccountInfo(String sys, String accountType, String account, String password) throws java.rmi.RemoteException;
    public String SOF_GetCertInfoByType(String certData, int type) throws java.rmi.RemoteException;
    public String SOF_GetCertInfoByOid(String certData, String oid) throws java.rmi.RemoteException;
    public String SOF_GenRandom(int len) throws java.rmi.RemoteException;
}

+ 16 - 0
business/base-service/src/main/java/com/yihu/jw/utils/Pkis/PKIService_Service.java

@ -0,0 +1,16 @@
/**
 * PKIService_Service.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */
package com.yihu.jw.utils.Pkis;
public interface PKIService_Service extends javax.xml.rpc.Service {
    public String getPKIServiceImplPortAddress();
    public PKIService_PortType getPKIServiceImplPort() throws javax.xml.rpc.ServiceException;
    public PKIService_PortType getPKIServiceImplPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
}

+ 142 - 0
business/base-service/src/main/java/com/yihu/jw/utils/Pkis/PKIService_ServiceLocator.java

@ -0,0 +1,142 @@
/**
 * PKIService_ServiceLocator.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
 */
package com.yihu.jw.utils.Pkis;
public class PKIService_ServiceLocator extends org.apache.axis.client.Service implements PKIService_Service {
    public PKIService_ServiceLocator() {
    }
    public PKIService_ServiceLocator(org.apache.axis.EngineConfiguration config) {
        super(config);
    }
    public PKIService_ServiceLocator(String wsdlLoc, javax.xml.namespace.QName sName) throws javax.xml.rpc.ServiceException {
        super(wsdlLoc, sName);
    }
    // Use to get a proxy class for PKIServiceImplPort
    private String PKIServiceImplPort_address = "http://101.132.67.155:8080/pkis/services/v1";
    public String getPKIServiceImplPortAddress() {
        return PKIServiceImplPort_address;
    }
    // The WSDD service name defaults to the port name.
    private String PKIServiceImplPortWSDDServiceName = "PKIServiceImplPort";
    public String getPKIServiceImplPortWSDDServiceName() {
        return PKIServiceImplPortWSDDServiceName;
    }
    public void setPKIServiceImplPortWSDDServiceName(String name) {
        PKIServiceImplPortWSDDServiceName = name;
    }
    public PKIService_PortType getPKIServiceImplPort() throws javax.xml.rpc.ServiceException {
       java.net.URL endpoint;
        try {
            endpoint = new java.net.URL(PKIServiceImplPort_address);
        }
        catch (java.net.MalformedURLException e) {
            throw new javax.xml.rpc.ServiceException(e);
        }
        return getPKIServiceImplPort(endpoint);
    }
    public PKIService_PortType getPKIServiceImplPort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
        try {
            PKIServiceSoapBindingStub _stub = new PKIServiceSoapBindingStub(portAddress, this);
            _stub.setPortName(getPKIServiceImplPortWSDDServiceName());
            return _stub;
        }
        catch (org.apache.axis.AxisFault e) {
            return null;
        }
    }
    public void setPKIServiceImplPortEndpointAddress(String address) {
        PKIServiceImplPort_address = address;
    }
    /**
     * For the given interface, get the stub implementation.
     * If this service has no port for the given interface,
     * then ServiceException is thrown.
     */
    public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (PKIService_PortType.class.isAssignableFrom(serviceEndpointInterface)) {
                PKIServiceSoapBindingStub _stub = new PKIServiceSoapBindingStub(new java.net.URL(PKIServiceImplPort_address), this);
                _stub.setPortName(getPKIServiceImplPortWSDDServiceName());
                return _stub;
            }
        }
        catch (Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
    /**
     * For the given interface, get the stub implementation.
     * If this service has no port for the given interface,
     * then ServiceException is thrown.
     */
    public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        if (portName == null) {
            return getPort(serviceEndpointInterface);
        }
        String inputPortName = portName.getLocalPart();
        if ("PKIServiceImplPort".equals(inputPortName)) {
            return getPKIServiceImplPort();
        }
        else  {
            java.rmi.Remote _stub = getPort(serviceEndpointInterface);
            ((org.apache.axis.client.Stub) _stub).setPortName(portName);
            return _stub;
        }
    }
    public javax.xml.namespace.QName getServiceName() {
        return new javax.xml.namespace.QName("http://webservice.platform.jhsec.com.cn/", "PKIService");
    }
    private java.util.HashSet ports = null;
    public java.util.Iterator getPorts() {
        if (ports == null) {
            ports = new java.util.HashSet();
            ports.add(new javax.xml.namespace.QName("http://webservice.platform.jhsec.com.cn/", "PKIServiceImplPort"));
        }
        return ports.iterator();
    }
    /**
    * Set the endpoint address for the specified port name.
    */
    public void setEndpointAddress(String portName, String address) throws javax.xml.rpc.ServiceException {
        
if ("PKIServiceImplPort".equals(portName)) {
            setPKIServiceImplPortEndpointAddress(address);
        }
        else 
{ // Unknown Port Name
            throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
        }
    }
    /**
    * Set the endpoint address for the specified port name.
    */
    public void setEndpointAddress(javax.xml.namespace.QName portName, String address) throws javax.xml.rpc.ServiceException {
        setEndpointAddress(portName.getLocalPart(), address);
    }
}

+ 26 - 0
business/base-service/src/main/java/com/yihu/jw/utils/sfutils/MyErrorCode.java

@ -0,0 +1,26 @@
package com.yihu.jw.utils.sfutils;
public enum MyErrorCode {
    EXCEPTION_ONE(725,"请选择与上次相同的快递方式"),
    EXCEPTION_TWO(400,"异常二提示信息"),
    EXCEPTION_THREE(400,"异常三提示信息")
    ;
    //状态码
    private Integer code;
    //异常提示信息
    private String msg;
    MyErrorCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public Integer getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
}

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

@ -122,13 +122,13 @@ public class StatisticsEsService {
        object.put("prescriptionRate",prescriptionRate);//开方率
        String startTime = DateUtil.getStringDateShort()+" 00:00:00";
        String endTime = DateUtil.getStringDateShort() +" 23:59:59";
        String sql = "select count(*) as total from base.wlyy_consult_oupatient_info o where  o.create_time >='"+startTime+"' and o.create_time <='"+endTime+"'";
        String sql = "select count(*) as \"total\" from base.wlyy_consult_oupatient_info o where  o.create_time >='"+startTime+"' and o.create_time <='"+endTime+"'";
        if (level==4){
            sql += " and o.doctor IN (SELECT doctor_code FROM `base_doctor_hospital` dh where dh.org_code ='"+area+"' and dh.del=1)";
            sql += " and o.doctor IN (SELECT doctor_code as \"doctor_code\" FROM `base_doctor_hospital` dh where dh.org_code ='"+area+"' and dh.del=1)";
        }if (level==2){
            sql += " AND 1=1 ";
        }else if (level==5){
            sql += " and o.doctor IN (SELECT doctor_code FROM `base_doctor_hospital` dh where dh.dept_code ='"+area+"' and dh.del=1)";
            sql += " and o.doctor IN (SELECT doctor_code as \"doctor_code\" FROM `base_doctor_hospital` dh where dh.dept_code ='"+area+"' and dh.del=1)";
        }else if (level==6){
            sql +=" and o.doctor='"+area+"'";
        }
@ -911,10 +911,10 @@ public class StatisticsEsService {
        String sql = null;
        JSONObject object1= new JSONObject();
        if (flag==1){
            sql="SELECT dhd.CODE AS dept_code, dhd. NAME AS dept_name, CASE WHEN c. COUNT IS NOT NULL THEN " +
                    "c. COUNT ELSE 0 END AS COUNT FROM DICT_HOSPITAL_DEPT dhd " +
                    "LEFT JOIN ( SELECT dh.DEPT_CODE, hd. NAME AS dept_name, " +
                    "COUNT(dh.DOCTOR_CODE) AS COUNT FROM BASE_DOCTOR bd " +
            sql="SELECT dhd.CODE AS \"dept_code\", dhd. NAME AS \"dept_name\", CASE WHEN c. COUNT IS NOT NULL THEN " +
                    "c. COUNT ELSE 0 END AS \"COUNT\" FROM DICT_HOSPITAL_DEPT dhd " +
                    "LEFT JOIN ( SELECT dh.DEPT_CODE as\"DEPT_CODE\", hd. NAME AS \"dept_name\", " +
                    "COUNT(dh.DOCTOR_CODE) AS \"COUNT\" FROM BASE_DOCTOR bd " +
                    "LEFT JOIN BASE_DOCTOR_HOSPITAL dh ON bd. ID = dh.DOCTOR_CODE " +
                    "RIGHT JOIN DICT_HOSPITAL_DEPT hd ON hd.CODE = dh.DEPT_CODE " +
                    "WHERE bd.DEL = 1 AND bd.job_title_code IN('1201','1301','1401','1101','066','067','061','1310','061','065')  AND  bd.OUTPATIENT_TYPE IS NOT NULL GROUP BY dh.DEPT_CODE, hd. NAME " +
@ -947,7 +947,7 @@ public class StatisticsEsService {
        }else if (flag ==2) {
            List<SaveModel> saveModels = elasticsearchUtil.findDateQuotaLevel0(startDate, endDate, area, level, index, SaveModel.timeLevel_ZL, null, "6");
            String deptSql = "select hd.CODE,hd.NAME from DICT_HOSPITAL_DEPT hd where hd.ORG_CODE ='" + area + "' and CONSULT_DEPT_FLAG=1";
            String deptSql = "select hd.CODE as \"CODE\",hd.NAME as \"NAME\" from DICT_HOSPITAL_DEPT hd where hd.ORG_CODE ='" + area + "' and CONSULT_DEPT_FLAG=1";
            List<Map<String, Object>> mapList = jdbcTemplate.queryForList(deptSql);
            List<JSONObject> result = new ArrayList<>();
            for (SaveModel saveModel : saveModels) {
@ -1016,11 +1016,11 @@ public class StatisticsEsService {
    public JSONObject getDoctorTotal(String startDate, String endDate, String area, int level, String index, String level2_type,Integer flag) throws Exception {
        JSONObject object = new JSONObject();
        if (flag==1){
            String sql = "SELECT bd.JOB_TITLE_CODE, bd.JOB_TITLE_NAME, COUNT(bd.ID) as count FROM " +
            String sql = "SELECT bd.JOB_TITLE_CODE as \"JOB_TITLE_CODE\", bd.JOB_TITLE_NAME as \"JOB_TITLE_NAME\", COUNT(bd.ID) as \"count\" FROM " +
                    "BASE_DOCTOR bd, BASE_DOCTOR_HOSPITAL bdh,DICT_HOSPITAL_DEPT dhd  WHERE bd.ID = bdh.DOCTOR_CODE AND dhd.code = bdh.DEPT_CODE AND bd.DEL = 1 " +
                    " AND bdh.DEL = 1 AND bd.OUTPATIENT_TYPE IS NOT NULL AND bd.job_title_code IN('1201','1301','1401','1101','066','067','061','1310','061','065') " ;
            String sqlCount = "SELECT COUNT(bd.ID) as total FROM " +
            String sqlCount = "SELECT COUNT(bd.ID) as \"total\" FROM " +
                    "BASE_DOCTOR bd, BASE_DOCTOR_HOSPITAL bdh,DICT_HOSPITAL_DEPT dhd WHERE bd.ID = bdh.DOCTOR_CODE AND dhd.code = bdh.DEPT_CODE AND bd.DEL = 1 " +
                    " AND bdh.DEL = 1 AND bd.OUTPATIENT_TYPE IS NOT NULL AND dhd.CONSULT_DEPT_FLAG='1' AND bd.job_title_code IN('1201','1301','1401','1101','066','067','061','1310','061','065') ";
@ -1058,7 +1058,7 @@ public class StatisticsEsService {
                buffer.deleteCharAt(buffer.length()-1);
            }
            if (buffer.length()>0){
                String sql ="SELECT bd.JOB_TITLE_CODE, bd.JOB_TITLE_NAME,COUNT(bd.ID) AS total FROM BASE_DOCTOR bd WHERE  bd.DEL = 1";
                String sql ="SELECT bd.JOB_TITLE_CODE as \"JOB_TITLE_CODE\", bd.JOB_TITLE_NAME as \"JOB_TITLE_NAME\" ,COUNT(bd.ID) AS \"total\" FROM BASE_DOCTOR bd WHERE  bd.DEL = 1";
                sql +="  AND bd.ID IN("+buffer+")";
                sql +="  GROUP BY bd.JOB_TITLE_CODE,bd.JOB_TITLE_NAME";
                List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);//各职称人数
@ -1076,8 +1076,8 @@ public class StatisticsEsService {
    public JSONObject getDoctorStatisticsExcel(String startDate, String endDate, String area, int level, String index, String level2_type,Integer flag) throws Exception {
        JSONObject object = new JSONObject();
        if (flag==1){//开通医生
            String sql ="SELECT bd.ID, bd.NAME, bd.OUTPATIENT_TYPE, " +
                    "dhd.code AS dept_code, dhd.name AS dept_name,bd.JOB_TITLE_NAME  FROM " +
            String sql ="SELECT bd.ID as\"ID\", bd.NAME as\"NAME\", bd.OUTPATIENT_TYPE as\"OUTPATIENT_TYPE\", " +
                    "dhd.code AS \"dept_code\", dhd.name AS \"dept_name\",bd.JOB_TITLE_NAME as\"JOB_TITLE_NAME\" FROM " +
                    "BASE_DOCTOR bd, BASE_DOCTOR_HOSPITAL bdh, " +
                    "DICT_HOSPITAL_DEPT dhd WHERE bd.ID = bdh.DOCTOR_CODE " +
                    "AND dhd.code = bdh.DEPT_CODE " +
@ -1085,7 +1085,7 @@ public class StatisticsEsService {
                    "AND bdh.DEL = 1 " +
                    "AND bd.OUTPATIENT_TYPE IS NOT NULL " +
                    " AND dhd.CONSULT_DEPT_FLAG='1' AND bd.job_title_code IN('1201','1301','1401','1101','066','067','061','1310','061','065')";
            String deptSql = "select hd.CODE,hd.NAME from DICT_HOSPITAL_DEPT hd where CONSULT_DEPT_FLAG=1";
            String deptSql = "select hd.CODE as \"CODE\",hd.NAME as \"NAME\" from DICT_HOSPITAL_DEPT hd where CONSULT_DEPT_FLAG=1";
            if (level==4){//科室
                sql+=" AND dhd.ORG_CODE = '"+area+"'";
                deptSql+=" AND hd.ORG_CODE ='" + area + "'";
@ -1181,7 +1181,7 @@ public class StatisticsEsService {
            //专科
            List<SaveModel> specialistModels = elasticsearchUtil.findDateQuotaLevel1(startDate, endDate, area, level,index, SaveModel.timeLevel_ZL,"1",null, "6");
            String deptSql = "select hd.CODE,hd.NAME from DICT_HOSPITAL_DEPT hd where CONSULT_DEPT_FLAG=1";
            String deptSql = "select hd.CODE as \"CODE\",hd.NAME as \"NAME\" from DICT_HOSPITAL_DEPT hd where CONSULT_DEPT_FLAG=1";
            if (level==4){//科室
                deptSql+=" AND hd.ORG_CODE ='" + area + "'";
            }else if (level==5){//医生
@ -2536,7 +2536,7 @@ public class StatisticsEsService {
        }else if (SaveModel.doctorLevel.equalsIgnoreCase(level.toString())){
            condition +=" and dh.doctor_code = '"+area+"'";
        }
        String sql = "SELECT COUNT(*) total FROM `base_doctor_role` dr LEFT JOIN base_doctor_hospital dh ON dr.doctor_code = dh.doctor_code where dr.role_code='specialist' "+condition;
        String sql = "SELECT COUNT(*) as \"total\" FROM `base_doctor_role` dr LEFT JOIN base_doctor_hospital dh ON dr.doctor_code = dh.doctor_code where dr.role_code='specialist' "+condition;
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);
        Long doctorCount = 0L;
        if (mapList!=null&&mapList.size()!=0){

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

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

+ 122 - 23
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -1996,9 +1996,9 @@ public class ImService {
			WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionVO.getOutpatientId());
			if (wlyyOutpatientDO.getOutpatientType()!=null){
				if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("1")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1");
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1",null);
				}else if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("2")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_16", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1");
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_16", "24", JSON.toJSONString(wlyyPrescriptionDiagnosisVOS),"1",null);
				}
			}
		}
@ -2014,9 +2014,9 @@ public class ImService {
			WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionVO.getOutpatientId());
			if (wlyyOutpatientDO.getOutpatientType()!=null){
				if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("1")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "27", JSON.toJSONString(object),"1");
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_9", "27", JSON.toJSONString(object),"1",null);
				}else if (wlyyOutpatientDO.getOutpatientType().equalsIgnoreCase("1")&&wlyyOutpatientDO.getType().equalsIgnoreCase("2")){
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_16", "27", JSON.toJSONString(object),"1");
					String response = imUtil.sendImMsg(wlyyPrescriptionVO.getDoctor(), wlyyPrescriptionVO.getDoctorName(), wlyyPrescriptionVO.getPatientCode()+"_"+wlyyPrescriptionVO.getOutpatientId()+"_16", "27", JSON.toJSONString(object),"1",null);
				}
			}
		}
@ -2042,7 +2042,7 @@ public class ImService {
//			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_9", "31",jsonObject.toString(),"1");
//		}else
		if("2".equals(outpatientType)){
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_12", "31",jsonObject.toString(),"1");
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_12", "31",jsonObject.toString(),"1",null);
		}else{
			return null;
		}
@ -2056,7 +2056,7 @@ public class ImService {
	 * @throws Exception
	 */
	public String sendOutPatientSuggestMsg(String msg,String doctor,String doctorName,String sessionid) throws Exception {
		return imUtil.sendImMsg(doctor, doctorName, sessionid, "34",msg,"1");
		return imUtil.sendImMsg(doctor, doctorName, sessionid, "34",msg,"1",null);
	}
	
	
@ -2072,9 +2072,9 @@ public class ImService {
	 */
	public String pushPrescriptionBackMsg(com.alibaba.fastjson.JSONObject jsonObject,String doctor,String doctorName,String outpatientId,String patient,String outpatientType) throws Exception {
		if("1".equals(outpatientType)){
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_9", "33",jsonObject.toString(),"1");
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_9", "33",jsonObject.toString(),"1",null);
		}else if("2".equals(outpatientType)){
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_12", "33",jsonObject.toString(),"1");
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_12", "33",jsonObject.toString(),"1",null);
		}else{
			return null;
		}
@ -2092,9 +2092,9 @@ public class ImService {
	 */
	public String sendOutPatientPayMsg(com.alibaba.fastjson.JSONObject jsonObject,String doctor,String doctorName,String outpatientId,String patient,String outpatientType) throws Exception {
		if("1".equals(outpatientType)){
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_9", "35",jsonObject.toString(),"1");
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_9", "35",jsonObject.toString(),"1",null);
		}else if("2".equals(outpatientType)){
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_12", "35",jsonObject.toString(),"1");
			return imUtil.sendImMsg(doctor, doctorName, patient+"_"+outpatientId+"_12", "35",jsonObject.toString(),"1",null);
		}else{
			return null;
		}
@ -2140,12 +2140,13 @@ public class ImService {
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientSex\"," +
					"d.photo AS \"patientPhoto\" " +
					"d.photo AS \"patientPhoto\", " +
					"b.doctor as \"doctor\"  "+
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d " +
					"WHERE a.id=b.consult " +
					"AND b.patient=d.id AND b.doctor='"+doctor+"'";
					"AND b.patient=d.id ";
		}else{
			
			sql = "SELECT " +
@ -2172,15 +2173,19 @@ public class ImService {
					"op.type as \"consultType\"," +
					"op.general_doctor as \"generalDoctor\"," +
					"op.icd10_name as \"icd10Name\"," +
					"d.photo AS \"patientPhoto\" " +
					"d.photo AS \"patientPhoto\" , " +
					"b.doctor as \"doctor\"  "+
					"FROM wlyy_consult_team b," +
					"base_patient d," +
					"wlyy_consult a   " +
					"left join wlyy_outpatient op on  a.relation_code = op.id " +
					"WHERE a.id=b.consult " +
					"AND b.patient=d.id AND b.doctor='"+doctor+"' ";
					"AND b.patient=d.id ";
		}
		if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)){
			sql+=" AND b.doctor='"+doctor+"' ";
		}
		
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
@ -2246,6 +2251,14 @@ public class ImService {
			}else {
				map.put("patientAge",null);
			}
			if (map.get("doctor")!=null){
				String doctorId = map.get("doctor").toString();
				BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
				if (baseDoctorDO!=null){
					map.put("doctorName",baseDoctorDO.getName());
				}
			}
		}
		return mapList;
	}
@ -2263,7 +2276,7 @@ public class ImService {
	 */
	public Long countConsultRecordByDoctor(String doctor, String id,String type, Integer status,String title,String start_time,String end_time) {
		
		String  sql = "SELECT " +
		/*String  sql = "SELECT " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult_team b," +
				"base_patient d," +
@ -2289,7 +2302,7 @@ public class ImService {
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
			/*sql +=" and a.czrq >= '"+start_time+"'";*/
			*//*sql +=" and a.czrq >= '"+start_time+"'";*//*
		}
		
		if(!StringUtils.isEmpty(end_time)){
@ -2330,8 +2343,93 @@ public class ImService {
		Long count = 0L;
		if (rstotal != null && rstotal.size() > 0) {
			count = Long.parseLong(rstotal.get(0).get("total").toString());
		}*/
		String  sql = "";
		//专家咨询
		if("1".equals(type) || "15".equals(type) || type.contains(",")){
			sql = "SELECT " +
					" COUNT(1) AS \"total\" "+
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d " +
					"WHERE a.id=b.consult " +
					"AND b.patient=d.id ";
		}else{
			sql = "SELECT " +
					" COUNT(1) AS \"total\" "+
					"FROM wlyy_consult_team b," +
					"base_patient d," +
					"wlyy_consult a   " +
					"left join wlyy_outpatient op on  a.relation_code = op.id " +
					"WHERE a.id=b.consult " +
					"AND b.patient=d.id ";
		}
		if (org.apache.commons.lang.StringUtils.isNotBlank(doctor)){
			sql+=" AND b.doctor='"+doctor+"' ";
		}
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			sql +=" and a.symptoms like '"+title+"'";
		}
		if(!StringUtils.isEmpty(start_time)){
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql +=" and a.czrq >= str_to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq >= to_date('"+start_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq >= '"+start_time+"'";
			}
		}
		if(!StringUtils.isEmpty(end_time)){
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql +=" and a.czrq <= str_to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}else {
					sql +=" and a.czrq <= to_date('"+end_time+"','YYYY-MM-DD HH24:MI:SS')";
				}
			}else {
				sql +=" and a.czrq <= '"+end_time+"'";
			}
		}
		//咨询状态
		if(status != 0){
			if(status ==2 ){//就诊中
				sql +=" and b.status = 0 ";
			}else if(status ==3 ){
				sql +=" and b.status = 1 ";
			}else{}
		}
		//咨询类型
		if(!StringUtils.isEmpty(type)&&!type.equalsIgnoreCase("0")){
			sql +=" AND a.type in ("+type+")" ;
		}
		if (!StringUtils.isEmpty(id)) {
			sql += " and a.id = '" + id + "'";
		}
		sql += " ORDER BY a.czrq desc ";
		List<Map<String,Object>> mapList = hibenateUtils.createSQLQuery(sql);
		Long count = 0L;
		if (mapList != null && mapList.size() > 0) {
			count = Long.parseLong(mapList.get(0).get("total").toString());
		}
		
		return count;
	}
	
@ -2403,8 +2501,8 @@ public class ImService {
	 * @param business_type
	 * @return
	 */
	public String patientGuaidenceAppend(String sender_id, String sender_name, String session_id,String content_type, String content, String business_type)throws Exception  {
		return imUtil.sendImMsg(sender_id, sender_name,session_id, content_type, content, "1");
	public String patientGuaidenceAppend(String sender_id, String sender_name, String session_id,String content_type, String content, String business_type,String extend)throws Exception  {
		return imUtil.sendImMsg(sender_id, sender_name,session_id, content_type, content, "1",extend);
	}
	
	/**
@ -2971,6 +3069,7 @@ public class ImService {
		}
		if("9".equals(type) || "16".equals(type)|| "12".equals(type)){
			sql = "SELECT " +
					" DISTINCT op.id AS \"outpatientId\"," +
					"op.description AS \"title\"," +
					"op.description AS \"symptoms\",";
			if("xm_ykyy_wx".equals(wxId)){
@ -2990,8 +3089,7 @@ public class ImService {
					"patient.id AS \"patientId\"," +
					"patient.idcard AS \"patientIdcard\"," +
					"patient.sex AS \"patientsex\"," +
					"patient.photo AS \"patientphoto\"," +
					"op.id AS \"outpatientId\"," ;
					"patient.photo AS \"patientphoto\",";
			if("xm_ykyy_wx".equals(wxId)){
				if (flag){
					sql = sql + "date_format(op.register_date,'%Y-%m-%d %H:%i:%S' )  AS \"registerDate\",";
@ -3072,7 +3170,7 @@ public class ImService {
				"count(id) AS \"total\"," +
				"doctor as \"doctor\"" +
				"FROM wlyy_consult_team " +
				"WHERE doctor IN ("+doctorids+") AND (type=1 OR type=15) and status = 0 GROUP BY doctor";
				"WHERE doctor IN ("+doctorids+") AND (type=1 OR type=15 OR type=9 OR type =16) and status = 0 GROUP BY doctor";
		List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
		return list;
	}
@ -3085,11 +3183,12 @@ public class ImService {
	 * @param cancleContent
	 * @return
	 */
	public String sendOutPatientCancle(String patientName,String patientCode,String doctor,String cancleReason, String cancleContent) {
	public String sendOutPatientCancle(String patientName,String patientCode,String doctor,String cancleReason, String cancleContent,String outPatientId) {
		JSONObject msg = new JSONObject();
		msg.put("content",patientName+",您好!您的复诊已被医生取消");
		msg.put("cancleReason",cancleReason);
		msg.put("cancleContent",cancleContent);
		msg.put("outPatientId",outPatientId);
		logger.info("开始发送"+msg.toJSONString());
		return imUtil.sendMessage(doctor,patientCode,"2",msg.toString());
	}

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

@ -254,7 +254,7 @@ public class ImUtil {
	 * @param contentType 1文字 2图片消息
	 * @param content     内容
	 */
	public String sendImMsg(String from, String fromName, String sessionId, String contentType, String content, String businessType) {
	public String sendImMsg(String from, String fromName, String sessionId, String contentType, String content, String businessType,String extend) {
		String imAddr = im_host + "api/v2/sessions/" + sessionId + "/messages";
		System.out.println("im地址"+imAddr);
		JSONObject params = new JSONObject();
@ -264,6 +264,7 @@ public class ImUtil {
		params.put("content", content);
		params.put("session_id", sessionId);
		params.put("business_type", businessType);
		params.put("extend",extend);
		String response = HttpClientUtil.postBody(imAddr, params);
		return response;
	}

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

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

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

@ -619,4 +619,5 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    public void setOnline(String online) {
        this.online = online;
    }
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorMessageDO.java

@ -22,6 +22,7 @@ public class BaseDoctorMessageDO extends UuidIdentityEntityWithOperator {
    private String content;
    private String contentDesc;
    private Integer isSort;
    private String extend;
    private Integer del;
    @Column(name = "doctor")
@ -86,4 +87,13 @@ public class BaseDoctorMessageDO extends UuidIdentityEntityWithOperator {
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "extend")
    public String getExtend() {
        return extend;
    }
    public void setExtend(String extend) {
        this.extend = extend;
    }
}

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

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

+ 8 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyInspectionDO.java

@ -54,7 +54,15 @@ public class WlyyInspectionDO extends UuidIdentityEntity {
    private String sfzg;//是否做过 0 否 和 1是
    private Integer del;//1可用 0删除
    private String totalUnit;//单位
    public String getTotalUnit() {
        return totalUnit;
    }
    public void setTotalUnit(String totalUnit) {
        this.totalUnit = totalUnit;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;//,

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

@ -234,7 +234,18 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    private String  operator;
    private String source;//来源
    /*
    *提醒次数
     */
    private Integer remindCount;
    @Column(name = "remind_count")
    public Integer getRemindCount() {
        return remindCount;
    }
    public void setRemindCount(Integer remindCount) {
        this.remindCount = remindCount;
    }
    @Column(name = "operator")
    public String getOperator() {
        return operator;

+ 15 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionDO.java

@ -2,7 +2,7 @@ package com.yihu.jw.entity.hospital.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@ -263,6 +263,11 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
     */
    private Integer payType;
    /**
     * 是否签名
     */
    private Integer signFlag;
    @Column(name = "outpatient_id")
    public String getOutpatientId() {
        return outpatientId;
@ -652,4 +657,13 @@ public class WlyyPrescriptionDO extends UuidIdentityEntity {
    public void setPayType(Integer payType) {
        this.payType = payType;
    }
    @Column(name = "sign_flag")
    public Integer getSignFlag() {
        return signFlag;
    }
    public void setSignFlag(Integer signFlag) {
        this.signFlag = signFlag;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageLogDO.java

@ -16,7 +16,7 @@ import java.util.Date;
*
*/
@Entity
@Table(name = "wlyy_prescription_expressage_log")
@Table(name = "prescription_expressage_log")
public class WlyyPrescriptionExpressageLogDO extends UuidIdentityEntity {
    /**

+ 64 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionSignDO.java

@ -0,0 +1,64 @@
package com.yihu.jw.entity.hospital.prescription;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* 处方签名记录
*
* @author wangzhinan 20200518
*
*/
@Entity
@Table(name = "wlyy_prescription_sign")
public class WlyyPrescriptionSignDO extends UuidIdentityEntityWithOperator {
    private String prescriptionId;
    private String signData;
    private String signResult;
    private String certData;
    private String relationCode;
    public String getPrescriptionId() {
        return prescriptionId;
    }
    public void setPrescriptionId(String prescriptionId) {
        this.prescriptionId = prescriptionId;
    }
    public String getSignData() {
        return signData;
    }
    public void setSignData(String signData) {
        this.signData = signData;
    }
    public String getSignResult() {
        return signResult;
    }
    public void setSignResult(String signResult) {
        this.signResult = signResult;
    }
    public String getCertData() {
        return certData;
    }
    public void setCertData(String certData) {
        this.certData = certData;
    }
    public String getRelationCode() {
        return relationCode;
    }
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
}

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

@ -126,7 +126,7 @@ public class YkEmrJcsqDO {
    }
    @Basic
    @Column(name = "KDSJ")
    @JsonFormat(pattern = "dd-mm月-yy", timezone = "GMT+08:00")
    @JsonFormat(pattern = "dd-mm-yy", timezone = "GMT+08:00")
    public Date getKdsj() {
        return kdsj;
    }
@ -181,7 +181,7 @@ public class YkEmrJcsqDO {
    }
    @Basic
    @Column(name = "TJSJ")
    @JsonFormat(pattern = "dd-mm月-yy", timezone = "GMT+08:00")
    @JsonFormat(pattern = "dd-mm-yy", timezone = "GMT+08:00")
    public Date getTjsj() {
        return tjsj;
    }

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkMsYj01DO.java

@ -82,7 +82,7 @@ public class YkMsYj01DO {
    }
    @Basic
    @Column(name = "KDRQ")
    @JsonFormat(pattern = "dd-mm月-yy", timezone = "GMT+08:00")
    @JsonFormat(pattern = "dd-mm-yy", timezone = "GMT+08:00")
    public Date getKdrq() {
        return kdrq;
    }

+ 8 - 8
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/YkMsYj02DO.java

@ -13,7 +13,7 @@ public class YkMsYj02DO {
    private Integer yjxh ;//Ms_yi01里的yjxh
    private Integer ylxh;//组套明细里关联VEMR_ORDER_ITEM 里面  ITEM_CODE
    private Integer xmlx;//SELECT XMLX  javax.persistence.criteria.From GY_YLSF Where FYXH =l l_fyxh   查询后结果写入
    private Integer yjxz;//明细第一条是1,其它是0
    private Integer yjzx;//明细第一条是1,其它是0
    private Integer Yldj;//单价  select * from  portal_his.gy_ylsf@YKZXTEST where fyxh = l l_fyxh
    private Integer ylsl;//数量 = 取项目明细 * 医生填的数量  参考截图   fysl
    private Integer hjje;//	合计金额
@ -41,12 +41,12 @@ public class YkMsYj02DO {
        this.yjxh = yjxh;
    }
    @Basic
    @Column(name = "YLX")
    @Column(name = "YLXH")
    public Integer getYlxh() {
        return ylxh;
    }
    public void setYlxh(Integer ylx) {
    public void setYlxh(Integer ylxh) {
        this.ylxh = ylxh;
    }
    @Basic
@ -59,13 +59,13 @@ public class YkMsYj02DO {
        this.xmlx = xmlx;
    }
    @Basic
    @Column(name = "YJXZ")
    public Integer getYjxz() {
        return yjxz;
    @Column(name = "YJZX")
    public Integer getYjzx() {
        return yjzx;
    }
    public void setYjxz(Integer yjxz) {
        this.yjxz = yjxz;
    public void setYjzx(Integer yjzx) {
        this.yjzx = yjzx;
    }
    @Basic
    @Column(name = "YLDJ")

+ 201 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/suggest/BaseSuggestionDO.java

@ -0,0 +1,201 @@
package com.yihu.jw.entity.hospital.suggest;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
/**
 * Created by wj on 2020/0811.
 */
@Entity
@Table(name = "base_suggestion")
public class BaseSuggestionDO extends UuidIdentityEntityWithOperator {
    /**
     *建议类型id
     */
    @Column(name = "suggest_id")
    private String suggestId;
    /*
     *建议内容
     */
    @Column(name = "suggest_content")
    private String suggestContent;
    /**
     *上传图片地址
     */
    @Column(name = "suggest_img_url")
    private String suggestImgUrl;
    /**
     *填写建议的用户id
     */
    @Column(name = "suggest_user_id")
    private String suggestUserId;
    /**
     * 用户名
     */
    @Column(name = "suggest_user_name")
    private String  suggestUserName;
    /*
     *用户手机号
     */
    @Column(name = "suggest_user_phone")
    private String  suggestUserPhone;
    /*
     *删除标识 1正常 0删除
     */
    @Column(name = "is_del")
    private Integer  isDel;
    /*
     *状态图 1回复 0未回复
     */
    @Column(name = "suggest_status")
    private Integer  suggestStatus;
    /*
     *回复内容
     */
    @Column(name = "manager_res")
    private String  managerRes;
    /*
     *回复人id
     */
    @Column(name = "res_user")
    private String  resUser;
    /*
     *回复人名称
     */
    @Column(name = "res_user_name")
    private String  resUserName;
    /*
     *用户客户端
     */
    @Column(name = "user_client")
    private String  userClient;
    /*
     *建议名称
     */
    @Transient
    private String  suggestName;
    /*
     *用户类型
     */
    @Column(name = "user_type")
    private String  userType;
    public String getUserType() {
        return userType;
    }
    public void setUserType(String userType) {
        this.userType = userType;
    }
    @Transient
    public String getSuggestName() {
        return suggestName;
    }
    public void setSuggestName(String suggestName) {
        this.suggestName = suggestName;
    }
    public Integer getSuggestStatus() {
        return suggestStatus;
    }
    public void setSuggestStatus(Integer suggestStatus) {
        this.suggestStatus = suggestStatus;
    }
    public String getManagerRes() {
        return managerRes;
    }
    public void setManagerRes(String managerRes) {
        this.managerRes = managerRes;
    }
    public String getResUser() {
        return resUser;
    }
    public void setResUser(String resUser) {
        this.resUser = resUser;
    }
    public String getResUserName() {
        return resUserName;
    }
    public void setResUserName(String resUserName) {
        this.resUserName = resUserName;
    }
    public String getUserClient() {
        return userClient;
    }
    public void setUserClient(String userClient) {
        this.userClient = userClient;
    }
    public String getSuggestId() {
        return suggestId;
    }
    public void setSuggestId(String suggestId) {
        this.suggestId = suggestId;
    }
    public String getSuggestContent() {
        return suggestContent;
    }
    public void setSuggestContent(String suggestContent) {
        this.suggestContent = suggestContent;
    }
    public String getSuggestImgUrl() {
        return suggestImgUrl;
    }
    public void setSuggestImgUrl(String suggestImgUrl) {
        this.suggestImgUrl = suggestImgUrl;
    }
    public String getSuggestUserId() {
        return suggestUserId;
    }
    public void setSuggestUserId(String suggestUserId) {
        this.suggestUserId = suggestUserId;
    }
    public String getSuggestUserName() {
        return suggestUserName;
    }
    public void setSuggestUserName(String suggestUserName) {
        this.suggestUserName = suggestUserName;
    }
    public String getSuggestUserPhone() {
        return suggestUserPhone;
    }
    public void setSuggestUserPhone(String suggestUserPhone) {
        this.suggestUserPhone = suggestUserPhone;
    }
    public Integer getIsDel() {
        return isDel;
    }
    public void setIsDel(Integer isDel) {
        this.isDel = isDel;
    }
}

+ 84 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/suggest/BaseSuggestionDictDO.java

@ -0,0 +1,84 @@
package com.yihu.jw.entity.hospital.suggest;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 *
 */
@Entity
@Table(name = "base_suggestions_dict")
public class BaseSuggestionDictDO extends UuidIdentityEntityWithOperator {
    /**
     *版本号
     */
    @Column(name = "saas_id")
    private String saasId;
    /*
     *建议名称
     */
    @Column(name = "suggest_name")
    private String suggestName;
    /**
     *建议描述
     */
    @Column(name = "suggest_describe")
    private String suggestDescribe;
    /**
     *是否删除 1正常 0删除
     */
    @Column(name = "is_del")
    private Integer isDel;
    /**
     * 排序
     */
    @Column(name = "is_sort")
    private Integer  isSort;
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getSuggestName() {
        return suggestName;
    }
    public void setSuggestName(String suggestName) {
        this.suggestName = suggestName;
    }
    public String getSuggestDescribe() {
        return suggestDescribe;
    }
    public void setSuggestDescribe(String suggestDescribe) {
        this.suggestDescribe = suggestDescribe;
    }
    public Integer getIsDel() {
        return isDel;
    }
    public void setIsDel(Integer isDel) {
        this.isDel = isDel;
    }
    public Integer getIsSort() {
        return isSort;
    }
    public void setIsSort(Integer isSort) {
        this.isSort = isSort;
    }
}

+ 11 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/rehabilitation/PatientRehabilitationPlanDO.java

@ -2,7 +2,6 @@ package com.yihu.jw.entity.specialist.rehabilitation;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import org.springframework.data.annotation.CreatedDate;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -52,6 +51,8 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntityWithOperator
    @Column(name = "team_code")
    private Integer teamCode;//专科医生签约团队
    private String healthStatusCode;//健康情况
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
@ -203,4 +204,13 @@ public class PatientRehabilitationPlanDO extends UuidIdentityEntityWithOperator
    public void setTeamCode(Integer teamCode) {
        this.teamCode = teamCode;
    }
    @Column(name = "health_status_code")
    public String getHealthStatusCode() {
        return healthStatusCode;
    }
    public void setHealthStatusCode(String healthStatusCode) {
        this.healthStatusCode = healthStatusCode;
    }
}

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

@ -6,7 +6,9 @@ import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
/**
 * Created by humingfen on 2018/8/15.
 */
@ -21,6 +23,17 @@ public class RehabilitationTemplateDetailDO extends UuidIdentityEntityWithOperat
    @Column(name = "hospital_service_item_id")
    private String hospitalServiceItemId;//机构服务项目id
    private Integer type;//执行者类型(1家医,2行政团队)
    private String executeTimes;//服务项目执行时间
    private String frequencyCode;//频次
    private String frequencyName;//频次名称
    private String dateName;//日期名称
    private String dateCode;//日期code
    private Integer timeType;//时间类型
    private String remark;//备注
    private String name;//服务项名称
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
@ -47,4 +60,85 @@ public class RehabilitationTemplateDetailDO extends UuidIdentityEntityWithOperat
    public void setHospitalServiceItemId(String hospitalServiceItemId) {
        this.hospitalServiceItemId = hospitalServiceItemId;
    }
    @Column(name = "execute_times")
    public String getExecuteTimes() {
        return executeTimes;
    }
    public void setExecuteTimes(String executeTimes) {
        this.executeTimes = executeTimes;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "frequency_code")
    public String getFrequencyCode() {
        return frequencyCode;
    }
    public void setFrequencyCode(String frequencyCode) {
        this.frequencyCode = frequencyCode;
    }
    @Column(name = "time_type")
    public Integer getTimeType() {
        return timeType;
    }
    public void setTimeType(Integer timeType) {
        this.timeType = timeType;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark){
        this.remark = remark;
    }
    @Column(name = "frequency_name")
    public String getFrequencyName() {
        return frequencyName;
    }
    public void setFrequencyName(String frequencyName) {
        this.frequencyName = frequencyName;
    }
    @Column(name = "date_name")
    public String getDateName() {
        return dateName;
    }
    public void setDateName(String dateName) {
        this.dateName = dateName;
    }
    @Column(name = "date_code")
    public String getDateCode() {
        return dateCode;
    }
    public void setDateCode(String dateCode) {
        this.dateCode = dateCode;
    }
    @Transient
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

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

@ -239,6 +239,7 @@ public class BaseRequestMapping {
        public static final String PREFIX  = "/open/fileUpload";
        public static final String UPLOAD_STREAM_IMG  = "/upload_stream_img";
        public static final String UPLOAD_STREAM  = "/upload_stream";
        public static final String UPLOAD_STREAM_video  = "/upload_stream_video";
        public static final String UPLOAD_STRING  = "/upload_string";
        public static final String UPLOAD_STREAM_ATTACHMENT  = "/upload_stream_attachment";
    }

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

@ -1029,6 +1029,7 @@ public class BaseHospitalRequestMapping {
        public static final String findZtmxByid = "/findZtmxByid";
        public static final String findZlxm = "/findZlxm";
        public static final String findZlxmMx = "/findZlxmMx";
        public static final String getPrevious = "/getPrevious";
    }
@ -1210,8 +1211,33 @@ public class BaseHospitalRequestMapping {
        public static final String saveDoctorMessage  = "/saveDoctorMessage";
        public static final String setMessageHead="/setMessageHead";
        public static final String delDoctorMessage = "/delDoctorMessage";
        public static final String selectMessageById = "/selectMessageById";
    }
    /**
     * 反馈建议
     */
    public static class suggestion extends Basic{
        public static final String suggestionManage  = "/suggestionManage";
        public static final String findSuggestionByType  = "/findSuggestionByType";
        public static final String delSuggestion  = "/delSuggestion";;
        public static final String saveSuggestion  = "/saveSuggestion";
        public static final String responseSuggestion  = "/responseSuggestion";
        public static final String findSuggestionById  = "/findSuggestionById";
    }
    /**
     * 反馈建议类型
     */
    public static class suggestionDict extends Basic{
        public static final String suggestionDictManage  = "/suggestionDictManage";
        public static final String findSuggestionType  = "/findSuggestionType";
        public static final String delSuggestionType = "/delSuggestionType";;
        public static final String saveSuggestionType  = "/saveSuggestionType";
        public static final String updateSuggestionType  = "/updateSuggestionType";
        public static final String upSuggestionType  = "/upSuggestionType";
        public static final String downSuggestionType  = "/downSuggestionType";
    }
    /**
@ -1306,6 +1332,9 @@ public class BaseHospitalRequestMapping {
        public static final String findLevelOneDoctorUpcoming="/findLevelOneDoctorUpcoming";
        public static final String getUpcomingByDoctor="/getUpcomingByDoctor";
        public static final String checkOperateTime="/checkOperateTime";
        public static final String querySettledRecord="/querySettledRecord";
        public static final String paySuccessNotice="/paySuccessNotice";
    }
    /**

+ 73 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/MutilFileInfo.java

@ -0,0 +1,73 @@
package com.yihu.jw.restmodel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
/*
*   文件上传实体类
 */
@ApiModel("大文件分片入参实体")
public class MutilFileInfo {
    @ApiModelProperty("文件传输任务ID")
    private String taskId;
    @ApiModelProperty("当前为第几分片")
    private int chunk;
    @ApiModelProperty("每个分块的大小")
    private long size;
    @ApiModelProperty("分片总数")
    private int chunkTotal;
    @ApiModelProperty("主体类型--这个字段是我项目中的其他业务逻辑可以忽略")
    private int objectType;
    @ApiModelProperty("分块文件传输对象")
    private MultipartFile file;
    public String getTaskId() {
        return taskId;
    }
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
    public int getChunk() {
        return chunk;
    }
    public void setChunk(int chunk) {
        this.chunk = chunk;
    }
    public long getSize() {
        return size;
    }
    public void setSize(long size) {
        this.size = size;
    }
    public int getChunkTotal() {
        return chunkTotal;
    }
    public void setChunkTotal(int chunkTotal) {
        this.chunkTotal = chunkTotal;
    }
    public int getObjectType() {
        return objectType;
    }
    public void setObjectType(int objectType) {
        this.objectType = objectType;
    }
    public MultipartFile getFile() {
        return file;
    }
    public void setFile(MultipartFile file) {
        this.file = file;
    }
}

+ 9 - 7
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyHisPrescriptionVO.java

@ -1,14 +1,7 @@
package com.yihu.jw.restmodel.hospital.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Date;
import java.util.List;
/**
@ -132,6 +125,7 @@ public class WlyyHisPrescriptionVO extends UuidIdentityVOWithOperator {
    private String ywjcDate;//以往检查时间-病理申请单选填 格式:yyyy-mm-dd',
    private String blzd;//病理诊断-病理申请单选填',
    private String fixationfluid;//固定液
    private String selfDelivered;//快递是否1是0否
@ -440,4 +434,12 @@ public class WlyyHisPrescriptionVO extends UuidIdentityVOWithOperator {
    public void setComm(String comm) {
        this.comm = comm;
    }
    public String getSelfDelivered() {
        return selfDelivered;
    }
    public void setSelfDelivered(String selfDelivered) {
        this.selfDelivered = selfDelivered;
    }
}

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

@ -35,4 +35,18 @@ public class ListEnvelop<T> extends Envelop {
    public void setDetailModelList(List<T> detailModelList) {
        this.detailModelList = detailModelList;
    }
    public static ListEnvelop getSuccess(String message, List detailModelList) {
        ListEnvelop envelop = new ListEnvelop();
        envelop.setMessage(message);
        envelop.setDetailModelList(detailModelList);
        envelop.setStatus(200);
        return envelop;
    }
    public static ListEnvelop getError(String message) {
        ListEnvelop envelop = new ListEnvelop();
        envelop.setMessage(message);
        envelop.setStatus(-1);
        return envelop;
    }
}

+ 33 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -1,12 +1,13 @@
package com.yihu.jw.security.core.userdetails.jdbc;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.security.core.userdetails.SaltUser;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.dao.patient.BasePatientWechatDao;
import com.yihu.jw.security.model.WlyyUserDetails;
import com.yihu.jw.security.model.WlyyUserSimple;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.utils.security.MD5;
@ -82,6 +83,8 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private BasePatientDao patientDao;
    public WlyyUserDetailsService(DataSource dataSource) {
        this.setDataSource(dataSource);
@ -628,6 +631,35 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
            JSONObject object1 = JSONObject.parseObject(res);
            if (null != object1&&null!=object1.get("status") && "200".equals(object1.get("status").toString())) {
                JSONObject patient = object1.getJSONObject("userinfo");
                logger.info("开始同步患者数据");
                String idcard = patient.getString("idcard");
                BasePatientDO patientDO2 = patientDao.findByIdcardAndDel(idcard,"1");
                BasePatientDO patient1 = new BasePatientDO();
                if (patientDO2!=null){
                    patient1=patientDO2;
                }
                String salt = UUID.randomUUID().toString().substring(0,5);
                String mobile = patient.getString("mobile");
                String pw = null;
                if(org.apache.commons.lang3.StringUtils.isNotBlank(mobile)){
                    pw = mobile.substring(mobile.length()-6);
                }else{
                    pw = idcard.substring(idcard.length()-6);
                }
                patient1.setIdcard(idcard);
                patient1.setName(patient.getString("name"));
                patient1.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                patient1.setSalt(salt);
                patient1.setSex(StringUtils.isNotBlank(idcard)?Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)):null);
                patient1.setMobile(mobile);
                patient1.setDel("1");
                patient1.setEnabled(1);
                patient1.setLocked(0);
                patient1.setCreateTime(new Date());
                patient1.setUpdateTime(new Date());
                patient1.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
                patient1 = patientDao.save(patient1);
                logger.info("结束同步患者数据");
                return patient;
            }
        }catch (Exception e){

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

@ -2,17 +2,16 @@ package com.yihu.jw.security.oauth2.provider.endpoint;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.restmodel.ResultStatus;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.security.core.userdetails.jdbc.WlyyUserDetailsService;
import com.yihu.jw.security.dao.OauthKeypairDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.patient.BasePatientDao;
import com.yihu.jw.security.exception.ImgCaptchaException;
import com.yihu.jw.security.login.service.BaseLoginLogService;
@ -52,11 +51,11 @@ import org.springframework.security.oauth2.provider.request.DefaultOAuth2Request
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;
import org.springframework.util.*;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import sun.misc.BASE64Encoder;
import javax.annotation.PostConstruct;
import javax.imageio.ImageIO;
@ -74,7 +73,6 @@ import java.security.interfaces.RSAPublicKey;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import sun.misc.BASE64Encoder;
/**
 *
@ -136,6 +134,8 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    private YkyyService ykyyService;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @PostConstruct
    private void init() {
@ -254,7 +254,6 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        baseLoginLogDO.setUserAgent(userAgent);
        baseLoginLogDO.setLoginType(loginType);
        baseLoginLogService.save(baseLoginLogDO);
        return getResponse(wlyyUserSimple);
    }
@ -476,6 +475,9 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (StringUtils.isEmpty(username)) {
            throw new InvalidRequestException("username");
        }
        if (username.length()>12){
            throw new InvalidRequestException("请输入正确的手机号!");
        }
        //验证请求间隔超时,防止频繁获取验证码
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, username)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
@ -491,7 +493,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, username, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, _captcha);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, null);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
@ -820,6 +822,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                        JSONObject patient =  userDetailsService.getHLWyyUser(opid);
                        rs.put("idcard",patient.getString("idcard"));
                        rs.put("mobile",patient.getString("mobile"));
                    }
                }else {
                    rs.put("openid",openid);

+ 32 - 21
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java

@ -7,7 +7,9 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.base.util.ErrorCodeUtil;
import com.yihu.jw.exception.code.BaseErrorCode;
import com.yihu.jw.file_upload.FileManageService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.restmodel.MutilFileInfo;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -16,15 +18,18 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.apache.http.entity.ContentType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLDecoder;
import java.util.Base64;
import java.util.Map;
@ -53,6 +58,8 @@ public class FileUploadController extends EnvelopRestEndpoint {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private FileManageService filemanage;
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_IMG)
    @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
@ -137,26 +144,30 @@ public class FileUploadController extends EnvelopRestEndpoint {
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM)
    @ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
    public ObjEnvelop<UploadVO> uploadStream(@ApiParam(value = "文件", required = true)
                                             @RequestParam(value = "file", required = true) MultipartFile file) throws Exception{
                                             @RequestParam(value = "file", required = true) MultipartFile file
            /*@ApiParam(value = "jsonData", required = true)
            @RequestBody MutilFileInfo param, HttpServletResponse response, HttpServletRequest request*/) throws Exception{
        UploadVO uploadVO = new UploadVO();
        if (isClose.equalsIgnoreCase("1")){
            Map<String, Object> map = fileUploadService.uploadImg(file);
            uploadVO.setFullUri(map.get("accessory").toString());
            uploadVO.setFileName(file.getOriginalFilename());
        }else if(isClose.equals("2")){
            //内网上传
            String rs = fileUploadService.request(remote_inner_url,file,null);
            logger.info(rs);
            JSONObject json = JSON.parseObject(rs);
            uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
        }else {
            // 得到文件的完整名称  xxx.txt
            String originalFilename = file.getOriginalFilename();
            InputStream inputStream = file.getInputStream();
            uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
            if (isClose.equalsIgnoreCase("1")){
                Map<String, Object> map = fileUploadService.uploadImg(file);
                uploadVO.setFullUri(map.get("accessory").toString());
                uploadVO.setFileName(file.getOriginalFilename());
            }else if(isClose.equals("2")){
                //内网上传
                String rs = fileUploadService.request(remote_inner_url,file,null);
                logger.info(rs);
                JSONObject json = JSON.parseObject(rs);
                uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
            }else {
                // 得到文件的完整名称  xxx.txt
                String originalFilename = file.getOriginalFilename();
                InputStream inputStream = file.getInputStream();
                uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
            }
            return success("上传成功", uploadVO);
        }
        return success("上传成功", uploadVO);
    }
}

+ 15 - 5
svr/svr-base/src/main/java/com/yihu/jw/base/service/doctor/BaseDoctorService.java

@ -87,6 +87,8 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
    @Autowired
    private DictDoctorDutyService dictDoctorDutyService;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Value("${wechat.flag}")
    private boolean flag;
@ -226,13 +228,16 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                "\tEND AS status,\n" +
                "\tdoc.create_time\n" +
                "FROM\n" +
                "\tbase_doctor doc,\n" +
                " base_doctor doc LEFT join base_doctor_hospital hos on doc.id = hos.doctor_code " +
                " LEFT JOIN dict_hospital_dept dept on hos.org_code = dept.org_code" +
                " AND hos.dept_code = dept.code"+
                /*"\tbase_doctor doc,\n" +
                "\tbase_doctor_hospital hos,\n" +
                "\tdict_hospital_dept dept\n" +
                "WHERE\n" +
                "\tdoc.id = hos.doctor_code\n" +
                "\tdict_hospital_dept dept\n" +*/
                " WHERE 1=1";
                /*"\tdoc.id = hos.doctor_code\n" +
                "AND hos.org_code = dept.org_code\n" +
                "AND hos.dept_code = dept.code\n" ;
                "AND hos.dept_code = dept.code\n"*/
        if (!StringUtils.isEmpty(nameOrIdcard)){
            sql += " and (doc.idcard LIKE '%"+nameOrIdcard+"%' or doc.name LIKE '%"+nameOrIdcard+"%')";
        }if (!StringUtils.isEmpty(orgCode)){
@ -497,6 +502,11 @@ public class BaseDoctorService extends BaseJpaService<BaseDoctorDO, BaseDoctorDa
                         hospitalIdList.remove(baseDoctorHospitalDO.getId());
                     }
                     baseDoctorHospitalDO.setDoctorCode(baseDoctorDO.getId());
                     String deptCode = baseDoctorHospitalDO.getDeptCode();
                     DictHospitalDeptDO dictHospitalDeptDO = dictHospitalDeptDao.findByCode(deptCode);
                     if (dictHospitalDeptDO!=null){
                         baseDoctorHospitalDO.setDeptName(dictHospitalDeptDO.getName());
                     }
                     baseDoctorHospitalService.save(baseDoctorHospitalDO);
                 }
             } catch (IOException e) {

+ 17 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/util/ExceptionHandler.java

@ -0,0 +1,17 @@
package com.yihu.jw.base.util;
import com.yihu.jw.utils.AdminException;
import com.yihu.jw.utils.sfutils.MyErrorCode;
import org.csource.common.MyException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
//该类全局拦截Controller请求
@ControllerAdvice
public class ExceptionHandler {
    //对自定义RuntimeException进行拦截和相关响应的修改
    @org.springframework.web.bind.annotation.ExceptionHandler(AdminException.class)
    public ResponseEntity<ExceptionResult> handlerException(AdminException e) {
        MyErrorCode ee = e.getMyErrorCode();
        return ResponseEntity.status(ee.getCode()).body(new ExceptionResult(ee));
    }}

+ 23 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/util/ExceptionResult.java

@ -0,0 +1,23 @@
package com.yihu.jw.base.util;
import com.yihu.jw.utils.sfutils.MyErrorCode;
public class ExceptionResult {
    private Integer code;
    private String msg;
    private Long timestamp;
    public Integer getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public ExceptionResult(MyErrorCode ee) {
        this.code = ee.getCode();
        this.msg = ee.getMsg();
        this.timestamp = System.currentTimeMillis();
    }
}

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

@ -196,7 +196,7 @@ spring:
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
  fastdfs_file_url: http://172.26.0.110:8888/
demo:
  flag: true
hospital:

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

@ -95,7 +95,7 @@ public class MqSdkController extends EnvelopRestEndpoint {
                               @RequestParam(value = "startTime", required = false) String startTime,
                               @ApiParam(name = "endTime", value = "结束时间")
                               @RequestParam(value = "endTime", required = false) String endTime) throws Exception {
        List<WlyyOutpatientVO> obj = entranceService.BS30025(patNo,conNo, startTime, endTime, demoFlag);
        List<WlyyOutpatientVO> obj = entranceService.BS30025(patNo,conNo, startTime, endTime, demoFlag,null);
        return success(obj);
    }

+ 16 - 11
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java

@ -242,14 +242,14 @@ public class YkyyController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "/outPatientOrder")
    @ApiOperation(value = "医生开单")
    public ObjEnvelop outPatientOrder(@ApiParam(name = "json", value = "json", required = true)
    public ListEnvelop outPatientOrder(@ApiParam(name = "json", value = "json", required = true)
                                       @RequestParam(value = "json",required = true)String json,
                                              @ApiParam(name = "table", value = "table", required = true)
                                           @RequestParam(value = "table",required = true)String table) throws  Exception{
        List<YkEmrJcsqDO> surveys = EntityUtils.jsonToList(json, YkEmrJcsqDO.class);
        System.out.println(surveys);
        long totalprice=0l;
        ObjEnvelop mixEnvelop = new ObjEnvelop();
        ListEnvelop mixEnvelop = new ListEnvelop();
        if (surveys!=null){
            for (YkEmrJcsqDO ykEmrJcsqDO:surveys){
                String sqdhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_emr@ykzxtest where bmc = 'EMR_JCSQ'";
@ -269,7 +269,7 @@ public class YkyyController extends EnvelopRestEndpoint {
                ykEmrJcsqDO.setQxbz(0);
                totalprice +=ykEmrJcsqDO.getXmdj()*ykEmrJcsqDO.getSqsl();
                System.out.println("totalprice"+totalprice);
                String yjxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_emr@ykzxtest where bmc = 'MS_YJ01'";
                String yjxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@ykzxtest where bmc = 'MS_YJ01'";
                List<Map<String,Object>> yjxhList = hibenateUtils.createSQLQuery(yjxhSql);
                Long yjxh = 0L;
                if (yjxhList!=null&&yjxhList.size()!=0){
@ -280,6 +280,7 @@ public class YkyyController extends EnvelopRestEndpoint {
                    ykEmrJcsqDO.setYjxh(yjxh.intValue());
                }
                ykyyEntranceService.save(ykEmrJcsqDO);
                //检查主表
                YkMsYj01DO ykMsYj01DO = new YkMsYj01DO();
                ykMsYj01DO.setYjxh(yjxh.intValue());
                ykMsYj01DO.setMZXH(0);
@ -305,17 +306,18 @@ public class YkyyController extends EnvelopRestEndpoint {
                ykMsYj01DO.setLjlx(0);
                System.out.println(ykMsYj01DO);
                ykyyEntranceService.save(ykMsYj01DO);
                String sqlCxzt = "Select t.zlxmid,t.fyxh,t.fysl from VEMR_ORDER_ITEM_MX t where t.zlxmid =' "+ykEmrJcsqDO.getXmid()+"'";
                String sqlCxzt = "Select t.zlxmid as \"zlxmid\",t.fyxh as \"fyxh\",t.fysl as \"fysl\" from VEMR_ORDER_ITEM_MX t where t.zlxmid ='"+ykEmrJcsqDO.getXmid()+"'";
                List<Map<String,Object>> sbxlMap = hibenateUtils.createSQLQuery(sqlCxzt);
                if (sbxlMap.size()>0){
                    int i = 0;
                    //明细可能会有多条
                    for (Map<String,Object> map:sbxlMap){
                        String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_emr@ykzxtest where bmc = 'MS_YJ02'";
                        String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@ykzxtest where bmc = 'MS_YJ02'";
                        List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
                        Long sbxh = 0L;
                        if (sbxhList!=null&&sbxhList.size()!=0){
                            sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                            System.out.println("yjxh:"+yjxh);
                            System.out.println("sbxh:"+sbxh);
                            String updateyjxh = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'MS_YJ02'";
                            hibenateUtils.updateBySql(updateyjxh);
                        }
@ -325,26 +327,29 @@ public class YkyyController extends EnvelopRestEndpoint {
                        ykMsYj02DO.setYlxh(ykEmrJcsqDO.getXmid());
                        Integer sqsl = ykEmrJcsqDO.getSqsl();
                        ykMsYj02DO.setYlsl(Integer.valueOf(map.get("fysl").toString())*sqsl);
                        ykMsYj02DO.setYjxz(i==0?1:0);
                        ykMsYj02DO.setYjzx(i==0?1:0);
                        i++;
                        String fyxhSql ="select t.xmlx as \"xmlx\",t.fydj as \"fydj\",t.fygb as \"fygb\"" +
                                "from portal_his.GY_YLSF@ykzxtest t " +
                                " and t.fyxh = '"+map.get("fyxh").toString()+"'";
                                " from portal_his.GY_YLSF@ykzxtest t " +
                                " where t.fyxh = '"+map.get("fyxh").toString()+"'";
                        List<Map<String,Object>> fyxhList = hibenateUtils.createSQLQuery(fyxhSql);
                        if (fyxhList.size()>0){
                            ykMsYj02DO.setXmlx(Integer.valueOf(fyxhList.get(0).get("XMLX").toString()));
                            ykMsYj02DO.setXmlx(Integer.valueOf(fyxhList.get(0).get("xmlx").toString()));
                            ykMsYj02DO.setFygb(Integer.valueOf(fyxhList.get(0).get("fygb").toString()));
                            ykMsYj02DO.setYldj(Integer.valueOf(fyxhList.get(0).get("fydj").toString()));
                            ykMsYj02DO.setHjje(ykMsYj02DO.getYldj()*ykMsYj02DO.getYlsl());
                        }
                        ykMsYj02DO.setZfbl(1);
                        ykMsYj02DO.setZxpb(0);
                        ykMsYj02DO.setZjflag(0);
                        System.out.println(ykMsYj02DO);
                        ykyyEntranceService.save(ykMsYj02DO);
                    }
                }
            }
            mixEnvelop.setObj(totalprice);
            mixEnvelop.setDetailModelList(surveys);
        }
        return mixEnvelop;
    }

+ 2 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/Application.java

@ -5,12 +5,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
 * Created by Trick on 2019/5/13.
 */
@SpringBootApplication
@EnableJpaAuditing
@EnableScheduling
public class Application extends SpringBootServletInitializer {
    public static void main(String[] args)  {

+ 74 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/DoctorTimeOutTipsJob.java

@ -0,0 +1,74 @@
package com.yihu.jw.job;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.util.date.DateUtil;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.util.Date;
import java.util.List;
public class DoctorTimeOutTipsJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(DoctorTimeOutTipsJob.class);
    @Autowired
    public ImUtil imUtil;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Value("${wechat.ids}")
    private String wxId;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        logger.info("启动发送超时提示消息开始");
        System.out.println(wxId);
        System.out.println("启动发送超时提示消息开始");
        List<WlyyOutpatientDO> wlyyOutpatientDOS= outpatientDao.findWaitingOutpatient(5);
        String senderId ="";
        String reciverId = "";
        long timeCount = 0l;
        String content = "您邀请的医师暂无应答,您可以选择继续等待或者取消邀请。";
        JSONObject object = new JSONObject();
        object.put("socket_sms_type",14);
        object.put("msg",content);
        object.put("msg_time", DateUtil.dateToStrLong(new Date()));
        if (null!=wlyyOutpatientDOS){
            for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOS){
                long patientTime = wlyyOutpatientDO.getCreateTime().getTime();
                logger.info("接诊创建时间="+patientTime);
                List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findByDictName("outpatient_timeout_remind");
                if (wlyyHospitalSysDictDOS.size()>0){
                    timeCount = Long.valueOf(wlyyHospitalSysDictDOS.get(0).getDictValue());
                }
                long currentTime = new Date().getTime();
                logger.info("当前时间="+currentTime);
                logger.info("数据库配置时间=0"+timeCount);
                if (currentTime-patientTime>timeCount*60*1000){
                    logger.info("--便利发送消息");
                    reciverId = wlyyOutpatientDO.getPatient();
                    logger.info("---发送人id"+senderId);
                    senderId= wlyyOutpatientDO.getDoctor();
                    logger.info("---接受人Id"+reciverId);
                    imUtil.sendMessage(senderId,reciverId,"1",object.toString());
                    logger.info("--发送结束");
                    logger.info("--模板发送开始");
                    prescriptionService.sendWxTemplateMsg(wxId,wlyyOutpatientDO.getId(),null,null,"outPatientTimeOutRemind","");
                }
            }
        }
    }
}

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

@ -3,12 +3,14 @@ package com.yihu.jw.service.channel;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.job.QuartzJobLog;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.repository.job.QuartzJobLogDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
@ -61,6 +63,8 @@ public class PrescriptionStatusUpdateService {
    private BusinessOrderService businessOrderService;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private QuartzJobLogDao quartzJobLogDao;
    public void autoPush() throws Exception {
@ -143,11 +147,11 @@ public class PrescriptionStatusUpdateService {
                if (!preExistFlag) {
                    updatePrescriptionInfo(preId,wlyyPrescriptionVO,wlyyOutpatientDO);
                }
                //更改门诊状态为已经检查
                /*//更改门诊状态为已经检查
                if (100 == wlyyPrescriptionVO.getStatus()) {
                    wlyyOutpatientDO.setStatus("2");
                    wlyyOutpatientDO.setStatus("3");
                }
                outpatientDao.save(wlyyOutpatientDO);
                outpatientDao.save(wlyyOutpatientDO);*/
                //更新处方状态记录
                wlyyPrescriptionDO.setStatus(wlyyPrescriptionVO.getStatus());
@ -279,16 +283,17 @@ public class PrescriptionStatusUpdateService {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        int i = calendar.get(Calendar.HOUR_OF_DAY);
        QuartzJobLog quartzJobLog = new QuartzJobLog();
        //复诊记录状态状态安全锁,每天0~2点才允许触发,避免误调用
        //将所有的已接诊的处方记录
        if(i==0||i==1){
            List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus("1");
            List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus();
            if(outpatientDOs!=null&&outpatientDOs.size()>0){
                for(WlyyOutpatientDO outpatientDO:outpatientDOs){
                    //结束门诊
                    outpatientDO.setStatus("3");
    
                    logger.info(outpatientDO.getId()+"的处方记录设置为结束");
                    String consultCode = imService.getConsultCodeByOutpatientId(outpatientDO.getId());
                    if(StringUtils.isNoneBlank(consultCode)){
                        try {
@ -299,27 +304,32 @@ public class PrescriptionStatusUpdateService {
                        }
                       
                    }
                    //保存操作日志
                    quartzJobLog.setId(UUID.randomUUID().toString());
                    quartzJobLog.setJobName("setOutPatientOver");
                    quartzJobLog.setJobId("setOutPatientOver");
                    quartzJobLog.setJobContent(outpatientDO.getId()+"问诊执行自动结束"+outpatientDO.getStatus());
                    quartzJobLog.setJobStartTime(new Date());
                    quartzJobLogDao.save(quartzJobLog);
                }
                outpatientDao.save(outpatientDOs);
                //退费
                for (WlyyOutpatientDO outpatientDO:outpatientDOs){
                    try {
                    BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(outpatientDO.getId());
                    if (businessOrderDO!=null){
                        try {
                            if (businessOrderDO.getPayType()==1){
                                businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                            }else if (businessOrderDO.getPayType()==3){
/*
                                businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
*/
                            }
                        } catch (Exception e) {
                            e.printStackTrace();
                        if (businessOrderDO.getPayType()==1){
                            businessOrderService.orderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
                        }else if (businessOrderDO.getPayType()==3){
    /*
                            businessOrderService.ylzOrderRefund(wechatId,businessOrderDO.getPatient(),businessOrderDO.getOrderNo(),businessOrderDO.getPayPrice(),businessOrderDO.getDescription());
    */
                        }
                    } } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                logger.info("setOutPatientOver count :"+outpatientDOs.size());
            }else {
                logger.info("setOutPatientOver count :"+0);
@ -339,7 +349,7 @@ public class PrescriptionStatusUpdateService {
        //复诊记录状态状态安全锁,每天0~2点才允许触发,避免误调用
        //将所有的已接诊的处方记录
        if(i==0||i==1){
            List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus("2");
            List<WlyyOutpatientDO> outpatientDOs = outpatientDao.findByStatus();
            if(outpatientDOs!=null&&outpatientDOs.size()>0){
                for(WlyyOutpatientDO outpatientDO:outpatientDOs){

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

@ -0,0 +1,129 @@
package com.yihu.jw.util;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.bouncycastle.asn1.cmp.CertOrEncCert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.List;
@Lazy(false)
@Component
@EnableScheduling
public class AutoTimeOutRemind implements SchedulingConfigurer {
    private static final Logger logger = LoggerFactory.getLogger(AutoTimeOutRemind.class);
    private static String cron = "0 0/1 * * * ?";
    private static String dictName = "remind_patient_job";
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    public ImUtil imUtil;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private PrescriptionService prescriptionService;
    @Value("${wechat.ids}")
    private String wxId;
    public AutoTimeOutRemind() {
      cron = "0 0/1 * * * ?";
        System.out.println("创建时的corn"+cron);
    }
    public String change(String corIn){
        if (StringUtils.isNotBlank(corIn)){
            cron = corIn;
        }else {
            List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDO =wlyyHospitalSysDictDao.findByDictName(dictName);
            if (wlyyHospitalSysDictDO.size()>0){
                cron = wlyyHospitalSysDictDO.get(0).getDictValue();
                System.out.println("dict"+ cron);
            }
        }
        System.out.println(cron);
        return "success";
    }
    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        taskRegistrar.addTriggerTask(new Runnable() {
            @Override
            public void run() {
                logger.info("启动发送超时提示消息开始");
                System.out.println(wxId);
                System.out.println("启动发送超时提示消息开始");
                Integer remindCount = 3;
                List<WlyyHospitalSysDictDO> countList = wlyyHospitalSysDictDao.findByDictName("remind_count");
                if (countList.size()>0){
                    remindCount= null!=countList.get(0).getDictValue()?Integer.parseInt(countList.get(0).getDictValue()):remindCount;
                }
                List<WlyyOutpatientDO> wlyyOutpatientDOS= outpatientDao.findWaitingOutpatient(remindCount);
                String senderId ="";
                String reciverId = "";
                long timeCount = 0l;
                String content = "您邀请的医师暂无应答,您可以选择继续等待或者取消邀请。";
                JSONObject object = new JSONObject();
                object.put("socket_sms_type",14);
                object.put("msg",content);
                object.put("msg_time", DateUtil.dateToStrLong(new Date()));
                if (null!=wlyyOutpatientDOS){
                    for (WlyyOutpatientDO wlyyOutpatientDO:wlyyOutpatientDOS){
                        long patientTime = wlyyOutpatientDO.getCreateTime().getTime();
                        Integer currentRemindCount = null==wlyyOutpatientDO.getRemindCount()?0:wlyyOutpatientDO.getRemindCount();
                        logger.info("接诊创建时间="+patientTime);
                        List<WlyyHospitalSysDictDO> wlyyHospitalSysDictDOS = wlyyHospitalSysDictDao.findByDictName("outpatient_timeout_remind");
                        if (wlyyHospitalSysDictDOS.size()>0){
                            timeCount = Long.valueOf(wlyyHospitalSysDictDOS.get(0).getDictValue());
                        }
                        long currentTime = new Date().getTime();
                        logger.info("当前时间="+currentTime);
                        logger.info("数据库配置时间=0"+timeCount);
                        if (currentTime-patientTime>timeCount*60*1000){
                            wlyyOutpatientDO.setRemindCount(currentRemindCount+1);
                            System.out.println("remind_count"+currentRemindCount+1);
                            outpatientDao.save(wlyyOutpatientDO);
                            logger.info("--便利发送消息");
                            reciverId = wlyyOutpatientDO.getPatient();
                            logger.info("---发送人id"+senderId);
                            senderId= wlyyOutpatientDO.getDoctor();
                            logger.info("---接受人Id"+reciverId);
                            imUtil.sendMessage(senderId,reciverId,"1",object.toString());
                            logger.info("--发送结束");
                            logger.info("--模板发送开始");
                            prescriptionService.sendWxTemplateMsg(wxId,wlyyOutpatientDO.getId(),null,null,"outPatientTimeOutRemind","");
                        }
                    }
                }
            }
        }, new Trigger() {
            @Override
            public Date nextExecutionTime(TriggerContext triggerContext) {
                // 任务触发,可修改任务的执行周期
                CronTrigger trigger = new CronTrigger(cron);
                System.out.println("任务触发,可修改任务的执行周期"+cron);
                Date nextExec = trigger.nextExecutionTime(triggerContext);
                return nextExec;
            }
        });
    }
}

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

@ -1,6 +1,8 @@
package com.yihu.jw.web.quota;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.internet.service.DataGeneratorService;
import com.yihu.jw.internet.service.InternetCommonService;
@ -10,8 +12,10 @@ import com.yihu.jw.job.*;
import com.yihu.jw.job.ykyy.UnSettledHISPrescriptionJob;
import com.yihu.jw.job.ykyy.UpdateStatusByPayTimeJob;
import com.yihu.jw.job.ykyy.YkyyDataUploadJob;
import com.yihu.jw.repository.job.QuartzJobConfigDao;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.service.quota.JobService;
import com.yihu.jw.util.AutoTimeOutRemind;
import com.yihu.jw.util.SystemConf;
import com.yihu.jw.web.BaseController;
import com.yihu.jw.wechat.service.WxTemplateService;
@ -24,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.sound.midi.Soundbank;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
@ -58,6 +63,10 @@ public class JobController extends BaseController {
    private InternetCommonService internetCommonService;
    @Autowired
    private WxTemplateService wxTemplateService;
    @Autowired
    private QuartzJobConfigDao wlyyJobConfigDao;
    @Autowired
    private WlyyHospitalSysDictDao wlyyHospitalSysDictDao;
    @Autowired
    public JobController(JobService jobService, QuartzHelper quartzHelper) {
@ -186,6 +195,17 @@ public class JobController extends BaseController {
                    } else {
                        logger.info("pay_status_notice_job  job exist");
                    }
                    break;
                case "CSTXJOB" :
                    if (!quartzHelper.isExistJob("CSTXJOB")) {
                        System.out.println("id"+taskId);
                        String trigger = SystemConf.getInstance().getSystemProperties().getProperty("CSTXJOB");
                        System.out.println(trigger);
                        quartzHelper.addJob(DoctorTimeOutTipsJob.class, trigger, "CSTXJOB", new HashMap<String, Object>());
                        logger.info("CSTXJOB  job success");
                    } else {
                        logger.info("CSTXJOB  job exist");
                    }
                    break;
                default :
@ -337,7 +357,7 @@ public class JobController extends BaseController {
    @ApiOperation("处方状态变更")
    public String PrescriptionStatusUpdateJob() {
        try {
            quartzHelper.startNow(PrescriptionStatusUpdateJob.class, UUID.randomUUID().toString(), null);
                quartzHelper.startNow(PrescriptionStatusUpdateJob.class, UUID.randomUUID().toString(), null);
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
@ -594,4 +614,12 @@ public class JobController extends BaseController {
    }
    @RequestMapping(value = "changeDoctorRemindTimeOut", method = RequestMethod.GET)
    public String changeDoctorRemindTimeOut(String corn){
        AutoTimeOutRemind autoTimeOutRemind = new AutoTimeOutRemind();
        return autoTimeOutRemind.change(corn);
    }
}

+ 8 - 4
svr/svr-internet-hospital-job/src/main/resources/application.yml

@ -125,11 +125,13 @@ wlyy:
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  ids: xm_zsyy_wx
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: JKZL
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
jobs:
  schedule: 0 */1 * * * ?
---
spring:
  profiles: jwOracleTest
@ -222,7 +224,7 @@ express:
spring:
  profiles: jwprod
  datasource:
    url: jdbc:mysql://192.0.33.27:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    url: jdbc:mysql://172.16.1.42:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false #jdbc:mysql://192.0.33.27:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: im
    password: 2oEq3Kf7
@ -235,7 +237,7 @@ demo:
pay:
  flag: true
hospital:
  url: https://172.16.1.34
  url: https://wx.xmzsh.com #https://172.16.1.34
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
@ -250,11 +252,13 @@ wlyy:
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  ids: xm_zsyy_wx
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
jobs:
  schedule: 0 */30 * * * ?
---
spring:

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

@ -7,13 +7,15 @@ prescription_overdue_job=0 0 1 * * ?
#每天13 点触发
data_upload_job=0 0 2 * * ?
#每10分钟触发一次
#-------------------------中山医院end-----------------------------#
#-------------------------眼科医院-----------------------------#
data_ykupload_job=0 0 0 * * ?
#每间隔1分钟触发
unsettled_prescription_notice_job=0 */1 * * * ?
pay_status_notice_job=0 */1 * * * ?
CSTXJOB=0 */1 * * * ?
#-------------------------眼科医院end-----------------------------#
#-------------------------监管平台通用医院-----------------------------#
data_common_upload_job=0 0 0 * * ?

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

@ -11,6 +11,7 @@ import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionEmrDO;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService;
@ -219,15 +220,14 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
					if("0".equals(rsCode)||"-2".equals(rsCode)){
						//挂号成功,已经挂号
						//2.
						result = imService.addPrescriptionConsult(outpatientCode, patientCode,doctorCode,consult,reason,type,wxId);
					}else{
						failed(mes);
						return failed(mes);
					}
					logger.info("调用挂号接口====END");
				}
				
				
				//2.
				result = imService.addPrescriptionConsult(outpatientCode, patientCode,doctorCode,consult,reason,type,wxId);
			}
			return success("操作成功",result);
	}
@ -455,7 +455,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "医生咨询记录查询")
	public Envelop records(
			@ApiParam(name = "doctor", value = "医生id")
			@RequestParam(value = "doctor",required = true) String doctor,
			@RequestParam(value = "doctor",required = false) String doctor,
			@ApiParam(name = "title", value = "咨询标题关键字")
			@RequestParam(value = "title",required = false) String title,
			@ApiParam(name = "id", value = "咨询ID")
@ -558,7 +558,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
							logger.info("结束咨询成功!");
						}
					}
					String immsg = imService.sendOutPatientCancle(patientName,patientCode,doctor,cancelRemark,cancelValue);
					String immsg = imService.sendOutPatientCancle(patientName,patientCode,doctor,cancelRemark,cancelValue,outPatientId);
					System.out.println("发送拒绝接诊消息成功:"+immsg);
				}
			}
@ -939,7 +939,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
								   @ApiParam(name = "patient", value = "patient")
									   @RequestParam(value = "patient", required = true)String patient)throws Exception {
		String success= ykyyEntranceService.outPatientOrder(jsondata,false,doctor,patient);
		String success= ykyyEntranceService.outPatientOrderYk(jsondata,false,doctor,patient);
		ObjEnvelop objEnvelop = new ObjEnvelop();
		objEnvelop.setObj(success);
		return objEnvelop;
@ -984,4 +984,14 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		objEnvelop.setObj(array);
		return objEnvelop;
	}
	@PostMapping(value = BaseHospitalRequestMapping.DodtorIM.getPrevious)
	@ApiOperation(value = "查询病人的电子病历", notes = "查询病人的电子病历")
	public ObjEnvelop findPatientEmr(@ApiParam(name = "patientId", value = "patientId")
								 @RequestParam(value = "patientId", required = true)String patientId)throws Exception {
		List<WlyyPrescriptionEmrDO> array= ykyyEntranceService.getPrevious(patientId);
		ObjEnvelop objEnvelop = new ObjEnvelop();
		objEnvelop.setObj(array);
		return objEnvelop;
	}
}

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

@ -775,6 +775,8 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "content_type", required = true) String content_type,
			@ApiParam(name = "content", value = "消息内容", defaultValue = "")
			@RequestParam(value = "content", required = true) String content,
			@ApiParam(name = "extend", value = "扩展内容", defaultValue = "")
			@RequestParam(value = "extend", required = false) String extend,
			@ApiParam(name = "type", value = "咨询type", defaultValue = "")
			@RequestParam(value = "type", required = false) String type,
			@ApiParam(name = "times", value = "times", defaultValue = "")
@ -831,7 +833,7 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
			}
		}
		session_id = imService.getPatientGuaidenceConsult(sender_id,session_id,type);
		String result = imService.patientGuaidenceAppend(sender_id,sender_name,session_id,content_type,content,"1");
		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消息:通知医生导诊");

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

@ -3,7 +3,9 @@ package com.yihu.jw.hospital.endpoint.file_upload;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.file_upload.FileManageService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.restmodel.MutilFileInfo;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
@ -11,17 +13,21 @@ 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.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Map;
@ -46,6 +52,8 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private FileManageService fileManageService;
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_IMG)
    @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
@ -120,6 +128,66 @@ public class FileUploadEndpoint extends EnvelopRestEndpoint {
        }
        return success("上传成功", uploadVO);
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STREAM_video)
    @ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
    public ObjEnvelop<UploadVO> uploadStreamVideo(@ApiParam(value = "文件", required = true)
                                             @RequestParam(value = "file", required = true) MultipartFile file,
                                                  @ApiParam(value = "文件", required = false)
                                                  @RequestParam(value = "filename", required = false) String filename,
                                                  @ApiParam(value = "taskId", required = false)
                                                      @RequestParam(value = "taskId", required = false) String taskId,
                                                  @ApiParam(value = "chunk", required = false)
                                                      @RequestParam(value = "chunk", required = false) Integer chunk,
                                                  @ApiParam(value = "文件", required = false)
                                                      @RequestParam(value = "sizesize", required = false) Long size,
                                                  @ApiParam(value = "chunkTotal", required = false)
                                                      @RequestParam(value = "chunkTotal", required = false) Integer chunkTotal,
                                                  @ApiParam(value = "objectType", required = false)
                                                      @RequestParam(value = "objectType", required = false) Integer objectType
                                             ) throws Exception{
        UploadVO uploadVO = new UploadVO();
        MutilFileInfo files = new MutilFileInfo();
        files.setChunk(chunk);
        files.setChunkTotal(chunkTotal);
        files.setFile(file);
        files.setObjectType(objectType);
        files.setSize(file.getSize());
        files.setTaskId(taskId);
        String taskid = fileManageService.chunkUploadByMappedByteBuffer(files);
        if ("unCompelete".equalsIgnoreCase(taskid)){
            System.out.println("第"+files.getChunk());
            return success("未传完",uploadVO);
        }else {
            File file1 = new File(taskid);
            FileInputStream input = new FileInputStream(file1);
            MultipartFile multipartFile = new MockMultipartFile("file", file1.getName(), "text/plain", IOUtils.toByteArray(input));
            if (isClose.equalsIgnoreCase("1")){
                Map<String, Object> map = fileUploadService.uploadImg(multipartFile);
                uploadVO.setFullUri(map.get("accessory").toString());
            }else if(isClose.equals("2")){
                //内网上传
                String rs = fileUploadService.request(remote_inner_url,multipartFile,null);
                logger.info(rs);
                JSONObject json = JSON.parseObject(rs);
                uploadVO = objectMapper.readValue(json.getJSONObject("obj").toJSONString(),UploadVO.class);
            }else {
                // 得到文件的完整名称  xxx.txt
                String originalFilename = multipartFile.getOriginalFilename();
                //判断文件名称是否有包含后缀,及前端是否有传后缀名称,有的话拼接图片后缀
                if(originalFilename.lastIndexOf(".") == 0 && StringUtils.isNotEmpty(filename)){
                    originalFilename = originalFilename +"."+filename;
                }
                InputStream inputStream = multipartFile.getInputStream();
                uploadVO = fileUploadService.uploadStream(inputStream,originalFilename,fastdfs_file_url);
                file1.delete();
            }
            return success("上传成功", uploadVO);
        }
    }
    @PostMapping(value = BaseRequestMapping.FileUpload.UPLOAD_STRING)
    @ApiOperation(value = "base64上传图片",notes = "base64上传图片")

+ 7 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseDoctorBGController.java

@ -119,6 +119,13 @@ public class BaseDoctorBGController extends EnvelopRestEndpoint {
        return success(baseDoctorBGService.setMessageHead(id));
    }
    @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));
    }
    @ApiOperation("删除医生快捷回复")
    @PostMapping(value= BaseHospitalRequestMapping.BaseBackground.delDoctorMessage)

+ 83 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseSuggestionController.java

@ -0,0 +1,83 @@
package com.yihu.jw.hospital.endpoint.hospital;
import com.yihu.jw.entity.base.doctor.BaseDoctorBackgroundDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.suggest.BaseSuggestionDO;
import com.yihu.jw.hospital.suggest.service.BaseSuggestionService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import 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.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.suggestion.suggestionManage)
@Api(value = "反馈建议", description = "反馈建议", tags = {"互联网医院 - 反馈建议"})
public class BaseSuggestionController extends EnvelopRestEndpoint {
    @Autowired
    private BaseSuggestionService baseSuggestionService;
    @ApiOperation("查询反馈建议")
    @PostMapping(value= BaseHospitalRequestMapping.suggestion.findSuggestionByType)
    public MixEnvelop findSuggestionByType(@ApiParam(name = "type", value = "类型id", required = false)
                                @RequestParam(value = "type", required = false)String type,
                                           @ApiParam(name = "userId", value = "发送者id", required = false)
                                           @RequestParam(value = "userId", required = false)String userId,
                               @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){
        MixEnvelop mixEnvelop=baseSuggestionService.findSuggestionByType(type,userId,page,pageSize);
        return mixEnvelop;
    }
    @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("新增成功");
    }
    @PostMapping(value= BaseHospitalRequestMapping.suggestion.responseSuggestion)
    @ApiOperation("回复反馈建议")
    public Envelop responseSuggestion(
            @ApiParam(name = "id", value = "建议id", required = true)
    @RequestParam(value = "id", required = true)String id,
            @ApiParam(name = "content", value = "回复内容", required = true)
            @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();
        }
        String userName = getUNAME();
        baseSuggestionService.reponseSuggestion(id,content,userId,userName);
        return success("回复成功");
    }
    @PostMapping(value= BaseHospitalRequestMapping.suggestion.findSuggestionById)
    @ApiOperation("回复反馈建议")
    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);
    }
}

+ 120 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/hospital/BaseSuggestionDictController.java

@ -0,0 +1,120 @@
package com.yihu.jw.hospital.endpoint.hospital;
import com.yihu.jw.entity.hospital.message.BaseBannerDO;
import com.yihu.jw.entity.hospital.suggest.BaseSuggestionDO;
import com.yihu.jw.entity.hospital.suggest.BaseSuggestionDictDO;
import com.yihu.jw.hospital.suggest.service.BaseSuggestionDictService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import 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.*;
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.suggestionDict.suggestionDictManage)
@Api(value = "反馈建议类型", description = "反馈建议类型", tags = {"互联网医院 - 反馈建议类型"})
public class BaseSuggestionDictController extends EnvelopRestEndpoint {
    @Autowired
    private BaseSuggestionDictService baseSuggestionDictService;
    @ApiOperation("查询反馈建议类型")
    @PostMapping(value= BaseHospitalRequestMapping.suggestionDict.findSuggestionType)
    public MixEnvelop findSuggestionByType(@ApiParam(name = "name", value = "类型名称", required = false)
                                           @RequestParam(value = "name", required = false)String name,
                                           @ApiParam(name = "des", value = "类型描述", required = false)
                                           @RequestParam(value = "des", required = false)String des,
                                           @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){
        MixEnvelop mixEnvelop=baseSuggestionDictService.findByNameAndDes(name,des,page,pageSize);
        return mixEnvelop;
    }
    @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("新增成功");
    }
    @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("删除失败");
        }
    }
    @PostMapping(value= BaseHospitalRequestMapping.suggestionDict.updateSuggestionType)
    @ApiOperation("更新建议类型")
    public Envelop updateSuggestionType(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id", required = true)String id,
            @ApiParam(name = "suggestName", value = "suggestName", required = false)
            @RequestParam(value = "suggestName", required = false)String suggestName,
            @ApiParam(name = "suggestDes", value = "suggestDes", required = false)
            @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("更新失败,礼物不存在");
        }
        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("上移成功");
        }
    }
    @GetMapping(value= BaseHospitalRequestMapping.suggestionDict.downSuggestionType)
    @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("下移成功");
        }
    }
}

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

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

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

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

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

@ -23,9 +23,11 @@ import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.prescription.dao.OauthYlzConfigDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.PayInfoNoticeService;
import com.yihu.jw.hospital.prescription.service.PrescriptionExpressageService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.WorkTimeService;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.service.consult.KnowledgeArticleService;
import com.yihu.jw.hospital.service.consult.QrcodeService;
import com.yihu.jw.hospital.service.consult.SysDictService;
@ -33,6 +35,7 @@ import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.pay.utils.PayLogService;
import com.yihu.jw.order.pay.ylz.YlzPayService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
@ -51,6 +54,7 @@ import com.ylzinfo.onepay.sdk.OnepayClient;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.domain.WebHook;
import com.ylzinfo.onepay.sdk.domain.ext.WaitPayDetailVO;
import com.ylzinfo.onepay.sdk.exception.PayException;
import com.ylzinfo.onepay.sdk.utils.SecurityUtil;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
@ -138,6 +142,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private KnowledgeArticleService knowledgeArticleService;
    @Autowired
    private WechatDao wechatDao;
    @Autowired
    private YlzPayService ylzPayService;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private PayInfoNoticeService payInfoNoticeService;
    private String successxml = "SUCCESS";
@ -730,6 +740,129 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        String uri = qrcodeService.makeSpecialistQrcode(doctor);
        return success("操作成功",uri);
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.querySettledRecord)
    @ApiOperation(value = "易联众_查询结算状态")
    public Envelop querySettledRecord(@ApiParam(name = "cardNo", value = "cardNo", required = true)
                             @RequestParam(value = "cardNo", required = true)String cardNo,
                                      @ApiParam(name = "beginDate", value = "beginDate", required = false)
                                      @RequestParam(value = "beginDate", required = false)String beginDate,
                                      @ApiParam(name = "endDate", value = "endDate", required = false)
                                          @RequestParam(value = "endDate", required = false)String endDate,
                                      @ApiParam(name = "queryType", value = "queryType", required = false)
                                          @RequestParam(value = "queryType", required = false)String queryType,
                                      @ApiParam(name = "billSn", value = "billSn", required = false)
                                          @RequestParam(value = "billSn", required = false)String billSn,
                                      @ApiParam(name = "traceNo", value = "traceNo", required = false)
                                          @RequestParam(value = "traceNo", required = false)String traceNo,
                                      @ApiParam(name = "pageNo", value = "页码", required = false)
                                          @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);
    }
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.paySuccessNotice)
    @ApiOperation(value = "微信支付状态查询")
    public Envelop paySuccessNotice(@ApiParam(name = "userName", value = "userName", required = true)
                                      @RequestParam(value = "userName", required = true)String userName,
                                      @ApiParam(name = "idCard", value = "idCard", required = false)
                                      @RequestParam(value = "idCard", required = false)String idCard,
                                      @ApiParam(name = "phone", value = "phone", required = false)
                                      @RequestParam(value = "phone", required = false)String phone,
                                      @ApiParam(name = "title", value = "title", required = false)
                                      @RequestParam(value = "title", required = false)String title,
                                      @ApiParam(name = "url", value = "url", required = false)
                                      @RequestParam(value = "url", required = false)String url,
                                      @ApiParam(name = "doctorName", value = "doctorName", required = false)
                                      @RequestParam(value = "doctorName", required = false)String doctorName,
                                      @ApiParam(name = "total", value = "总费用", required = false)
                                      @RequestParam(value = "total", required = false)String total,
                                      @ApiParam(name = "miPay", value = "医保支付", required = false)
                                      @RequestParam(value = "miPay", required = false)String miPay,
                                    @ApiParam(name = "selfPay", value = "个人支付", required = false)
                                        @RequestParam(value = "selfPay", required = false)String selfPay,
                                    @ApiParam(name = "orderNo", value = "单据号", required = false)
                                        @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);
    }
    /**
     * 商户回调通知
     * @param request
     * @param response
     * @throws IOException
     * @throws PayException
     */
    @RequestMapping(value = "/ylzSettleRecord")
    public String ylzSettleRecord(HttpServletRequest request, HttpServletResponse response) throws Exception{
        response.setContentType("text/html;charset=utf-8");
        OauthYlzConfigDO oauthYlzConfigDO = oauthYlzConfigDao.findById("ylz_pay_config");
        if(oauthYlzConfigDO==null){
            return "未找到支付配置文件";
        }
        String appId = oauthYlzConfigDO.getAppId();
        String appSecret = oauthYlzConfigDO.getAppKey();
        InputStream inputStream = request.getInputStream();
        String params = StreamUtils.copyToString(inputStream, Charset.forName("UTF-8"));
        logger.info("回调参数:{}", params);
        if (StringUtil.isEmpty(params)) {
            response.getWriter().write("empty");
            return appId;
        }
        // 参数转换
        ResponseParams<?> encryptRes = JSON.parseObject(params, ResponseParams.class);
        OnepayDefaultClient client = new OnepayDefaultClient("", appId, appSecret, encryptRes.getSignType(), encryptRes.getEncryptType());
        try {
            logger.info("解密前:{}", JSON.toJSONString(encryptRes));
            ResponseParams<?> decryptRes = client.decryptNotifyResponse(encryptRes);
            logger.info("解密后:{}",JSON.toJSONString(decryptRes) );
            boolean isDecrypt = ("-1".equals(decryptRes.getRespCode()) ? false : true); // 是否解密失败
            if (!isDecrypt) {
                response.getWriter().write("DECRYPT FAILURE");
            } else {
                boolean isVerify = client.verifyResponseSign(decryptRes);
                logger.info("验签结果:{}", isVerify);
                if (!isVerify) {
                    response.getWriter().write("FAILURE");
                } else {
                    JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(decryptRes));
                    JSONObject param = jsonObject.getJSONObject("param");
                    logger.info("param"+params);
                    String cardNo = param.getString("cardNo");
                    String billSn =  param.getString("billSn");
                    String traceNo = param.getString("traceNo");
                    String result = ylzPayService.querySettledRecord(cardNo,null,null,"onlineRecordDetail",billSn,traceNo,"1","10000");
                    JSONObject jsonObjectTotal = JSON.parseObject(result);
                    if (jsonObjectTotal.get("respCode").toString().equalsIgnoreCase("000000")){
                       JSONObject listParam =  JSON.parseObject(jsonObjectTotal.get("param").toString());
                       String bills = listParam.getString("bills");
                       String len = listParam.getString("len");
                       JSONObject billParam = JSON.parseObject(bills);
                       String drugState = billParam.getString("drugState");
                       String messageRemind = "您在中山医院医院内科就诊费用已支付成功!";
                       WaitPayDetailVO waitPayDetailVO = new WaitPayDetailVO();
                       if ("1".equalsIgnoreCase(drugState)){
                           messageRemind += "自取患者请于周一至周五上午8点到12点、下午2:30到5:30,到门诊药房9号或10号窗口凭相应的就诊卡或电子健康卡取药。";
                        }else {
                           messageRemind += "";
                       }
                        List<WaitPayDetailVO> listWPD = JSONObject.parseArray(billParam.getString("waitPayDetailVOs"),  WaitPayDetailVO.class);
                    }
                    response.getWriter().write("SUCCESS");
                }
            }
        } catch (Exception e) {
            response.getWriter().write(e.getMessage());
        }
        return appId;
    }
}

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

@ -130,8 +130,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                          @ApiParam(name = "startTime", value = "开始时间")
                                          @RequestParam(value = "startTime",required = false) String startTime,
                                          @ApiParam(name = "endTime", value = "结束时间")
                                          @RequestParam(value = "endTime",required = false) String endTime) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag);
                                          @RequestParam(value = "endTime",required = false) String endTime,
                                          @ApiParam(name = "ksdm", value = "科室代码")
                                              @RequestParam(value = "ksdm",required = false) String ksdm) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm);
        return success(vos);
    }
    
@ -343,18 +345,33 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "chargeType", required = false)String chargeType)throws Exception {
        
        WlyyOutpatientDO wlyyOutpatientDO = prescriptionService.appointmentRevisit(outpatientJson,expressageJson,registerJson,chargeType);
        
        //发送系统消息
        SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
        //发送IM消息
        hospitalSystemMessageService.sendImMessage(systemMessageDO);
        
        //发送医生抢单消息
        if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
            hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
        if (wlyyOutpatientDO!=null&&null==wlyyOutpatientDO.getId()){
            ObjEnvelop objEnvelop =new ObjEnvelop();
            String msg = "";
            if (1==wlyyOutpatientDO.getRemindCount()){
                msg = "自取";
            }else {
                msg = "快递配送";
            }
            objEnvelop.setMessage("您已经选择过"+msg+"方式,请勿修改");
            objEnvelop.setStatus(300);
            return objEnvelop;
        }else {
            //发送系统消息
            SystemMessageDO systemMessageDO = prescriptionService.sendOutPatientMes(wlyyOutpatientDO,payFlag);
            //发送IM消息
            hospitalSystemMessageService.sendImMessage(systemMessageDO);
            //发送医生抢单消息
            if(StringUtils.isBlank(wlyyOutpatientDO.getDoctor())){
                hospitalSystemMessageService.sendImPichCheckMessage(wlyyOutpatientDO);
            }
            return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
        }
        
        return success(BaseHospitalRequestMapping.Prescription.api_success,wlyyOutpatientDO);
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.getICD10)
@ -411,8 +428,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                    @ApiParam(name = "inspectionJson", value = "检查检验")
                                    @RequestParam(value = "inspectionJson", required = false)String inspectionJson,
                                    @ApiParam(name = "emrJson", value = "电子病历")
                                        @RequestParam(value = "emrJson", required = false)String emrJson)throws Exception {
        Map<String,Object> result = prescriptionService.makeDiagnosis(outPatientId,advice,type,infoJsons,diagnosisJson,inspectionJson,emrJson);
                                        @RequestParam(value = "emrJson", required = false)String emrJson,
                                    @ApiParam(name = "prescriptionId", value = "处方id")
                                        @RequestParam(value = "prescriptionId", required = false)String prescriptionId)throws Exception {
        Map<String,Object> result = prescriptionService.makeDiagnosis(outPatientId,prescriptionId,advice,type,infoJsons,diagnosisJson,inspectionJson,emrJson);
        try {
            
            com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
@ -1200,8 +1219,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                        @ApiParam(name = "name", value = "医生名称")
                                        @RequestParam(value = "name",required = false)String name,
                                        @ApiParam(name = "chargeType", value = "号别")
                                        @RequestParam(value = "chargeType",required = false)String chargeType) {
        return success(prescriptionService.findDoctorByName(hospital,name,chargeType));
                                        @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));
    }
    
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptWithDoctorWorkTime)

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

@ -99,8 +99,10 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                          @ApiParam(name = "startTime", value = "开始时间")
                                          @RequestParam(value = "startTime",required = false) String startTime,
                                          @ApiParam(name = "endTime", value = "结束时间")
                                          @RequestParam(value = "endTime",required = false) String endTime) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag);
                                          @RequestParam(value = "endTime",required = false) String endTime,
                                          @ApiParam(name = "ksdm", value = "科室代码")
                                              @RequestParam(value = "ksdm",required = false) String ksdm) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm);
        return success(vos);
    }
@ -109,8 +111,10 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
    public ObjEnvelop findOutpatientInfo(@ApiParam(name = "patient", value = "居民id")
                                         @RequestParam(value = "patient",required = false) String patient,
                                         @ApiParam(name = "conNo", value = "就诊次数")
                                         @RequestParam(value = "conNo",required = false) String conNo)throws Exception{
        WlyyOutpatientVO obj = prescriptionService.findOutpatientInfo(patient,conNo,demoFlag);
                                         @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);
    }
@ -165,9 +169,11 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "pyKey", required = false)String pyKey,
                                         @ApiParam(name = "winNo", value = "分部编码")
                                         @RequestParam(value = "winNo", required = false)String winNo,
                                         @ApiParam(name = "groupNo", value = "药房编码")
                                         @RequestParam(value = "groupNo", required = false)String groupNo)throws Exception {
        return success(prescriptionService.getDrugDictionary(drugNo,pyKey,winNo,groupNo));
                                         @ApiParam(name = "groupNo", value = "分组")
                                         @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));
    }

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

@ -240,7 +240,7 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
					object.put("title",knowledgeArticleDO.getTitle());
					object.put("content",knowledgeArticleDO.getIntro());
					object.put("img",knowledgeArticleDO.getImage());
					imUtil.sendImMsg(patientBusinessDO.getDoctor(), patientBusinessDO.getDoctorName(), patientBusinessDO.getSessionId(), "4", object.toJSONString(),"1");
					imUtil.sendImMsg(patientBusinessDO.getDoctor(), patientBusinessDO.getDoctorName(), patientBusinessDO.getSessionId(), "4", object.toJSONString(),"1",null);
				}else {
					WlyySurveyUserDO wlyySurveyUserDO = new WlyySurveyUserDO();
					String doctor = patientBusinessDO.getDoctor();
@ -264,7 +264,7 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
						object.put("content",wlyySurveyTemplateDO.getTemplateComment());
						object.put("id",wlyySurveyTemplateDO.getId());
					}
					imUtil.sendImMsg(patientBusinessDO.getDoctor(), patientBusinessDO.getDoctorName(), patientBusinessDO.getSessionId(), "17", object.toJSONString(),"1");
					imUtil.sendImMsg(patientBusinessDO.getDoctor(), patientBusinessDO.getDoctorName(), patientBusinessDO.getSessionId(), "17", object.toJSONString(),"1",null);
				}
			}

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/WlyyDeviceService.java

@ -71,7 +71,7 @@ public class WlyyDeviceService {
        }
        //数据权限过滤
        List<String> orgList = orgUserService.getUserOrgNameById(userAgent.getUID());
        List<String> orgList = orgUserService.getUserOrgById(userAgent.getUID());
        if(!orgList.contains(userAgent.commonHospital)){
            sql += " and grant_org_code in ("+orgUserService.getUserOrg(orgList)+") ";
        }

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

@ -3,9 +3,9 @@ package com.yihu.jw.controller.rehabilitation;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dao.rehabilitation.RehabilitationOperateRecordsDao;
import com.yihu.jw.entity.specialist.RehabilitationServiceItemDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
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;
@ -17,7 +17,6 @@ import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -93,14 +92,14 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
    @GetMapping(value = SpecialistMapping.rehabilitation.findTemplateDetailByTemplateId)
    @ApiOperation(value = "获取康复服务套餐模板明细")
    public MixEnvelop<RehabilitationServiceItemDO, RehabilitationServiceItemDO> findTemplateDetailByTemplateId(@ApiParam(name = "templateId", value = "模板id")
    public ListEnvelop findTemplateDetailByTemplateId(@ApiParam(name = "templateId", value = "模板id")
                                                                                      @RequestParam(value = "templateId", required = true)String templateId){
        try {
            return rehabilitationPlanService.findTemplateDetailByTemplateId(templateId);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return MixEnvelop.getError(e.getMessage());
            return ListEnvelop.getError(e.getMessage());
        }
    }

+ 6 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/dao/rehabilitation/RehabilitationServiceItemDao.java

@ -2,9 +2,15 @@ package com.yihu.jw.dao.rehabilitation;
import com.yihu.jw.entity.specialist.RehabilitationServiceItemDO;
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 RehabilitationServiceItemDao extends PagingAndSortingRepository<RehabilitationServiceItemDO, Long>,JpaSpecificationExecutor<RehabilitationServiceItemDO> {
    RehabilitationServiceItemDO findByCode(String itemId);
    @Query("SELECT a FROM RehabilitationServiceItemDO a ")
    List<RehabilitationServiceItemDO> findList();
}

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

@ -1311,12 +1311,13 @@ public class RehabilitationManageService {
    public Map<String,Object> updateNodeAndRelationRecordImg(String node,String image,String planDeatilId,String relationCode)throws Exception{
        Map<String,Object> resultMap = new HashedMap();
        try{
            int i =0;
            RehabilitationDetailDO detailDO = rehabilitationDetailDao.findById(planDeatilId);
            detailDO.setStatus(1);
            detailDO.setUpdateTime(new Date());
            if (StringUtils.isNoneBlank(relationCode)){
                i=rehabilitationDetailDao.updateStatusAndRelationCodeById(1,planDeatilId,relationCode);
            }else {
                i=rehabilitationDetailDao.updateStatusById(1,planDeatilId);
                detailDO.setRelationCode(relationCode);
            }
            rehabilitationDetailDao.save(detailDO);
            int j = rehabilitationOperateRecordsDao.updateNodeAndRelationRecordImg(node,image,planDeatilId);
            //如果整个计划的服务项都完成了,整个计划也完成了
            String allSql ="SELECT * FROM wlyy_rehabilitation_plan_detail where plan_id = (SELECT plan_id FROM `wlyy_rehabilitation_plan_detail` WHERE id='"+planDeatilId+"')";

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

@ -10,6 +10,7 @@ import com.yihu.jw.entity.specialist.RehabilitationServiceItemDO;
import com.yihu.jw.entity.specialist.rehabilitation.*;
import com.yihu.jw.restmodel.specialist.PatientSignInfoVO;
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.rm.specialist.SpecialistMapping;
@ -18,6 +19,7 @@ import com.yihu.jw.service.SpecialistHospitalServiceItemService;
import com.yihu.jw.service.SpecialistService;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.vo.TemplateDetailVo;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
@ -29,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -83,6 +86,25 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
        templateDO.setDel(1);
        templateDO.setUpdateTime(new Date());
        templateDO = templateDao.save(templateDO);
        String templateId = templateDO.getId();
        String user = templateDO.getCreateUser();
        String userName = templateDO.getCreateUserName();
        //默认新增服务项
        String sql = "SELECT code from wlyy.system_dict WHERE `dict_name` = 'default_service_item_id'";
        List<String> list = jdbcTemplate.queryForList(sql,String.class);
        if(list!=null&&list.size()>0){
            list.stream().forEach(code->{
                RehabilitationTemplateDetailDO detailDO = new RehabilitationTemplateDetailDO();
                detailDO.setTemplateId(templateId);
                detailDO.setHospitalServiceItemId(code);
                detailDO.setCreateUser(user);
                detailDO.setCreateUserName(userName);
                detailDO.setCreateTime(new Date());
                detailDO.setUpdateTime(new Date());
                templateDetailDao.save(detailDO);
            });
        }
        return ObjEnvelop.getSuccess(SpecialistMapping.api_success,templateDO.getId());
    }
@ -134,22 +156,26 @@ public class RehabilitationPlanService extends BaseJpaService<RehabilitationPlan
     * @param templateId
     * @return
     */
    public MixEnvelop<RehabilitationServiceItemDO, RehabilitationServiceItemDO> findTemplateDetailByTemplateId(String templateId) {
        MixEnvelop<RehabilitationServiceItemDO,RehabilitationServiceItemDO> envelop = new MixEnvelop<>();
        List<RehabilitationServiceItemDO> serviceItemDOS = new ArrayList<>();
        List<String> hospitalServiceItemIds = templateDetailDao.findHospitalServiceItemIdByTemplateId(templateId);
        for(String itemId : hospitalServiceItemIds){
            RehabilitationServiceItemDO serviceItemDO = serviceItemDao.findByCode(itemId);
            if (serviceItemDO != null){
                serviceItemDOS.add(serviceItemDO);
    public ListEnvelop findTemplateDetailByTemplateId(String templateId) {
        List<TemplateDetailVo> resultList = new ArrayList<>();
        List<RehabilitationTemplateDetailDO>  list = templateDetailDao.findTemplateDetailByTemplateId(templateId);
        List<RehabilitationServiceItemDO> itemDOList = serviceItemDao.findList();
        Map<String, List<RehabilitationTemplateDetailDO>> map = list.stream().collect(Collectors.groupingBy(RehabilitationTemplateDetailDO::getHospitalServiceItemId));
        for (String code : map.keySet()){
            TemplateDetailVo detailVo = new TemplateDetailVo();
            detailVo.setCode(code);
            detailVo.setId(code);
            detailVo.setList(map.get(code));
            for (RehabilitationServiceItemDO item:itemDOList){
                if(code.equals(item.getCode())){
                    detailVo.setName(item.getName());
                    break;
                }
            }
            resultList.add(detailVo);
        }
        envelop.setDetailModelList(serviceItemDOS);
        return envelop;
//        if(hospitalServiceItemIds.size() > 0) {
//            return hospitalServiceItemService.selectById(hospitalServiceItemIds);
//        }
//        return MixEnvelop.getSuccess(SpecialistMapping.api_success);
        return ListEnvelop.getSuccess(SpecialistMapping.api_success,resultList);
    }
    public PatientRehabilitationPlanDO createPatientRehabilitationPlan(PatientRehabilitationPlanDO planDO) {

+ 47 - 0
svr/svr-wlyy-specialist/src/main/java/com/yihu/jw/vo/TemplateDetailVo.java

@ -0,0 +1,47 @@
package com.yihu.jw.vo;
import com.yihu.jw.entity.specialist.rehabilitation.RehabilitationTemplateDetailDO;
import java.util.List;
/**
 * Created by yeshijie on 2020/8/7.
 */
public class TemplateDetailVo {
    private String id;//兼容之前的版本
    private String code;
    private String name;
    private List<RehabilitationTemplateDetailDO> list;
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public List<RehabilitationTemplateDetailDO> getList() {
        return list;
    }
    public void setList(List<RehabilitationTemplateDetailDO> list) {
        this.list = list;
    }
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
}