Forráskód Böngészése

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

huangwenjie 6 éve
szülő
commit
dd2cd75503
38 módosított fájl, 2249 hozzáadás és 175 törlés
  1. 4 2
      business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java
  2. 6 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/OutpatientDao.java
  3. 14 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionDao.java
  4. 5 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionExpressageDao.java
  5. 5 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionExpressageLogDao.java
  6. 2 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionInfoDao.java
  7. 1 1
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/PrescriptionInfoLogDao.java
  8. 25 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/WlyyExpressagePriceDao.java
  9. 21 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/dao/WlyyOutpatientExpressageLogDao.java
  10. 16 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageLogService.java
  11. 638 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionExpressageService.java
  12. 266 115
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  13. 22 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/WlyyExpressagePriceService.java
  14. 278 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/SFUtils.java
  15. 2 2
      common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHospitalDeptDO.java
  16. 30 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java
  17. 99 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/consult/WlyyHospitalWaitingRoomDO.java
  18. 100 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyExpressagePriceDO.java
  19. 71 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java
  20. 181 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientExpressageLogDO.java
  21. 9 20
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageDO.java
  22. 9 7
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageLogDO.java
  23. 47 2
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  24. 9 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictHospitalDeptVO.java
  25. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/org/BaseOrgVO.java
  26. 54 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyOutpatientVO.java
  27. 7 6
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionExpressageVO.java
  28. 14 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionVO.java
  29. 99 0
      common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientKit.java
  30. 6 3
      gateway/ag-basic/src/main/resources/application.yml
  31. 4 2
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  32. 4 4
      server/svr-authentication/src/main/resources/application.yml
  33. 14 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/config/JpaConfig.java
  34. 79 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/expressage/ExpressageEndpoint.java
  35. 1 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/third/PrescriptionUpdateController.java
  36. 7 0
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  37. 74 6
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  38. 16 1
      svr/svr-internet-hospital/src/main/resources/application.yml

+ 4 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java

@ -55,8 +55,9 @@ public class PatientMappingService {
            patientMappingDao.save(mappingDO);
            return mappingCode;
        }else{
            throw new RuntimeException("获取his居民信息失败!");
        }
        return null;
    }
    public String findHisPatNoByPatient(String patient)throws Exception{
@ -85,7 +86,8 @@ public class PatientMappingService {
            patientMappingDao.save(mappingDO);
            return mappingCode;
        }else{
            throw new RuntimeException("获取his居民信息失败!");
        }
        return null;
    }
}

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

@ -2,10 +2,16 @@ package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/6/3.
 */
public interface OutpatientDao extends PagingAndSortingRepository<WlyyOutpatientDO, String>, JpaSpecificationExecutor<WlyyOutpatientDO> {
    @Query("from WlyyOutpatientDO a where a.patient = ?1 and a.status in(0,1)")
    List<WlyyOutpatientDO> findByPatientList(String patient);
}

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

@ -1,10 +1,14 @@
package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
/**
@ -14,4 +18,14 @@ public interface PrescriptionDao extends PagingAndSortingRepository<WlyyPrescrip
    @Query("select a from WlyyPrescriptionDO a where a.patientCode = ?1 and a.status >= 0 ")
    List<WlyyPrescriptionDO> findByPatientCode(String patientCode);
    @Modifying
    @Query("update WlyyPrescriptionDO p set p.status=?2 where p.id=?1")
    void updateStatus(String id,Integer status);
    @Modifying
    @Query("update WlyyPrescriptionDO p set p.status=?2 ,p.finishTime =?3 where p.id=?1")
    void updateStatus(String id, Integer status, Date date);
    List<WlyyPrescriptionDO> findByOutpatientId(String outpatientId);
}

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

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.prescription.dao;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -11,5 +12,8 @@ import java.util.List;
 */
public interface PrescriptionExpressageDao extends PagingAndSortingRepository<WlyyPrescriptionExpressageDO, String>, JpaSpecificationExecutor<WlyyPrescriptionExpressageDO> {
    List<WlyyPrescriptionExpressageDO> findByPrescriptionId(String prescriptionId);
    @Query("from WlyyPrescriptionExpressageDO p where p.mailno=?1")
    WlyyPrescriptionExpressageDO findByPrescriptionExpressMailno(String mailno);
    List<WlyyPrescriptionExpressageDO> findByOutpatientId(String outpatientId);
}

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

@ -4,8 +4,13 @@ import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2019/5/17.
 */
public interface PrescriptionExpressageLogDao extends PagingAndSortingRepository<WlyyPrescriptionExpressageLogDO, String>, JpaSpecificationExecutor<WlyyPrescriptionExpressageLogDO> {
    List<WlyyPrescriptionExpressageLogDO> queryByOutpatientId(String outpatientId);
}

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

@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Set;
/**
 * Created by Trick on 2019/5/17.
@ -15,4 +16,5 @@ public interface PrescriptionInfoDao extends PagingAndSortingRepository<WlyyPres
    List<WlyyPrescriptionInfoDO> findByPrescriptionId(String prescriptionId);
    List<WlyyPrescriptionInfoDO> queryAllByPrescriptionIdInAndDel(Set ids,Integer del);
}

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

@ -7,5 +7,5 @@ import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2019/5/17.
 */
public interface PrescriptionInfoLogDao extends PagingAndSortingRepository<WlyyPrescriptionLogDO, String>, JpaSpecificationExecutor<WlyyPrescriptionLogDO> {
public interface PrescriptionLogDao extends PagingAndSortingRepository<WlyyPrescriptionLogDO, String>, JpaSpecificationExecutor<WlyyPrescriptionLogDO> {
}

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

@ -0,0 +1,25 @@
package com.yihu.jw.hospital.prescription.dao;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.hospital.prescription.WlyyExpressagePriceDO;
/**
 * 
 *  数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * Administrator 	1.0  		2019年06月05日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface WlyyExpressagePriceDao extends PagingAndSortingRepository<WlyyExpressagePriceDO, String>, JpaSpecificationExecutor<WlyyExpressagePriceDO>  {
    @Query("from WlyyExpressagePriceDO where code = ?1 and endAddressName LIKE ?2 ")
    WlyyExpressagePriceDO getExprePriceByIdAndEndAdressName(String code,String end_address_name);
}

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

@ -0,0 +1,21 @@
package com.yihu.jw.hospital.prescription.dao;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientExpressageLogDO;
/**
 * 
 * 门诊物流日志表 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * Administrator 	1.0  		2019年06月05日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface WlyyOutpatientExpressageLogDao extends PagingAndSortingRepository<WlyyOutpatientExpressageLogDO, String>, JpaSpecificationExecutor<WlyyOutpatientExpressageLogDO>  {
}

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

@ -0,0 +1,16 @@
package com.yihu.jw.hospital.prescription.service;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageLogDO;
import com.yihu.jw.hospital.prescription.dao.PrescriptionExpressageLogDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 *  门诊物流日志服务
 * lith 2019.06.04
 */
@Service
public class PrescriptionExpressageLogService extends BaseJpaService<WlyyPrescriptionExpressageLogDO, PrescriptionExpressageLogDao> {
}

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

@ -0,0 +1,638 @@
//package com.yihu.jw.hospital.prescription.service;
//
//import com.yihu.jw.entity.base.org.BaseOrgDO;
//import com.yihu.jw.entity.hospital.prescription.*;
//import com.yihu.jw.hospital.prescription.dao.*;
//import com.yihu.jw.hospital.prescription.service.entrance.util.SFUtils;
//import com.yihu.jw.org.dao.BaseOrgDao;
//import com.yihu.jw.util.date.DateUtil;
//import com.yihu.jw.util.http.HttpClientKit;
//import com.yihu.mysql.query.BaseJpaService;
//import org.apache.commons.lang3.StringUtils;
//import org.apache.http.NameValuePair;
//import org.apache.http.message.BasicNameValuePair;
//import org.dom4j.Document;
//import org.dom4j.DocumentHelper;
//import org.dom4j.Element;
//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.orm.jpa.JpaTransactionManager;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.TransactionDefinition;
//import org.springframework.transaction.TransactionStatus;
//import org.springframework.transaction.support.DefaultTransactionDefinition;
//
//import java.util.*;
//
///**
// *  门诊物流服务
// * lith 2019.06.04
// */
//
//@Service
//public class PrescriptionExpressageService extends BaseJpaService<WlyyPrescriptionExpressageDO, PrescriptionExpressageDao> {
//    private static Logger logger = LoggerFactory.getLogger(PrescriptionExpressageService.class);
//
////    //顺丰快递接口请求地址
////    //@Value("${express.sf_url}")
////    private String sf_url;
////
////    //顺丰快递接口接入编码
////    //@Value("${express.sf_code}")
////    private String sf_code;
////
////    //顺丰快递接口checkword
////    //@Value("${express.sf_check_word}")
////    private String sf_check_word;
//
//    @Autowired
//    private SFUtils SFUtils;
//
//    @Autowired
//    private JpaTransactionManager transactionManager;
//
//    //处方日志
//    @Autowired
//    private WlyyOutpatientExpressageLogDao outpatientExpressageLogDao;
//
//    @Autowired
//    private PrescriptionDao prescriptionDao;
//
//    @Autowired
//    private WlyyExpressagePriceDao expressagePriceDao;
//
//    @Autowired
//    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
//
//    @Autowired
//    private PrescriptionExpressageDao prescriptionExpressageDao;
//
//    @Autowired
//    private BaseOrgDao baseOrgDao;
//
//
//    /**
//     * 组装请求参数,发送请求
//     * @param xml
//     * @return
//     * @throws Exception
//     */
//    private String SFExpressPost(String xml)throws Exception{
//        String verifyCode = SFUtils.verifyCodeSFXmlStr(xml,sf_check_word);
//        List<NameValuePair> params = new ArrayList<>();
//        params.add(new BasicNameValuePair("xml", xml));
//        params.add(new BasicNameValuePair("verifyCode", verifyCode));
//        String re = HttpClientKit.post(sf_url, params, "UTF-8");
//        return re;
//    }
//
//    /**
//     * 校验返回的xml报文
//     * @param responseXml
//     * @param title
//     */
//    private void verificationResponXml(String responseXml,String title) throws Exception {
//        String error = "";
//        if (StringUtils.isBlank(responseXml)) {
//            // 如果返回的XML报文为空,请求也算失败
//            //保存http日志
//            error = title + ",返回的XML为空!";
//            logger.info(error);
//            throw new Exception(error);
//        }else{
////          报错的报文示例<Response service="ScopeService"><Head>ERR</Head><ERROR code="8014">校验码错误 </ERROR></Response>
//            Document doc = DocumentHelper.parseText(responseXml);
//            String headvalue = doc.selectSingleNode("/Response/Head").getText();
//            if(StringUtils.isNotBlank(headvalue) && "ERR".equals(headvalue)){
//                //错误代码
//                String errorCode = "";
//                //错误代对应的文字
//                String errorMessage = doc.selectSingleNode("/Response/ERROR").getText();
//                Document error_doc = doc.selectSingleNode("/Response/ERROR").getDocument();
//                Element root = error_doc.getRootElement();
//                List<?> child = root.elements();
//                for (Object o : child){
//                    Element e = (Element) o;
//                    errorCode = e.attributeValue("code");
//                }
//                error = title+","+errorCode+","+errorMessage;
//                logger.info(error);
//                throw new Exception(error);
//            }
//        }
//    }
//
//
//    /**
//     * 查询派送地址是否属于顺丰的派送范围
//     * @param d_address 派送地址
//     * @return
//     */
//    public Boolean getSFOrderFilterService(String d_address) throws Exception {
//
//        boolean result = false;
//
//        String xml = SFUtils.getSFOrderFilterXml(d_address,sf_code,"","","","");
//
//        String re = this.SFExpressPost(xml);
//
////        String re = "<Response service=\"OrderFilterService\"><Head>OK</Head><Body><OrderFilterResponse orderid=\"TE201407020016\" filter_result=\"2\" origincode=\"755\" remark=\"2\"/></Body></Response>";
//
//        //xml验证
//        verificationResponXml(re,"查询派送地址是否有效失败!");
//
//
//        Document doc = DocumentHelper.parseText(re);
//        String headvalue = doc.selectSingleNode("/Response/Head").getText();
//        Element root = doc.getRootElement();
//        if(StringUtils.isNotBlank(headvalue) && "OK".equals(headvalue)) {
//            //是否能派送:1:人工确认;2:可收派;3:不可以收派
//            String filter_result = "";
//
//            Element firstWorldElement = root.element("Body");
//
//            List<Element> elements = firstWorldElement.elements();
//
//            for (Element o : elements){
//                filter_result = o.attributeValue("filter_result");
//            }
//
//            if(StringUtils.isNotBlank(filter_result) && "2".equals(filter_result)){
//                result = true;
//            }
//        }
//        return result;
//
//
//    }
//
//    /**
//     * 向顺丰快递下订单
//     * @param sfexpress_obj
//     * @return
//     * @throws Exception
//     */
//    public WlyyPrescriptionExpressageDO postSFOrderService(WlyyPrescriptionExpressageDO sfexpress_obj) throws Exception {
//
//        //获取医生所处的医院详细地址,作为寄件人地址
//        WlyyPrescriptionDO prescription = prescriptionDao.findOne(sfexpress_obj.getOutpatientId());
//        BaseOrgDO hospital = baseOrgDao.findByCode(prescription.getHospital());
//
//        String xml = SFUtils.postSFOrderService(sfexpress_obj,hospital,sf_code);
//        logger.info("顺丰快递下订单:xml"+xml);
//        String re = this.SFExpressPost(xml);
////        String re = "<Response service=\"OrderService\"><Head>OK</Head><Body><OrderResponse filter_result=\"2\" destcode=\"592\" mailno=\"444844978335\" origincode=\"592\" orderid=\"6daa6baec5fd4b65a1b023a8b60e2e91\"/></Body></Response>";
//
//        //xml验证
//        logger.info("顺丰快递下订单:re"+re);
//        verificationResponXml(re,"向顺丰快递下订单失败!");
//
//        Document doc = DocumentHelper.parseText(re);
//        String headvalue = doc.selectSingleNode("/Response/Head").getText();
//        if(StringUtils.isNotBlank(headvalue) && "OK".equals(headvalue)) {
//            Element root = doc.getRootElement();
//            if (root.element("Body") != null)     //包含OrderResponse节点
//            {
//                root = root.element("Body");
//            }
//
//            //是否能派送:1:人工确认;2:可收派;3:不可以收派
//            String filter_result = "";
//            String orderid = "";//业务订单号
//            String mailno = "";//顺丰运单号
//            String destCode = "";//目的地区域代码
//            List<?> child = root.elements();
//            for (Object o : child) {
//                Element e = (Element) o;
//                filter_result = e.attributeValue("filter_result");
//                orderid = e.attributeValue("orderid");
//                mailno = e.attributeValue("mailno");
//                destCode = e.attributeValue("destcode");
//            }
//            if(StringUtils.isNotBlank(filter_result) && "3".equals(filter_result)){
//                logger.info("顺丰快递下订单失败:派送地址不可派送,门诊编号:"+sfexpress_obj.getOutpatientId());
//                throw new Exception("顺丰快递下订单失败:派送地址不可派送");
//            }
//
//            if(StringUtils.isBlank(mailno)){
//                logger.info("顺丰快递下订单失败:未获取到快递单号!门诊编号:"+sfexpress_obj.getOutpatientId());
//                throw new Exception("顺丰快递下订单失败:未获取到快递单号!");
//            }
//            sfexpress_obj.setMailno(mailno);
//            sfexpress_obj.setCityCode(destCode);
//        }
//        return sfexpress_obj;
//    }
//
//
//    /**
//     * 调用顺丰接口获取物流路由日志,与本地匹配,进行增量修改,并返回完整日志列表
//     * @param prescription
//     * @param sfexpress_obj
//     * @param sfexpresslogList
//     * @return
//     */
//    public List<WlyyPrescriptionExpressageLogDO> getRoutInfos(WlyyPrescriptionDO prescription, WlyyPrescriptionExpressageDO sfexpress_obj, List<WlyyPrescriptionExpressageLogDO> sfexpresslogList) throws Exception {
//        String xml = SFUtils.getRoutInfos(sfexpress_obj,sf_code);
//        String re = this.SFExpressPost(xml);
//        //xml验证
//        verificationResponXml(re,"查询顺丰快递路由信息失败!");
//        Document doc = DocumentHelper.parseText(re);
//        String headvalue = doc.selectSingleNode("/Response/Head").getText();
//        if(StringUtils.isNotBlank(headvalue) && "OK".equals(headvalue)) {
//            Element root = doc.getRootElement();
//            if (root.element("Body") != null)     //取报文根节点
//            {
//                root = root.element("Body");
//            }
//            List<?> child = root.elements();
//            String mailno = "";
//            Map<String,List<WlyyPrescriptionExpressageLogDO>> wayroutlsit = new HashMap<>();
//            for (Object o : child) {
//                Element e = (Element) o;
//                mailno = e.attributeValue("mailno");
//                //判断快递单号不为空,且和我们本地的一致
//                if(StringUtils.isNotBlank(mailno) &&
//                        sfexpress_obj.getMailno().equals(mailno)){
//
//                    //解析报文,结合本地数据返回最终的日志结果
//                    return this.xmltologlist(e,sfexpresslogList,sfexpress_obj);
//                }else{
//                    continue;
//                }
//            }
//        }
//        return null;
//    }
//
//    private List<WlyyPrescriptionExpressageLogDO> xmltologlist(Element e, List<WlyyPrescriptionExpressageLogDO> sfexpresslogList, WlyyPrescriptionExpressageDO sfexpress_obj)throws Exception{
//
//        //获取本地所有路由信息的时间集
//        Set<String> routAcceptTimeSet = new HashSet<>();
//        for (WlyyPrescriptionExpressageLogDO log: sfexpresslogList) {
//            routAcceptTimeSet.add(DateUtil.dateToStrLong(log.getAcceptTime()));
//        }
//
//        List<?> child = e.elements();
//
//        List<WlyyPrescriptionExpressageLogDO> newroutinfolist = new ArrayList<>();
//
//        //用于判断新节点是否包含了"已收件"的节点
//        boolean isContainEndRoutInfo = false;
//
//        for (Object o : child) {
//            Element routinfoe = (Element) o;
//            String accept_time = routinfoe.attributeValue("accept_time");
//            String accept_address = routinfoe.attributeValue("accept_address");
//            String accept_remark = routinfoe.attributeValue("remark");
//            String opcode = routinfoe.attributeValue("opcode");
//
//            //和时间集作比对,过滤已存在的
//            if(!routAcceptTimeSet.contains(accept_time)){
//                WlyyPrescriptionExpressageLogDO newlogobj = new WlyyPrescriptionExpressageLogDO();
//                newlogobj.setAcceptTime(DateUtil.strToDate(accept_time));
//                newlogobj.setAcceptAddress(accept_address);
//                newlogobj.setAcceptRemark(accept_remark);
//                newlogobj.setOpCode(opcode);
//                newlogobj.setId(UUID.randomUUID().toString().replace("-",""));
//                newlogobj.setOutpatientId(sfexpress_obj.getOutpatientId());
//                newlogobj.setExpressageId(sfexpress_obj.getId());
//                newlogobj.setCreateTime(new Date());
//                newroutinfolist.add(newlogobj);
//                sfexpresslogList.add(newlogobj);
//                //aopcode=80,为已签收
//                if("80".equals(opcode)){
//                    isContainEndRoutInfo = true;
//                }
//            }
//        }
//
//
//        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
//        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
//        TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
//        try {
//
//            //如果有新增的路由信息,则添加到数据库
//            if(!newroutinfolist.isEmpty()){
//                prescriptionExpressageLogDao.save(newroutinfolist);
//            }
//
//            //如果路由信息节点包含了"已收件"节点,这修改处方派送状态为完成,增加物流派送日志为完成
//            if(isContainEndRoutInfo){
//                //修改处方状态为完成
//                prescriptionDao.updateStatus(sfexpress_obj.getId(), 100,new Date());
//
//                //保存门诊处方配送成功的日志
//                WlyyOutpatientExpressageLogDO outpatiExpressLog = new WlyyOutpatientExpressageLogDO();
//                outpatiExpressLog.setOutpatientId(sfexpress_obj.getOutpatientId());
//                outpatiExpressLog.setId(UUID.randomUUID().toString());
//                outpatiExpressLog.setType(8);
//                outpatiExpressLog.setCreateTime(new Date());
//                outpatiExpressLog.setFlag(1);
//                outpatiExpressLog.setStatus(100);
//                outpatientExpressageLogDao.save(outpatiExpressLog);
//            }
//
//            //事务提交
//            transactionManager.commit(status);
//        } catch (Exception ex) {
//            //报错事务回滚
//            transactionManager.rollback(status);
//        }
//
//
//        return sfexpresslogList;
//    }
//
//    /**
//     * 解析顺丰推送过来的路由信息,和本地数据匹配并进行增量更新)
//     * @param xml
//     * @return
//     * @throws Exception
//     */
//    public void SFRoutePushService(String xml) throws Exception{
//        Document doc = DocumentHelper.parseText(xml);
//        Element root = doc.getRootElement();
//        if (root.element("Body") != null)     //包含WaybillRoute节点
//        {
//            root = root.element("Body");
//        }
//        List<?> child = root.elements();
//
//        Map<String,List<WlyyPrescriptionExpressageLogDO>> wayroutlsit = new HashMap<>();
//        for (Object o : child) {
//            Element routinfoe = (Element) o;
//            WlyyPrescriptionExpressageLogDO sflog = new WlyyPrescriptionExpressageLogDO();
//            String accept_time = routinfoe.attributeValue("accepttime");
//            String accept_address = routinfoe.attributeValue("acceptaddress");
//            String accept_remark = routinfoe.attributeValue("remark");
//            String opcode = routinfoe.attributeValue("opcode");
//            String mailno = routinfoe.attributeValue("mailno");
//            String orderid = routinfoe.attributeValue("orderid");
//
//            sflog.setAcceptTime(DateUtil.strToDate(accept_time));
//            sflog.setAcceptAddress(accept_address);
//            sflog.setAcceptRemark(accept_remark);
//            sflog.setOpCode(opcode);
//            sflog.setExpressageId(orderid);
//            sflog.setId(UUID.randomUUID().toString());
//            sflog.setCreateTime(new Date());
//            if(wayroutlsit.keySet().contains(mailno)){
//                wayroutlsit.get(mailno).add(sflog);
//            }else{
//                List<WlyyPrescriptionExpressageLogDO> newsflogs = new ArrayList<>();
//                newsflogs.add(sflog);
//                wayroutlsit.put(mailno,newsflogs);
//            }
//        }
//
//        if(!wayroutlsit.keySet().isEmpty()){
//            for (String mailno:wayroutlsit.keySet()) {
//                List<WlyyPrescriptionExpressageLogDO> pushSFLogs = wayroutlsit.get(mailno);
//                //同一个快递单号的执行一个事务操作
//                this.saveSFPushRoutInfos(mailno,pushSFLogs);
//            }
//        }
//    }
//
//    /**
//     * 同一个快递单号的执行一个事务操作
//     * @param mailno
//     * @param pushSFLogs
//     */
//    public void saveSFPushRoutInfos(String mailno,List<WlyyPrescriptionExpressageLogDO> pushSFLogs){
//
//        //根据快递单号获取处方配送详细信息
//        WlyyPrescriptionExpressageDO sfexpress = prescriptionExpressageDao.findByPrescriptionExpressMailno(mailno);
//        //根据快递单号获取本地的路由信息
//        List<WlyyPrescriptionExpressageLogDO> localroutinfos = prescriptionExpressageLogDao.queryByOutpatientId(sfexpress.getOutpatientId());
//        //需要增量更新到本地的路由信息集合
//        List<WlyyPrescriptionExpressageLogDO> newroutinfolist = new ArrayList<>();
//
//        DefaultTransactionDefinition def = new DefaultTransactionDefinition();
//        def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事务隔离级别,开启新事务
//        TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
//        try {
//
//            //用于判断新节点是否包含了"已收件"的节点
//            boolean isContainEndRoutInfo = false;
//
//            //获取本地所有路由信息的时间集
//            Set<String> routAcceptTimeSet = new HashSet<>();
//            for (WlyyPrescriptionExpressageLogDO log: localroutinfos) {
//                routAcceptTimeSet.add(DateUtil.dateToStrLong(log.getAcceptTime()));
//            }
//
//            for (WlyyPrescriptionExpressageLogDO pushlog: pushSFLogs) {
//
//                //判断是否有已收件的路由节点
//                if("80".equals(pushlog.getOpCode())){
//                    isContainEndRoutInfo = true;
//                }
//
//                if(routAcceptTimeSet.contains(DateUtil.dateToStrLong(pushlog.getAcceptTime()))){
//                    continue;
//                }else{
//                    pushlog.setOutpatientId(sfexpress.getOutpatientId());
//                    newroutinfolist.add(pushlog);
//                }
//            }
//
//            //如果有新增的路由信息,则添加到数据库
//            if(!newroutinfolist.isEmpty()){
//                prescriptionExpressageLogDao.save(newroutinfolist);
//            }
//
//            //如果路由信息节点包含了"已收件"节点,则修改处方状态为完成,增加物流派送日志为完成
//            if(isContainEndRoutInfo){
//                //修改处方状态为完成
//                prescriptionDao.updateStatus(sfexpress.getOutpatientId(), 100,new Date());
//
//                //保存配送成功的日志
//                WlyyOutpatientExpressageLogDO outpatiExpressLog = new WlyyOutpatientExpressageLogDO();
//                outpatiExpressLog.setOutpatientId(sfexpress.getOutpatientId());
//                outpatiExpressLog.setId(UUID.randomUUID().toString());
//                outpatiExpressLog.setType(8);
//                outpatiExpressLog.setCreateTime(new Date());
//                outpatiExpressLog.setFlag(1);
//                outpatiExpressLog.setStatus(100);
//                outpatientExpressageLogDao.save(outpatiExpressLog);
//            }
//            //事务提交
//            transactionManager.commit(status);
//        } catch (Exception ex) {
//            //报错事务回滚
//            transactionManager.rollback(status);
//        }
//
//
//    }
//
//    /**
//     * 根据收寄地址获取快递费用
//     * @param d_province 省份名称
//     * @param d_city     城市名称
//     * @return
//     */
//    public WlyyExpressagePriceDO getSFExpressPrice(String d_province, String d_city) throws Exception{
//        String end_address_name = "";
//
//        if("厦门市".equals(d_city)){
//            end_address_name = "同城";
//        }else{
//            if("福建省".equals(d_province)){
//                end_address_name = "省内";
//            }else{
//                end_address_name = d_province;
//            }
//        }
//        end_address_name = "%"+end_address_name.replaceAll("省","").replaceAll("市","")+"%";
//        WlyyExpressagePriceDO sfprice =  expressagePriceDao.getExprePriceByIdAndEndAdressName("shunfeng",end_address_name);
//        return sfprice;
//    }
//
//    /**
//     * 根据处方快递订单号判断是否下单成功
//     * 如果下单成功,保存处方物流记录,保存配送日志
//     * @param sfexpress_obj
//     * @return
//     * @throws Exception
//     */
//    public boolean sfOrderSearchService(WlyyPrescriptionExpressageDO sfexpress_obj)  throws Exception{
//
//        boolean go_on = false;
//
//        String xml = SFUtils.sfOrderSearchService(sfexpress_obj.getId(),sf_code);
//        String re = this.SFExpressPost(xml);
//
//        try {
//            //xml验证
//            verificationResponXml(re,"订单处理失败!");
//
//            Document doc = DocumentHelper.parseText(re);
//            String headvalue = doc.selectSingleNode("/Response/Head").getText();
//            if(StringUtils.isNotBlank(headvalue) && "OK".equals(headvalue)) {
//                //是否能派送:1:人工确认;2:可收派;3:不可以收派
//                String filter_result = "";
//                String orderid = "";//业务订单号
//                String mailno = "";//顺丰运单号
//                String destCode = "";//目的地区域代码
//
//                //错误代对应的文字
//                Document redoc = doc.selectSingleNode("/Response/Body/Orderresponse").getDocument();
//                Element root = redoc.getRootElement();
//                List<?> child = root.elements();
//                for (Object o : child) {
//                    Element e = (Element) o;
//                    filter_result = e.attributeValue("filter_result");
//                    orderid = e.attributeValue("orderid");
//                    mailno = e.attributeValue("mailno");
//                    destCode = e.attributeValue("destCode");
//                }
//
//                if(StringUtils.isBlank(mailno)){
//                    logger.info("顺丰快递下订单失败:未获取到快递单号!"+sfexpress_obj.getOutpatientId());
//                    return true;
//                }
//
//                if(StringUtils.isNotBlank(filter_result) && "3".equals(filter_result)){
//                    logger.info("顺丰快递下订单失败:派送地址不可派送,处方编号:"+sfexpress_obj.getOutpatientId());
//                    return true;
//                }
//
//                sfexpress_obj.setMailno(mailno);
//                sfexpress_obj.setCityCode(destCode);
//            }
//
//            //如果成功获取到快递单号,则保存处方物流记录,保存配送日志
//            //修改处方状态为配送中
//            prescriptionDao.updateStatus(sfexpress_obj.getOutpatientId(),65);
//
//            //保存处方物流记录
//            prescriptionExpressageDao.save(sfexpress_obj);
//
//            //保存配送日志
//            WlyyOutpatientExpressageLogDO outpatiExpressLog = new WlyyOutpatientExpressageLogDO();
//            outpatiExpressLog.setOutpatientId(sfexpress_obj.getOutpatientId());
//            outpatiExpressLog.setId(UUID.randomUUID().toString());
//            outpatiExpressLog.setType(8);
//            outpatiExpressLog.setCreateTime(new Date());
//            outpatiExpressLog.setFlag(1);
//            outpatiExpressLog.setStatus(100);
//            outpatientExpressageLogDao.save(outpatiExpressLog);
//
//
//        }catch (Exception ex){
//            logger.info("顺丰快递下订单失败:派送地址不可派送,处方编号:"+sfexpress_obj.getOutpatientId());
//            //如果订单处理失败,则可以继续下单
//            go_on = true;
//        }
//
//        return go_on;
//
//    }
//
//    public boolean sfOrderSearchServiceJustSearch(WlyyPrescriptionExpressageDO sfexpress_obj)  throws Exception{
//
//        String xml = SFUtils.sfOrderSearchService(sfexpress_obj.getId(),sf_code);
//        String re = this.SFExpressPost(xml);
//
//        boolean reslut = false;
//
//        try {
//            //xml验证
//            verificationResponXml(re,"订单处理失败!");
//
//            Document doc = DocumentHelper.parseText(re);
//            String headvalue = doc.selectSingleNode("/Response/Head").getText();
//            if(StringUtils.isNotBlank(headvalue) && "OK".equals(headvalue)) {
//                Element root = doc.getRootElement();
//                if (root.element("Body") != null)     //包含OrderResponse节点
//                {
//                    root = root.element("Body");
//                }
//
//                //是否能派送:1:人工确认;2:可收派;3:不可以收派
//                String filter_result = "";
//                String orderid = "";//业务订单号
//                String mailno = "";//顺丰运单号
//                List<?> child = root.elements();
//                for (Object o : child) {
//                    Element e = (Element) o;
//                    filter_result = e.attributeValue("filter_result");
//                    orderid = e.attributeValue("orderid");
//                    mailno = e.attributeValue("mailno");
//                }
//                if(StringUtils.isNotBlank(filter_result) && "3".equals(filter_result)){
//                    logger.info("顺丰快递下订单失败:派送地址不可派送,处方编号:"+sfexpress_obj.getOutpatientId());
//                    throw new Exception("顺丰快递下订单失败:派送地址不可派送");
//                }
//
//                if(StringUtils.isBlank(mailno)){
//                    logger.info("顺丰快递下订单失败:未获取到快递单号!"+sfexpress_obj.getOutpatientId());
//                    throw new Exception("顺丰快递下订单失败:未获取到快递单号!");
//                }
//            }
//
//
//
//        }catch (Exception ex){
//            logger.info("顺丰快递下订单失败:派送地址不可派送,处方编号:"+sfexpress_obj.getOutpatientId());
//            //如果订单处理失败,则可以继续下单
//            throw new Exception(ex.getMessage());
//        }
//
//        return reslut;
//    }
//
//    public String getRoutInfosSearch(WlyyPrescriptionExpressageDO sfexpress_obj)throws Exception {
//        String xml = SFUtils.getRoutInfos(sfexpress_obj,sf_code);
//        String re = this.SFExpressPost(xml);
//
//        return xml;
//    }
//
//}

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

@ -1,5 +1,6 @@
package com.yihu.jw.hospital.prescription.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
@ -9,10 +10,7 @@ import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.consult.dao.DoctorClinicRoomConsultDao;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
@ -21,12 +19,16 @@ import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.mysql.query.BaseJpaService;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
@ -79,6 +81,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private PatientMappingService patientMappingService;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -97,6 +101,23 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return entranceService.BS30025(patNo,null,null,startTime,endTime,demoFlag);
    }
    /**
     * 查询单条门诊记录
     * @param patient
     * @param registerSn
     * @param admNo
     * @return
     */
    public WlyyOutpatientVO findOutpatientInfo(String patient,String registerSn,String admNo)throws Exception{
        String patNo =patientMappingService.findHisPatNoByPatient(patient);
        List<WlyyOutpatientVO> list = entranceService.BS30025(patNo,admNo,registerSn,null,null,demoFlag);
        if(list!=null&&list.size()>0){
            return list.get(0);
        }
        return null;
    }
    /**
     * 原处方记录列表
     * @param registerSn
@ -130,7 +151,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    /**
     *
     * 获取复诊记录列表
     * @param patient
     * @param status
     * @param page
@ -143,8 +164,10 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " FROM " +
                " wlyy_outpatient o " +
                " WHERE " +
                " o.patient = '"+patient+"'" +
                " o.status = "+status;
                " o.patient = '"+patient+"'";
        if(status!=null){
            totalSql +=  " AND o.status = "+status;
        }
        if(StringUtils.isNotBlank(startTime)){
            totalSql += " AND create_time >='"+startTime+" 00:00:00'";
        }
@ -162,6 +185,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.origin_adm_no AS originAdmNo, " +
                " o.register_no AS registerNo, " +
                " o.origin_register_no AS originRegisterNo, " +
                " o.hos" +
                " o.dept AS dept, " +
                " o.dept_name AS deptName, " +
                " o.patient AS patient, " +
@ -169,6 +193,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " o.doctor AS doctor, " +
                " o.doctor_name AS doctorName, " +
                " o.idcard AS idcard, " +
                " o.card_no AS cardNo," +
                " o.mjz AS mjz, " +
                " o.icd10 AS icd10, " +
                " o.icd10_name AS icd10Name, " +
@ -181,13 +206,15 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " FROM " +
                " wlyy_outpatient o " +
                " WHERE " +
                " o.patient = '"+patient+"'" +
                " o.status = "+status;
                " o.patient = '"+patient+"'";
        if(status!=null){
            sql +=  " AND o.status = "+status;
        }
        if(StringUtils.isNotBlank(startTime)){
            totalSql += " AND create_time >='"+startTime+" 00:00:00'";
            sql += " AND create_time >='"+startTime+" 00:00:00'";
        }
        if(StringUtils.isNotBlank(endTime)){
            totalSql += " AND create_time <='"+endTime+" 23:59:59'";
            sql += " AND create_time <='"+endTime+" 23:59:59'";
        }
        sql += " LIMIT " + (page - 1) * size + "," + size + "";
        List<WlyyOutpatientVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyOutpatientVO.class));
@ -195,6 +222,57 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
    /**
     * 获取单条复诊记录信息
     * @param outpatientId
     * @return
     */
    public com.alibaba.fastjson.JSONObject findReOutpatientInfo(String outpatientId){
        com.alibaba.fastjson.JSONObject rs = new com.alibaba.fastjson.JSONObject();
        //复诊信息
        WlyyOutpatientDO outpatientDO = outpatientDao.findOne(outpatientId);
        rs.put("outpatient",convertToModel(outpatientDO,WlyyOutpatientVO.class));
        //居民详情
        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
        rs.put("patientName",basePatientDO.getName());
        rs.put("patientId",basePatientDO.getId());
        rs.put("idCard",basePatientDO.getIdcard());
        rs.put("sex", basePatientDO.getSex());
        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),outpatientDO.getPatient(),"1");
        rs.put("ssc",cardDO);
        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
        //获取处方信息
        List<WlyyPrescriptionDO> prescriptionDOs = prescriptionDao.findByOutpatientId(outpatientId);
        List<WlyyPrescriptionVO> prescriptionVOs = new ArrayList<>();
        if(prescriptionDOs!=null&&prescriptionDOs.size()>0){
            convertToModels(prescriptionDOs,prescriptionVOs,WlyyPrescriptionVO.class);
            for(WlyyPrescriptionVO vo:prescriptionVOs){
                //疾病信息
                vo.setDiagnosisVOs(findDiagnosisById(vo.getId()));
                //药品信息
                List<WlyyPrescriptionInfoVO> infoVOs = new ArrayList<>();
                vo.setInfoVOs(convertToModels(prescriptionInfoDao.findByPrescriptionId(vo.getId()),infoVOs,WlyyPrescriptionInfoVO.class));
            }
        }
        rs.put("prescriptions",prescriptionVOs);
        //物流信息
        List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByOutpatientId(outpatientId);
        if(expressageDOs!=null&&expressageDOs.size()>0){
            rs.put("expressage",convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class));
        }else{
            rs.put("expressage",null);
        }
        return rs;
    }
    /**
     * 查询历史
     * @param patient
@ -329,14 +407,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        rs.put("ssc",cardDO);
        rs.put("age",IdCardUtil.getAgeForIdcard(basePatientDO.getIdcard()));
        //物流信息
        List<WlyyPrescriptionExpressageDO> expressageDOs = prescriptionExpressageDao.findByPrescriptionId(wlyyPrescriptionDO.getId());
        if(expressageDOs!=null&&expressageDOs.size()>0){
            rs.put("expressage",convertToModel(expressageDOs.get(0), WlyyPrescriptionExpressageVO.class));
        }else{
            rs.put("expressage",null);
        }
        //诊断信息
        rs.put("diagnosis",findDiagnosisById(wlyyPrescriptionDO.getId()));
@ -354,119 +424,118 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        return true;
    }
    /**
     * 预约
     * @param json
     * @return
     */
    public Boolean appointmentRevisit(JSONObject json)throws Exception{
        //1.创建支付
        //2.支付回调
        paymentCallback(json);
        return true;
    }
    /**
     *
     * @param json
     * 发起图文和视频复诊
     * @param outpatientJson
     * @param expressageJson
     * @return
     * @throws Exception
     */
    public String paymentCallback(JSONObject json)throws Exception{
        //创建续方
        createPrescription(json);
        //创建诊室
        createRoom(json);
        return null;
    }
    public Boolean createPrescription(JSONObject json) throws Exception{
    public Boolean appointmentRevisit(String outpatientJson,String expressageJson)throws Exception{
        String patient = json.getString("patient");
        String doctor = json.getString("doctor");
        //1.保存就诊实体
        String originRealOrder = json.getString("originRealOrder");
        String originAdmNo = json.getString("originAdmNo");
        String serialNo = json.getString("serialNo");
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson,WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        outpatientDO.setMjz("mz");
        outpatientDO.setStatus("0");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setCreateTime(new Date());
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),patient,"1");
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findOne(doctor);
        String patNo  = patientMappingService.findHisPatNoByIdCard(basePatientDO.getIdcard());
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        WlyyPrescriptionVO originPrescriptionVO = findOriginPrescription(serialNo,patNo,originAdmNo,originRealOrder,demoFlag);
        //2.物流信息
        WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson,WlyyPrescriptionExpressageDO.class);
        expressageDO.setDel(1);
        expressageDO.setCreateTime(new Date());
        prescriptionExpressageDao.save(expressageDO);
        WlyyPrescriptionDO prescription = new WlyyPrescriptionDO();
        prescription.setOriginAdmNo(originAdmNo);
        prescription.setOriginRealOrder(originRealOrder);
        prescription.setOriginSerialNo(serialNo);
        prescription.setStatus(0);
        prescription.setPatientCode(patient);
        prescription.setPatientName(basePatientDO.getName());
        prescription.setSsc(cardDO.getCode());
        prescription.setDoctor(doctor);
        prescription.setDoctorName(baseDoctorDO.getName());
        //3.创建候诊室
        createRoom(outpatient);
        List<WlyyPrescriptionInfoVO> originInfoVOs = originPrescriptionVO.getInfoVOs();
        List<WlyyPrescriptionInfoDO> infoDOs = new ArrayList<>();
        List<WlyyPrescriptionDiagnosisVO> diagnosisVOs = originPrescriptionVO.getDiagnosisVOs();
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = new ArrayList<>();
        prescriptionInfoDao.save(convertToModels(originInfoVOs,infoDOs,WlyyPrescriptionInfoDO.class));
        prescriptionDiagnosisDao.save(convertToModels(diagnosisVOs,diagnosisDOs,WlyyPrescriptionDiagnosisDO.class));
        prescriptionDao.save(prescription);
        return true;
    }
//    /**
//     *
//     * @param json
//     * @return
//     */
//    public String paymentCallback(JSONObject json)throws Exception{
//
//        //创建续方
//        createPrescription(json);
//        //创建诊室
//        createRoom(json);
//        return null;
//    }
//    public Boolean createPrescription(JSONObject json) throws Exception{
//
//        String patient = json.getString("patient");
//        String doctor = json.getString("doctor");
//
//        String originRealOrder = json.getString("originRealOrder");
//        String originAdmNo = json.getString("originAdmNo");
//        String serialNo = json.getString("serialNo");
//
//
//        BasePatientDO basePatientDO = basePatientDao.findById(patient);
//        PatientMedicareCardDO cardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel(PatientMedicareCardDO.Type.MedicareCard.getType(),patient,"1");
//        BaseDoctorDO baseDoctorDO = baseDoctorDao.findOne(doctor);
//        String patNo  = patientMappingService.findHisPatNoByIdCard(basePatientDO.getIdcard());
//
//        WlyyPrescriptionVO originPrescriptionVO = findOriginPrescription(serialNo,patNo,originAdmNo,originRealOrder,demoFlag);
//
//        WlyyPrescriptionDO prescription = new WlyyPrescriptionDO();
//        prescription.setOriginAdmNo(originAdmNo);
//        prescription.setOriginRealOrder(originRealOrder);
//        prescription.setOriginSerialNo(serialNo);
//        prescription.setStatus(0);
//        prescription.setPatientCode(patient);
//        prescription.setPatientName(basePatientDO.getName());
//        prescription.setSsc(cardDO.getCode());
//        prescription.setDoctor(doctor);
//        prescription.setDoctorName(baseDoctorDO.getName());
//
//        List<WlyyPrescriptionInfoVO> originInfoVOs = originPrescriptionVO.getInfoVOs();
//        List<WlyyPrescriptionInfoDO> infoDOs = new ArrayList<>();
//        List<WlyyPrescriptionDiagnosisVO> diagnosisVOs = originPrescriptionVO.getDiagnosisVOs();
//        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = new ArrayList<>();
//
//        prescriptionInfoDao.save(convertToModels(originInfoVOs,infoDOs,WlyyPrescriptionInfoDO.class));
//        prescriptionDiagnosisDao.save(convertToModels(diagnosisVOs,diagnosisDOs,WlyyPrescriptionDiagnosisDO.class));
//        prescriptionDao.save(prescription);
//        return true;
//    }
    public Boolean createRoom(JSONObject json){
        String patient = json.getString("patient");
        String doctor = json.getString("doctor");
        String dept = json.getString("dept");
        String hospital = json.getString("hospital");
        String reservationTime = json.getString("reservationTime");
        Integer consultType = json.getInt("consultType");
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findOne(doctor);
        List<WlyyDoctorClinicRoomDO> list = doctorClinicRoomConsultDao.findByDoctorAndStatus(doctor,1);
        if(list!=null&&list.size()>0){
            //已经有诊室不做操作
        }else{
            //未有诊室则新增
            WlyyDoctorClinicRoomDO room = new WlyyDoctorClinicRoomDO();
            room.setDoctor(doctor);
            room.setDoctorName(baseDoctorDO.getName());
            room.setClinicName(baseDoctorDO.getName());
            DictHospitalDeptDO deptDO = dictHospitalDeptDao.findByCode(dept);
            room.setDept(dept);
            room.setDept(deptDO.getName());
            BaseOrgDO baseOrgDO = baseOrgDao.findByCode(hospital);
            room.setDept(hospital);
            room.setDept(baseOrgDO.getName());
            room.setClinicStatus(-1);
            room.setDate(new Date());
            room.setStatus(1);
            doctorClinicRoomConsultDao.save(room);
        }
    /**
     * 创建候诊室
     * @param outpatientDO
     * @return
     */
    public Boolean createRoom(WlyyOutpatientDO outpatientDO){
        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO();
        waitingRoom.setConsultType(1);
        waitingRoom.setPatientId(patient);
        waitingRoom.setPatientName(basePatientDO.getName());
        waitingRoom.setReservationTime(DateUtil.strToDate(reservationTime));
        waitingRoom.setPatientId(outpatientDO.getPatient());
        waitingRoom.setPatientName(outpatientDO.getPatientName());
        waitingRoom.setReservationTime(outpatientDO.getAdmDate());
        waitingRoom.setVisitStatus(0);
        waitingRoom.setReservationType(1);
        waitingRoom.setSort(0);
        waitingRoom.setConsultType(consultType);
        waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType()));
        if(StringUtils.isNotBlank(outpatientDO.getDoctor())){
            waitingRoom.setDoctor(outpatientDO.getDoctor());
            waitingRoom.setDoctor(outpatientDO.getDoctorName());
        }
        waitingRoom.setOutpatientId(outpatientDO.getId());
        waitingRoom.setCreateTime(new Date());
        HospitalWaitingRoomDao.save(waitingRoom);
        return true;
@ -481,16 +550,98 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    /**
     *
     *@param admNo 门诊唯一号
     * @param realOrder 处方号
     *  @param status 处方状态 1审方失败,2审核完成,3结算完成
     * @return
     */
    public boolean updatePrescriptionByHisStatu(String admNo,String realOrder,String status)throws Exception{
        //TODO 状态需要再判断
        String sql="UPDATE base.wlyy_prescription p SET p.`status`='',p.pay_status='' WHERE p.adm_no='"+admNo+"' AND p.real_order='"+realOrder+"' ";
    public boolean updatePrescriptionByHisStatu(String admNo,String realOrder,String status)throws Exception {
        String sql = "";
        //status 处方流程状态 ,11 药师审核失败 / 调整中,12  药师审核完成,已完成:100 已完成
        //pay_status`:处方结算状态,0为未结算,1为结算成功,默认为0',
        if ("1".equals(status)) {
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='11' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
        } else if ("2".equals(status)) {
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='12' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
        } else if ("3".equals(status)) {
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='100',p.pay_status='1' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
        }
        jdbcTemplate.execute(sql);
        return true;
    }
    /**
     * 获取卡记录
     * @param patient
     * @return
     * @throws Exception
     */
    public JSONArray findPatientCard(String patient)throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        return entranceService.BS15018(patientDO.getIdcard(),null,demoFlag);
    }
    public JSONObject checkOutpatient(String patient){
        //-1卡余额不足,,-2 存在未结束的诊断热 1成功
        JSONObject rs = new JSONObject();
        //1.判断钱是否够
        //2.判断是否有未结束的
        List<WlyyOutpatientDO> list = outpatientDao.findByPatientList(patient);
        if(list!=null&&list.size()>0){
            rs.put("code",-2);
            rs.put("mes","存在未结束的诊断");
            return rs;
        }
        rs.put("code",1);
        rs.put("mes","验证通过");
        return rs;
    }
    /**
     * 获取所有医院列表
     * @return
     */
    public List<BaseOrgVO> findAllHospital(){
        List<BaseOrgDO> list = baseOrgDao.findByDel("1");
        List<BaseOrgVO> rs = new ArrayList<>();
        return convertToModels(list,rs,BaseOrgVO.class);
    }
    /**
     * 获取机构下部门信息
     * @param orgCode
     * @return
     */
    public List<DictHospitalDeptVO> findDeptByHospital(String orgCode){
        List<DictHospitalDeptDO> list =  dictHospitalDeptDao.findByOrgCodeIn(orgCode);
        List<DictHospitalDeptVO> rs = new ArrayList<>();
        return convertToModels(list,rs,DictHospitalDeptVO.class);
    }
    /**
     * 获取医生列表
     * @param orgCode
     * @param dept
     * @return
     */
    public List<Map<String,Object>> findDoctorByHospitalAndDept(String orgCode,String dept){
        String sql ="SELECT " +
                " d.id, " +
                " d.photo, " +
                " d.`name`, " +
                " h.doctor_duty_code, " +
                " h.doctor_duty_name " +
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " WHERE  " +
                " h.dept_code = '"+dept+"' " +
                " AND h.org_code = '"+orgCode+"'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
//    public JSONArray find
}

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

@ -0,0 +1,22 @@
package com.yihu.jw.hospital.prescription.service;
import com.yihu.jw.hospital.prescription.dao.WlyyExpressagePriceDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.hospital.prescription.WlyyExpressagePriceDO;
/**
 * 
 * 服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * Administrator    1.0  2019年06月05日 Created
 *
 * </pre>
 * @since 1.
 */
@Service
public class WlyyExpressagePriceService extends BaseJpaService<WlyyExpressagePriceDO, WlyyExpressagePriceDao> {
}

+ 278 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/util/SFUtils.java

@ -0,0 +1,278 @@
package com.yihu.jw.hospital.prescription.service.entrance.util;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionInfoDO;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import sun.misc.BASE64Encoder;
import java.io.FileInputStream;
import java.io.InputStream;
import java.security.MessageDigest;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
 * 顺丰速递接口相关的一些公用方法
 * @author huangwenjie 2017.8.2
 */
@Component
public class SFUtils {
    private static Logger logger = LoggerFactory.getLogger(SFUtils.class);
    @Autowired
    private PrescriptionService prescriptionService;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    /**
     * 生成接口校验码
     * 1.先把XML报文与checkword前后连接。
     * 2.把连接后的字符串做 MD5(16位) 编码。
     * 3.把MD5编码后的数据进行 Base64 编码,此时编码后的字符串即为校验码。
     * @param xml   xml报文
     * @param sf_check_word  接口check_word
     * @return
     */
    public String verifyCodeSFXmlStr(String xml,String sf_check_word){
        String verifyCode = xml+sf_check_word;
        verifyCode = md5EncryptAndBase64(verifyCode);
        return verifyCode;
    }
    /**
     * 查询派送地址是否属于顺丰的派送范围
     * @param d_address     派送地址
     * @param sf_code       顺丰接口接入码
     * @param orderid       订单ID
     * @param j_tel         寄方电话
     * @param j_address     寄方地址
     * @param d_tel         收方电话
     * @return
     */
    public String getSFOrderFilterXml(String d_address,String sf_code,String orderid,String j_tel,String j_address,String d_tel){
        //head 传入接口接入码
        StringBuilder xml = new StringBuilder("<Request service='OrderFilterService' lang='zh-cn'><Head>"+sf_code+"</Head><Body>");
        xml.append("<OrderFilter filter_type='1' ");
        //订单号
        if(StringUtils.isNotBlank(orderid)){
            xml.append("orderid='"+orderid+"' ");
        }
        //派送地址,必填
        xml.append("d_address='"+d_address+"'/>");
        //如果扩张字段有不为空的,则增加扩张字段参数
        if(StringUtils.isNotBlank(j_tel) ||
                StringUtils.isNotBlank(j_address)||
                    StringUtils.isNotBlank(d_tel)){
            xml.append("<OrderFilterOption ");
            //寄方电话
            if(StringUtils.isNotBlank(j_tel)){
                xml.append("j_tel='"+j_tel+"' ");
            }
            //寄方地址
            if(StringUtils.isNotBlank(j_address)){
                xml.append("j_address='"+j_address+"' ");
            }
            //收方电话
            if(StringUtils.isNotBlank(d_tel)){
                xml.append("d_tel='"+d_tel+"' ");
            }
            xml.append("/></OrderFilter>");
        }
        xml.append("</Body></Request>");
        return xml.toString();
    }
    /**
     * 向顺丰快递下订单
     * @param sfexpress_obj
     * @param hospital
     * @return
     */
    public String postSFOrderService(WlyyPrescriptionExpressageDO sfexpress_obj, BaseOrgDO hospital, String sf_code) {
        //head 传入接口接入码
        StringBuilder xml = new StringBuilder("<Request service='OrderService' lang='zh-cn'><Head>"+sf_code+"</Head><Body>");
        xml.append("<Order ");
        //订单号(快递业务号作为订单号"SF开头的为顺丰快递")
        xml.append("orderid='"+sfexpress_obj.getId()+"' ");
        /**
         * --------寄方参数------
         */
        //寄件方公司名称
        if(StringUtils.isNotBlank(hospital.getName())){
            xml.append("j_company='"+hospital.getName()+"' ");
        }
        //寄方联系人
        if(StringUtils.isNotBlank(hospital.getName())){
            xml.append("j_contact='"+hospital.getName()+"' ");
        }
        //寄件方联系电话
        if(StringUtils.isNotBlank(hospital.getMobile())){
            xml.append("j_tel='"+hospital.getMobile()+"' ");
            xml.append("j_mobile='"+hospital.getMobile()+"' ");
        }
        //寄方所在省份
        if(StringUtils.isNotBlank(hospital.getProvinceName())){
            xml.append("j_province='"+hospital.getProvinceName()+"' ");
        }
        //寄方所在城市
        if(StringUtils.isNotBlank(hospital.getCityName())){
            xml.append("j_city='"+hospital.getCityName()+"' ");
        }
        //寄方所在县/区
        if(StringUtils.isNotBlank(hospital.getTownName())){
            xml.append("j_county='"+hospital.getTownName()+"' ");
        }
        //寄件方详细地址,包括省市县/区
        if(StringUtils.isNotBlank(hospital.getAddress())){
            xml.append("j_address='"+hospital.getAddress()+"' ");
        }
        /**
         * --------收方参数------
         */
        //派送地址,必填
        xml.append("d_address='"+sfexpress_obj.getAddress()+"' ");
        //到件方单位名称,因为接口不能为空,这里默认放到件方联系人
        xml.append("d_company='"+sfexpress_obj.getName()+"' ");
        //到件方联系人
        xml.append("d_contact='"+sfexpress_obj.getName()+"' ");
        //到件方联系电话
        xml.append("d_tel='"+sfexpress_obj.getPhone()+"' ");
        //到件方手机
        if(StringUtils.isNotBlank(sfexpress_obj.getMobile())){
            xml.append("d_mobile='"+sfexpress_obj.getMobile()+"' ");
        }
        xml.append("d_province='"+sfexpress_obj.getProvinceName()+"' ");
        xml.append("d_city='"+sfexpress_obj.getCityName()+"' ");
        xml.append("d_county='"+sfexpress_obj.getTownName()+"' ");
        //是否要求通过是否手持终端;通知顺丰收派员收件:1:要求,其它为不要求
        xml.append("is_docall='1' ");
        //快件产品类别:11,医药常温,1:顺丰标快
        //付款方式:1:寄方付,2:收方付 3:第三方付
        xml.append("express_type='1' pay_method='2' >");
//        xml.append("express_type='11' pay_method='1' custid='9999999999'>");
        //根据快递物流获取门诊信息,根据门诊信息获取处方订单的药品详情
        List<WlyyPrescriptionDO> prescriptionDOList = prescriptionService.findByField("outpatientId",sfexpress_obj.getOutpatientId());
        if(CollectionUtils.isEmpty(prescriptionDOList)){
        }
        Set<String> prescriptionIdSet = new HashSet<>();
        prescriptionDOList.forEach(
               onePrescription -> {
                   prescriptionIdSet.add(onePrescription.getId());
                }
        );
        List<WlyyPrescriptionInfoDO> prescriptionInfolist = prescriptionInfoDao.queryAllByPrescriptionIdInAndDel(prescriptionIdSet,1);
        if(!prescriptionInfolist.isEmpty()){
            for (int i = 0; i < prescriptionInfolist.size(); i++) {
                xml.append("<Cargo name='"+prescriptionInfolist.get(i).getDrugName()+"' count='"+prescriptionInfolist.get(i).getQuantity()+"'></Cargo>");
            }
        }
        xml.append("</Order></Request>");
        return xml.toString();
    }
    /**
     * 顺丰路由查询
     * @param sfexpress_obj
     * @param sf_code
     * @return
     */
    public String getRoutInfos(WlyyPrescriptionExpressageDO sfexpress_obj, String sf_code) {
        //head 传入接口接入码
        StringBuilder xml = new StringBuilder("<Request service='RouteService' lang='zh-cn'><Head>"+sf_code+"</Head><Body>");
        xml.append("<RouteRequest tracking_type='1' method_type='1' ").append("tracking_number='"+sfexpress_obj.getMailno()+"' />");
        xml.append("</Body></Request>");
        return xml.toString();
    }
    /**
     * 订单结果查询接口
     * @param sfexpress_objCode
     * @param sf_code
     * @return
     */
    public String sfOrderSearchService(String sfexpress_objCode, String sf_code) {
        StringBuilder xml = new StringBuilder("<Request service='OrderSearchService' lang='zh-cn'><Head>"+sf_code+"</Head><Body>");
        xml.append("<OrderSearch orderid='"+sfexpress_objCode+"'/>");
        xml.append("</Body></Request>");
        return xml.toString();
    }
    //-----------顺丰快递验证码加密的相关方法------------------START
    public static String loadFile(String fileName) {
        InputStream fis;
        try {
            fis = new FileInputStream(fileName);
            byte[] bs = new byte[fis.available()];
            fis.read(bs);
            String res = new String(bs);
            fis.close();
            return res;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    public static String md5EncryptAndBase64(String str) {
        return encodeBase64(md5Encrypt(str));
    }
    private static byte[] md5Encrypt(String encryptStr) {
        try {
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            md5.update(encryptStr.getBytes("utf8"));
            return md5.digest();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    private static String encodeBase64(byte[] b) {
        BASE64Encoder base64Encode = new BASE64Encoder();
        String str = base64Encode.encode(b);
        return str;
    }
    public static void main(String[] args) {
        String xml = "<Request service='OrderSearchService' lang='zh-cn'><Head>SDDF</Head><Body><OrderSearch orderid='6daa6baec5fd4b65a1b023a8b60e2e76'/></Body></Request>";
        String check_word = "ttzlgGyOQu4L";
        System.out.println(md5EncryptAndBase64(xml + check_word));
//        System.out.println(md5EncryptAndBase64("abc"));
//        System.out.println(md5EncryptAndBase64("中"));
    }
    //-----------顺丰快递验证码加密的相关方法------------------END
}

+ 2 - 2
common/common-entity/src/main/java/com/yihu/jw/entity/base/dict/DictHospitalDeptDO.java

@ -2,6 +2,8 @@ package com.yihu.jw.entity.base.dict;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.IntegerIdentityEntity;
import org.springframework.beans.factory.annotation.Autowired;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@ -72,6 +74,4 @@ public class DictHospitalDeptDO extends IntegerIdentityEntity {
        this.createTime = createTime;
    }
}

+ 30 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/org/BaseOrgDO.java

@ -105,6 +105,12 @@ public class BaseOrgDO extends UuidIdentityEntityWithOperator {
	 */
	private String photo;
   /**
	 * 机构联系电话
	 */
	private String mobile;
    /**
	 * 经度
	 */
@ -152,6 +158,11 @@ public class BaseOrgDO extends UuidIdentityEntityWithOperator {
     */
    private Integer level;
    /**
     * 机构分部号,每个机构都不一样,例如中山医院:6总部7金榜8夏禾
     */
    private String winNo;
    public BaseOrgDO() {
    }
@ -303,7 +314,16 @@ public class BaseOrgDO extends UuidIdentityEntityWithOperator {
        this.photo = photo;
    }
	@Column(name = "longitude")
    @Column(name = "mobile")
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    @Column(name = "longitude")
    public String getLongitude() {
        return longitude;
    }
@ -375,4 +395,13 @@ public class BaseOrgDO extends UuidIdentityEntityWithOperator {
    public void setLevel(Integer level) {
        this.level = level;
    }
    @Column(name = "win_no")
    public String getWinNo() {
        return winNo;
    }
    public void setWinNo(String winNo) {
        this.winNo = winNo;
    }
}

+ 99 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/consult/WlyyHospitalWaitingRoomDO.java

@ -39,6 +39,36 @@ public class WlyyHospitalWaitingRoomDO extends UuidIdentityEntity {
	 */
	private String patientName;
    /**
     * 医院code
     */
    private String hospital;
    /**
     * 医院名称
     */
    private String hospitalName;
    /**
     * 部门
     */
    private String dept;
    /**
     * 部门名称
     */
    private String deptName;
    /**
     * 医生
     */
    private String doctor;
    /**
     * 医生名称
     */
    private String doctorName;
    /**
	 * 0离线 1在线(候诊) 2已诊
	 */
@ -70,6 +100,12 @@ public class WlyyHospitalWaitingRoomDO extends UuidIdentityEntity {
	 */
	private String outpatientId;
    /**
     *  创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date createTime;
	@Column(name = "saas_id")
    public String getSaasId() {
@ -151,4 +187,67 @@ public class WlyyHospitalWaitingRoomDO extends UuidIdentityEntity {
	public void setOutpatientId(String outpatientId) {
		this.outpatientId = outpatientId;
	}
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "dept")
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    @Column(name = "dept_name")
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 100 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyExpressagePriceDO.java

@ -0,0 +1,100 @@
package com.yihu.jw.entity.hospital.prescription;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* 实体
*
* @author Administrator on  2019年06月05日
*
*/
@Entity
@Table(name = "wlyy_expressage_price")
public class WlyyExpressagePriceDO extends UuidIdentityEntityWithOperator {
    /**
	 * 起始地址名称
	 */
	private String startAddressName;
    /**
	 * 结束地址名称
	 */
	private String endAddressName;
    /**
	 * 首重
	 */
	private Integer firstWeight;
    /**
	 * 首重价格
	 */
	private Integer firstWeightPrice;
    /**
	 * 续重
	 */
	private Integer continueWeight;
    /**
	 * 续重价格
	 */
	private Integer continueWeightPrice;
	@Column(name = "start_address_name")
    public String getStartAddressName() {
        return startAddressName;
    }
    public void setStartAddressName(String startAddressName) {
        this.startAddressName = startAddressName;
    }
	@Column(name = "end_address_name")
    public String getEndAddressName() {
        return endAddressName;
    }
    public void setEndAddressName(String endAddressName) {
        this.endAddressName = endAddressName;
    }
	@Column(name = "first_weight")
    public Integer getFirstWeight() {
        return firstWeight;
    }
    public void setFirstWeight(Integer firstWeight) {
        this.firstWeight = firstWeight;
    }
	@Column(name = "first_weight_price")
    public Integer getFirstWeightPrice() {
        return firstWeightPrice;
    }
    public void setFirstWeightPrice(Integer firstWeightPrice) {
        this.firstWeightPrice = firstWeightPrice;
    }
	@Column(name = "continue_weight")
    public Integer getContinueWeight() {
        return continueWeight;
    }
    public void setContinueWeight(Integer continueWeight) {
        this.continueWeight = continueWeight;
    }
	@Column(name = "continue_weight_price")
    public Integer getContinueWeightPrice() {
        return continueWeightPrice;
    }
    public void setContinueWeightPrice(Integer continueWeightPrice) {
        this.continueWeightPrice = continueWeightPrice;
    }
}

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

@ -39,6 +39,26 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
	 */
	private String originRegisterNo;
    /**
     * 1.图文 2.视频
     */
    private String type;
    /**
     * 医院编码
     */
    private String hospital;
    /**
     * 医院名称
     */
    private String hospitalName;
    /**
     * 机构分部编码
     */
    private String winNo;
    /**
	 * 部门
	 */
@ -74,6 +94,11 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
	 */
	private String idcard;
    /**
     * 就诊卡
     */
    private String cardNo;
    /**
	 * 门急诊标记(MZ门诊,JZ急诊)
	 */
@ -153,7 +178,34 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
        this.originRegisterNo = originRegisterNo;
    }
	@Column(name = "dept")
    @Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "dept")
    public String getDept() {
        return dept;
    }
@ -283,4 +335,22 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setDiseaseImg(String diseaseImg) {
        this.diseaseImg = diseaseImg;
    }
    @Column(name="card_no")
    public String getCardNo() {
        return cardNo;
    }
    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }
    @Column(name="win_no")
    public String getWinNo() {
        return winNo;
    }
    public void setWinNo(String winNo) {
        this.winNo = winNo;
    }
}

+ 181 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientExpressageLogDO.java

@ -0,0 +1,181 @@
package com.yihu.jw.entity.hospital.prescription;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* 门诊物流日志表实体
*
* @author Administrator on  2019年06月05日
*
*/
@Entity
@Table(name = "wlyy_outpatient_expressage_log")
public class WlyyOutpatientExpressageLogDO extends UuidIdentityEntityWithOperator {
    /**
	 * 
	 */
	private String saasId;
    /**
	 * 门诊id 关联表wlyy_outpatient id
	 */
	private String outpatientId;
    /**
	 * 创建时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date createTime;
    /**
	 * 类型: -1 失效 1HIS对接 2易联众对接  3创建处方 4 审核  5付款 6 配送 7完成 8物流对接
	 */
	private Integer type;
    /**
	 * (-2 患者自己取消 -1 审核不通过 , 0 审核中, 10 审核通过/待支付 ,21支付失败  20 配药中/支付成功, 21 等待领药 ,30 配送中 ,100配送成功/已完成)
	 */
	private Integer status;
    /**
	 * 医生或者患者code
	 */
	private String userCode;
    /**
	 * 医生或者患者name
	 */
	private String userName;
    /**
	 * 1 患者 2医生
	 */
	private Integer userType;
    /**
	 * 医院id
	 */
	private String hospital;
    /**
	 * 医院名称
	 */
	private String hospitalName;
    /**
	 * 操作是否成功 1成功 0失败
	 */
	private Integer flag;
    /**
	 * 备注信息
	 */
	private String remark;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
	@Column(name = "outpatient_id")
    public String getOutpatientId() {
        return outpatientId;
    }
    public void setOutpatientId(String outpatientId) {
        this.outpatientId = outpatientId;
    }
	@Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
	@Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
	@Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
	@Column(name = "user_code")
    public String getUserCode() {
        return userCode;
    }
    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }
	@Column(name = "user_name")
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
	@Column(name = "user_type")
    public Integer getUserType() {
        return userType;
    }
    public void setUserType(Integer userType) {
        this.userType = userType;
    }
	@Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
	@Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
	@Column(name = "flag")
    public Integer getFlag() {
        return flag;
    }
    public void setFlag(Integer flag) {
        this.flag = flag;
    }
	@Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 9 - 20
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionExpressageDO.java

@ -19,15 +19,12 @@ import java.util.Date;
@Table(name = "wlyy_prescription_expressage")
public class WlyyPrescriptionExpressageDO extends UuidIdentityEntity {
    /**
	 * 
	 */
	private String saasId;
    /**
	 * 关联wlyy_wlyy_prescription id
	 * 门诊记录ID
	 * 关联wlyy_outpatient id
	 */
	private String prescriptionId;
	private String outpatientId;
    /**
	 * 快递单号
@ -142,24 +139,16 @@ public class WlyyPrescriptionExpressageDO extends UuidIdentityEntity {
	private Integer del;
	@Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    @Column(name = "outpatient_id")
    public String getOutpatientId() {
        return outpatientId;
    }
	@Column(name = "prescription_id")
    public String getPrescriptionId() {
        return prescriptionId;
    }
    public void setPrescriptionId(String prescriptionId) {
        this.prescriptionId = prescriptionId;
    public void setOutpatientId(String outpatientId) {
        this.outpatientId = outpatientId;
    }
	@Column(name = "mailno")
    @Column(name = "mailno")
    public String getMailno() {
        return mailno;
    }

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

@ -25,9 +25,9 @@ public class WlyyPrescriptionExpressageLogDO extends UuidIdentityEntity {
	private String saasId;
    /**
	 * 关联表wlyy_prescription id
	 * 关联表wlyy_ouapatient id
	 */
	private String prescriptionId;
	private String outpatientId;
    /**
	 * 关联wlyy_prescription_expressage id
@ -141,12 +141,14 @@ public class WlyyPrescriptionExpressageLogDO extends UuidIdentityEntity {
        this.saasId = saasId;
    }
	@Column(name = "prescription_id")
    public String getPrescriptionId() {
        return prescriptionId;
    @Column(name = "outpatient_id")
    public String getOutpatientId() {
        return outpatientId;
    }
    public void setPrescriptionId(String prescriptionId) {
        this.prescriptionId = prescriptionId;
    public void setOutpatientId(String outpatientId) {
        this.outpatientId = outpatientId;
    }
	@Column(name = "expressage_id")

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

@ -26,6 +26,7 @@ public class BaseHospitalRequestMapping {
        public static final String PREFIX  = "/prescription";
        //=====================start=======================================
        /**
         * 获取门诊记录
         */
@ -35,11 +36,48 @@ public class BaseHospitalRequestMapping {
         * 查询单条门诊记录接口
         */
        public static final String findOutpatientInfo ="/findOutpatientInfo";
        /**
         * 查询单条复诊信息全部接口
         */
        public static final String findReOutpatientInfo = "/findReOutpatientInfo";
        /**
         * 获取复诊记录类别
         */
        public static final String findReOutpatientList ="/findReOutpatientList";
        /**
         * 查询患者就诊卡
         */
        public static final String findPatientCard = "/findPatientCard";
        /**
         * 判断是否可用发起门诊
         */
        public static final String checkOutpatient ="/checkOutpatient";
        /**
         * 居民发起复诊
         */
        public static final String appointmentRevisit = "/appointmentRevisit";
        /**
         * 查询所有机构
         */
        public static final String findAllHospital ="/findAllHospital";
        /**
         * 查询机构底下部门
         */
        public static final String findDeptByHospital ="/findDeptByHospital";
        /**
         * 查询部门下医生
         */
        public static final String findDoctorByHospitalAndDept = "/findDoctorByHospitalAndDept";
        //=================end=======================================
        /**
         * 原处方记录
         */
@ -67,8 +105,6 @@ public class BaseHospitalRequestMapping {
         * 获取医生及号员信息
         */
        public static final String findDoctorList = "/findDoctorList";
        //支付+预约
        public static final String appointmentRevisit = "/appointmentRevisit";
        /**
         * 进入候诊室
@ -103,4 +139,13 @@ public class BaseHospitalRequestMapping {
        //医生下诊断
        public static final String diagnose ="/diagnose";
    }
    /**
     * 门诊处方物流
     */
    public static class Expressage extends Basic {
        public static final String PREFIX  = "/expressage";
    }
}

+ 9 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/dict/DictHospitalDeptVO.java

@ -47,6 +47,9 @@ public class DictHospitalDeptVO extends IntegerIdentityVO{
	@ApiModelProperty(value = "创建时间", example = "yyyy-MM-dd HH:mm:ss/该字段可不填")
    private Date createTime;
    @ApiModelProperty(value = "6总部7金榜8夏禾", example = "神经内科")
    private String deptTypeCode;
    public String getOrgCode() {
        return orgCode;
@ -76,5 +79,11 @@ public class DictHospitalDeptVO extends IntegerIdentityVO{
        this.createTime = createTime;
    }
    public String getDeptTypeCode() {
        return deptTypeCode;
    }
    public void setDeptTypeCode(String deptTypeCode) {
        this.deptTypeCode = deptTypeCode;
    }
}

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/org/BaseOrgVO.java

@ -151,6 +151,8 @@ public class BaseOrgVO extends UuidIdentityVOWithOperator {
     */
    @ApiModelProperty(value = "11一级甲等 12一级乙等 13一级丙等二级甲等 22二级乙等 23二级丙等31三级特等 32三级甲等 33三级乙等 34三级丙级", example = "1")
    private Integer level;
    @ApiModelProperty(value = "机构分部号,每个机构都不一样,例如中山医院:6总部7金榜8夏禾", example = "1")
    private String winNo;
    private List<DictHospitalDeptVO> depts;
@ -310,4 +312,12 @@ public class BaseOrgVO extends UuidIdentityVOWithOperator {
    public void setDepts(List<DictHospitalDeptVO> depts) {
        this.depts = depts;
    }
    public String getWinNo() {
        return winNo;
    }
    public void setWinNo(String winNo) {
        this.winNo = winNo;
    }
}

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

@ -47,6 +47,24 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
	@ApiModelProperty(value = "原始挂号流水号", example = "模块1")
    private String originRegisterNo;
    /**
     * 医院编码
     */
    @ApiModelProperty(value = "医院编码", example = "模块1")
    private String hospital;
    /**
     * 医院名称
     */
    @ApiModelProperty(value = "医院名称", example = "模块1")
    private String hospitalName;
    /**
     * 机构分部编码
     */
    @ApiModelProperty(value = "机构分部编码", example = "模块1")
    private String winNo;
    /**
	 * 部门
	 */
@ -89,6 +107,9 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
	@ApiModelProperty(value = "身份证号", example = "模块1")
    private String idcard;
    @ApiModelProperty(value = "就诊卡", example = "模块1")
    private String cardNo;
    /**
	 * 门急诊标记(MZ门诊,JZ急诊)
	 */
@ -136,6 +157,7 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @ApiModelProperty(value = "创建时间", example = "模块1")
    private Date createTime;
@ -174,6 +196,22 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
        this.originRegisterNo = originRegisterNo;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getDept() {
        return dept;
    }
@ -288,4 +326,20 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    public void setDiseaseImg(String diseaseImg) {
        this.diseaseImg = diseaseImg;
    }
    public String getCardNo() {
        return cardNo;
    }
    public void setCardNo(String cardNo) {
        this.cardNo = cardNo;
    }
    public String getWinNo() {
        return winNo;
    }
    public void setWinNo(String winNo) {
        this.winNo = winNo;
    }
}

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

@ -31,8 +31,8 @@ public class WlyyPrescriptionExpressageVO extends UuidIdentityVOWithOperator {
    /**
	 * 关联wlyy_wlyy_prescription id
	 */
	@ApiModelProperty(value = "关联wlyy_wlyy_prescription id", example = "模块1")
    private String prescriptionId;
	@ApiModelProperty(value = "关联门诊记录", example = "模块1")
    private String outpatientId;
    /**
	 * 快递单号
@ -305,11 +305,12 @@ public class WlyyPrescriptionExpressageVO extends UuidIdentityVOWithOperator {
        this.saasId = saasId;
    }
    public String getPrescriptionId() {
        return prescriptionId;
    public String getOutpatientId() {
        return outpatientId;
    }
    public void setPrescriptionId(String prescriptionId) {
        this.prescriptionId = prescriptionId;
    public void setOutpatientId(String outpatientId) {
        this.outpatientId = outpatientId;
    }
    public String getMailno() {

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

@ -85,6 +85,9 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "居民身份证号", example = "模块1")
    private String idcard;
    @ApiModelProperty(value = "居民就诊卡", example = "模块1")
    private String cardNo;
    /**
     * 社保卡号
     */
@ -298,6 +301,9 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "关联药品实体", example = "模块1")
    List<WlyyPrescriptionInfoVO> infoVOs;
    @ApiModelProperty(value = "关联物流实体", example = "模块1")
    WlyyPrescriptionExpressageVO expressage;
    public String getOutpatientId() {
        return outpatientId;
    }
@ -631,4 +637,12 @@ public class WlyyPrescriptionVO extends UuidIdentityVOWithOperator {
    public void setDiseaseImg(String diseaseImg) {
        this.diseaseImg = diseaseImg;
    }
    public WlyyPrescriptionExpressageVO getExpressage() {
        return expressage;
    }
    public void setExpressage(WlyyPrescriptionExpressageVO expressage) {
        this.expressage = expressage;
    }
}

+ 99 - 0
common/common-util/src/main/java/com/yihu/jw/util/http/HttpClientKit.java

@ -1,9 +1,23 @@
package com.yihu.jw.util.http;
import javafx.util.Pair;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -152,4 +166,89 @@ public class HttpClientKit {
        }
    }
    /**
     * 发送post请求
     *
     * @param url     请求地址
     * @param params  请求参数
     * @param chatSet 编码格式
     * @return
     */
    public  static String post(String url, List<NameValuePair> params, String chatSet) {
        // 创建默认的httpClient实例.
        CloseableHttpClient httpclient = HttpClients.createDefault();
        // 创建httppost
        HttpPost httppost = new HttpPost(url);
        UrlEncodedFormEntity uefEntity;
        try {
            uefEntity = new UrlEncodedFormEntity(params, chatSet);
            httppost.setEntity(uefEntity);
            CloseableHttpResponse response = httpclient.execute(httppost);
            try {
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    /**
     * 发送get请求
     *
     * @param url     请求地址
     * @param chatSet 编码格式
     * @return
     */
    public  String get(String url, String chatSet) {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            // 创建httpget.
            HttpGet httpget = new HttpGet(url);
            // 执行get请求.
            CloseableHttpResponse response = httpclient.execute(httpget);
            try {
                // 获取响应实体
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
}

+ 6 - 3
gateway/ag-basic/src/main/resources/application.yml

@ -55,14 +55,17 @@ zuul:
    svr-internet-hospital:
      path: /hospital/**
      serviceId: svr-internet-hospital
    svr-internet-hospital-entrance:
      path: /hospitalEntrance/**
      serviceId: svr-internet-hospital-entrance
---
spring:
  profiles: jwdev
  datasource:
    url: jdbc:mysql://172.19.103.77/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
    url: jdbc:mysql://172.26.0.114/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: jkzl
    password: jkzlehr
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.

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

@ -66,7 +66,7 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
        if (users == null || users.size() == 0) {
            throw new UsernameNotFoundException(username);
        }
        if (users.get(0).isLocked()) {
        if (null != users.get(0).isLocked() && users.get(0).isLocked()) {
            Date date = users.get(0).getLockedDate();
            if (new Date().after(DateUtils.addMinutes(date, autoUnlockTime))) {
                //解除锁定
@ -74,7 +74,9 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                users.get(0).setLocked(false);
            }
        }
        return new SaltUser(username, users.get(0).getPassword(), users.get(0).getSalt(), users.get(0).isEnabled(), users.get(0).isLocked(), getGrantedAuthorities(username));
        boolean isEnabled = null == users.get(0).isEnabled() ? false : users.get(0).isEnabled();
        boolean isLocked = null == users.get(0).isLocked() ? false : users.get(0).isLocked();
        return new SaltUser(username, users.get(0).getPassword(), users.get(0).getSalt(), isEnabled, isLocked, getGrantedAuthorities(username));
    }

+ 4 - 4
server/svr-authentication/src/main/resources/application.yml

@ -33,11 +33,11 @@ user:
spring:
  profiles: jwdev
  datasource:
    url: jdbc:mysql://172.19.103.77/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
    url: jdbc:mysql://172.26.0.114/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: jkzl
    password: jkzlehr
  redis:
    host: 172.19.103.88 # Redis server host.
    host: 172.26.0.253 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
---

+ 14 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/config/JpaConfig.java

@ -0,0 +1,14 @@
package com.yihu.jw.entrance.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.jpa.JpaTransactionManager;
@Configuration
public class JpaConfig {
    @Bean
    public JpaTransactionManager jpaTransactionManager(){
        return new JpaTransactionManager();
    }
}

+ 79 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/expressage/ExpressageEndpoint.java

@ -0,0 +1,79 @@
//package com.yihu.jw.entrance.controller.expressage;
//
//import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
//import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
//import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
//import com.yihu.jw.hospital.prescription.service.PrescriptionExpressageService;
//import com.yihu.jw.hospital.prescription.service.PrescriptionService;
//import com.yihu.jw.restmodel.web.Envelop;
//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.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.util.CollectionUtils;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import java.net.URLDecoder;
//import java.util.List;
//
//@RestController
//@RequestMapping(value = BaseHospitalRequestMapping.Expressage.PREFIX)
//@Api(value = "门诊处方快递物流管理器", description = "门诊处方快递物流管理器", tags = {"wlyy基础服务 - 门诊处方快递物流管理服务接口"})
//public class ExpressageEndpoint extends EnvelopRestEndpoint {
//    private static Logger logger = LoggerFactory.getLogger(ExpressageEndpoint.class);
//
//    @Autowired
//    private PrescriptionExpressageService sfexpressService;
//
//    @Autowired
//    private PrescriptionExpressageService prescriptionExpressageService;
//
//    private String successxml = "<Response service='RoutePushService'><Head>OK</Head></Response>";
//    private String failedxml = "<Response service='RoutePushService'><Head>ERR</Head><ERROR code='-1'>系统发生数据错误或运行时异常</ERROR></Response>";
//
//    @RequestMapping(value="/routepushservice",method = RequestMethod.POST)
//    @ApiOperation("接受顺丰推送过来的路由信息")
//    public Envelop SFRoutePushService (
//            @ApiParam(name="content", value="入参报文") @RequestParam(value = "content",required = true) String content){
//        try {
//            content = URLDecoder.decode(content,"utf-8");
//            logger.info("顺丰路由信息推送,xml="+content);
//            sfexpressService.SFRoutePushService(content);
//            return success(successxml);
//        }catch (Exception e){
//            logger.error("接收顺丰路由信息推送失败,入参xml:"+content);
//            //日志文件中记录异常信息
//            //返回接口异常信息处理结果
//            return failed(failedxml);
//        }
//    }
//
//    @RequestMapping(value="/sfrouteserviceSearch",method = RequestMethod.GET)
//    @ApiOperation("通过门诊编号查询顺丰物流派送记录")
//    public Envelop SFRouteServiceSearch(@ApiParam(name="outpatientId", value="门诊编号") @RequestParam(value = "outpatientId",required = true) String outpatientId){
//        try {
//            List<WlyyPrescriptionExpressageDO> expressageDOList = prescriptionExpressageService.findByField("outpatientId",outpatientId);
//            if(CollectionUtils.isEmpty(expressageDOList)){
//                return failed("当前门诊没有物流信息!");
//            }
//            WlyyPrescriptionExpressageDO sfexpress_obj = expressageDOList.get(0);
//            String result  = sfexpressService.getRoutInfosSearch(sfexpress_obj);
//            return success(result);
//        }catch (Exception e){
//            //日志文件中记录异常信息
//            //返回接口异常信息处理结果
//            return failed( "查询失败,"+e.getMessage());
//        }
//
//    }
//
//
//
//}

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

@ -33,7 +33,7 @@ public class PrescriptionUpdateController extends EnvelopRestEndpoint {
            @RequestParam(value = "admNo") String admNo,
            @ApiParam(name = "realOrder", value = "处方号", required = true)
            @RequestParam(value = "realOrder") String realOrder,
            @ApiParam(name = "status", value = "处方状态", required = true)
            @ApiParam(name = "status", value = "处方状态:1审方失败,2审核完成,3结算完成", required = true)
            @RequestParam(value = "status") String status) {
        try {
            boolean obj= prescriptionService.updatePrescriptionByHisStatu(admNo,realOrder,status);

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

@ -37,6 +37,13 @@ fast-dfs:
configDefault: # 默认配置
  saasId: xmjkzl_saasId
express:
  sf_url: http://218.17.248.244:11080/bsp-oisp/sfexpressService
  #  sf_url: https://bsp-ois.sit.sf-express.com:9443/bsp-ois/sfexpressServic
  sf_code: SDDF
  sf_check_word: ttzlgGyOQu4L
---
spring:
  profiles: jwdev

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

@ -1,6 +1,8 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.restmodel.base.dict.DictHospitalDeptVO;
import com.yihu.jw.restmodel.base.org.BaseOrgVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -12,12 +14,10 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -37,7 +37,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private boolean demoFlag;
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientList)
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录 V1.00")
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录")
    public ListEnvelop findOutpatientList(@ApiParam(name = "patient", value = "居民id")
                               @RequestParam(value = "patient",required = false) String patient,
                               @ApiParam(name = "startTime", value = "开始时间")
@ -48,6 +48,18 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(vos);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientInfo)
    @ApiOperation(value = " 查询单条门诊就诊记录")
    public ObjEnvelop findOutpatientInfo(@ApiParam(name = "patient", value = "居民id")
                                         @RequestParam(value = "patient",required = false) String patient,
                                         @ApiParam(name = "registerSn", value = "流水号")
                                         @RequestParam(value = "registerSn",required = false) String registerSn,
                                         @ApiParam(name = "admNo", value = "就诊唯一号")
                                         @RequestParam(value = "admNo",required = false) String admNo)throws Exception{
        WlyyOutpatientVO obj = prescriptionService.findOutpatientInfo(patient,registerSn,admNo);
        return success(obj);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOriginPrescriptionList)
    @ApiOperation(value = "门诊下所有处方信息")
    public ListEnvelop findOriginPrescriptionList(
@ -112,7 +124,15 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return prescriptionService.findReOutpatientList(patient,status,startTime,endTime,page,size);
    }
        @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionInfo)
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findReOutpatientInfo)
    @ApiOperation(value = "查询复诊记录,处方,居民信息,物流(单条)", notes = "查询复诊记录,处方,居民信息,物流(单条)")
    public ObjEnvelop findReOutpatientInfo(@ApiParam(name = "outpatientId", value = "复诊ID")
                                           @RequestParam(value = "outpatientId", required = true) String outpatientId)throws Exception{
        com.alibaba.fastjson.JSONObject obj =  prescriptionService.findReOutpatientInfo(outpatientId);
        return success(obj);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPrescriptionInfo)
    @ApiOperation(value = "获取所有居民相关信息,续方信息,物流信息,药品信息(单条)", notes = "获取所有居民相关信息,续方信息,物流信息,药品信息(单条)")
    public ObjEnvelop<Map<String,Object>> findPrescriptionInfo(@ApiParam(name = "prescriptionId", value = "续方明细")
                                                               @RequestParam(value = "prescriptionId", required = false) String prescriptionId) {
@ -135,6 +155,54 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.cancelPrescription(prescriptionId));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findPatientCard)
    @ApiOperation(value = "查询患者就诊卡", notes = "查询患者就诊卡")
    public ListEnvelop findPatientCard(@ApiParam(name = "patient", value = "居民Code")
                                       @RequestParam(value = "patient", required = true)String patient)throws Exception {
        return success(prescriptionService.findPatientCard(patient));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.checkOutpatient)
    @ApiOperation(value = "判断是否可用发起门诊", notes = "判断是否可用发起门诊")
    public ObjEnvelop checkOutpatient(@ApiParam(name = "patient", value = "续方明细")
                                      @RequestParam(value = "patient", required = true)String patient){
        return success(prescriptionService.checkOutpatient(patient));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findAllHospital)
    @ApiOperation(value = "查询所有机构", notes = "查询所有机构")
    public ListEnvelop findAllHospital() {
        return success(prescriptionService.findAllHospital());
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDeptByHospital)
    @ApiOperation(value = "查询机构底下部门", notes = "查询机构底下部门")
    public ListEnvelop findDeptByHospital(@ApiParam(name = "orgCode", value = "机构code")
                                          @RequestParam(value = "orgCode", required = true)String orgCode) {
        return success(prescriptionService.findDeptByHospital(orgCode));
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByHospitalAndDept)
    @ApiOperation(value = "查询部门下医生", notes = "查询机构底下部门")
    public ListEnvelop findDoctorByHospitalAndDept(@ApiParam(name = "orgCode", value = "机构code")
                                                   @RequestParam(value = "orgCode", required = true)String orgCode,
                                                   @ApiParam(name = "dept", value = "部门code")
                                                   @RequestParam(value = "dept", required = true)String dept) {
        return success(prescriptionService.findDoctorByHospitalAndDept(orgCode,dept));
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.appointmentRevisit)
    @ApiOperation(value = "居民发起复诊", notes = "居民发起复诊")
    public ObjEnvelop appointmentRevisit(@ApiParam(name = "outpatientJson", value = "居民门诊json")
                                         @RequestParam(value = "outpatientJson", required = false)String outpatientJson,
                                         @ApiParam(name = "expressageJson", value = "居民物流json")
                                         @RequestParam(value = "expressageJson", required = false)String expressageJson)throws Exception {
        return success(BaseHospitalRequestMapping.Prescription.api_success,prescriptionService.appointmentRevisit(outpatientJson,expressageJson));
    }
    //===========

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

@ -116,6 +116,11 @@ sms:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
hospital:
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
---
spring:
  profiles: jwtest
@ -153,6 +158,11 @@ myFamily:
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
hospital:
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
---
spring:
  profiles: prod
@ -186,4 +196,9 @@ myFamily:
  qrCodeFailurTime: 2
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
  flag: false
hospital:
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01