Browse Source

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

humingfen 5 years ago
parent
commit
83b455dcaa
25 changed files with 1251 additions and 276 deletions
  1. 35 0
      business/base-service/src/main/java/com/yihu/jw/hospital/dict/YkDictIcd10Dao.java
  2. 41 1
      business/base-service/src/main/java/com/yihu/jw/hospital/mapping/service/PatientMappingService.java
  3. 50 20
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 136 111
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  5. 343 78
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  6. 20 1
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  7. 24 0
      business/base-service/src/main/java/com/yihu/jw/utils/hibernate/HibenateUtils.java
  8. 10 10
      business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java
  9. 10 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf01DO.java
  10. 14 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java
  11. 85 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotShareInterfaceDO.java
  12. 11 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  13. 18 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  14. 11 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/prescription/WlyyPrescriptionInfoVO.java
  15. 9 7
      common/common-util/src/main/java/com/yihu/jw/util/common/FileUtil.java
  16. 52 4
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  17. 2 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/ykyy/UnSettledHISPrescriptionJob.java
  18. 3 5
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  19. 42 26
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java
  20. 34 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java
  21. 126 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java
  22. 14 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotShareInterfaceDao.java
  23. 32 12
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java
  24. 128 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotShareInterfaceService.java
  25. 1 1
      svr/svr-iot/src/main/resources/bootstrap.yml

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

@ -0,0 +1,35 @@
package com.yihu.jw.hospital.dict;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
import java.util.Map;
/**
 * 
 * ICD10字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface YkDictIcd10Dao extends PagingAndSortingRepository<DictIcd10DO, Integer>, JpaSpecificationExecutor<DictIcd10DO>  {
    @Query("select code as code,name as name from DictIcd10DO where saasId = ?1")
    List<Map<String,Object>> findCodeAndNameSaasId(String saasId, Pageable pageable);
    @Query("select code as code,name as name from DictIcd10DO")
    List<Map<String,Object>> findCodeAndName(Pageable pageable);
    List<DictIcd10DO> findBySaasId(String saasId);
    Long countBySaasId(String saasId);
}

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

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.mapping.service;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.patient.dao.BasePatientDao;
import net.sf.json.JSONArray;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
@ -29,7 +30,8 @@ public class PatientMappingService {
    private PatientMappingDao patientMappingDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private EntranceService entranceService;
@ -65,6 +67,44 @@ public class PatientMappingService {
        }
    }
    /**
     * 眼科医院
     * @param patient
     * @return
     * @throws Exception
     */
    public String findYkyyPatNoByPatient(String patient)throws Exception{
        logger.info("findYkyyPatNoByPatient:"+patient);
        BasePatientDO patientDO = basePatientDao.findById(patient);
        logger.info("patientDO:"+patientDO.toString());
        PatientMappingDO patientMappingDO = patientMappingDao.findByIdcardAndSource(patientDO.getIdcard(),"1");
        if(patientMappingDO!=null){
            return patientMappingDO.getMappingCode();
        }
        com.alibaba.fastjson.JSONArray rs = ykyyEntranceService.findHisPatient(patientDO.getIdcard());
        if(rs!=null&&rs.size()>0){
            //获取居民信息
            com.alibaba.fastjson.JSONObject json = rs.getJSONObject(0);
            String mappingCode = json.getString("brid").trim();
            //存储对应映射关系
            PatientMappingDO mappingDO = new PatientMappingDO();
            mappingDO.setSource("1");
            mappingDO.setPatientName(patientDO.getName());
            mappingDO.setPatient(patientDO.getId());
            mappingDO.setMappingCode(mappingCode);
            mappingDO.setCreateTime(new Date());
            mappingDO.setIdcard(patientDO.getIdcard());
            patientMappingDao.save(mappingDO);
            return mappingCode;
        }else{
            return null;
        }
    }
    public String findHisPatNoByPatient(String patient)throws Exception{
        logger.info("findHisPatNoByPatient:"+patient);
        BasePatientDO patientDO = basePatientDao.findById(patient);

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

@ -82,6 +82,8 @@ import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.Boolean;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*;
/**
@ -108,8 +110,6 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private HospitalWaitingRoomDao hospitalWaitingRoomDao;
@ -1806,6 +1806,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
            BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(prescriptionDO.getOutpatientId());
            prescriptionDO.setOrderNo(businessOrderDO.getOrderNo());
            prescriptionDO.setAdmNo(outpatientDO.getAdmNo());
        }
        WlyyPrescriptionDO prescription = prescriptionDao.save(prescriptionDO);
@ -1878,9 +1879,11 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                }
                //保存药品信息
                prescriptionInfoDao.save(infoDOs);
                logger.info("123");
                Double price = getInfoFee(infoDOs);
                logger.info("12312313213"+price);
                //计算药品费用
                prescription.setDrugFee(getInfoFee(infoDOs));
                prescription.setDrugFee(price);
            }
            //=====================药品操作=======================================================================
@ -1908,7 +1911,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                wlyyInspectionDao.save(inspections);
                //计算检查检验费用
                prescription.setDrugFee(getInsFee(inspections));
                prescription.setInspectFee(getInsFee(inspections));
            }
            //=====================检查检验=======================================================================
@ -1916,12 +1919,18 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            prescription.setRegFee(getChargeFee(outpatientDO.getDoctor()));
            //保存费用
            prescriptionDao.save(prescription);
            //上传his开方
            return sendHisDiagnosis(jsonData, outpatientDO, prescription);
    
            if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                outpatientDO.setStatus("2");
                outpatientDao.save(outpatientDO);
                result.put("code", 1);
                result.put("mes", "诊断完成");
                return result;
            }else{
                //上传his开方
                return sendHisDiagnosis(jsonData, outpatientDO, prescription);
            }
        } else {
            outpatientDO.setStatus("2");
            outpatientDao.save(outpatientDO);
            result.put("code", 1);
@ -1931,6 +1940,9 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    }
    /**
     * 计算药品费用
     *
@ -1938,16 +1950,24 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public Double getInfoFee(List<WlyyPrescriptionInfoDO> infoDOs) {
        DecimalFormat df = new DecimalFormat("#.00");
        Double fee = 0D;
        try {
            if (infoDOs != null && infoDOs.size() > 0) {
                for (WlyyPrescriptionInfoDO info : infoDOs) {
                    Integer quantity = Integer.parseInt(info.getQuantity());
                    fee += info.getPackRetprice() * quantity;
                }
        if (infoDOs != null && infoDOs.size() > 0) {
            for (WlyyPrescriptionInfoDO info : infoDOs) {
                logger.error("getInfoFee===========Quantity:" +info.getQuantity());
          /*      Integer quantity = Integer.parseInt(info.getQuantity());*/
                logger.error("getInfoFee===========PackRetprice:" +info.getPackRetprice());
             /*   fee += info.getPackRetprice() * quantity;*/
                logger.error("getInfoFee===========:" +fee);
                BigDecimal total = new BigDecimal(0);
                BigDecimal quantity = new BigDecimal(info.getQuantity());
                BigDecimal price = new BigDecimal(info.getPackRetprice());
                total = total.add(quantity.multiply(price));
                Double f1 = total.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
                fee+=f1;
            }
        } catch (Exception e) {
            logger.error("getInfoFee:" + e.toString());
            logger.error("getInfoFee===========:" +fee);
        }
        return fee;
    }
@ -1959,17 +1979,25 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public Double getInsFee(List<WlyyInspectionDO> inspections) {
        DecimalFormat df = new DecimalFormat("#.00");
        Double fee = 0D;
        try {
            if (inspections != null && inspections.size() > 0) {
                for (WlyyInspectionDO ins : inspections) {
                    Double chargeAmount = Double.parseDouble(ins.getChargeAmount());
                    fee += chargeAmount * ins.getQuantity();
              /*      Double chargeAmount = Double.parseDouble(ins.getChargeAmount());
                    fee += chargeAmount * ins.getQuantity();*/
                    BigDecimal total = new BigDecimal(0);
                    BigDecimal quantity = new BigDecimal(ins.getChargeAmount());
                    BigDecimal price = new BigDecimal(ins.getQuantity());
                    total = total.add(quantity.multiply(price));
                    Double f1 = total.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
                    fee+=f1;
                }
            }
        } catch (Exception e) {
            logger.error("getInsFee:" + e.toString());
        }
        fee = Double.parseDouble(df.format(fee));
        return fee;
    }
@ -1980,6 +2008,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @return
     */
    public Double getChargeFee(String doctor) {
        DecimalFormat df = new DecimalFormat("#.00");
        Double fee = 0D;
        try {
            BaseDoctorDO doctorDO = baseDoctorDao.findById(doctor);
@ -1989,6 +2018,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            logger.error("getChargeFee:" + e.toString());
        }
        fee = Double.parseDouble(df.format(fee));
        return fee;
    }

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

@ -1,87 +1,49 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.org.BaseDoctorPatientFollowDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.consult.WlyyDoctorClinicRoomDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorOnlineTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.ylzinfo.OauthYlzConfigDO;
import com.yihu.jw.file_upload.FileUploadService;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.doctor.dao.DoctorWorkTimeDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.doctor.dao.WlyyDoctorOnlineTimeDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.*;
import com.yihu.jw.hospital.prescription.service.entrance.EntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BaseDoctorPatientFollowDao;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.pay.wx.WeChatConfig;
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.archive.ArchiveVO;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
import com.yihu.jw.restmodel.hospital.doctor.WlyyDoctorWorkTimeVO;
import com.yihu.jw.restmodel.hospital.prescription.*;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import com.ylzinfo.ehc.EhcHandler;
import com.ylzinfo.ehc.common.utils.DateUtils;
import com.ylzinfo.ehc.trans.TransRequest;
import com.ylzinfo.ehc.trans.TransResponse;
import jxl.write.*;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.Boolean;
import java.util.*;
@ -94,87 +56,57 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    private static final Logger logger = LoggerFactory.getLogger(YkyyPrescriptionService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private BasePatientMedicareCardDao basePatientMedicareCardDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private PrescriptionExpressageLogDao prescriptionExpressageLogDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private HospitalWaitingRoomDao hospitalWaitingRoomDao;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private BaseOrgDao baseOrgDao;
    @Autowired
    private EntranceService entranceService;
    @Autowired
    private PatientMappingService patientMappingService;
    @Autowired
    private DoctorMappingService doctorMappingService;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private WlyyChargeDictDao wlyyChargeDictDao;
    @Autowired
    private WlyyHospitalSysDictDao sysDictDao;
    @Autowired
    private DoctorWorkTimeDao doctorWorkTimeDao;
    @Autowired
    private PatientRegisterTimeDao patientRegisterTimeDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Autowired
    private WlyyDoctorClinicRoomDao wlyyDoctorClinicRoomDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private PrescriptionExpressageService sfexpressService;
    @Autowired
    private WlyyDoctorOnlineTimeDao wlyyDoctorOnlineTimeDao;
    @Autowired
    private OauthYlzConfigDao oauthYlzConfigDao;
    @Autowired
    private PatientRegisterDao patientRegisterDao;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private WlyyInspectionDao wlyyInspectionDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private SystemMessageService systemMessageService;
    @Autowired
    private HibenateUtils hibenateUtils;
    private YkyyEntranceService ykyyEntranceService;
    @Autowired
    private BaseDoctorPatientFollowDao baseOrgPatientDao;
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private WlyyHospitalWorkRuleDao wlyyHospitalWorkRuleDao;
    private WechatDao wechatDao;
    @Autowired
    private BaseDoctorInfoService baseDoctorService;
    private BasePatientWechatDao patientWechatDao;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private YkyyEntranceService ykyyEntranceService;
    @Value("${demo.flag}")
    private boolean demoFlag;
    /**
     * 获取居民就诊记录接口
     * @param patient
     * @param startTime
     * @param endTime
     * @param demoFlag
     * @return
     * @throws Exception
     */
    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag)throws Exception{
        logger.info("findOutpatientList patient:"+patient);
        String patNo =patientMappingService.findYkyyPatNoByPatient(patient);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
        logger.info("findOutpatientList patNo "+patNo);
        return ykyyEntranceService.BS30025(patNo,null,startTime,endTime,demoFlag);
    }
    /**
     * 发起图文和视频复诊
@ -371,6 +303,7 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
            JSONObject object = new JSONObject();
            object.put("supply_code",map.get("pydm"));
            object.put("supply_name",map.get("xmmc"));
            object.put("ypyf",map.get("ypyf"));
            array.add(object);
        }
        return array;
@ -455,4 +388,96 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        return array;
    }
    /**
     * 获取卡记录
     *  "PAT_NO": "P5616242-0  ",
     "CARD_NO": "D40136791",
     "CARD_STAT": "旧卡停用",
     "OP_DATE": "2011-09-27 15:35:57",
     "CARD_TYPE": "2",
     "CARD_TYPE_NAME": "社保卡",
     "social_no": "350211198411053024"
     * @param patient
     * @return
     * @throws Exception
     */
    public JSONArray findPatientCard(String patient)throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if (patientDO!=null){
            JSONArray res = ykyyEntranceService.findHisCard(patientDO.getIdcard());
            JSONArray rs = new JSONArray();
            if(res !=null){
                for (int i =0;i<res.size();i++){
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("PAT_NO",jsonObject.get("pat_no"));
                    jsonObject.put("CARD_NO",jsonObject.get("card_no"));
                    jsonObject.put("OP_DATE",jsonObject.get("op_date"));
                    jsonObject.put("CARD_STAT",jsonObject.get("card_stat"));
                    jsonObject.put("CARD_TYPE",jsonObject.get("card_type"));
                    jsonObject.put("CARD_TYPE_NAME",jsonObject.get("card_type_name"));
                }
            }
            return rs;
        }
        return null;
    }
    public JSONArray synYkICD10() throws Exception {
        JSONArray jsonArray = ykyyEntranceService.findIcd10();
        return jsonArray;
    }
    /**
     *
     * 处方下单
     *
     * @return
     * @throws Exception
     */
    public Map<String,Object> savePrescriptionOrder(String code,Double price,String wechatId) throws Exception {
        WxWechatDO wxWechatDO = wechatDao.findById(wechatId);
        Map<String,Object> map = new HashedMap();
        if(wxWechatDO==null){
            throw new Exception("can't find wechat:the wxId is "+wechatId);
        }
        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
        if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
            BusinessOrderDO businessOrderDO = new BusinessOrderDO();
            businessOrderDO.setCreateTime(new Date());
            businessOrderDO.setUpdateTime(new Date());
            businessOrderDO.setStatus(0);
            businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
            businessOrderDO.setUploadStatus(0);
            businessOrderDO.setPayType(1);
            businessOrderDO.setRelationCode(code);
            businessOrderDO.setRelationName("处方结算");
            businessOrderDO.setOrderCategory("4");
            businessOrderDO.setOrderType(4);
            businessOrderDO.setDoctor(wlyyPrescriptionDO.getDoctor());
            businessOrderDO.setPatient(wlyyPrescriptionDO.getPatientCode());
            businessOrderDO.setPatientName(wlyyPrescriptionDO.getPatientName());
            businessOrderDO.setPayPrice(wlyyPrescriptionDO.getDrugFee()*100);
            businessOrderDO.setDescription("处方结算");
            businessOrderDO = businessOrderDao.save(businessOrderDO);
            if (businessOrderDO!=null){
                List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
                String openId = "";
                if (patientWechatDos!=null&&patientWechatDos.size()!=0){
                    openId = patientWechatDos.get(0).getOpenid();
                }
                String url = wxWechatDO.getBaseUrl();
                String notifyUrl =url;
                String totalFee =businessOrderDO.getPayPrice().intValue()+"";
                map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, WeChatConfig.TRADE_TYPE_JSAPI,openId,businessOrderDO.getOrderNo(),notifyUrl);
            }
        }
        return map;
    }
}

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

@ -10,6 +10,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.dict.DictHospitalDeptDO;
import com.yihu.jw.entity.base.dict.DictIcd10DO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
@ -21,12 +22,16 @@ import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.dict.YkDictIcd10Dao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.entrance.util.ConvertUtil;
import com.yihu.jw.hospital.prescription.service.entrance.util.MqSdkUtil;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
@ -111,6 +116,9 @@ public class YkyyEntranceService {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private YkDictIcd10Dao ykDictIcd10Dao;
    public List<Map<String, Object>> createSQLQuery(String sql, Map<String, Object> params, Integer page, Integer size){
        return hibenateUtils.createSQLQuery(sql,params,page,size);
@ -120,6 +128,14 @@ public class YkyyEntranceService {
    public void save(Object object){
        hibenateUtils.save(object);
    }
    public void update(String id,Integer status){
        hibenateUtils.update(id,status);
    }
    public void updateBySql(String sql){
        hibenateUtils.updateBySql(sql);
    }
    /**
     * 同步科室信息
     * @return
@ -167,6 +183,88 @@ public class YkyyEntranceService {
        return "success";
    }
    /**
     * 患者门诊就诊记录
     * 使用时间查询的话,很可能会超时。时间没有索引,所以超时时间需要加长
     *
     * @param PAT_NO    居民唯一号 一个居民在该医院只有一个号,该接口必须输入的参数
     * @param conNo     就诊次数,使用居民唯一号+就诊次数获取唯一一条就诊记录
     *                  // *  @param admNo 就诊唯一号 每一次就诊都有一个唯一号:居民号+就诊次数,查询确定的一条就诊记录时需要传,否则传null
     *                  // *  @param registerSn 挂号流水号,查询确定的一条就诊记录时需要传,否则传null
     * @param startTime 开始时间 (查询一段时间内就诊记录开始时间,查询就诊记录列表时需要传,否则传null)
     * @param endTime   结束时间 (查询一段时间内就诊记录结束时间,查询就诊记录列表时需要传,否则传null)
     * @return
     * @throws Exception
     */
    public List<WlyyOutpatientVO> BS30025(String PAT_NO, String conNo, String startTime, String endTime, boolean demoFlag) throws Exception {
        String fid = "BS30025";
        logger.info("EntranceService " + fid + " PAT_NO :" + PAT_NO + " conNo:" + conNo + " startTime:" + startTime + " endTime:" + endTime);
        String resp = "";
        String orgCode = "350211A5004";
        String orgName = "厦门大学附属厦门眼科中心";
        //居民id转化
        PatientMappingDO patientMappingDO = patientMappingDao.findByMappingCodeAndSource(PAT_NO,"1");
        if(patientMappingDO == null){
            return null;
        }
        //查找眼科数据
        JSONArray jsonArray = findV_ZKSG_HZCX_HIS(patientMappingDO.getMappingCode(),conNo,startTime,endTime);
        if (jsonArray.size() == 0) {
            return null;
        }
//        String tmp = "{\"JZXH\":2395594,\"SFZH\":\"350203201411221635\",\"ZDMC\":\"结膜炎\",\"YSDM\":\"1785\",\"BRXZ\":\"医保\",\"JZKH\":\"DA6736810\",\"KDYS\":\"况坤\",\"KSDM\":112,\"BRID\":1175116,\"BRXM\":\"王竣皓\",\"SJHM\":null,\"KSSJ\":\"2020/04/28 20:56:34\",\"KSMC\":\"眼整形专科\"}";
//        JSONArray jsonArray = new JSONArray();
//        jsonArray.add(JSONObject.parse(tmp));
        List<WlyyOutpatientVO> wlyyOutpatientVOS = new ArrayList<>();
        WlyyOutpatientVO wlyyOutpatientVO;
        for (int i = 0; i < jsonArray.size(); i++) {
            JSONObject jsonObjectMgsInfo = jsonArray.getJSONObject(i);
            if (null != jsonObjectMgsInfo) {
                wlyyOutpatientVO = new WlyyOutpatientVO();
                wlyyOutpatientVO.setHospital(orgCode);
                wlyyOutpatientVO.setHospitalName(orgName);
                wlyyOutpatientVO.setWinNo("6");
                wlyyOutpatientVO.setAdmNo(null == jsonObjectMgsInfo.get("JZXH") ? "" : jsonObjectMgsInfo.get("JZXH") + "");
                //wlyyOutpatientVO.setRegisterNo(null == jsonObjectMgsInfo.get("REGISTER_SN") ? "" : jsonObjectMgsInfo.get("REGISTER_SN") + "");
                wlyyOutpatientVO.setDept(null == jsonObjectMgsInfo.get("KSDM") ? "" : jsonObjectMgsInfo.get("KSDM") + "");
                wlyyOutpatientVO.setDeptName(null == jsonObjectMgsInfo.get("KSMC") ? "" : jsonObjectMgsInfo.get("KSMC") + "");
                wlyyOutpatientVO.setPatient(patientMappingDO.getPatient());
                wlyyOutpatientVO.setPatientName(patientMappingDO.getPatientName());
                wlyyOutpatientVO.setConNo(null == jsonObjectMgsInfo.get("JZXH") ? "" : jsonObjectMgsInfo.get("JZXH") + "");
                String doctor = null == jsonObjectMgsInfo.get("YSDM") ? "" : jsonObjectMgsInfo.get("YSDM") + "";
                //转化医生
                String mappingCode = doctor.trim();
                String doctorCode = "";
                if (StringUtils.isNotBlank(mappingCode)) {
                    List<DoctorMappingDO> mappingDOs = doctorMappingDao.findByOrgCodeAndMappingCode(orgCode, mappingCode);
                    if (mappingDOs != null && mappingDOs.size() > 0) {
                        doctorCode = mappingDOs.get(0).getDoctor();
                    }
                }
                wlyyOutpatientVO.setDoctor(doctorCode);
                wlyyOutpatientVO.setDoctorName(null == jsonObjectMgsInfo.get("KDYS") ? "" : jsonObjectMgsInfo.get("KDYS") + "");
//                wlyyOutpatientVO.setMjz(null == jsonObjectMgsInfo.get("MJZ") ? "" : jsonObjectMgsInfo.get("MJZ") + "");
                String icdName = null == jsonObjectMgsInfo.get("ZDMC") ? "" : jsonObjectMgsInfo.get("ZDMC") + "";
//                wlyyOutpatientVO.setIcd10(icdcodes);
                wlyyOutpatientVO.setIcd10Name(icdName);
                String admDate = null == jsonObjectMgsInfo.get("KSSJ") ? "" : jsonObjectMgsInfo.get("KSSJ") + "";
                String conDate = null == jsonObjectMgsInfo.get("KSSJ") ? "" : jsonObjectMgsInfo.get("KSSJ") + "";
                wlyyOutpatientVO.setAdmDate(DateUtil.strToDate(admDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
                wlyyOutpatientVO.setConDate(DateUtil.strToDate(conDate, DateUtil.YYYY_MM_DD_HH_MM_SS_));
                wlyyOutpatientVOS.add(wlyyOutpatientVO);
            }
        }
        return wlyyOutpatientVOS;
    }
    /**
     * 查找眼科his 已审核未付款的处方
     * @throws Exception
@ -186,6 +284,38 @@ public class YkyyEntranceService {
        return new JSONArray();
    }
    /**
     * HIS就诊患者历史查询
     * @throws Exception
     */
    public JSONArray findV_ZKSG_HZCX_HIS(String brid,String conNo,String startTime,String endTime) throws Exception{
        String sql = "SELECT to_char(h.KSSJ ,'yyyy/MM/dd hh24:mi:ss' ) as KSSJ,h.BRID,h.BRXM,h.SJHM,h.JZKH,h.SFZH,h.BRXZ,h.YSDM,h.KDYS" +
                ",h.KSDM,h.KSMC,h.ZDMC,h.JZXH from V_ZKSG_HZCX_HIS h WHERE h.BRID = "+brid+" ";
        if(!StringUtil.isBlank(conNo)){
            sql += " and h.JZXH = " + conNo;
        }
        if(!StringUtil.isBlank(startTime)){
            sql += " and h.KSSJ >= to_date('"+startTime+"', 'YYYY-MM-DD HH24:MI:SS')";
        }
        if(!StringUtil.isBlank(endTime)){
            sql += " and h.KSSJ <= to_date('"+endTime+"', 'YYYY-MM-DD HH24:MI:SS')";
        }
        sql += " order by h.KSSJ desc";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            return rs.getJSONArray("detailModelList");
        }
        return new JSONArray();
    }
    public String updateYkyyDoctor()throws Exception{
        String sql ="select y.code AS \"code\",y.name AS \"name\",y.expertise AS \"expertise\",y.introduce AS \"introduce\",y.mobile AS \"mobile\",y.idCard AS \"idcard\",y.jobtitlecode AS \"jobTitleCode\",y.jobTitleName AS \"jobTitleName\",y.dept AS \"dept\",y.deptName AS \"deptName\" from v_Hlw_Ysxx y where y.idcard is not null";
        Map<String,Object> params = new HashedMap();
@ -763,6 +893,96 @@ public class YkyyEntranceService {
    }
    /**
     * 获取his病人信息
     * @param idcard
     * @return
     * @throws Exception
     */
    public JSONArray findHisPatient(String idcard) throws Exception {
        String sql = "SELECT\n" +
                "\tx.brid AS \"brid\",\n" +
                "\tx.mzhm AS \"mzhm\",\n" +
                "\tx.brxm AS \"brxm\",\n" +
                "\tx.sfzh AS \"sfzh\",\n" +
                "\tx.brxz AS \"brxz\",\n" +
                "\tx.brxb AS \"brxb\",\n" +
                "\tx.csny as \"csny\",\n" +
                "\tx.jzkh AS \"jzkh\",\n" +
                "\tx.jdsj AS \"jdsj\",\n" +
                "\tx.sjhm AS \"sjhm\",\n" +
                "\tx.fzxmc AS \"fzxmc\",\n" +
                "\tx.gzztmc AS \"gzztmc\",\n" +
                "\tx.lxdz AS \"lxdz\"\n" +
                "FROM\n" +
                "\tV_ZKSG_BRCX x\n" +
                "WHERE\n" +
                "\tsfzh.sfzh = '"+idcard+"' ";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    /**
     * 获取his就诊卡号
     * @param idcard
     * @return
     * @throws Exception
     */
    public JSONArray findHisCard(String idcard) throws Exception {
        String sql = "select o.pat_no as \"pat_no\",o.card_no as \"card_no\",o.card_stat as \"card_stat\",o.op_date as \"op_date\",o.card_type as \"card_type\",o.card_type_name as \"card_type_name\" from v_zksg_brcx x,V_HLW_CARDINFO o where  o.pat_no = x.mzhm and x.sfzh = '"+idcard+"'";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
        }
        return array;
    }
    public JSONArray findIcd10() throws Exception {
        String sql = "select i.code as \"code\",i.name as \"name\",i.disea_reason as \"disea_reason\",i.death_reason as \"death_reason\",i.py_code as \"py_code\",i.flag as \"flag\",i.add_code as \"add_code\",i.emr as \"emr\" from v_hlw_icd10 i";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ICD10:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        logger.info("response:"+content);
        JSONObject rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if (status==200){
            array = rs.getJSONArray("detailModelList");
            ykDictIcd10Dao.deleteAll();
            for (int i=0;i<array.size();i++){
                JSONObject object = array.getJSONObject(i);
                DictIcd10DO dictIcd10DO = new DictIcd10DO();
                dictIcd10DO.setCode(object.getString("code"));
                dictIcd10DO.setName(object.getString("name"));
                ykDictIcd10Dao.save(dictIcd10DO);
            }
        }
        return array;
    }
@ -781,100 +1001,145 @@ public class YkyyEntranceService {
                wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
            }
            prescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
            synPrecriptionHis(prescriptionVO);
            synPrecriptionHis(prescriptionVO,code);
        }
        return wlyyPrescriptionDOs.toString();
    }
    public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO) throws Exception {
    public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception {
        HlwCf01DO hlwCf01DO = new HlwCf01DO();
        logger.info("开始===================");
        if (wlyyPrescriptionVO!=null){
            hlwCf01DO.setSPZT(0);
            hlwCf01DO.setFKZT(wlyyPrescriptionVO.getPayStatus());
            hlwCf01DO.setYFSB(3);
            hlwCf01DO.setCFLX(wlyyPrescriptionVO.getType());
            hlwCf01DO.setKFRQ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
            hlwCf01DO.setZFPB(1);
            hlwCf01DO.setFYBZ(0);
            hlwCf01DO.setPYBZ(0);
            hlwCf01DO.setDJYBZ(0);
            hlwCf01DO.setCFTS(1);
            hlwCf01DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
            hlwCf01DO.setYXPB(1);
            hlwCf01DO.setSCDDH(wlyyPrescriptionVO.getOrderNo());
            String patient = wlyyPrescriptionVO.getPatientCode();
            PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
            hlwCf01DO.setBRID(Integer.parseInt(patientMappingDO.getMappingCode()));
            hlwCf01DO.setBRXM(wlyyPrescriptionVO.getPatientName());
            hlwCf01DO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
            String doctor = wlyyPrescriptionVO.getDoctor();
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
            hlwCf01DO.setYSDM(doctorMappingDO.getMappingCode());
            hlwCf01DO.setJZKH(wlyyPrescriptionVO.getSsc());
            hlwCf01DO.setGUID(getCode());
           /* hibenateUtils.save(hlwCf01DO);*/
            String jsonString = JSONObject.toJSONString(hlwCf01DO);
            Map<String,Object> params = new HashedMap();
            params.put("json",jsonString);
            params.put("table","HLW_CF01");
            logger.info("HLW_CF01:"+jsonString);
            HttpResponse response = HttpUtils.doGet(saveUrl,params);
            if (response.getStatus()==200){
                logger.info("表HLW_CF01同步成功!");
            }else {
                logger.info("表HLW_CF01同步失败!"+response.getErrorMsg());
            }
            logger.info("处方:"+wlyyPrescriptionVO);
            List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
            for (WlyyPrescriptionInfoVO wlyyPrescriptionInfoVO:wlyyPrescriptionInfoVOS){
                try {
                    logger.info("chufang1============");
                HlwCf02DO hlwCf02DO = new HlwCf02DO();
                hlwCf02DO.setCFSB(Integer.parseInt(wlyyPrescriptionVO.getRealOrder()));
                hlwCf02DO.setYPXH(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugNo()));
                logger.info("drugNo"+hlwCf02DO.getYPXH());
                hlwCf02DO.setYPCD(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugPlace()));
                hlwCf02DO.setXMLX(1);
                hlwCf02DO.setCFTS(1);
                hlwCf02DO.setYPSL(Double.parseDouble(wlyyPrescriptionInfoVO.getQuantity()));
                hlwCf02DO.setYPDJ(wlyyPrescriptionInfoVO.getPackRetprice());
                hlwCf02DO.setHJJE(Integer.parseInt(wlyyPrescriptionInfoVO.getQuantity())*wlyyPrescriptionInfoVO.getPackRetprice());//划价价额
                hlwCf02DO.setYPZS(1);//药品组数  待确定
                hlwCf02DO.setYCSL("0");
                hlwCf02DO.setFYGB(17);//费用归并
                hlwCf02DO.setZFBL(1.0);//自负比例
                hlwCf02DO.setYFDW(wlyyPrescriptionInfoVO.getPackUnitName());
                hlwCf02DO.setMRCS(Integer.parseInt(wlyyPrescriptionInfoVO.getDosage()));//每日次数
                hlwCf02DO.setYFBZ(wlyyPrescriptionInfoVO.getPackQuantity());
                hlwCf02DO.setYPYF(wlyyPrescriptionInfoVO.getUsageCode());
                /*hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));*/
                hlwCf02DO.setYFGG(wlyyPrescriptionInfoVO.getSpecification());
              /*  hibenateUtils.save(hlwCf02DO);*/
                String jsonString1 = JSONObject.toJSONString(hlwCf02DO);
                    logger.info("chufang2============");
                Map<String,Object> params1 = new HashedMap();
                params1.put("json",jsonString1);
                params1.put("table","HLW_CF02");
                logger.info("HLW_CF02:"+jsonString1);
                HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
                if (response1.getStatus()==200){
                    logger.info("表HLW_CF02同步成功!");
            try {
                hlwCf01DO.setSPZT(0);
                hlwCf01DO.setFKZT(wlyyPrescriptionVO.getPayStatus());
                hlwCf01DO.setYFSB(3);
                hlwCf01DO.setCFLX(wlyyPrescriptionVO.getType());
                hlwCf01DO.setKFRQ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
                hlwCf01DO.setZFPB(0);
                hlwCf01DO.setFYBZ(0);
                hlwCf01DO.setPYBZ(0);
                hlwCf01DO.setDJYBZ(0);
                hlwCf01DO.setCFTS(1);
                hlwCf01DO.setYXPB(1);
                hlwCf01DO.setDYBZ(0);
                hlwCf01DO.setTSCF(0);
                hlwCf01DO.setTYBZ(0);
                hlwCf01DO.setTSLX(6);
                hlwCf01DO.setCFBZ(0);
                hlwCf01DO.setJZXH(0);
                hlwCf01DO.setYXPB(0);
                hlwCf01DO.setLSCFBZ(0);
                hlwCf01DO.setZJFLAG(0);
                hlwCf01DO.setLSCFBZ(0);
                hlwCf01DO.setZJFLAG(0);
                hlwCf01DO.setFKZT(1);
                hlwCf01DO.setSCDDH(wlyyPrescriptionVO.getOrderNo());
                String patient = wlyyPrescriptionVO.getPatientCode();
                PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
                hlwCf01DO.setBRID(Integer.parseInt(patientMappingDO.getMappingCode()));
                hlwCf01DO.setBRXM(wlyyPrescriptionVO.getPatientName());
                hlwCf01DO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
                String doctor = wlyyPrescriptionVO.getDoctor();
                DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(doctor);
                hlwCf01DO.setYSDM(doctorMappingDO.getMappingCode());
                hlwCf01DO.setJZKH(wlyyPrescriptionVO.getSsc());
                hlwCf01DO.setGUID(getCode());
                hlwCf01DO.setSJLY(1);
                hlwCf01DO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
               /* hibenateUtils.save(hlwCf01DO);*/
                String jsonString = JSONObject.toJSONString(hlwCf01DO);
                Map<String,Object> params = new HashedMap();
                params.put("json",jsonString);
                params.put("table","HLW_CF01");
                logger.info("HLW_CF01:"+jsonString);
                HttpResponse response = HttpUtils.doGet(saveUrl,params);
                String cfsb = "";
                if (response.getStatus()==200){
                    logger.info("content"+response.getContent());
                    String content = response.getContent();
                    JSONObject jsonObject = JSONObject.parseObject(content);
                    JSONObject object = jsonObject.getJSONObject("obj");
                    if (object!=null){
                        cfsb = object.getString("cfsb");
                        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
                        if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                            wlyyPrescriptionDO.setRealOrder(cfsb);
                            wlyyPrescriptionVO.setRealOrder(cfsb);
                            prescriptionDao.save(wlyyPrescriptionDO);
                        }
                    }
                    logger.info("表HLW_CF01同步成功!");
                }else {
                    logger.info("表HLW_CF02同步失败!"+response1.getErrorMsg());
                    logger.info("表HLW_CF01同步失败!"+response.getErrorMsg());
                }
                logger.info("处方:"+wlyyPrescriptionVO);
                if (!StringUtils.isNoneBlank(cfsb)){
                    throw new Exception("添加失败");
                }
                }catch (Exception e){
                    e.printStackTrace();
                    e.getMessage();
                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
                for (WlyyPrescriptionInfoVO wlyyPrescriptionInfoVO:wlyyPrescriptionInfoVOS){
                    try {
                        logger.info("chufang1============");
                    HlwCf02DO hlwCf02DO = new HlwCf02DO();
                    hlwCf02DO.setCFSB(Integer.parseInt(cfsb));
                    hlwCf02DO.setYPXH(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugNo()));
                    logger.info("drugNo"+hlwCf02DO.getYPXH());
                    hlwCf02DO.setYPCD(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugPlace()));
                    hlwCf02DO.setXMLX(1);
                    hlwCf02DO.setCFTS(1);
                    hlwCf02DO.setYPSL(Double.parseDouble(wlyyPrescriptionInfoVO.getQuantity()));
                    hlwCf02DO.setYPDJ(wlyyPrescriptionInfoVO.getPackRetprice());
                    hlwCf02DO.setHJJE(Integer.parseInt(wlyyPrescriptionInfoVO.getQuantity())*wlyyPrescriptionInfoVO.getPackRetprice());//划价价额
                    hlwCf02DO.setYPZS(1);//药品组数  待确定
                    hlwCf02DO.setYCSL("0");
                    hlwCf02DO.setFYGB(17);//费用归并
                    hlwCf02DO.setZFBL(1.0);//自负比例
                    hlwCf02DO.setYFDW(wlyyPrescriptionInfoVO.getPackUnitName());
                    hlwCf02DO.setMRCS(Integer.parseInt(wlyyPrescriptionInfoVO.getDosage()));//每日次数
                    hlwCf02DO.setYFBZ(wlyyPrescriptionInfoVO.getPackQuantity());
                    hlwCf02DO.setYPYF(wlyyPrescriptionInfoVO.getUsageCode());
                    hlwCf02DO.setGYTJ(wlyyPrescriptionInfoVO.getYpyf());
                    hlwCf02DO.setPSPB(0);
                    hlwCf02DO.setYYTS(1);
                    /*hlwCf02DO.setYPZH(Integer.parseInt(wlyyPrescriptionInfoVO.getFrequency()));*/
                    hlwCf02DO.setYFGG(wlyyPrescriptionInfoVO.getSpecification());
                  /*  hibenateUtils.save(hlwCf02DO);*/
                    String jsonString1 = JSONObject.toJSONString(hlwCf02DO);
                        logger.info("chufang2============");
                    Map<String,Object> params1 = new HashedMap();
                    params1.put("json",jsonString1);
                    params1.put("table","HLW_CF02");
                    logger.info("HLW_CF02:"+jsonString1);
                    HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
                    if (response1.getStatus()==200){
                        logger.info("表HLW_CF02同步成功!");
                    }else {
                        logger.info("表HLW_CF02同步失败!"+response1.getErrorMsg());
                    }
                    }catch (Exception e){
                        e.printStackTrace();
                        e.getMessage();
                    }
                }
            }catch (Exception e){
                e.printStackTrace();
            }
        }
        return null;
    }
    public String getCode() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
}

+ 20 - 1
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -11,11 +11,13 @@ import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.entity.order.BusinessOrderRefundDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.order.dao.BusinessOrderRefundDao;
@ -72,6 +74,9 @@ public class BusinessOrderService {
    private ConsultOrderDao consultOrderDao;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
@ -84,7 +89,7 @@ public class BusinessOrderService {
        businessOrderDO.setCreateTime(new Date());
        businessOrderDO.setUpdateTime(new Date());
        businessOrderDO.setStatus(0);
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis());
        businessOrderDO.setOrderNo("VAS"+businessOrderDO.getOrderType()+System.currentTimeMillis()+(int)(Math.random()*900)+100);
        businessOrderDO.setUploadStatus(0);
        businessOrderDO.setPayType(1);
        if (businessOrderDO.getOrderCategory().equalsIgnoreCase("1")){
@ -479,6 +484,13 @@ public class BusinessOrderService {
                    WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(businessOrderDO.getRelationCode());
                    wlyyOutpatientDO.setPayStatus(1);
                    outpatientDao.save(wlyyOutpatientDO);
                }else if (businessOrderDO.getOrderCategory().equalsIgnoreCase("4")){
                    List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(businessOrderDO.getRelationCode());
                    if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                        WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                        wlyyPrescriptionDO.setPayStatus(1);
                        prescriptionDao.save(wlyyPrescriptionDO);
                    }
                }
            }
            ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),businessOrderDO.getStatus().toString());
@ -535,4 +547,11 @@ public class BusinessOrderService {
        return response;
    }
    public PrescriptionDao getPrescriptionDao() {
        return prescriptionDao;
    }
    public void setPrescriptionDao(PrescriptionDao prescriptionDao) {
        this.prescriptionDao = prescriptionDao;
    }
}

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

@ -1,5 +1,8 @@
package com.yihu.jw.utils.hibernate;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.prescription.HlwCf01DO;
import com.yihu.jw.entity.hospital.prescription.HlwCf02DO;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
import org.hibernate.Transaction;
@ -156,6 +159,11 @@ public class HibenateUtils {
        }
    }
    public void updateBySql(String sql){
        Session session = (Session) entityManager.getDelegate();
        session.createSQLQuery(sql).executeUpdate();
    }
    public void save(Object object) {
        Session session = (Session) entityManager.getDelegate();
@ -165,4 +173,20 @@ public class HibenateUtils {
        transaction.commit();
    }
    /**
     * 更新
     * @param entity
     */
    public void update(Object entity){
        entityManager.merge(entity);
        entityManager.flush();
    }
    public void update(String id,Integer status){
        HlwCf01DO hlwCf01DO = entityManager.find(HlwCf01DO.class,id);
        hlwCf01DO.setFKZT(status);
        update(hlwCf01DO);
    }
}

+ 10 - 10
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -22,6 +22,8 @@ import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import com.yihu.jw.wechat.dao.WxTemplateDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@ -134,11 +136,6 @@ public class WxTemplateService {
        if("xm_ykyy_wx".equals(wechatId)){
            //获取已审核未结算的处方
            JSONArray array = ykyyEntranceService.getUnsettledPrescription();
//            JSONArray array = new JSONArray();
//            JSONObject tmpjson = new JSONObject();
//            tmpjson.put("BRID","1234");
//            tmpjson.put("CFSB","1159744");
//            array.add(tmpjson);
            //发送模板
            if(array!=null&&array.size()>0) {
                for (int i = 0; i<array.size(); i++){
@ -168,11 +165,14 @@ public class WxTemplateService {
                                }else{
                                    ps.stream().forEach(one->{
                                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_unsettled_notice","djsxxtz",1);
                                        config.setFirst(config.getFirst().replace("key1",patientDO.getName()));
                                        config.setUrl(config.getUrl()+""+outpatientId+"&openid="+one.getOpenid());
                                        config.setKeyword3(doctorName);
                                        WxTemplateConfigDO newConfig = new WxTemplateConfigDO();
                                        BeanUtils.copyProperties(config,newConfig);
                                        newConfig.setFirst(config.getFirst().replace("key1",patientDO.getName()));
                                        newConfig.setUrl(config.getUrl()+""+outpatientId);
                                        newConfig.setKeyword3(doctorName);
                                        WxAccessTokenDO wxAccessTokenDO = wxAccessTokenService.getWxAccessTokenById(wechatId);
                                        weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(),one.getOpenid(),config);
                                        logger.info("=======setUrl========"+newConfig.getUrl());
                                        weixinMessagePushUtils.putWxMsg(wxAccessTokenDO.getAccessToken(),one.getOpenid(),newConfig);
                                    });
                                    //保存发送模板记录,
                                    WxPushLogDO wxPushLogDO = new WxPushLogDO();
@ -271,7 +271,7 @@ public class WxTemplateService {
            }else{
                for (BasePatientWechatDo basePatientWechatDo:ps){
                        WxTemplateConfigDO config = wxTemplateConfigDao.findByWechatIdAndTemplateNameAndSceneAndStatus(wechatId,"template_im_notice","zxtx",1);
                        config.setFirst(config.getFirst().replace("key1",senderName));
                        config.setFirst(config.getFirst().replace("key1",userName));
                        config.setKeyword1(contentString);
                        config.setKeyword2(DateUtil.dateToStrLong(new Date()));
                        config.setUrl(url);

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/HlwCf01DO.java

@ -63,6 +63,7 @@ public class HlwCf01DO {
    private Integer fKZT;//	NUMBER(1)	Y	0		0 未付款  1付款
    private String sPGH;//	VARCHAR2(10)	Y			审批工号
    private String gUID;//
    private Integer sJLY;//1互联网
    @Basic
    @Id
@ -558,4 +559,13 @@ public class HlwCf01DO {
    public void setGUID(String gUID) {
        this.gUID = gUID;
    }
    @Column(name = "SJLY")
    public Integer getSJLY() {
        return sJLY;
    }
    public void setSJLY(Integer sJLY) {
        this.sJLY = sJLY;
    }
}

+ 14 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPrescriptionInfoDO.java

@ -147,6 +147,11 @@ public class WlyyPrescriptionInfoDO extends UuidIdentityEntity {
     */
    private Integer packQuantity;
    /**
     * 用法id
     */
    private Integer ypyf;
    @Column(name = "prescription_id")
    public String getPrescriptionId() {
@ -370,4 +375,13 @@ public class WlyyPrescriptionInfoDO extends UuidIdentityEntity {
    public void setPackQuantity(Integer packQuantity) {
        this.packQuantity = packQuantity;
    }
    @Column(name = "ypyf")
    public Integer getYpyf() {
        return ypyf;
    }
    public void setYpyf(Integer ypyf) {
        this.ypyf = ypyf;
    }
}

+ 85 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/platform/IotShareInterfaceDO.java

@ -0,0 +1,85 @@
package com.yihu.jw.entity.iot.platform;
import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/4/28
 */
@Entity
@Table(name = "iot_share_interface")
public class IotShareInterfaceDO extends UuidIdentityEntityWithOperator implements Serializable {
    @Column(name = "saas_id")
    private String saasId;
    @Column(name = "method_name")
    private String methodName;//方法名
    @Column(name = "interface_name")
    private String interfaceName;//接口名称
    @Column(name = "type_name")
    private String typeName;//业务类型名称
    @Column(name = "explanation")
    private String explanation;//说明
    @Column(name = "del")
    private String del;//是否删除 1:删除  0:不删除
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getMethodName() {
        return methodName;
    }
    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }
    public String getInterfaceName() {
        return interfaceName;
    }
    public void setInterfaceName(String interfaceName) {
        this.interfaceName = interfaceName;
    }
    public String getTypeName() {
        return typeName;
    }
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
    public String getExplanation() {
        return explanation;
    }
    public void setExplanation(String explanation) {
        this.explanation = explanation;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

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

@ -62,6 +62,17 @@ public class BaseHospitalRequestMapping {
         */
        public static final String findPatientCard = "/findPatientCard";
        /**
         * 查询患者就诊卡
         */
        public static final String prescriptionPay = "/prescriptionPay";
        /**
         * 查询患者就诊卡
         */
        public static final String synYkIcd10 = "/synYkIcd10";
        /**
         * 判断是否可用发起门诊
         */

+ 18 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -22,6 +22,7 @@ public class IotRequestMapping {
        public static final String patientDevice = api_iot_common + "/patientDevice";
        public static final String wlyy = api_iot_common + "/wlyy";
        public static final String figereLabel = api_iot_common + "/figereLabel";
        public static final String platform = api_iot_common + "/platform";
        public static final String hospital = api_iot_common + "/hospital";
@ -74,6 +75,7 @@ public class IotRequestMapping {
        public static final String auditCompanyNoPass = "auditCompanyNoPass";
        public static final String findAll = "findAll";
        public static final String enterType = "enterType";
        public static final String conditionQueryPage = "conditionQueryPage";
        public static final String findCompanyCertPage = "findCompanyCertPage";
        public static final String findCompanyCertById = "findCompanyCertById";
@ -286,6 +288,22 @@ public class IotRequestMapping {
    }
    /**
     * 居民标签信息模块常量
     */
    public static class  Platform{
        public static final String addInterface ="addInterface";
        public static final String editInterface ="editInterface";
        public static final String findInterfaceById ="findInterfaceById";
        public static final String findAll ="findAll";
        public static final String conditionQueryPage ="conditionQueryPage";
        public static final String message_success_add = "add success";
        public static final String message_success_edit = "edit success";
        public static final String message_success_find = "find success";
    }
    /**
     * 单位模块常量
     */

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

@ -149,6 +149,9 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    @ApiModelProperty(value = "药房包装", example = "药房包装")
    private Integer packQuantity;
    @ApiModelProperty(value = "给药途径", example = "给药途径")
    private Integer ypyf;
    private String comm;
@ -349,4 +352,12 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
    public void setPackQuantity(Integer packQuantity) {
        this.packQuantity = packQuantity;
    }
    public Integer getYpyf() {
        return ypyf;
    }
    public void setYpyf(Integer ypyf) {
        this.ypyf = ypyf;
    }
}

+ 9 - 7
common/common-util/src/main/java/com/yihu/jw/util/common/FileUtil.java

@ -5,6 +5,7 @@ import com.yihu.fastdfs.FastDFSUtil;
import it.sauronsoftware.jave.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.FileInputStream;
@ -15,10 +16,11 @@ import java.io.InputStream;
 * 文件处理工具类
 * @author huangwenjie
 */
@Component
public class FileUtil {
	
	@Autowired
	private FastDFSUtil fastDFSHelper;
	public FastDFSUtil fastDFSHelper;
	
	public void changeToMp3(String sourcePath, String targetPath) {
		File source = new File(sourcePath);
@ -49,18 +51,19 @@ public class FileUtil {
	 */
	
	
	public String copyTempVoice(String voices_Path,String fastdfs_file_url) throws Exception {
	public  String copyTempVoice(String voices_Path,String fastdfs_file_url) throws Exception {
		// 文件保存的临时路径
		FastDFSUtil fastDFSUtil = new FastDFSUtil();
		String fileUrls = "";
		File f = new File(voices_Path);
		if (f.exists()) {
			String fileName = f.getName();
			InputStream in = new FileInputStream(f);
			ObjectNode result = fastDFSUtil.upload(in, fileName.substring(fileName.lastIndexOf(".") + 1), "");
			//得到文件类型
			String fileType = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
			ObjectNode result = fastDFSHelper.upload(in, fileType, "");
			in.close();
			if (result != null) {
				fileUrls += (StringUtils.isEmpty(fileUrls) ? "" : ",") + fastdfs_file_url
				fileUrls += (StringUtils.isEmpty(fileUrls) ? "" : ",")
						+ result.get("groupName").toString().replaceAll("\"", "") + "/"
						+ result.get("remoteFileName").toString().replaceAll("\"", "");
				f.delete();
@ -79,7 +82,6 @@ public class FileUtil {
	public String copyTempImage(String files,String tempPath) throws Exception {
		// 文件保存的临时路径
		String[] fileArray = files.split(",");
		FastDFSUtil fastDFSUtil = new FastDFSUtil();
		String fileUrls = "";
		for (String file : fileArray) {
			File f = new File(tempPath + file);
@ -87,7 +89,7 @@ public class FileUtil {
			if (f.exists()) {
				String fileName = f.getName();
				InputStream in = new FileInputStream(f);
				ObjectNode result = fastDFSUtil.upload(in, fileName.substring(fileName.lastIndexOf(".") + 1), "");
				ObjectNode result = fastDFSHelper.upload(in, fileName.substring(fileName.lastIndexOf(".") + 1), "");
				in.close();
				if (result != null) {
					//1.3.7去掉前缀

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

@ -11,8 +11,10 @@ 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.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -47,6 +49,8 @@ public class YkyyController extends EnvelopRestEndpoint {
    
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private HibenateUtils hibenateUtils;
    @GetMapping(value = "/createSQLQuery")
    @ApiOperation(value = "视图统一查询")
@ -62,17 +66,61 @@ public class YkyyController extends EnvelopRestEndpoint {
    }
    @GetMapping(value = "/update")
    @ApiOperation(value = "更新支付")
    public ObjEnvelop udapte(@ApiParam(name = "id", value = "sql语句", required = true)
                                      @RequestParam(value = "id",required = true)String id,
                                      @ApiParam(name = "status", value = "状态", required = true)
                                      @RequestParam(value = "status",required = false)Integer status){
        ObjEnvelop envelop = new ObjEnvelop();
        ykyyEntranceService.update(id,status);
        return success(envelop);
    }
    @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();
        ykyyEntranceService.updateBySql(sql);
        return success(envelop);
    }
    @GetMapping(value = "/save")
    @ApiOperation(value = "视图统一查询")
    public Envelop save(@ApiParam(name = "json", value = "json", required = true)
    @ApiOperation(value = "保存01和02表")
    public ObjEnvelop save(@ApiParam(name = "json", value = "json", required = true)
                                      @RequestParam(value = "json",required = true)String json,
                        @ApiParam(name = "table", value = "table", required = true)
                           @ApiParam(name = "table", value = "table", required = true)
                        @RequestParam(value = "table",required = true)String table) throws IOException {
        Envelop envelop = new Envelop();
        ObjEnvelop envelop = new ObjEnvelop();
        JSONObject object = JSONObject.parseObject(json);
        if (table.equalsIgnoreCase("HLW_CF01")){
            HlwCf01DO hlwCf01VO =  JSONObject.toJavaObject(object,HlwCf01DO.class);
            String cfsbSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_CF01'";
            String cfhmSql="select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_CF01_CFHM'";
            List<Map<String,Object>> cfsbList = hibenateUtils.createSQLQuery(cfsbSql);
            List<Map<String,Object>> cfhmList = hibenateUtils.createSQLQuery(cfhmSql);
            Long cfsb = 0L;
            Long cfhm = 0L;
            if (cfsbList!=null&&cfsbList.size()!=0){
                cfsb = Long.parseLong(cfsbList.get(0).get("total").toString());
            }
            if (cfhmList!=null&&cfhmList.size()!=0){
                cfhm = Long.parseLong(cfhmList.get(0).get("total").toString());
            }
            hlwCf01VO.setCFSB(cfsb.intValue());
            hlwCf01VO.setCFHM(cfhm+"");
            JSONObject object1 = new JSONObject();
            object1.put("cfsb",cfsb);
            object1.put("cfhm",cfhm);
            ykyyEntranceService.save(hlwCf01VO);
            envelop.setObj(object1);
        }else if (table.equalsIgnoreCase("HLW_CF02")){
            HlwCf02DO hlwCf01VO =  JSONObject.toJavaObject(object,HlwCf02DO.class);
            ykyyEntranceService.save(hlwCf01VO);

+ 2 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/ykyy/UnSettledHISPrescriptionJob.java

@ -7,6 +7,7 @@ import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.job.DataUploadJob;
import com.yihu.jw.util.wechat.WeiXinMessageUtils;
import com.yihu.jw.wechat.service.WxTemplateService;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@ -20,6 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 *
 * @author yeshijie.
 */
@DisallowConcurrentExecution
public class UnSettledHISPrescriptionJob implements Job{
    private static final Logger logger = LoggerFactory.getLogger(UnSettledHISPrescriptionJob.class);

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

@ -16,17 +16,14 @@ import com.yihu.jw.im.service.ImService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.restmodel.im.ConsultVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
import com.yihu.jw.util.common.FileUtil;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.jw.wechat.enterprise.EnterpriseService;
import com.yihu.jw.wechat.service.WechatInfoService;
@ -92,8 +89,6 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Autowired
	private BusinessOrderService businessOrderService;
	
	public FileUtil fileUtil;
	
	@Value("${fastDFS.fastdfs_file_url}")
	private String fastdfs_file_url;
	
@ -109,6 +104,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	@Value("${wechat.id}")
	private String wxId;
	
	@Autowired
	private FileUtil fileUtil;
	
	@GetMapping(value = BaseHospitalRequestMapping.PatientIM.records)
	@ApiOperation(value = "患者咨询记录查询")
	public Envelop records(

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

@ -48,36 +48,25 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private YkyyPrescriptionService prescriptionService;
    @Autowired
    private WlyyBusinessService wlyyBusinessService;
    @Autowired
    private PrescriptionLogService prescriptionLogService;
    @Autowired
    private InspectionService inspectionService;
    @Autowired
    private DoctorPreSignService doctorPreSignService;
    
    @Autowired
    private HospitalSystemMessageService hospitalSystemMessageService;
    @Autowired
    private WorkTimeService workTimeService;
    
    @Autowired
    private ImService imService;
    
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${wechat.id}")
    private String wxId;
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientList)
    @ApiOperation(value = " 查询某个时间段的患者门诊就诊记录")
    public ListEnvelop findOutpatientList(@ApiParam(name = "patient", value = "居民id")
                                          @RequestParam(value = "patient",required = false) String patient,
                                          @ApiParam(name = "startTime", value = "开始时间")
                                          @RequestParam(value = "startTime",required = false) String startTime,
                                          @ApiParam(name = "endTime", value = "结束时间")
                                          @RequestParam(value = "endTime",required = false) String endTime) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag);
        return success(vos);
    }
    @PostMapping(value = BaseHospitalRequestMapping.YkyyPrescription.appointmentRevisit)
    @ApiOperation(value = "居民发起复诊", notes = "居民发起复诊")
@ -146,4 +135,31 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                               @RequestParam(value = "codes", required = false)String codes)throws Exception{
        return success(prescriptionService.getInspectionDictionary(pyKey,codes,winNo));
    }
    @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.synYkIcd10)
    @ApiOperation(value = "同步眼科icd10", notes = "同步眼科icd10")
    public ListEnvelop findPatientCard()throws Exception {
        return success(prescriptionService.synYkICD10());
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.prescriptionPay)
    @ApiOperation(value = "处方支付", notes = "处方支付")
    public ObjEnvelop findPatientCard(@ApiParam(name = "code", value = "处方code")
                                       @RequestParam(value = "code", required = true)String code,
                                       @ApiParam(name = "price", value = "支付费用")
                                       @RequestParam(value = "price", required = false)Double price)throws Exception {
        try {
            return success("ok",prescriptionService.savePrescriptionOrder(code,price,wxId));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
}

+ 34 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -69,6 +69,39 @@ public class IotCompanyController extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = IotRequestMapping.Company.conditionQueryPage)
    @ApiOperation(value = "条件查找企业", notes = "条件查找企业")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> conditionQueryPage(@ApiParam(name = "name", value = "厂商名称或联系人名称", defaultValue = "")
                                                                  @RequestParam(value = "name", required = false) String name,
                                                                  @ApiParam(name = "status", value = "审核状态", defaultValue = "")
                                                                  @RequestParam(value = "status", required = false) String status,
                                                                  @ApiParam(name = "type", value = "产商类型", defaultValue = "")
                                                                  @RequestParam(value = "type", required = false) String type,
                                                                  @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                  @RequestParam(value = "page", required = false) Integer page,
                                                                  @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                  @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            if(StringUtils.isBlank(status)){
                return iotCompanyService.conditionQueryPage(page,size,null,name,type);
            }else {
                return iotCompanyService.conditionQueryPage(page,size,status,name,type);
            }
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Company.addCompany)
    @ApiOperation(value = "创建企业", notes = "创建企业")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> addCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
@ -103,6 +136,7 @@ public class IotCompanyController extends EnvelopRestEndpoint {
                                                                    @ApiParam(name = "msg",value = "拒绝说明") @RequestParam(value = "msg",required = true,defaultValue = "")String msg){
        try {
            return  iotCompanyService.auditCompany(id, msg);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

+ 126 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/platform/IotInterfaceController.java

@ -0,0 +1,126 @@
package com.yihu.iot.controller.platform;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.service.platform.IotShareInterfaceService;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/4/28
 */
@RestController
@RequestMapping(IotRequestMapping.Common.platform)
@Api(tags = "平台接口管理相关操作", description = "平台接口管理相关操作")
public class IotInterfaceController extends EnvelopRestEndpoint {
    @Autowired
    private IotShareInterfaceService iotShareInterfaceService;
    @PostMapping(value = IotRequestMapping.Platform.addInterface)
    @ApiOperation(value = "新增共享接口",notes = "新增共享接口")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> addInterface(@ApiParam(name = "JSON",value = "接口JSON串") @RequestParam(value = "JSON",required = true)String json){
        try {
            iotShareInterfaceService.addInterface(json);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_add);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.editInterface)
    @ApiOperation(value = "编辑共享接口",notes = "编辑共享接口")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> editInterface(@ApiParam(name = "JSON",value = "接口JSON串") @RequestParam(value = "JSON",required = true)String json){
        try {
            iotShareInterfaceService.editInterface(json);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_edit);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.findInterfaceById)
    @ApiOperation(value = "查找共享接口",notes = "查找共享接口")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> findInterfaceById(@ApiParam(name = "id",value = "id") @RequestParam(value = "id",required = true)String id){
        try {
           IotShareInterfaceDO iotShareInterfaceDO = iotShareInterfaceService.findInterfaceById(id);
            return MixEnvelop.getSuccess(IotRequestMapping.Platform.message_success_find,iotShareInterfaceDO);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.findAll)
    @ApiOperation(value = "分页查询所有",notes = "分页查询所有")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> findAll(@ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                           @RequestParam(value = "page", required = false) Integer page,
                                                                       @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                           @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotShareInterfaceService.findAll(page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Platform.conditionQueryPage)
    @ApiOperation(value = "条件查询分页",notes = "条件查询分页")
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> conditionQueryPage(@ApiParam(name = "type", value = "业务类型", defaultValue = "")
                                                                       @RequestParam(value = "type", required = false) String type,
                                                                            @ApiParam(name = "name", value = "接口名称", defaultValue = "")
                                                                       @RequestParam(value = "name", required = false) String name,
                                                                            @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                                       @RequestParam(value = "page", required = false) Integer page,
                                                                            @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                                       @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return iotShareInterfaceService.conditionQueryPage(page,size,type,name);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 14 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/platform/IotShareInterfaceDao.java

@ -0,0 +1,14 @@
package com.yihu.iot.dao.platform;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/4/28
 */
public interface IotShareInterfaceDao extends PagingAndSortingRepository<IotShareInterfaceDO,String>, JpaSpecificationExecutor<IotShareInterfaceDO> {
}

+ 32 - 12
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -217,7 +217,18 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
    }
/*    public MixEnvelop<IotCompanyVO, IotCompanyVO> queryPage(Integer page, Integer size, String status, String name, String type){
    /**
     * 条件分页查找
     * @param page
     * @param size
     * @param status
     * @param name
     * @param type
     * @return
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> conditionQueryPage(Integer page, Integer size, String status, String name, String type){
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_company c ,iot_company_type t WHERE c.del=1 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_company c ,iot_company_type t WHERE c.del=1 ");
        List<Object> args = new ArrayList<>();
@ -227,22 +238,28 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            args.add(status);
        }
        if(StringUtils.isNotBlank(name)){
            sql.append(" and (c.name like ? or c.contacts_name like ?)");
            sqlCount.append(" and (c.name like '").append(name).append("' or c.contacts_name like '").append(name).append("')");
            args.add(name);
            args.add(name);
            sql.append(" and (c.name like '%").append(name).append("%' or c.contacts_name like '%").append(name).append("%')");
            sqlCount.append(" and (c.name like '%").append(name).append("%' or c.contacts_name like '%").append(name).append("%')");
        }
        if(StringUtils.isNotBlank(type)){
            sql.append(" and c.id = t.company_id and t.type=? ");
            sqlCount.append(" and c.id = t.company_id and t.type='").append(type).append("' ");
            sql.append(" and c.id = t.company_id and t.type_name=? ");
            sqlCount.append(" and c.id = t.company_id and t.type_name='").append(type).append("' ");
            args.add(type);
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotCompanyDO> list = jdbcTempalte.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotCompanyDO.class));
        list.forEach(one->{
            findType(one);
        });
        if(StringUtils.isBlank(type)){
            //得到list数据
            list.forEach(one->{
                findAppType(one);
            });
        }else {
            list.forEach(one->{
                findType(one);
            });
        }
        List<Map<String,Object>> countList = jdbcTempalte.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
@ -250,7 +267,9 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        List<IotCompanyVO> iotCompanyVOList = convertToModelVOs(list,new ArrayList<>(list.size()));
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
    }*/
    }
    /**
     * 新增
@ -297,6 +316,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
            });
            iotCompanyTypeDao.save(companyTypes);
        }
        //应用的营业执照号 可以相同
        if("0".equalsIgnoreCase(iotCompany.getAccountType())){
            List<IotCompanyDO> iotCompanyDOS = iotCompanyDao.findByAccountType(iotCompany.getAccountType());
@ -573,7 +593,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
    public MixEnvelop auditCompany(String id) {
        IotCompanyDO companyDO = findById(id);
        if (companyDO==null){
            return MixEnvelop.getError("无该企业");
        }
        String uname = userAgent.getUNAME();
        if (uname==null){

+ 128 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/platform/IotShareInterfaceService.java

@ -0,0 +1,128 @@
package com.yihu.iot.service.platform;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.dao.platform.IotShareInterfaceDao;
import com.yihu.jw.entity.iot.company.IotCompanyDO;
import com.yihu.jw.entity.iot.platform.IotShareInterfaceDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2020/4/28
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class IotShareInterfaceService extends BaseJpaService<IotShareInterfaceDO, IotShareInterfaceDao> {
    @Autowired
    private IotShareInterfaceDao iotShareInterfaceDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 增加接口
     * @param jsonData
     * @return
     */
    public void addInterface(String jsonData){
        IotShareInterfaceDO iotShareInterfaceDO = JSONObject.parseObject(jsonData, IotShareInterfaceDO.class);
        iotShareInterfaceDO.setDel("0");
        iotShareInterfaceDao.save(iotShareInterfaceDO);
    }
    /**
     * 编辑接口
     * @param json
     * @return
     */
    public void editInterface(String json) {
        IotShareInterfaceDO newInterface = JSONObject.parseObject(json, IotShareInterfaceDO.class);
        IotShareInterfaceDO oldInterface = iotShareInterfaceDao.findOne(newInterface.getId());
        oldInterface.setTypeName(newInterface.getTypeName());
        oldInterface.setExplanation(newInterface.getExplanation());
        oldInterface.setMethodName(newInterface.getMethodName());
        oldInterface.setInterfaceName(newInterface.getInterfaceName());
        oldInterface.setId(newInterface.getId());
        oldInterface.setDel("0");
        iotShareInterfaceDao.save(oldInterface);
    }
    /**
     * 根据ID查询接口
     * @param id
     * @return
     */
    public IotShareInterfaceDO findInterfaceById(String id) throws ParseException {
        IotShareInterfaceDO iotShareInterfaceDO = iotShareInterfaceDao.findOne(id);
        return iotShareInterfaceDO;
    }
    /**
     * 分页查询所有
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotShareInterfaceDO,IotShareInterfaceDO> findAll(Integer page, Integer size) throws ParseException {
        String filters = "del=0;";
        String sorts = "-updateTime";//按更新时间降序
        List<IotShareInterfaceDO> list = search(null, filters, sorts, page, size);
        //获取总数
        long count = getCount(filters);
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Platform.message_success_find,list,page, size,count);
    }
    /**
     * 分页查询所有
     * @param page
     * @param size
     * @param type
     * @param name
     * @return
     */
    public MixEnvelop<IotShareInterfaceDO, IotShareInterfaceDO> conditionQueryPage(Integer page, Integer size, String type, String name){
        StringBuffer sql = new StringBuffer("SELECT DISTINCT c.* from iot_share_interface c  WHERE c.del=0 ");
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT c.id) count from iot_share_interface c  WHERE c.del=0 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(type)){
            sql.append(" and c.type_name=? ");
            sqlCount.append(" and c.type_name='").append(type).append("' ");
            args.add(type);
        }
        if(StringUtils.isNotBlank(name)){
            sql.append(" and c.method_name like '%").append(name).append("%'");
            sqlCount.append(" and c.method_name like '%").append(name).append("%'");
        }
        sql.append("order by c.update_time desc limit ").append((page-1)*size).append(",").append(size);
        List<IotCompanyDO> list = jdbcTemplate.query(sql.toString(),args.toArray(),new BeanPropertyRowMapper(IotShareInterfaceDO.class));
        List<Map<String,Object>> countList = jdbcTemplate.queryForList(sqlCount.toString());
        long count = Long.valueOf(countList.get(0).get("count").toString());
        return MixEnvelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,list, page, size,count);
    }
}

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

@ -1,3 +1,3 @@
spring:
  application:
    name: svr-iot  #注册到发现服务的id 如果id一样 eurika会自动做负载
    name: svr-iot-shw #注册到发现服务的id 如果id一样 eurika会自动做负载