Преглед изворни кода

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

LAPTOP-KB9HII50\70708 пре 2 година
родитељ
комит
7919349510
23 измењених фајлова са 1044 додато и 76 уклоњено
  1. 1 3
      business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java
  2. 3 0
      business/base-service/src/main/java/com/yihu/jw/hospital/healthCare/YlzMedicailRelationDao.java
  3. 340 7
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/HcyyPrescriptionService.java
  4. 36 3
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  5. 175 14
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/HcyyEntranceService.java
  6. 168 0
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  7. 71 0
      business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java
  8. 2 0
      common/common-entity/sql/sql记录
  9. 1 0
      svr/svr-base/src/main/java/com/yihu/jw/base/config/MultipartConfig.java
  10. 5 11
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java
  11. 3 2
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/music/MusicController.java
  12. 9 4
      svr/svr-base/src/main/java/com/yihu/jw/base/service/music/MusicService.java
  13. 1 3
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java
  14. 5 5
      svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java
  15. 15 0
      svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhylyjkglxt/sql记录.sql
  16. 1 1
      svr/svr-internet-hospital-entrance/pom.xml
  17. 105 0
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/HcyyController.java
  18. 28 16
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  19. 1 1
      svr/svr-internet-hospital-job/pom.xml
  20. 5 1
      svr/svr-internet-hospital-job/src/main/resources/application.yml
  21. 8 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  22. 54 3
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/HcyyPrescriptionCotroller.java
  23. 7 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

+ 1 - 3
business/base-service/src/main/java/com/yihu/jw/file_upload/FileUploadService.java

@ -17,7 +17,6 @@ import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.apache.poi.util.IOUtils;
import org.csource.common.MyException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,7 +32,6 @@ import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.security.NoSuchAlgorithmException;
import java.util.*;
@ -678,7 +676,7 @@ public class FileUploadService {
            type = type.substring(type.lastIndexOf("."),type.length()-1);
        }
        logger.info(type);
        List img = new ArrayList(Arrays.asList("jpeg","bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp","xls","xlsx","text/plain","mp4","m4v","avi","ogm","wmv","mpg","webm","ogv","mov","asx","mpeg","image/png","amr"));
        List img = new ArrayList(Arrays.asList("jpeg","bmp", "jpg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr", "pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp","xls","xlsx","text/plain","mp3","mp4","m4v","avi","ogm","wmv","mpg","webm","ogv","mov","asx","mpeg","image/png","amr"));
        if (!img.contains(type)) {
            return false;
        }

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

@ -27,6 +27,9 @@ public interface YlzMedicailRelationDao extends PagingAndSortingRepository<YlzMe
    @Query("from YlzMedicalRelationDO a where a.logNo = ?1 ")
    YlzMedicalRelationDO findByLog_no(String logNo);
   /* @Query("from YlzMedicalRelationDO a where a.hisSerial = ?1 ")
    YlzMedicalRelationDO findByHisSerial(String hisSerial);*/
    @Query("from YlzMedicalRelationDO a where a.insuranceSerial = ?1 ")
    YlzMedicalRelationDO findByInsuranceSerial(String insuranceSerial);
}

+ 340 - 7
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/HcyyPrescriptionService.java

@ -10,17 +10,25 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.ca.OauthCaConfigDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalIcdDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalMxDO;
import com.yihu.jw.entity.hospital.healthCare.YlzMedicalRelationDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailIcdDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailMxDao;
import com.yihu.jw.hospital.healthCare.YlzMedicailRelationDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.HcyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.util.common.IdCardUtil;
@ -28,6 +36,8 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -36,6 +46,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.security.PublicKey;
import java.text.DecimalFormat;
import java.util.*;
@ -84,6 +95,21 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    private HcyyEntranceService hcyyEntranceService;
    @Autowired
    private PrescriptionDao prescriptionDao;
    public static String entranceUrlLocal = "http://127.0.0.1:10023/hcyy/";
    @Autowired
    public YlzMedicailRelationDao ylzMedicailRelationDao;
    @Autowired
    public YlzMedicailMxDao ylzMedicailMxDao;
    @Autowired
    public YlzMedicailIcdDao ylzMedicailIcdDao;
    @Autowired
    public BusinessOrderDao businessOrderDao;
    @Autowired
    public PrescriptionLogDao prescriptionLogDao;
    @Autowired
    public PrescriptionService prescriptionService;
@ -191,12 +217,12 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @param patient 居民id
     * @return
     */
    public List<WlyyOutpatientVO> selectOutpatientList(String patient, String startTime, String endTime, String cardNo) throws Exception {
    public List<WlyyOutpatientVO> selectOutpatientList(String patient,String startTime, String endTime,String ksdm, String cardNo) throws Exception {
        List<WlyyOutpatientVO> wlyyOutpatientVOList = new ArrayList<>();
        JSONArray array = new JSONArray();
        String response="";
        patient = updatePatientMapping(patient,cardNo);
        String obj = hcyyEntranceService.findOutpatientInfo(patient,null,startTime,endTime);
        String obj = hcyyEntranceService.findOutpatientInfo(patient,null,ksdm,startTime,endTime);
        if (StringUtils.isNoneBlank(obj)){
            array = JSONArray.parseArray(obj).getJSONArray(0);
            for (int i=0;i<array.size();i++){
@ -248,7 +274,7 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            patient = savePatientMapping(patient);
        }
        if (StringUtils.isNoneBlank(patient)) {
            String obj = hcyyEntranceService.findOutpatientInfo(patient, conNo, null, null);
            String obj = hcyyEntranceService.findOutpatientInfo(patient, conNo, null,null, null);
            if (StringUtils.isNoneBlank(obj)) {
                array = JSONArray.parseArray(obj).getJSONArray(0);
                if (array != null && array.size() != 0) {
@ -743,7 +769,7 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
                JSONArray array = JSONArray.parseArray(obj);
                if (array!=null&&array.size()!=0){
                    JSONObject jsonObject = array.getJSONObject(0);
                    operatorId = jsonObject.getString("staffNo");
                    operatorId = jsonObject.getString("SUPER_ADD");
                }
            }
            if(null!=doctorMappingDO){
@ -766,15 +792,34 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
                paramRequest.put("outpatientCode","R"+wlyyOutpatientDO.getRegisterNo());
                paramRequest.put("eventno","R"+wlyyOutpatientDO.getRegisterNo());
            }
            paramRequest.put("templateid","1158");
            paramRequest.put("catalogid","50");
            paramRequest.put("templateid","2160");
            paramRequest.put("catalogid","74");
            paramRequest.put("emrtype","93");
            paramRequest.put("emrtitle","互联网医院");
            if (StringUtils.isNoneBlank(baseSign)){
                JSONObject object = hcyyEntranceService.getSignPicture(doctorDO.getId());
                if (object!=null){
                    String code = object.getString("code");
                    if (code.equalsIgnoreCase("1000")){
                        String data = object.getString("data");
                        if (StringUtils.isNoneBlank(data)){
                            JSONObject re = JSONObject.parseObject(data);
                            String image = re.getString("image");
                            paramRequest.put("baseSign",image);
                        }else {
                            paramRequest.put("baseSign","");
                        }
                    }else {
                        paramRequest.put("baseSign","");
                    }
                }else {
                    paramRequest.put("baseSign","");
                }
                //UploadVO uploadVO=fileUploadService.uploadImagesBase64(baseSign,fastdfs_file_url);
                //paramRequest.put("baseSign","https://ih.xmheart.com/fastdfs/"+uploadVO.getFullUri());
                paramRequest.put("baseSign",baseSign);
            }
        }
        params.put("jsonInfo",paramRequest.toJSONString());
@ -1561,4 +1606,292 @@ public class HcyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        optPatient+="</opt_prescription_item>";
        return optPatient;
    }
    public YlzMedicalRelationDO getSettlementInfo(String cardno,String outpatientId) throws Exception {
        YlzMedicalRelationDO ylzMedicalRelationDO =new YlzMedicalRelationDO();
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        String resNo = outpatientDO.getRegisterNo();
        //请求his获取待结算存储
        Map<String,Object> params = new HashedMap();
        String url =entranceUrlLocal +"getSettleMent";
        params.put("mct","03");
        params.put("mcn",cardno);
        HttpResponse response = HttpUtils.doGet(url,params);
        //获取his结算基本信息表
        String basicSql ="select * from SST_JSDP_JBXX_GJYB where CARD_NO ='"+cardno+"'";
        String res = hcyyEntranceService.getSql(basicSql);
        if (StringUtils.isNoneBlank(res)){
            JSONObject rs = JSONObject.parseObject(res);
            Integer status = rs.getInteger("status");
            if(status!=null&&status == 200){
                JSONArray array = rs.getJSONArray("detailModelList");
                for (int i=0;i<array.size();i++){
                    JSONObject object = array.getJSONObject(i);
                    String logNo = object.getString("LOG_NO");
                    String registerNo = object.getString("IPT_OTP_NO");
                    logger.info("logNo=="+logNo +"registerNo=="+registerNo);
                    if (registerNo.equalsIgnoreCase(resNo)){
                        logger.info("logNo=="+logNo +"registerNo=="+registerNo);
                        ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
                        if (ylzMedicalRelationDO==null){
                            ylzMedicalRelationDO = new YlzMedicalRelationDO();
                            ylzMedicalRelationDO.setLogNo(logNo);
                            ylzMedicalRelationDO.setRelationCode(outpatientId);
                            ylzMedicalRelationDO.setName(object.getString("PSN_NAME"));
                            ylzMedicalRelationDO.setTotalAmount(object.getString("COST"));
                            ylzMedicalRelationDO.setPersonCash(object.getString("ORIGIN_CHARGES"));
                            ylzMedicalRelationDO.setHisSerial(object.getString("RESIDENCE_NO"));
                            ylzMedicalRelationDO.setHisBillSerial(object.getString("SETTLE_NO"));
                            ylzMedicalRelationDO.setDeptCode(object.getString("DEPT_CODE"));
                            ylzMedicalRelationDO.setDeptName(object.getString("DEPT_NAME"));
                            ylzMedicalRelationDO.setHisDeptCode(object.getString("DEPT_CODE"));
                            ylzMedicalRelationDO.setHisDeptName(object.getString("DEPT_NAME"));
                            ylzMedicalRelationDO.setStatus(0);
                            ylzMedicalRelationDO.setState(0);
                            ylzMedicalRelationDO.setPersonAccount("0");
                            ylzMedicalRelationDO.setMedicalPrice("0");
                            ylzMedicalRelationDO.setHisSettleNo(object.getString("IPT_OTP_NO"));
                            ylzMedicalRelationDO.setCardNo(object.getString("CARD_NO"));
                            ylzMedicalRelationDO.setDate(DateUtil.strToDate(object.getString("BEGNTIME")));
                            ylzMedicalRelationDO.setBcwkje(object.getString("MEDFEE_SUMAMT"));
                        }else {
                            ylzMedicalRelationDO.setLogNo(logNo);
                            ylzMedicalRelationDO.setRelationCode(outpatientId);
                            ylzMedicalRelationDO.setName(object.getString("PSN_NAME"));
                            ylzMedicalRelationDO.setTotalAmount(object.getString("COST"));
                            ylzMedicalRelationDO.setPersonCash(object.getString("ORIGIN_CHARGES"));
                            ylzMedicalRelationDO.setHisSerial(object.getString("RESIDENCE_NO"));
                            ylzMedicalRelationDO.setHisBillSerial(object.getString("SETTLE_NO"));
                            ylzMedicalRelationDO.setDeptCode(object.getString("DEPT_CODE"));
                            ylzMedicalRelationDO.setDeptName(object.getString("DEPT_NAME"));
                            ylzMedicalRelationDO.setHisDeptCode(object.getString("DEPT_CODE"));
                            ylzMedicalRelationDO.setHisDeptName(object.getString("DEPT_NAME"));
                            ylzMedicalRelationDO.setPersonAccount("0");
                            ylzMedicalRelationDO.setMedicalPrice("0");
                            ylzMedicalRelationDO.setHisSettleNo(object.getString("IPT_OTP_NO"));
                            ylzMedicalRelationDO.setCardNo(object.getString("CARD_NO"));
                            ylzMedicalRelationDO.setDate(DateUtil.strToDate(object.getString("BEGNTIME")));
                            ylzMedicalRelationDO.setBcwkje(object.getString("MEDFEE_SUMAMT"));
                        }
                        ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
                        ylzMedicailMxDao.deleteByMedicalId(ylzMedicalRelationDO.getId());
                        //获取结算明细
                        String detailSql =" select * from SST_JSDP_JSMX_GJYB where LOG_NO ='"+logNo+"' ";
                        String detailRes = hcyyEntranceService.getSql(detailSql);
                        List<YlzMedicalMxDO> mxDOList = new ArrayList<>();
                        if (StringUtils.isNoneBlank(detailRes)) {
                            JSONObject drs = JSONObject.parseObject(detailRes);
                            Integer dstatus = drs.getInteger("status");
                            if (dstatus != null && dstatus == 200) {
                                JSONArray darray = drs.getJSONArray("detailModelList");
                                for (int j = 0; j < darray.size(); j++) {
                                    JSONObject dobject = darray.getJSONObject(j);
                                    YlzMedicalMxDO medicalMxDO = new YlzMedicalMxDO();
                                    medicalMxDO.setDel(1);
                                    medicalMxDO.setCreateTime(new Date());
                                    medicalMxDO.setItemName(dobject.getString("XMMC00"));
                                    medicalMxDO.setHisDetailSn(dobject.getString("FEEDETL_SN"));
                                    medicalMxDO.setItemCode(dobject.getString("MED_LIST_CODG"));
                                    medicalMxDO.setPrescriptionCode(dobject.getString(""));
                                    medicalMxDO.setChargeUnit(dobject.getString("PRCUNT"));
                                    medicalMxDO.setSpecificationType(dobject.getString(""));
                                    medicalMxDO.setAmount(dobject.getString("CNT"));
                                    medicalMxDO.setPrice(dobject.getString("PRIC"));
                                    medicalMxDO.setSingleDose(dobject.getString("SIN_DOS_DSCR"));
                                    medicalMxDO.setUseFrequency(dobject.getString("USED_FRQU_DSCR"));
                                    medicalMxDO.setMedicationDays(dobject.getString("PRD_DAYS"));
                                    medicalMxDO.setMedicalWay(dobject.getString("MEDC_WAY_DSCR"));
                                    medicalMxDO.setDeptCode(dobject.getString("BILG_DEPT_CODG"));
                                    medicalMxDO.setDeptName(dobject.getString("BILG_DEPT_NAME"));
                                    medicalMxDO.setHisDeptCode(dobject.getString("BILG_DEPT_CODG"));
                                    medicalMxDO.setHisDeptName(dobject.getString("BILG_DEPT_NAME"));
                                    medicalMxDO.setMedicalPerId(dobject.getString("BILG_DR_CODG"));
                                    medicalMxDO.setMedicalPerName(dobject.getString("BILG_DR_NAME"));
                                    medicalMxDO.setLimitType(dobject.getString("HOSP_APPR_FLAG"));
                                    medicalMxDO.setHisItemCode(dobject.getString("MED_LIST_CODG"));
                                    medicalMxDO.setHisItemName(dobject.getString("XMMC00"));
                                    medicalMxDO.setTotalMoney(dobject.getString("DET_ITEM_FEE_SUMAMT"));
                                    medicalMxDO = ylzMedicailMxDao.save(medicalMxDO);
                                    mxDOList.add(medicalMxDO);
                                }
                            }
                        }
                        ylzMedicalRelationDO.setYlzMedicalMxDOList(mxDOList);
                        List<YlzMedicalIcdDO> icdDOS = new ArrayList<>();
                        ylzMedicailIcdDao.deleteByMedicalId(ylzMedicalRelationDO.getId());
                        //获取诊断
                        String icdSql =" select * from SST_JSDP_JSMX_GJYB where LOG_NO ='"+logNo+"' ";
                        String icdRes = hcyyEntranceService.getSql(icdSql);
                        if (StringUtils.isNoneBlank(icdRes)) {
                            JSONObject drs = JSONObject.parseObject(icdRes);
                            Integer dstatus = drs.getInteger("status");
                            if (dstatus != null && dstatus == 200) {
                                JSONArray darray = drs.getJSONArray("detailModelList");
                                for (int j = 0; j < darray.size(); j++) {
                                    JSONObject dobject = darray.getJSONObject(j);
                                    YlzMedicalIcdDO icdDO = new YlzMedicalIcdDO();
                                    icdDO.setCreateTime(new Date());
                                    icdDO.setDel(1);
                                    icdDO.setDiseaseCodeIcd10(dobject.getString("DIAG_CODE"));
                                    icdDO.setDiseaseNameIcd10(dobject.getString("DIAG_NAME"));
                                    icdDO.setDiseaseType(dobject.getString("DIAG_TYPE"));
                                    icdDO.setDiseaseOrder(dobject.getString("DIAG_SRT_NO"));
                                    icdDO.setMedicalId(ylzMedicalRelationDO.getId());
                                    icdDO = ylzMedicailIcdDao.save(icdDO);
                                    icdDOS.add(icdDO);
                                }
                            }
                        }
                        ylzMedicalRelationDO.setYlzMedicalIcdDOList(icdDOS);
                    }
                }
            }
        }
        return  ylzMedicalRelationDO;
    }
    public String confirmSettlement(String outpatientId) throws Exception {
        try {
            WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
            if (outpatientDO==null){
                throw new Exception("未找到待结算记录");
            }
            YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
            if (ylzMedicalRelationDO.getState()==1){
                return "已结算";
            }
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
            ylzMedicalRelationDO.setState(1);
            ylzMedicalRelationDO.setSettleDate(new Date());
            ylzMedicalRelationDO = ylzMedicailRelationDao.save(ylzMedicalRelationDO);
            String sql = "update SST_JSDP_JBXX_GJYB\n" +
                    "   set SETL_ID           = '', \n" +
                    "       ACCT_PAY          = '0',\n" +
                    "       PSN_CASH_PAY      = '"+ylzMedicalRelationDO.getTotalAmount()+"',\n" +
                    "       FUND_PAY_SUMAMT   = '0',\n" +
                    "       CVLSERV_PAY       = '0',\n" +
                    "       PSN_PART_AMT      = '0',\n" +
                    "       HIFMI_PAY         = '0',\n" +
                    "       MEDFEE_SUMAMT     = '"+ylzMedicalRelationDO.getBcwkje()+"',\n" +
                    "       SETL_TIME         = '0',\n" +
                    "       BALC              = '0',\n" +
                    "       ACCT_MULAID_PAY   = '0',\n" +
                    "       HIFOB_PAY         = '0',\n" +
                    "       MDTRT_ID          = '',\n" +
                    "       HIFP_PAY          = '0',\n" +
                    "       MAF_PAY           = '',\n" +
                    "       OTH_PAY           = '0',\n" +
                    "       HIFES_PAY         = '0',\n" +
                    "       OUTCHARGENO       = '"+businessOrderDO.getOrderNo()+"',\n" +
                    "       PSN_CERT_TYPE     = '0',\n" +
                    "       NATY              = '0',\n" +
                    "       BRDY              = '0',\n" +
                    "       CVLSERV_FLAG      = '0',\n" +
                    "       ACT_PAY_DEDC      = '0',\n" +
                    "       PSN_TYPE          = '0',\n" +
                    "       HOSP_PART_AMT     = '0',\n" +
                    "       CLR_OPTINS        = '0',\n" +
                    "       CLR_WAY           = '0',\n" +
                    "       CLR_TYPE          = '0',\n" +
                    "       POOL_PROP_SELFPAY = '0',\n" +
                    "       INSUPLC_ADMDVS    = '',\n" +
                    "       INSUTYPE          = '',\n" +
                    "       PSN_NO            = '',\n" +
                    "       CHANNEL_TYPE      = '',\n" +
                    "       ACSIGN_TYPE       = 'null',\n" +
                    "       MDTRT_CERT_TYPE   = '03',\n" +
                    "       CVL_ACCT_PAY      = '0',\n" +
                    "       CVL_ACCT_BALC     = '0',\n" +
                    "       HL_ACCT_PAY       = '0',\n" +
                    "       HL_ACCT_BALC      = '0',\n" +
                    "       FM_ACCT_BALC      = '0',\n" +
                    "       PUR_ACCT_PAY      = '0'\n" +
                    " where 1 = 1\n" +
                    "   and LOG_NO = '"+ylzMedicalRelationDO.getLogNo()+"'";
            //结算更新
            System.out.println("sql=="+sql);
            String res = hcyyEntranceService.updateUrl(sql);
            Map<String,Object> params = new HashedMap();
            String url =entranceUrlLocal +"comfirmSettleMent";
            params.put("mct","03");
            params.put("mcn",ylzMedicalRelationDO.getCardNo());
            params.put("xtgzh0",ylzMedicalRelationDO.getLogNo());
            HttpResponse response = HttpUtils.doGet(url,params);
            System.out.println("response=="+response.getContent());
            List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findByOutPatientIdList(ylzMedicalRelationDO.getRelationCode());
            /*String */
            String realOrder = "";
            for (WlyyPrescriptionDO prescriptionDO:wlyyPrescriptionDOS){
                if (prescriptionDO.getStatus()==20){
                    WlyyPrescriptionLogDO prescriptionLogDO = new WlyyPrescriptionLogDO();
                    prescriptionLogDO.setCreateTime(new Date());
                    prescriptionLogDO.setStatus(30);
                    prescriptionLogDO.setOutpatientId(prescriptionDO.getOutpatientId());
                    prescriptionLogDO.setPrescriptionCode(prescriptionDO.getId());
                    prescriptionLogDO.setUserCode(prescriptionDO.getPatientCode());
                    prescriptionLogDO.setUserName(prescriptionDO.getPatientName());
                    prescriptionLogDO.setUserType(1);
                    prescriptionLogDO.setDatajson("处方结算");
                    prescriptionLogDao.save(prescriptionLogDO);
                    prescriptionDO.setStatus(30);
                    prescriptionDO.setPayTime(new Date());
                    prescriptionDao.save(prescriptionDO);
                    logger.info("变更处方结算状态成功");
                    realOrder = prescriptionDO.getRealOrder();
                }
                try {
                    sfToHis(outpatientId, realOrder);
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
            return "结算成功!";
        }catch (Exception e){
            e.printStackTrace();
            return "结算失败";
        }
    }
    /**
     * 顺丰下订单后同步his
     * @param outpatientId
     * @param realorder
     * @return
     * @throws Exception
     */
    public String sfToHis(String outpatientId,String realorder) throws Exception {
        WlyyOutpatientDO outpatientDO = outpatientDao.findById(outpatientId);
        String registerNo = outpatientDO.getRegisterNo();
        List<WlyyPrescriptionExpressageDO> prescriptionExpressageDOS = prescriptionExpressageDao.findByOutpatientId(outpatientId);
        WlyyPrescriptionExpressageDO expressageDO = new WlyyPrescriptionExpressageDO();
        if (prescriptionExpressageDOS!=null&&prescriptionExpressageDOS.size()!=0){
            expressageDO = prescriptionExpressageDOS.get(0);
        }
        if (expressageDO!=null){
            if (expressageDO.getOneselfPickupFlg()==0){
                Object result=prescriptionService.getSFExpressInfoNew(registerNo,realorder,"");
                String re = result.toString();
                if (re!=null){
                    JSONObject object = JSONObject.parseObject(re);
                    String sfOrder = object.getString("mainMailNo");
                    String address = expressageDO.getProvinceName()+expressageDO.getCityName()+expressageDO.getTownName()+expressageDO.getStreetName()+expressageDO.getAddress();
                    String phone = expressageDO.getMobile();
                    String remark = expressageDO.getRemark();
                    String cardNo = outpatientDO.getCardNo();
                    return  hcyyEntranceService.updateSftoHis(registerNo,cardNo,sfOrder,address,phone,remark);
                }else {
                    return null;
                }
            }else {
                return null;
            }
        }
        return null;
    }
}

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

@ -7061,8 +7061,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        if (StringUtils.isNotBlank(dept)) {
            sql += " AND h.dept_code =:dept ";
            params.put("dept", dept);
            String[] deptStr = dept.split(",");
            String depts = "";
            for (int i=0;i<deptStr.length;i++){
                depts +="'"+deptStr[i]+"',";
            }
            if (StringUtils.isNoneBlank(depts)){
                depts = depts.substring(0,depts.length()-1);
            }
            sql += " AND h.dept_code in("+depts+") ";
            /*sql += " AND h.dept_code =:dept ";*/
            /*params.put("dept", dept);*/
        }
@ -14417,7 +14426,31 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            object.put("cardNo",outpatientDO.getCardNo());
            object.put("deptName",outpatientDO.getPatientName());
            return object;
        }else {
        } else if (wechatId.equalsIgnoreCase("xm_hcyy_wx")){
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            logger.info("获取患者待结算信息开始!");
            YlzMedicalRelationDO ylzMedicalRelationDO = new YlzMedicalRelationDO();
            ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(outpatientId);
            try {
                ylzMedicalRelationDO = hcyyPrescriptionService.getSettlementInfo(outpatientDO.getCardNo(),outpatientDO.getId());
            }catch (Exception e){
                throw new Exception(e.getMessage());
            }
            BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getPersonCash());//个人现金
            BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
            BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
            Double totalPirce=b1.add(b2).add(b3).doubleValue();
            logger.info("总费用:"+totalPirce);
            if (totalPirce!=Double.parseDouble(ylzMedicalRelationDO.getTotalAmount())){
                object.put("code","403");
                object.put("message","金额不对无法结算!");
            }else {
                object.put("code","200");
                object.put("message","核对金额无误!");
            }
            object.put("getSettleInfo",ylzMedicalRelationDO);
            return object;
        } else {
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            logger.info("获取患者待结算信息开始!");
            YlzMedicalRelationDO ylzMedicalRelationDO = new YlzMedicalRelationDO();

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

@ -43,7 +43,10 @@ import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.util.wechat.wxhttp.HttpUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import net.sf.json.xml.XMLSerializer;
import nu.xom.*;
@ -54,6 +57,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -125,17 +129,29 @@ public class HcyyEntranceService {
    @Autowired
    private OauthRsaKeyDao rsaKeyDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private static String key="bvvsf3JA0mUXMU+mVnMaOQ==";
    private static String caKey = "bvvsf3JA0mUXMU+mVnMaOQ==";
    private static String checkKey = "ydxtMEQmPymRtfz15lW76Tne88pHcuAU8WygMu/TrTKPRY5G7jttcg==";
    //发送微信模板消息
    /*@Value("${wechat.url}")*/
    private String sendMessageUrl="http://172.16.100.37:8090/hospitalPortal-sms/sms/sendMessage";
    public static String entranceUrl = "http://172.16.100.240:10023/xzzx/";
    public static String entranceUrlLocal = "http://localhost:10023/xzzx/";
    public static String entranceUrlLocal = "http://127.0.0.1:10023/hcyy/";
    private final static String url="http://127.0.0.1:10023/hcyy/createSQLQuery";
    private final static String updateUrl="http://127.0.0.1:10023/hcyy/updateBySql";
    public static String hospitalUrl = "http://192.168.118.240:10022/";//172.16.100.63
@ -355,6 +371,8 @@ public class HcyyEntranceService {
        logger.info("getDoctorInfo params:"+params.toString());
        String xml = getXzzxWebServiceInfo("CallInterface",params,getSelectUrl());
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        logger.info("getDoctorInfo json:"+json);
@ -802,7 +820,7 @@ public class HcyyEntranceService {
     * @throws Exception
     */
    //获取单条门诊就诊记录
    public String findOutpatientInfo(String patient,String conNo,String startTime,String endTime)throws Exception{
    public String findOutpatientInfo(String patient,String conNo,String ksdm,String startTime,String endTime)throws Exception{
        String api = "FindOutpatientInfo";
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
@ -822,6 +840,9 @@ public class HcyyEntranceService {
            condition += "<startTime>"+startTime+"</startTime>";
        }
        if (StringUtils.isNoneBlank(ksdm)){
            condition +="<DEPT>"+ksdm+"</DEPT>";
        }
        if (!StringUtils.isEmpty(endTime)&&!endTime.equalsIgnoreCase("null")){
            condition += "<endTime>"+endTime+"</endTime>";
        }
@ -2449,10 +2470,12 @@ public class HcyyEntranceService {
    public String initParams(String serviceCode,String payType,String patient,String doctor,List<WlyyPrescriptionInfoDO> infos,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception {
    public String initParams(String hisId,String serviceCode,String payType,String patient,String doctor,List<WlyyPrescriptionInfoDO> infos,List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception {
        String xml ="";
        String hisId = UUID.randomUUID().toString();
        if (!StringUtils.isNoneBlank(hisId)){
            hisId = UUID.randomUUID().toString();
        }
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if (patientMappingDO == null){
            return "患者信息映射表为空";
@ -2605,7 +2628,7 @@ public class HcyyEntranceService {
                    "   </opt_diagnosis>  ";
            prescriptionDiagnoses += prescriptionDiagnose;
        }
        String cancelPrescription = "<opt_prescriptions>  \n" +
        String savePrescription = "<opt_prescriptions>  \n" +
                "       <opt_prescription>  \n" +
                "           <opt_prescription_info>  \n" +
                "               <recipe_id><![CDATA["+hisId+"]]></recipe_id>  \n" +
@ -2632,11 +2655,14 @@ public class HcyyEntranceService {
        if (serviceCode.equals("GY_V4_FLEXIBLE") || serviceCode.equals("GY_SF_V4")){
            xml = "<root>" + base + optPatient + prescriptions + diagnoses + "</root>";
        }
        if (serviceCode.equalsIgnoreCase("submitRecipe")){
            xml ="<root>"+ base+ savePrescription+" </root>";
        }
        else if (serviceCode.equals("SF_V4_VALID_FLAG")){
            xml = "<root>" + base + cancelPrescription + "</root>";
            xml = "<root>" + base + savePrescription + "</root>";
        }
        else if (serviceCode.equals("CANCEL_GROUP_DRUG_V4")){
            xml = "<root>" + base + doctors + cancelPrescription + "</root>";
            xml = "<root>" + base + doctors + savePrescription + "</root>";
        }
     /*   else if (serviceCode.equals("SF_V4_DOUBLE_SIGN")){
            xml = "<root>" + base + doctors + feedback + "</root>";
@ -2662,7 +2688,7 @@ public class HcyyEntranceService {
                "   <serverName>"+serviceCode+"</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+caKey+"</certificate> " +
                "   <certificate>"+checkKey+"</certificate> " +
                "</root>";
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                jsonData;
@ -2686,6 +2712,55 @@ public class HcyyEntranceService {
        return json;
    }
    /**
     * 互联网医院传入快递单号通知院内摆药
     * @param registerNo
     * @param cardNo
     * @param sfOrder
     * @param address
     * @param phone
     * @param remark
     * @return
     * @throws Exception
     */
    public String updateSftoHis(String registerNo,String cardNo,String sfOrder,String address,String phone,String remark) throws Exception {
        String msgHeader ="<?xml version=\"1.0\" encoding=\"utf-8\"?> " +
                "<root> " +
                "   <serverName>sendDispensingToHis</serverName>  " +
                "   <format>xml</format>" +
                "   <callOperator></callOperator> " +
                "   <certificate>"+checkKey+"</certificate> " +
                "</root>";
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
              "<root>\n" +
                "    <HISTradeNo>"+registerNo+"</HISTradeNo>\n" +
                "    <payCardNo>"+cardNo+"</payCardNo>\n" +
                "    <isExpress>1</isExpress>\n" +
                "<expressBillNo>"+sfOrder+"</expressBillNo>\n" +
                "<expressAddress>"+address+"</expressAddress>\n" +
                "<expressPhone>"+phone+"</expressPhone>\n" +
                "    <remark>"+remark+"</remark>\n" +
                "</root>";
        Map<String,String> params = new HashedMap();
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
        params.put("msgHeader",msgHeader);
        params.put("msgBody",msgBody);
        wlyyHttpLogDO.setRequest(params.toString());
        logger.info("sendDispensingToHis params:"+params.toString());
        String xml = getHcyyCAWebServiceInfo("CallInterface",params,getYYCheckUrl());
        wlyyHttpLogDO.setResponse(xml);
        wlyyHttpLogDO.setCreateTime(new Date());
        wlyyHttpLogDO.setCode("sendDispensingToHis");
        wlyyHttpLogDO.setName("互联网医院传入快递单号通知院内摆药");
        wlyyHttpLogDao.save(wlyyHttpLogDO);
        logger.info("互联网医院传入快递单号通知院内摆药 json:"+xml);
        XMLSerializer xmlSerializer = new XMLSerializer();
        String json = xmlSerializer.read(xml).toString();
        return json;
    }
    //处方保存前,进行合理用药审查
    public String checkPrescriptions(String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception {
@ -2696,12 +2771,27 @@ public class HcyyEntranceService {
            return "诊断信息为空";
        }
            String xml = "";
            xml = initParams("GY_SF_V4",payType, patient, doctor, infos, diagnosisDOS,outpatientId);
            xml = initParams(hisId,"GY_SF_V4",payType, patient, doctor, infos, diagnosisDOS,outpatientId);
            String response = checkPrescription("GY_SF_V4", xml, "合理用药审查");
        return response;
    }
    public String saveCheckPrescriptions(String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS,String outpatientId) throws Exception {
        if (null == infos || infos.size() == 0) {
            return "药品信息为空";
        }
        if (diagnosisDOS == null || diagnosisDOS.size() == 0){
            return "诊断信息为空";
        }
        String xml = "";
        xml = initParams(hisId,"submitRecipe",payType, patient, doctor, infos, diagnosisDOS,outpatientId);
        String response = checkPrescription("submitRecipe", xml, "合理用药审查");
        return response;
    }
    //处方在医生站系统成功保存后调用
    public String saveCheck(String outpatient, String hisId, String payType, String patient, String doctor,List<WlyyPrescriptionInfoDO> infos, List<WlyyPrescriptionDiagnosisDO> diagnosisDOS) throws Exception {
        if (infos == null || infos.size() == 0) {
@ -2712,7 +2802,7 @@ public class HcyyEntranceService {
        }
            String xml = null;
            try {
                xml = initParams("GY_SF_V4", payType, patient, doctor, infos, diagnosisDOS,outpatient);
                xml = initParams("","GY_SF_V4", payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }
@ -2730,7 +2820,7 @@ public class HcyyEntranceService {
        }
            String xml = null;
            try {
                xml = initParams("SF_V4_VALID_FLAG",payType, patient, doctor, infos, diagnosisDOS,outpatient);
                xml = initParams("","SF_V4_VALID_FLAG",payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }
@ -2748,7 +2838,7 @@ public class HcyyEntranceService {
        }
            String xml = null;
            try {
                xml = initParams("CANCEL_GROUP_DRUG_V4",payType, patient, doctor, infos, diagnosisDOS,outpatient);
                xml = initParams("","CANCEL_GROUP_DRUG_V4",payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }
@ -2766,7 +2856,7 @@ public class HcyyEntranceService {
        }
            String xml = null;
            try {
                xml = initParams("SF_V4_DOUBLE_SIGN",payType, patient, doctor, infos, diagnosisDOS,outpatient);
                xml = initParams("","SF_V4_DOUBLE_SIGN",payType, patient, doctor, infos, diagnosisDOS,outpatient);
            } catch (Exception e) {
                e.printStackTrace();
            }
@ -2958,7 +3048,7 @@ public class HcyyEntranceService {
                "   <callOperator></callOperator> " +
                "   <certificate>"+caKey+"</certificate> " +
                "</root>";
        String condition ="<strUserFileName>"+docIdcard+".png</strUserFileName>";
        String condition ="<strUserFileName>"+docIdcard+".jpg</strUserFileName>";
        String msgBody ="<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                "<root>"+condition+"</root>";
@ -2981,4 +3071,75 @@ public class HcyyEntranceService {
    //===========================CA签名==================================
    //=====================结算==============================
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
        return hibenateUtils.createSQLQuery(sql,params,page,size);
    }
    public List<Map<String, Object>> jdbcSQLQuery(String sql){
        return jdbcTemplate.queryForList(sql);
    }
    public void updateBySql(String sql){
        hibenateUtils.updateBySql(sql);
    }
    /**
     * 待结算
     *
     * @param fzxbh0
     * @param yyjgdm
     * @param mct
     * @param mcn
     * @return
     */
    public JSONObject  SP_SST_JSDP_JSMX_GJYB(String fzxbh0,String yyjgdm,String mct,String mcn){
        return hibenateUtils.SP_SST_JSDP_JSMX_GJYB(fzxbh0,yyjgdm,mct,mcn);
    }
    /**
     * 确认结算
     * @param fzxbh0
     * @param yyjgdm
     * @param mct
     * @param mcn
     * @param xtgzh0
     * @return
     */
    public JSONObject  SP_SST_JSDP_JSMXQR_GJYB(String fzxbh0,String yyjgdm,String mct,String mcn,String xtgzh0){
        return hibenateUtils.SP_SST_JSDP_JSMXQR_GJYB(fzxbh0,yyjgdm,mct,mcn,xtgzh0);
    }
    /**
     * 请求his服务查询数据
     * @param sql
     * @return
     * @throws Exception
     */
    public String getSql(String sql) throws Exception {
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("sql语句:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        return content;
    }
    public String updateUrl(String sql) throws Exception {
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("sql语句:"+sql);
        HttpResponse response = HttpUtils.doGet(updateUrl,params);
        String content = response.getContent();
        logger.info("response:"+content);
        return content;
    }
    //===========================结算==================================
}

+ 168 - 0
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -2112,6 +2112,174 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
        return response;
    }
    /**
     * 预交金处方支付
     * @param code
     * @param depositType
     * @param wechatId
     * @return
     * @throws Exception
     */
    public String ylzRechargePreHc(String code,String depositType,String wechatId,String cardType,String cardNo,boolean demoFlag) throws Exception {
        try {
        String response = null;
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        if(wxWechatDO==null){
            throw new Exception("can't find wechat:the wxId is "+wechatId);
        }
        WlyyHospitalSysDictDO hospitalSysDictDO =hospitalSysDictDao.findById("YLZ_NOTIFY_URL");
        WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(code);
        YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findByOutpatient(code);
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(ylzMedicalRelationDO.getId());
        BigDecimal b1 = new BigDecimal(ylzMedicalRelationDO.getBcwkje());//总金额
        BigDecimal b2 = new BigDecimal(ylzMedicalRelationDO.getPersonAccount());//个人账户
        BigDecimal b3 = new BigDecimal(ylzMedicalRelationDO.getMedicalPrice());//医保总金额
        Double fee = b1.subtract(b2).subtract(b3).doubleValue();
        if (businessOrderDO!=null){
            BasePatientDO patientDO = patientDao.findById(businessOrderDO.getPatient());
            String idcard = "";
            if (patientDO!=null){
                idcard = patientDO.getIdcard();
            }
            logger.info("开始1"+idcard);
            String openId = "";
            businessOrderDO.setPayPrice(b1.doubleValue());
            businessOrderDO.setPayType(4);
            businessOrderDO.setHistoryOrder(businessOrderDO.getOrderNo());
            businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDO.setDepositType(depositType);
            businessOrderDao.save(businessOrderDO);
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,wlyyOutpatientDO.getConsumer());
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
                openId = patientWechatDo.getOpenid();
            }else {
                throw new Exception("请关注“海沧医院”公众号,点击互联网医院-在线诊室进行结算!");
            }
            String price = businessOrderDO.getPayPrice().toString();
            String notifyUrl = hospitalSysDictDO.getDictCode();
            String operatorId =null;
            String operatorName = null;
            if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                operatorId = "123456";
                operatorName =businessOrderDO.getPatientName();
            }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }else if(wechatId.equalsIgnoreCase("xm_hcyy_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }
            response = ylzPayService.recharge(operatorId,operatorName,cardType,"01",cardNo,idcard,depositType,price,businessOrderDO.getOrderNo(),openId,patientDO.getName(),notifyUrl);
            if (depositType.equalsIgnoreCase("WX_QR")){
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        InputStream qrcode = QrcodeUtil.createQrcode(jsonObject.getString("qrcode"),300,"jpg");
                        ByteToInputStream byteToInputStream = new ByteToInputStream();
                        String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
                        jsonObject.put("qrcodeUrl","data:image/png;base64,"+ QRCodeImg);
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                    response = object.toJSONString();
                }
            }else {
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                }
            }
        }else {
            businessOrderDO = new BusinessOrderDO();
            BasePatientDO patientDO = patientDao.findById(wlyyOutpatientDO.getPatient());
            String idcard = "";
            if (patientDO!=null){
                idcard = patientDO.getIdcard();
            }
            logger.info("开始2"+idcard);
            String openId = "";
            businessOrderDO.setPayPrice(b1.doubleValue());
            businessOrderDO.setPayType(4);
            businessOrderDO.setOrderNo("HLWYY"+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDO.setDepositType(depositType);
            businessOrderDO.setRelationCode(ylzMedicalRelationDO.getId());
            businessOrderDO.setRelationName("费用结算");
            businessOrderDO.setPatientName(patientDO.getName());
            businessOrderDO.setPatient(patientDO.getId());
            businessOrderDO.setDoctor(wlyyOutpatientDO.getDoctor());
            businessOrderDO.setOrderCategory("6");
            businessOrderDO.setOrderType(6);
            businessOrderDO.setStatus(0);
            businessOrderDO.setDescription("费用结算");
            businessOrderDO.setCreateTime(new Date());
            businessOrderDO.setUpdateTime(new Date());
            businessOrderDao.save(businessOrderDO);
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                BasePatientWechatDo patientWechatDo = patientWechatDos.get(0);
                openId = patientWechatDo.getOpenid();
            }
            String price = businessOrderDO.getPayPrice().toString();
            String notifyUrl = hospitalSysDictDO.getDictCode();
            String operatorId =null;
            String operatorName = null;
            if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
                operatorId = "123456";
                operatorName =businessOrderDO.getPatientName();
            }else if(wechatId.equalsIgnoreCase("xm_xzzx_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }else if(wechatId.equalsIgnoreCase("xm_hcyy_wx")){
                operatorId = "hlwyy";
                operatorName = "互联网医院";
            }
            response = ylzPayService.recharge(operatorId,operatorName,cardType,"01",cardNo,idcard,depositType,price,businessOrderDO.getOrderNo(),openId,patientDO.getName(),notifyUrl);
            if (depositType.equalsIgnoreCase("WX_QR")){
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        InputStream qrcode = QrcodeUtil.createQrcode(jsonObject.getString("qrcode"),300,"jpg");
                        ByteToInputStream byteToInputStream = new ByteToInputStream();
                        String QRCodeImg = byteToInputStream.getBase64FromInputStream(qrcode);
                        jsonObject.put("qrcodeUrl","data:image/png;base64,"+ QRCodeImg);
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                    response = object.toJSONString();
                }
            }else {
                JSONObject object = JSONObject.parseObject(response);
                if (object!=null){
                    JSONObject jsonObject = object.getJSONObject("param");
                    if (object.getString("respCode").equalsIgnoreCase("000000")){
                        String traceNo = jsonObject.getString("traceNo");
                        businessOrderDO.setTraceNo(traceNo);
                        businessOrderDao.save(businessOrderDO);
                    }
                }
            }
        }
        return response;
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }
    /**
     * 咨询退费
     * @param consult

+ 71 - 0
business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java

@ -1,5 +1,6 @@
package com.yihu.jw.utils.hibernate;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.prescription.HlwCf01DO;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
@ -259,5 +260,75 @@ public class HibenateUtils {
        return priceStr;
    }
    /**
     * 获取待结算
     *
     * @param
     * @param fzxbh0 参保机构编号
     * @param yyjgdm  医院机构代码(总院、分院)
     * @param mct 就诊凭证类型01:医保凭证 02:身份证号 03:社保卡/接诊卡
     * @param mcn 病人卡号
     * @return
     */
    public JSONObject SP_SST_JSDP_JSMX_GJYB(String fzxbh0,String yyjgdm,String mct,String mcn){
        JSONObject object = new JSONObject();
        object.put("P_TRADE_TYPE","4");
        object.put("P_ZDBH00","XMHCYYHLWJS01");
        object.put("P_FZXBH0",fzxbh0);
        object.put("P_YYJGDM",yyjgdm);
        object.put("P_MDTRT_CERT_TYPE",mct);
        object.put("P_MDTRT_CERT_NO",mcn);
        System.out.println("object==="+object.toJSONString());
        StoredProcedureQuery query = entityManager
                .createStoredProcedureQuery("SP_SST_JSDP_JSMX_GJYB") // 被调用存储过程名称
                .registerStoredProcedureParameter("as_json_in", String.class, ParameterMode.IN) // 入参数
                .registerStoredProcedureParameter("rs_json_out",String.class,ParameterMode.INOUT) //出参
                .registerStoredProcedureParameter("P_ERRMSG", String.class, ParameterMode.INOUT)
                .setParameter("as_json_in",object.toJSONString());
        query.execute();
        JSONObject jsonObject = new JSONObject();
        String priceStr = (String) query.getOutputParameterValue("P_ERRMSG"); // 获取存储过程中的返回值
        String rs = (String) query.getOutputParameterValue("rs_json_out"); // 获取存储过程中的返回值
        jsonObject.put("error",priceStr);
        jsonObject.put("rs",rs);
        return jsonObject;
    }
    /**
     * 确认结算
     *
     * @param fzxbh0 参保机构编号
     * @param yyjgdm  医院机构代码(总院、分院)
     * @param mct 就诊凭证类型01:医保凭证 02:身份证号 03:社保卡/接诊卡
     * @param mcn 病人卡号
     * @param xtgzh0
     * @return
     */
    public JSONObject SP_SST_JSDP_JSMXQR_GJYB(String fzxbh0,String yyjgdm,String mct,String mcn,String xtgzh0){
        JSONObject object = new JSONObject();
        object.put("P_TRADE_TYPE","4");
        object.put("P_ZDBH00","XMHCYYHLWJS01");
        object.put("P_FZXBH0",fzxbh0);
        object.put("P_YYJGDM",yyjgdm);
        object.put("P_MDTRT_CERT_TYPE",mct);
        object.put("P_MDTRT_CERT_NO",mcn);
        object.put("P_XTGZH0",xtgzh0);
        System.out.println("object==="+object.toJSONString());
        StoredProcedureQuery query = entityManager
                .createStoredProcedureQuery("SP_SST_JSDP_JSMXQR_GJYB") // 被调用存储过程名称
                .registerStoredProcedureParameter("as_json_in", String.class, ParameterMode.IN) // 入参数
                .registerStoredProcedureParameter("rs_json_out",String.class,ParameterMode.INOUT) //出参
                .registerStoredProcedureParameter("P_ERRMSG", String.class, ParameterMode.INOUT)
                .setParameter("as_json_in",object.toJSONString());
        query.execute();
        JSONObject jsonObject = new JSONObject();
        String priceStr = (String) query.getOutputParameterValue("P_ERRMSG"); // 获取存储过程中的返回值
        String rs = (String) query.getOutputParameterValue("rs_json_out"); // 获取存储过程中的返回值
        jsonObject.put("error",priceStr);
        jsonObject.put("rs",rs);
        return jsonObject;
    }
}

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

@ -2422,3 +2422,5 @@ CREATE TABLE `base_check_org` (
  `check_file` varchar(255) DEFAULT NULL COMMENT '考核文件',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='机构考核';

+ 1 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/config/MultipartConfig.java

@ -26,6 +26,7 @@ public class MultipartConfig {
            tmpFile.mkdirs();
        }
        factory.setLocation(location);
        factory.setMaxFileSize("20MB");
        return factory.createMultipartConfig();
    }

+ 5 - 11
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/common/FileUploadController.java

@ -5,23 +5,18 @@ import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.jw.base.util.ErrorCodeUtil;
import com.yihu.jw.exception.code.BaseErrorCode;
import com.yihu.jw.file_upload.FileManageService;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.restmodel.MutilFileInfo;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.http.entity.ContentType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -30,11 +25,10 @@ import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLDecoder;
import java.util.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Map;
/**
 * 文件上传不在微服务中处理
@ -116,7 +110,7 @@ public class FileUploadController extends EnvelopRestEndpoint {
            //得到文件类型
            String fileName = originalFilename.substring(0, originalFilename.lastIndexOf("."));
            String fileType = originalFilename.substring(originalFilename.lastIndexOf(".") + 1).toLowerCase();
            if(StringUtils.isBlank(fileType)||!"doc、docx、pdf、xls、xlsx、ppt、pptx".contains(fileType)){
            if(StringUtils.isBlank(fileType)||!"doc、docx、pdf、xls、xlsx、ppt、pptx、mp3".contains(fileType)){
                return ObjEnvelop.getError("文件格式不支持");
            }
            InputStream inputStream = file.getInputStream();

+ 3 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/music/MusicController.java

@ -34,9 +34,10 @@ public class MusicController extends EnvelopRestEndpoint {
    @ApiOperation(value = "保存音乐")
    public Envelop saveMusic(@RequestParam(value = "url", required = true ) String url,
                             @RequestParam(value = "title", required = true )String title,
                             @RequestParam(value = "author", required = true )String author){
                             @RequestParam(value = "author", required = true )String author,
                             @RequestParam(value = "id", required = false )String id){
        try {
            musicService.saveMusic(url, title, author);
            musicService.saveMusic(url, title, author,id);
            return success("保存成功!");
        } catch (Exception e) {
            e.printStackTrace();

+ 9 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/service/music/MusicService.java

@ -30,12 +30,17 @@ public class MusicService {
    //url 地址   title  音乐名称  author  作者
    @Transactional(rollbackFor = Exception.class)
    public void saveMusic(String url,String title,String author){
    public void saveMusic(String url,String title,String author,String id){
        BaseVideoDO baseVideoDO = new BaseVideoDO();
        if (StringUtils.isNotBlank(id)){
            baseVideoDO.setId(id);
        }
        baseVideoDO.setUrl(url);
        baseVideoDO.setTitle(title);
        baseVideoDO.setIntroduction(author);
        baseVideoDO.setType("13");
        baseVideoDO.setStatus(1);
        baseVideoDao.save(baseVideoDO);
    }
@ -53,7 +58,7 @@ public class MusicService {
        JSONObject jsonObject= new JSONObject();
        String sql = "select * from base_video where type = 13";
        String sql = "select *,status * 1 as del from base_video where type = 13";
        String totalSql = "select count(id) from base_video where type = 13";
        if (StringUtils.isNotBlank(id)){
@ -61,8 +66,8 @@ public class MusicService {
        }
        if (StringUtils.isNotBlank(musicName)){
            sql += " and musicName like '%"+musicName+"%' ";
            totalSql += " and musicName like '%"+musicName+"%' ";
            sql += " and title like '%"+musicName+"%' ";
            totalSql += " and title like '%"+musicName+"%' ";
        }
        sql += " limit "+page+","+size;

+ 1 - 3
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/doorCoach/PatientDoorCoachOrderService.java

@ -15,8 +15,6 @@ import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.care.doorCoach.*;
import com.yihu.jw.entity.care.lifeCare.LifeCareFeeDetailDO;
import com.yihu.jw.entity.care.lifeCare.LifeCareOrderDO;
import com.yihu.jw.entity.door.BaseAdminServiceDynamic;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
@ -1315,7 +1313,7 @@ public class PatientDoorCoachOrderService extends BaseJpaService<BaseDoorCoachOr
                }
            }
        }
        all = waitForPay+waitForAccept+waitForServe+served+cancel;
        all = waitForAccept+waitForServe+served+cancel;
        map.put("all",all);
        map.put("waitForPay",waitForPay);
        map.put("waitForAccept",waitForAccept);

+ 5 - 5
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -1413,10 +1413,10 @@ public class StatisticsService {
        String sql = " SELECT count(id) from base_life_care_order WHERE  `status` = 2 and  TIMESTAMPDIFF(SECOND,create_time,conclusion_time) < 43200";
        Integer integer = jdbcTemplate.queryForObject(sql, Integer.class);
        if (saveModel2.getResult2().longValue()==0) {
            if (Integer.parseInt(res.get("orderNum").toString())==0) {
            res.put("serviceRate",0);
        }else {
            res.put("serviceRate",integer/saveModel2.getResult2().longValue()*100);
            res.put("serviceRate",String.format("%.2f",Long.parseLong(integer.toString())/Long.parseLong(res.get("orderNum").toString())*100));
        }
        return res;
@ -2364,12 +2364,12 @@ public class StatisticsService {
        Integer integer = jdbcTemplate.queryForObject(sql, Integer.class);
        if (saveModel.getResult2().longValue()==0) {
        if (Integer.parseInt(res.get("emeWarnTotal").toString())==0) {
            res.put("serviceRate",0);
        }else {
            res.put("serviceRate",integer/saveModel.getResult2().longValue()*100);
            res.put("serviceRate", String.format("%.2f",(Double.parseDouble(integer.toString())/Double.parseDouble(res.get("emeWarnTotal").toString()))*100));
        }
        logger.info("二十四小时:"+integer +"  "+res.get("emeWarnTotal")+"  "+String.format("%.2f",(Double.parseDouble(integer.toString())/Double.parseDouble(res.get("emeWarnTotal").toString()))*100) );
        return res;
    }

+ 15 - 0
svr/svr-cloud-job/src/main/java/com/yihu/jw/care/zhylyjkglxt/sql记录.sql

@ -731,3 +731,18 @@ CREATE TABLE `alarm_deal_sync` (
                                   `explanation` VARCHAR DEFAULT NULL COMMENT '处置说明',
                                   PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='事件处置同步';
CREATE TABLE `data_batch_sync` (
                                   `id` INT(50) NOT NULL AUTO_INCREMENT,
                                   `devicecode` varchar(50) NOT NULL COMMENT 'devicecode',
                                   `messagetype` varchar(50) NOT NULL COMMENT '1-信息,2-告警',
                                   `reporttime` varchar(50) NOT NULL '' COMMENT '上报时间 格式:yyyy-mm-dd hh:mm:ss',
                                   `topic` varchar(50) DEFAULT NULL COMMENT '标识',
                                   `name` VARCHAR(50) DEFAULT NULL COMMENT '名称',
                                   `alarmtype` varchar(50) DEFAULT NULL COMMENT '告警类型,messagetype=2,3时必填,1-事件告警,2-设备告警,3-其他告警',
                                   `alarmlevel` varchar(50) DEFAULT NULL COMMENT '居家状态 messagetype=2,3时必填,1-非 常严重,2-严重,3-较重,4-一般,5-轻微',
                                   `dataType` varchar(50) DEFAULT NULL COMMENT 'messageType=1时必填,0-数值 int,1-布尔boolean,2-字符串 string, 3-数组list,4-时间 date, 6-浮点float,7-枚举 enum',
                                   `alarmCode` varchar(50) DEFAULT NULL COMMENT 'messageType=2,3时必填。用于区分每一次告警事件和同步告警处理',
                                   `updateValue` varchar(50) DEFAULT NULL COMMENT '更新值',
                                   PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='数据同步';

+ 1 - 1
svr/svr-internet-hospital-entrance/pom.xml

@ -110,7 +110,7 @@
        </dependency>
        <!-- Jzkl Starter -->
        <dependency>
            <groupId>com.yihu</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>swagger-starter</artifactId>
            <version>2.0.0</version>
        </dependency>

+ 105 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/HcyyController.java

@ -0,0 +1,105 @@
package com.yihu.jw.entrance.controller;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.HcyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.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 java.io.IOException;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2020/1/19.
 */
@RestController
@RequestMapping(value ="/hcyy")
@Api(value = "海沧医院视图解析", description = "海沧医院视图解析", tags = {"海沧医院视图解析"})
public class HcyyController extends EnvelopRestEndpoint {
    @Autowired
    private HcyyEntranceService hcyyEntranceService;
    @GetMapping(value = "/createSQLQuery")
    @ApiOperation(value = "视图统一查询")
    public ListEnvelop createSQLQuery(@ApiParam(name = "sql", value = "sql语句", required = true)
                                      @RequestParam(value = "sql",required = true)String sql,
                                      @ApiParam(name = "params", value = "入参", required = false)
                                      @RequestParam(value = "params",required = false)Map<String, Object> params,
                                      @ApiParam(name = "page", value = "第几页", required = false)
                                      @RequestParam(value = "page",required = false)Integer page,
                                      @ApiParam(name = "size", value = "分页大小", required = false)
                                      @RequestParam(value = "size",required = false)Integer size){
        return success(hcyyEntranceService.createSQLQuery(sql,params,page,size));
    }
    @GetMapping(value = "/jdbcSQLQuery")
    @ApiOperation(value = "视图统一查询")
    public ListEnvelop jdbcSQLQuery(@ApiParam(name = "sql", value = "sql语句", required = true)
                                      @RequestParam(value = "sql",required = true)String sql){
        return success(hcyyEntranceService.jdbcSQLQuery(sql));
    }
    @GetMapping(value = "/getSettleMent")
    @ApiOperation(value = "待结算列表")
    public Envelop getSettleMent(@ApiParam(name = "fzxbh0", value = "参保机构编号", required = false)
                                    @RequestParam(value = "fzxbh0",required = false)String fzxbh0,
                                     @ApiParam(name = "yyjgdm", value = "医院机构代码(总院、分院)", required = false)
                                     @RequestParam(value = "yyjgdm",required = false)String yyjgdm,
                                     @ApiParam(name = "mct", value = "就诊凭证类型01:医保凭证 02:身份证号 03:社保卡/接诊卡", required = false)
                                         @RequestParam(value = "mct",required = false)String mct,
                                     @ApiParam(name = "mcn", value = "病人卡号", required = false)
                                         @RequestParam(value = "mcn",required = false)String mcn){
        return success(hcyyEntranceService.SP_SST_JSDP_JSMX_GJYB(fzxbh0,yyjgdm,mct,mcn));
    }
    @GetMapping(value = "/comfirmSettleMent")
    @ApiOperation(value = "确认结算")
    public Envelop comfirmSettleMent(@ApiParam(name = "fzxbh0", value = "参保机构编号", required = false)
                                 @RequestParam(value = "fzxbh0",required = false)String fzxbh0,
                                 @ApiParam(name = "yyjgdm", value = "医院机构代码(总院、分院)", required = false)
                                 @RequestParam(value = "yyjgdm",required = false)String yyjgdm,
                                 @ApiParam(name = "mct", value = "就诊凭证类型01:医保凭证 02:身份证号 03:社保卡/接诊卡", required = false)
                                 @RequestParam(value = "mct",required = false)String mct,
                                 @ApiParam(name = "mcn", value = "病人卡号", required = false)
                                 @RequestParam(value = "mcn",required = false)String mcn,
                                 @ApiParam(name = "xtgzh0", value = "系统跟踪号", required = false)
                                     @RequestParam(value = "xtgzh0",required = false)String xtgzh0){
        return success(hcyyEntranceService.SP_SST_JSDP_JSMXQR_GJYB(fzxbh0,yyjgdm,mct,mcn,xtgzh0));
    }
    @GetMapping(value = "/updateBySql")
    @ApiOperation(value = "更新语句")
    public ObjEnvelop updateBySql(@ApiParam(name = "sql", value = "sql语句", required = true)
                                  @RequestParam(value = "sql",required = true)String sql){
        ObjEnvelop envelop = new ObjEnvelop();
        hcyyEntranceService.updateBySql(sql);
        return success(envelop);
    }
}

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

@ -65,6 +65,11 @@ testPattern:
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
swagger:
  basic:
    enable: true
    username: jw
    password: jkzl
---
spring:
  profiles: jwdev
@ -575,12 +580,12 @@ express:
#海沧医院内网
spring:
  profiles: hcyyProd
  profiles: ZjxlProd
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: wlyy
    password: 2oEq3Kf7@zjxl
    url: jdbc:mysql://192.168.1.103:4406/zentao?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: root
    password: jkzlehr
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
@ -617,14 +622,21 @@ express:
---
#海沧医院内网
# 海沧医院连his库
spring:
  profiles: ZjxlProd
  profiles: hcyyProd
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://192.168.1.103:4406/zentao?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: root
    password: jkzlehr
    driver-class-name: oracle.jdbc.driver.OracleDriver
    url: jdbc:oracle:thin:@10.95.100.10:1521/hcyy
    username: NET
    password: zy02v4NT
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.Oracle10gDialect
        show_sql: true
    database: oracle
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
@ -639,22 +651,22 @@ hospital:
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://192.168.118.240:3000/
  im_list_get: http://172.16.1.42:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://127.0.0.1:8888/
  fastdfs_file_url: http://192.0.33.26:8888/
fast-dfs:
  tracker-server: :22122 #服务器地址
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_xzzx_wx  # base库中,wx_wechat 的id字段
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  url: http://172.16.100.37:8090/hospitalPortal-sms/sms/sendMessage
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000061
  sf_check_word: BEWFSCXSyjt4314rz
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890

+ 1 - 1
svr/svr-internet-hospital-job/pom.xml

@ -87,7 +87,7 @@
        </dependency>
        <!-- Jzkl Starter -->
        <dependency>
            <groupId>com.yihu</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>swagger-starter</artifactId>
            <version>2.0.0</version>
        </dependency>

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

@ -58,7 +58,11 @@ FileTempPath:
#  instance:
#    prefer-ip-address: false
#    instance-id: ${spring.cloud.client.ipAddress}:${server.port}
swagger:
  basic:
    enable: true
    username: jw
    password: jkzl
---
spring:
  profiles: jwdev

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

@ -232,6 +232,8 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    private TasyNatService tasyNatService;
    @Autowired
    private YqfkService yqfkService;
    @Autowired
    private HcyyPrescriptionService hcyyPrescriptionService;
    @Value("${testPattern.sign}")
    private String isClose;
@ -732,7 +734,12 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
                            hospitalSystemMessageService.sendImMessage(systemMessageDO);
                        }else if (businessOrderDO!=null&&businessOrderDO.getOrderCategory().equalsIgnoreCase("6")){
                            YlzMedicalRelationDO ylzMedicalRelationDO = ylzMedicailRelationDao.findOne(businessOrderDO.getRelationCode());
                            prescriptionService.confirmSettlementService(ylzMedicalRelationDO.getRelationCode());
                            if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
                                hcyyPrescriptionService.confirmSettlement(ylzMedicalRelationDO.getRelationCode());
                            }else {
                                prescriptionService.confirmSettlementService(ylzMedicalRelationDO.getRelationCode());
                            }
                        }
                    }
                    businessOrderService.updatePayStatus(traceNo);

+ 54 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/HcyyPrescriptionCotroller.java

@ -138,7 +138,7 @@ public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
                                             @RequestParam(value = "startTime",required = false)String startTime,
                                         @ApiParam(name = "endTime", value = "结束时间", required = false)
                                             @RequestParam(value = "endTime",required = false)String endTime)throws Exception{
        return ObjEnvelop.getSuccess("ok",hcyyEntranceService.findOutpatientInfo(patient,conNo,startTime,endTime));
        return ObjEnvelop.getSuccess("ok",hcyyEntranceService.findOutpatientInfo(patient,conNo,null,startTime,endTime));
    }
    /**
@ -646,8 +646,9 @@ public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
        return success(hcyyEntranceService.checkPrescriptions(prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS,outpatientId));
    }
    /**
     * 处方在医生站系统成功保存后调用
     * 合理用药审核
     * @param patient 病人id
     * @param doctor 医生id
     * @param diagnosisDOS 诊断json
@ -655,6 +656,47 @@ public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
     * @return
     * @throws Exception
     */
    @PostMapping(value = "/saveCheckPrescriptions")
    @ApiOperation(value = "合理用药审核")
    public Envelop saveCheckPrescriptions(
            @ApiParam(name = "prescriptionOnly", value = "处方唯一标识")
            @RequestParam(value = "prescriptionOnly", defaultValue = "") String prescriptionOnly,
            @ApiParam(name = "payType", value = "付款方式0自费;1医保")
            @RequestParam(value = "payType", defaultValue = "") String payType,
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", defaultValue = "") String doctor,
            @ApiParam(name = "patient", value = "病人id")
            @RequestParam(value = "patient", defaultValue = "") String patient,
            @ApiParam(name = "diagnosisDOS", value = "诊断json")
            @RequestParam(value = "diagnosisDOS", defaultValue = "") String diagnosisDOS,
            @ApiParam(name = "infos", value = "药品json")
            @RequestParam(value = "infos", defaultValue = "") String infos,
            @ApiParam(name = "outpatientId",value = "门诊id")
            @RequestParam(value = "outpatientId", defaultValue = "") String outpatientId) throws Exception {
        JSONArray druginfos = JSONArray.parseArray(infos);
        List<WlyyPrescriptionInfoDO> wlyyPrescriptionInfoDOS = new ArrayList<>();
        for (int i = 0; i < druginfos.size(); i++) {
            WlyyPrescriptionInfoDO wlyyPrescriptionInfo = toEntity(druginfos.get(i).toString(), WlyyPrescriptionInfoDO.class);
            wlyyPrescriptionInfoDOS.add(wlyyPrescriptionInfo);
        }
        JSONArray diagnosis = JSONArray.parseArray(diagnosisDOS);
        List<WlyyPrescriptionDiagnosisDO> wlyyPrescriptionDiagnosisDOS = new ArrayList<>();
        for (int i = 0; i < diagnosis.size(); i++) {
            WlyyPrescriptionDiagnosisDO wlyyPrescriptionDiagnosisDO = toEntity(diagnosis.get(i).toString(), WlyyPrescriptionDiagnosisDO.class);
            wlyyPrescriptionDiagnosisDOS.add(wlyyPrescriptionDiagnosisDO);
        }
        return success(hcyyEntranceService.saveCheckPrescriptions(prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS,outpatientId));
    }
   /* *//**
     * 处方在医生站系统成功保存后调用
     * @param patient 病人id
     * @param doctor 医生id
     * @param diagnosisDOS 诊断json
     * @param infos  药品json
     * @return
     * @throws Exception
     *//*
    @PostMapping(value = "/hcyySaveCheckInfo")
    @ApiOperation(value = "处方在医生站系统成功保存后调用")
    public Envelop hcyySaveCheckInfo(
@ -685,7 +727,7 @@ public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
            wlyyPrescriptionDiagnosisDOS.add(wlyyPrescriptionDiagnosisDO);
        }
        return success(hcyyEntranceService.saveCheck(outpatient,prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS));
    }
    }*/
    /**
     * 处方保存成功后,发送给审方系统进行人工审方
@ -809,4 +851,13 @@ public class HcyyPrescriptionCotroller extends EnvelopRestEndpoint {
        }
        return success(hcyyEntranceService.doubleSign(outpatient,prescriptionOnly,payType,patient,doctor,wlyyPrescriptionInfoDOS,wlyyPrescriptionDiagnosisDOS));
    }
    @GetMapping(value = "/sfToHis")
    @ApiOperation(value = "顺丰下订单后同步his", notes = "顺丰下订单后同步his")
    public ObjEnvelop findHistoryEmrRecord(@ApiParam(name = "outpatientId", value = "门诊id", required = false)
                                           @RequestParam(value = "outpatientId",required = false)String outpatientId,
                                           @ApiParam(name = "realorder", value = "处方号", required = false)
                                           @RequestParam(value = "realorder",required = false)String realorder)throws Exception{
        return ObjEnvelop.getSuccess("ok",hcyyPrescriptionService.sfToHis(outpatientId,realorder));
    }
}

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

@ -233,7 +233,7 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            } else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")) {
                vos = tnPrescriptionService.findOutpatientList(patient, cardNo, startTime, endTime, demoFlag, ksdm, flag);
            } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
                vos = hcyyPrescriptionService.selectOutpatientList(patient,startTime,endTime,cardNo);
                vos = hcyyPrescriptionService.selectOutpatientList(patient,startTime,endTime,ksdm,cardNo);
            } else {
                return ListEnvelop.getError("尚未开发!");
            }
@ -2162,6 +2162,9 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "cardNo", value = "cardNo", required = true)
            @RequestParam(required = true) String cardNo) throws Exception {
        try {
            if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
                return ObjEnvelop.getSuccess("ok", businessOrderService.ylzRechargePreHc(relationCode, depositType, wxId, cardType, cardNo, demoFlag));
            }
            return ObjEnvelop.getSuccess("ok", businessOrderService.ylzRechargePre(relationCode, depositType, wxId, cardType, cardNo, demoFlag));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
@ -3682,6 +3685,9 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "outpatientId", value = "outpatientId")
            @RequestParam(value = "outpatientId", required = false) String outpatientId) throws Exception {
        try {
            if (wxId.equalsIgnoreCase("xm_hcyy_wx")){
                return success("操作成功", hcyyPrescriptionService.confirmSettlement(outpatientId));
            }
            return success("操作成功", prescriptionService.confirmSettlementService(outpatientId));
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());