Browse Source

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

# Conflicts:
#	svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/wechat/WechatMenuController.java
wangzhinan 4 years ago
parent
commit
c5cddac32b
18 changed files with 1817 additions and 20 deletions
  1. 772 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/TnPrescriptionService.java
  2. 622 0
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/TnyyEntranceService.java
  3. 5 4
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/useragent/BaseUserAgent.java
  4. 1 1
      gateway/ag-basic/pom.xml
  5. 14 1
      gateway/ag-basic/src/main/resources/application.yml
  6. 9 0
      gateway/ag-basic/src/main/resources/bootstrap.yml
  7. 30 1
      server/svr-authentication/src/main/resources/application.yml
  8. 10 1
      server/svr-authentication/src/main/resources/bootstrap.yml
  9. 15 1
      server/svr-configuration/src/main/resources/bootstrap.yml
  10. 46 0
      svr/svr-base/src/main/resources/application.yml
  11. 8 0
      svr/svr-base/src/main/resources/bootstrap.yml
  12. 1 1
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/TnyyController.java
  13. 51 2
      svr/svr-internet-hospital-entrance/src/main/resources/application.yml
  14. 41 0
      svr/svr-internet-hospital-job/src/main/resources/application.yml
  15. 40 7
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  16. 52 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/tnyy/TnyyController.java
  17. 91 0
      svr/svr-internet-hospital/src/main/resources/application.yml
  18. 9 1
      svr/svr-internet-hospital/src/main/resources/bootstrap.yml

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

@ -0,0 +1,772 @@
package com.yihu.jw.hospital.prescription.service;
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.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxWechatDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
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.PatientRegisterTimeDao;
import com.yihu.jw.hospital.drugstore.dao.BaseDrugStoreDao;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionExpressageDao;
import com.yihu.jw.hospital.prescription.service.entrance.TnyyEntranceService;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
import com.yihu.jw.order.BusinessOrderService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.hospital.prescription.WlyyOutpatientVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2019/5/17.
 */
@Service
@Transactional
public class TnPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, PrescriptionDao> {
    private static final Logger logger = LoggerFactory.getLogger(TnPrescriptionService.class);
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private HospitalWaitingRoomDao hospitalWaitingRoomDao;
    @Autowired
    private PatientMappingService patientMappingService;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private PatientRegisterTimeDao patientRegisterTimeDao;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private WechatDao wechatDao;
    @Autowired
    private BasePatientWechatDao patientWechatDao;
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private BaseDrugStoreDao baseDrugStoreDao;
    @Autowired
    private BasePatientMedicareCardDao basePatientMedicareCardDao;
    @Autowired
    private PatientMappingDao patientMappingDao;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private BaseDoctorRoleDao doctorRoleDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private WlyyChargeDictDao wlyyChargeDictDao;
    @Autowired
    private WlyyHospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
    @Value("${wechat.flag}")
    private boolean flag;
    @Value("${pay.flag}")
    private boolean payFlag;
    @Value("${wechat.id}")
    private String wechatId;
    @Autowired
    private YkyyService ykyyService;
    /**
     * 获取居民就诊记录接口
     * @param patient
     * @param startTime
     * @param endTime
     * @param demoFlag
     * @return
     * @throws Exception
     */
    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String cardNo, String startTime, String endTime, boolean demoFlag, String ksdm)throws Exception{
        logger.info("findOutpatientList patient:"+patient);
        String patNo ="";
        PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patient);
        if(StringUtils.isNotBlank(cardNo)){
            BasePatientDO patientDO = basePatientDao.findByIdAndDel(patient,"1");
            /*JSONArray res = ykyyEntranceService.findPatientCodeByCardNo(cardNo,false);
            if(res !=null&&res.size()>0){
                JSONObject object = (JSONObject) res.get(0);
                if (object.get("brid")!=null){
                    patNo = object.get("brid").toString();
                }
            }*/
            if(!StringUtils.isBlank(patNo)){
                if (patientMappingDO!=null){
                    patientMappingDO.setMappingCode(patNo);
                }else {
                    patientMappingDO = new PatientMappingDO();
                    patientMappingDO.setMappingCode(patNo);
                    patientMappingDO.setCreateTime(new Date());
                    patientMappingDO.setSource("1");
                    patientMappingDO.setPatient(patient);
                    patientMappingDO.setIdcard(patientDO.getIdcard());
                    patientMappingDO.setPatientName(patientDO.getName());
                }
                patientMappingDao.save(patientMappingDO);
            }
        }else {
            if (patientMappingDO!=null){
                patNo = patientMappingDO.getMappingCode();
            }
        }
        if(StringUtils.isBlank(patNo)){
            return null;
        }
        logger.info("findOutpatientList patNo "+patNo);
        return tnyyEntranceService.BS30025(patNo,null,startTime,endTime,demoFlag,ksdm);
    }
    /**
     *
     */
    public List<WlyyPrescriptionVO> findOriginPrescriptionList(String registerSn, String patient, String realOrder, String admNo, boolean demoFlag)throws Exception{
        String patNo =patientMappingService.findHisPatNoByPatient(patient,null);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
        //BS16017(String REGISTER_SN,String realOrder,String PAT_NO,String ADM_NO,boolean demoFlag) throws Exception {
        logger.info("findOriginPrescriptionList: registerSn:"+registerSn+" patient"+patient+" patNo:"+patNo+" realOrder:"+realOrder+" admNo:"+admNo);
        return tnyyEntranceService.findMS_CF01And02(admNo,demoFlag);
    }
    /**
     * 获取居民就诊记录接口
     * @param patient
     * @return
     * @throws Exception
     */
    public  WlyyOutpatientVO findOutpatientInfo(String patient,String conNo, boolean demoFlag,String ksdm)throws Exception{
        logger.info("findOutpatientList patient:"+patient);
        String patNo =patientMappingService.findYkyyPatNoByPatient(patient,demoFlag);
        if(StringUtils.isBlank(patNo)){
            return null;
        }
        logger.info("findOutpatientList patNo "+patNo);
        List<WlyyOutpatientVO> wlyyOutpatientVOS = tnyyEntranceService.BS30025(patNo,conNo,null,null,demoFlag,ksdm);
        if (wlyyOutpatientVOS!=null&&wlyyOutpatientVOS.size()!=0){
            WlyyOutpatientVO outpatientVO = wlyyOutpatientVOS.get(0);
            BasePatientDO patientDO = basePatientDao.findById(patient);
            outpatientVO.setSex(patientDO.getSex()+"");
            outpatientVO.setBirthday(patientDO.getBirthday());
            outpatientVO.setIdcard(patientDO.getIdcard());
            return outpatientVO;
        }
       return null;
    }
    /**
     * 发起图文和视频复诊
     *
     * @param outpatientJson
     * @param expressageJson
     * @return
     * @throws Exception
     *//*
    public WlyyOutpatientDO appointmentRevisit(String outpatientJson, String expressageJson, String registerJson, String chargeType) throws Exception {
        //1.保存就诊实体
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        BasePatientDO patientDO = basePatientDao.findById(outpatientDO.getPatient());
        BaseDoctorDO doctorDO = doctorDao.findById(outpatientDO.getDoctor());
        outpatientDO.setMjz("mz");
        outpatientDO.setStatus("0");
        outpatientDO.setCreateTime(new Date());
        outpatientDO.setIdcard(patientDO.getIdcard());
        outpatientDO.setCreateTime(new Date());
        if (!payFlag){
            outpatientDO.setPayStatus(1);
        }else {
            outpatientDO.setPayStatus(0);
        }
        if (outpatientDO.getRegisterDate() == null) {
            outpatientDO.setRegisterDate(new Date());
        }
        WlyyOutpatientDO outpatient = outpatientDao.save(outpatientDO);
        BusinessOrderDO businessOrderDO = new BusinessOrderDO();
        if("3".equalsIgnoreCase(outpatient.getOutpatientType())){
            businessOrderDO.setRelationCode(outpatient.getId());
            businessOrderDO.setRelationName("专家咨询费");
            businessOrderDO.setDescription("专家咨询费");
            businessOrderDO.setRematk(outpatient.getDescription());
            businessOrderDO.setPatient(outpatient.getConsumer());
            businessOrderDO.setPatientName(outpatient.getConsumerName());
            businessOrderDO.setDoctor(outpatient.getDoctor());
            if (outpatientDO.getType().equalsIgnoreCase("1")) {
                businessOrderDO.setOrderType(1);
                businessOrderDO.setOrderCategory("1");
            } else if (outpatientDO.getType().equalsIgnoreCase("2")) {
                businessOrderDO.setOrderType(17);
                businessOrderDO.setOrderCategory("1");
            }
        }else {
            businessOrderDO.setRelationCode(outpatient.getId());
            businessOrderDO.setRelationName("复诊-诊查费");
            businessOrderDO.setDescription("复诊-诊查费");
            businessOrderDO.setRematk(outpatient.getDescription());
            businessOrderDO.setPatient(outpatient.getConsumer());
            businessOrderDO.setPatientName(outpatient.getConsumerName());
            businessOrderDO.setDoctor(outpatient.getDoctor());
            if (outpatientDO.getType().equalsIgnoreCase("1")) {
                businessOrderDO.setOrderType(1);
                businessOrderDO.setOrderCategory("2");
            } else if (outpatientDO.getType().equalsIgnoreCase("2")) {
                businessOrderDO.setOrderType(3);
                businessOrderDO.setOrderCategory("3");
            }
        }
        WlyyHospitalSysDictDO hospitalSysDictDO = hospitalSysDictDao.findById("WX_MONEY");
        Double price = 0.0;
        String chargeType1 = null;
        if (doctorDO!=null){
            if (outpatient.getOutpatientType().equalsIgnoreCase("1")){
                if(outpatientDO.getType().equalsIgnoreCase("1")){
                    chargeType1 = doctorDO.getTwfzChargeType();
                }else if(outpatientDO.getType().equalsIgnoreCase("2")){
                    chargeType1 = doctorDO.getSpfzChargeType();
                }
            }else if (outpatient.getOutpatientType().equalsIgnoreCase("3")){
                if(outpatientDO.getType().equalsIgnoreCase("1")){
                    chargeType1 = doctorDO.getTwzxChargeType();
                }else if(outpatientDO.getType().equalsIgnoreCase("2")){
                    chargeType1 = doctorDO.getSpzxChargeType();
                }
            }else if (outpatient.getOutpatientType().equalsIgnoreCase("2")){
                chargeType1 = doctorDO.getXtfzChargeType();
            }
            if(doctorDO!=null){
                if (StringUtils.isNoneBlank(chargeType1)){
                    WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeType(chargeType1);
                    if (chargeDictDO!=null){
                        price = chargeDictDO.getReqFee();
                    }else {
                        price = Double.parseDouble(hospitalSysDictDO.getDictValue());
                    }
                }
            }else {
                price = Double.parseDouble(hospitalSysDictDO.getDictValue());
            }
        }else {
            if (StringUtils.isNoneBlank(chargeType)){
                WlyyChargeDictDO chargeDictDO = wlyyChargeDictDao.findByChargeType(chargeType);
                if (chargeDictDO!=null){
                    price = chargeDictDO.getReqFee();
                }else {
                    price = Double.parseDouble(hospitalSysDictDO.getDictValue());
                }
            }
        }
        *//*if (doctorDO != null && StringUtils.isNoneBlank(doctorDO.getFee())) {
            price = Double.parseDouble(doctorDO.getFee());
        }else {
            price = Double.parseDouble(hospitalSysDictDO.getDictValue());
        }*//*
        if (price == 0.0) {
            outpatientDO.setPayStatus(1);
        } else {
            outpatientDO.setPayStatus(0);
        }
        businessOrderDO.setPayPrice(price*100);
        if (!flag){
            businessOrderDO = businessOrderService.saveOrder(businessOrderDO);
        }
        WlyyPatientRegisterTimeDO registerTimeDO = null;
        try {
            //如果是视频预约咨询
            if (StringUtils.isNotBlank(registerJson)) {
                registerTimeDO = objectMapper.readValue(registerJson, WlyyPatientRegisterTimeDO.class);
                registerTimeDO.setOutpatientId(outpatient.getId());
                registerTimeDO.setCreateTime(new Date());
                patientRegisterTimeDao.save(registerTimeDO);
            }
        } catch (Exception e) {
            throw new RuntimeException("号源已经被预约,请选择其他号源");
        }
        if ("3".equalsIgnoreCase(outpatient.getOutpatientType())){
        }else {
            //2.物流信息
            WlyyPrescriptionExpressageDO expressageDO = objectMapper.readValue(expressageJson, WlyyPrescriptionExpressageDO.class);
            expressageDO.setDel(1);
            expressageDO.setCreateTime(new Date());
            expressageDO.setOutpatientId(outpatient.getId());
            prescriptionExpressageDao.save(expressageDO);
            if (0==expressageDO.getOneselfPickupFlg()){
                if("xm_ykyy_wx".equalsIgnoreCase(wechatId)){
                    String drugCode= expressageDO.getHospitalCode()==null?"5550":expressageDO.getHospitalCode();
                    expressageDO.setHospitalCode(drugCode);
                }
                System.out.println("进入物流信息");
                expressageDO.setDel(1);
                expressageDO.setCreateTime(new Date());
                expressageDO.setOutpatientId(outpatient.getId());
                prescriptionExpressageDao.save(expressageDO);
            }else {
                System.out.println("写入自取信息");
                String drugStoreCode = expressageDO.getHospitalCode();
                BaseDrugStoreDO baseDrugStoreDO = baseDrugStoreDao.findDrugByid(drugStoreCode);
                if (null!=baseDrugStoreDO){
                    expressageDO.setCityCode(baseDrugStoreDO.getCityCode());
                    expressageDO.setCityName(baseDrugStoreDO.getCityName());
                    expressageDO.setProvinceCode(baseDrugStoreDO.getProvinceCode());
                    expressageDO.setProvinceName(baseDrugStoreDO.getProvinceName());
                    expressageDO.setTownCode(baseDrugStoreDO.getTownCode());
                    expressageDO.setTownName(baseDrugStoreDO.getTownName());
                    expressageDO.setHospitalCode(baseDrugStoreDO.getDrugStoreCode());
                    expressageDO.setHospitalName(baseDrugStoreDO.getHospitalName());
                    expressageDO.setHospitalAddress(baseDrugStoreDO.getAddress());
                }
                expressageDO.setDel(1);
                expressageDO.setCreateTime(new Date());
                expressageDO.setOutpatientId(outpatient.getId());
                prescriptionExpressageDao.save(expressageDO);
            }
        }
        //3.创建候诊室
        createRoom(outpatient, chargeType);
        return outpatient;
    }
    *//**
     * 创建候诊室
     *
     * @param outpatientDO
     * @return
     *//*
    public Boolean createRoom(WlyyOutpatientDO outpatientDO, String chargeType) {
        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO();
        waitingRoom.setDept(outpatientDO.getDept());
        waitingRoom.setDeptName(outpatientDO.getDeptName());
        waitingRoom.setHospital(outpatientDO.getHospital());
        waitingRoom.setHospitalName(outpatientDO.getHospitalName());
        //是否是有协同门诊医生
        if (StringUtils.isNotBlank(outpatientDO.getGeneralDoctor())) {
            waitingRoom.setGeneralDoctor(outpatientDO.getGeneralDoctor());
            waitingRoom.setGeneralDoctorName(outpatientDO.getGeneralDoctorName());
        }
        waitingRoom.setPatientId(outpatientDO.getConsumer());
        waitingRoom.setPatientName(outpatientDO.getConsumerName());
        waitingRoom.setReservationTime(outpatientDO.getRegisterDate());
        waitingRoom.setVisitStatus(0);
        //设置复诊类型
        waitingRoom.setReservationType(StringUtils.isNotBlank(outpatientDO.getOutpatientType()) ? Integer.parseInt(outpatientDO.getOutpatientType()) : 1);
        waitingRoom.setSort(0);
        waitingRoom.setConsultType(Integer.parseInt(outpatientDO.getType()));
        if (StringUtils.isNotBlank(outpatientDO.getDoctor())) {
            waitingRoom.setDoctor(outpatientDO.getDoctor());
            waitingRoom.setDoctorName(outpatientDO.getDoctorName());
        }
        waitingRoom.setOutpatientId(outpatientDO.getId());
        waitingRoom.setCreateTime(new Date());
        if (StringUtils.isNotBlank(chargeType)) {
            waitingRoom.setChargeType(chargeType);
        }
        hospitalWaitingRoomDao.save(waitingRoom);
        return true;
    }*/
    /**
     * 获取药品
     *
     `prescription_id` varchar(50) DEFAULT NULL COMMENT '处方code 关联表wlyy_prescription code',
     `drug_no` varchar(50) DEFAULT NULL COMMENT '药品编号',
     `drug_name` varchar(50) DEFAULT NULL COMMENT '药品名称',
     `disp_deposite` varchar(50) DEFAULT NULL COMMENT '库房号',
     `dosage` varchar(50) DEFAULT NULL COMMENT '药量',
     `quantity` varchar(50) DEFAULT NULL COMMENT '数量',
     `unit` varchar(50) DEFAULT NULL COMMENT '用量单位',
     `unit_name` varchar(50) DEFAULT NULL COMMENT '用量单位中文',
     `pack_unit` varchar(50) DEFAULT NULL COMMENT '包装单位',
     `pack_unit_name` varchar(50) DEFAULT NULL COMMENT '包装单位名称',
     `usage_code` varchar(50) DEFAULT NULL COMMENT '频率code',
     `usage_name` varchar(50) DEFAULT NULL COMMENT '频次名称',
     `supply_code` varchar(50) DEFAULT NULL COMMENT '用法',
     `supply_name` varchar(50) DEFAULT NULL COMMENT '用法名称',
     `days` varchar(50) DEFAULT NULL COMMENT '天数',
     `frequency` varchar(50) DEFAULT NULL COMMENT '组号',
     `serial` varchar(50) DEFAULT NULL COMMENT '药品序列号',
     `group_no` varchar(50) DEFAULT NULL COMMENT '库房号',
     `specification` varchar(50) DEFAULT NULL COMMENT '规格(10mgx10片/盒)',
     `pack_retprice` double(10,4) DEFAULT NULL COMMENT '包装价格',
     `herbal_count` varchar(10) DEFAULT NULL COMMENT '草药数量',
     `post_count` varchar(10) DEFAULT NULL COMMENT '贴数',
     `comm` varchar(50) DEFAULT NULL COMMENT '中药用法',
     `del` int(2) DEFAULT '1' COMMENT '1可用 0删除',
     `drug_place` varchar(100) DEFAULT NULL COMMENT '药品产地',
     `pack_quantity` int(11) DEFAULT NULL COMMENT '包装数量',
     PRIMARY KEY (`id`),
     */
    public JSONArray getDrugDictionary(String chargeCode, String pyKey, String winNo, String groupNo,String oupatientId) throws Exception {
        String hisCode = "";
        if (StringUtils.isNotEmpty(oupatientId)){
            List<WlyyPrescriptionExpressageDO> wlyyPrescriptionExpressageDOS = prescriptionExpressageDao.findByOutpatientIdAndOneSelfPick(oupatientId);
            if (wlyyPrescriptionExpressageDOS.size()>0){
                hisCode = wlyyPrescriptionExpressageDOS.get(0).getHospitalCode();
            }
        }
        JSONArray mapList = new JSONArray();
        mapList = tnyyEntranceService.findTnYpxx(chargeCode, null, null, pyKey,hisCode);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("charge_code",map.get("YPXH"));
            object.put("drugname",map.get("YPMC"));
            object.put("specification",map.get("YPGG"));
            object.put("pack_unit_name",map.get("JLDW"));
            object.put("yfdw",map.get("YFDW"));
            object.put("pack_size",map.get("YFBZ"));
         /*   object.put("yfsx",map.get("yfsx"));//药房属性*/
            object.put("ypjl",map.get("YPJL"));//药剂量
            object.put("jldw",map.get("JLDW"));//剂量单位
            object.put("py_code",map.get("PYDM"));//拼音代码
            object.put("fyfs",map.get("FYFS"));//发药方式
            object.put("supply_code",map.get("GYFF"));//给药方式
            object.put("yfzf",map.get("YFZF"));//药房作废
            object.put("supply_name",map.get("GYFF"));//给药方式名称
/*            object.put("ybfl",map.get("ybfl"));//医保分类*/
            object.put("retprice",map.get("LSJG"));//零售价格
            object.put("kcsl",map.get("KCSL"));//库存
            object.put("ypcd",map.get("YPCD"));//产地
            object.put("zfpb",map.get("ZFPB"));//作废判别
            object.put("jbywbz",map.get("jbywbz"));//基本药物标志
           /* object.put("ydyp",map.get("ydyp"));//药店药品
            object.put("ypmc2",map.get("ypmc2"));//药品名称2
            object.put("t",map.get("pzwh"));//药品批文*/
            array.add(object);
        }
        return array;
    }
    /**
     * 获取药品用法
     */
    public JSONArray getDrugUse(String drugNo, String pyKey,boolean demoFlag) throws Exception {
        JSONArray mapList = new JSONArray();
        mapList = tnyyEntranceService.findYpyf(pyKey);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("supply_code",map.get("YPYF"));
            object.put("supply_name",map.get("XMMC"));
            object.put("ypyf",map.get("YPYF"));
            array.add(object);
        }
        return array;
    }
    /**
     * 医院频次
     *
     * @return
     */
    public JSONArray getDrugFrequency(boolean demoFlag) throws Exception {
        JSONArray mapList = new JSONArray();
        mapList= tnyyEntranceService.findSypc(null);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("FREQ_CODE",map.get("PCBM"));
            object.put("FREQ_NAME",map.get("PCMC"));
            object.put("MRSC",map.get("MRCS"));
            array.add(object);
        }
        return array;
    }
   /* *//**
     * 获取检查检验
     *  "action": "select",
     "name": "丙型肝炎RNA测定(全自动荧光定量分析)",
     "charge_unit": "项",
     "charge_amount": "150",
     "py_code": "BXGYRNAC",
     "d_code": "GGEORNAI",
     "code": "393333",
     "exec_unit": "2160000",
     "win_no": "0",
     "exec_unit_name": "检验科"
     *
     * @return
     *//*
    public JSONArray getInspectionDictionary(String pyKey, String codes, String winNo) throws Exception {
        JSONArray mapList = ykyyEntranceService.findYkJcxm(pyKey);
        JSONArray array = new JSONArray();
        for (int i=0;i<mapList.size();i++){
            JSONObject map = mapList.getJSONObject(i);
            JSONObject object = new JSONObject();
            object.put("name",map.get("xmmc"));
            object.put("code",map.get("zlxmid"));
            object.put("py_code",map.get("pydm"));
            object.put("wbdm",map.get("wbdm"));
            object.put("jxdm",map.get("jxdm"));
            object.put("qtdm",map.get("qtdm"));
            object.put("ydyzlb",map.get("ydyzlb"));
            object.put("mlbh",map.get("mlbh"));
            object.put("zxpc",map.get("zxpc"));
            object.put("jfpc",map.get("jfpc"));
            object.put("jsfs",map.get("jsfs"));
            object.put("jszq",map.get("jszq"));
            object.put("charge_unit",map.get("jsdw"));
            object.put("syxb",map.get("syxb"));
            object.put("mxsy",map.get("mxsy"));
            object.put("zysy",map.get("zysy"));//住院使用
            object.put("tjsy",map.get("tjsy"));
            object.put("zxlb",map.get("zxlb"));//执行类别
            object.put("exec_unit",map.get("zxks"));//执行科室
            object.put("zxgzid",map.get("zxgzid"));//执行规则
            object.put("ywzx",map.get("ywzx"));
            object.put("zxap",map.get("zxap"));
            object.put("cpzx",map.get("cpzx"));
            object.put("szzx",map.get("szzx"));
            object.put("jjlx",map.get("jjlx"));
            object.put("ycxzsl",map.get("ycxzsl"));
            object.put("yblx",map.get("yblx"));
            object.put("zxbz",map.get("zxbz"));
            object.put("txid",map.get("txid"));
            object.put("bgbh",map.get("bgbh"));
            object.put("czsy",map.get("czsy"));
            object.put("lzsy",map.get("lzsy"));
            object.put("lccs",map.get("lccs"));
            object.put("bwbz",map.get("bwbz"));
            object.put("yblb",map.get("yblb"));
            array.add(object);
        }
        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
     * @return
     * @throws Exception
     *//*
    public JSONArray findPatientCard(String patient)throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if (patientDO!=null){
            //JSONArray res = ykyyEntranceService.findHisCard(patientDO.getIdcard(),demoFlag);
            JSONArray rs = new JSONArray();
            *//*if(res !=null){
                for (int i =0;i<res.size();i++){
                    JSONObject object = (JSONObject) res.get(i);
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("PAT_NO",object.get("pat_no"));
                    jsonObject.put("CARD_NO",object.get("card_no"));
                    jsonObject.put("OP_DATE",object.get("op_date"));
                    jsonObject.put("CARD_STAT",object.get("card_stat"));
                    jsonObject.put("CARD_TYPE",object.get("card_type"));
                    jsonObject.put("CARD_TYPE_NAME",object.get("card_type_name"));
                    rs.add(jsonObject);
                }
            }*//*
            List<PatientMedicareCardDO> list  = basePatientMedicareCardDao.findByPatientCode(patientDO.getId());
            PatientMappingDO patientMappingDO = patientMappingDao.findByPatient(patientDO.getId());
            if (list!=null&&list.size()>0){
                for (PatientMedicareCardDO patientMedicareCardDO :list){
                    JSONObject jsonObject = new JSONObject();
                    if (null!=patientMappingDO){
                        jsonObject.put("PAT_NO",patientMappingDO.getMappingCode());
                    }else {
                        JSONArray res = ykyyEntranceService.findPatientCodeByCardNo(patientMedicareCardDO.getCode(),false);
                        patientMappingDO = new PatientMappingDO();
                        if(res !=null&&res.size()>0){
                            JSONObject object = (JSONObject) res.get(0);
                            if (object.get("pat_no")!=null){
                                jsonObject.put("PAT_NO",object.get("pat_no").toString());
                            }
                            if (object.get("brid")!=null){
                                jsonObject.put("BRID",object.get("brid").toString());
                                patientMappingDO.setMappingCode(object.get("brid").toString());
                                patientMappingDO.setPatient(patient);
                                patientMappingDO.setPatientName(patientDO.getName());
                                patientMappingDO.setIdcard(patientDO.getIdcard());
                                patientMappingDO.setSource("1");
                                patientMappingDO.setCreateTime(new Date());
                                patientMappingDao.save(patientMappingDO);
                            }
                        }
                    }
                    jsonObject.put("CARD_NO",patientMedicareCardDO.getCode());
                    jsonObject.put("OP_DATE","");
                    jsonObject.put("CARD_STAT","正常");
                    jsonObject.put("CARD_TYPE","2");
                    jsonObject.put("CARD_TYPE_NAME","社保卡");
                    rs.add(jsonObject);
                }
                return rs;
            }
        }
        return null;
    }*/
    public JSONArray synYkICD10() throws Exception {
        JSONArray jsonArray = tnyyEntranceService.synYkICD10();
        return jsonArray;
    }
    /**
     *
     * 处方下单
     *
     * @return
     * @throws Exception
     */
    public Map<String,Object> savePrescriptionOrder(String code,Double price,String tradeType,String wechatId,String appletCode) 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);
        }
        BusinessOrderDO businessOrderDO = businessOrderDao.selectByRelationCode(code);
        if (businessOrderDO!=null){
            List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
            String openId = "";
            if (StringUtils.isNotBlank(appletCode)){
                logger.info("appletCode不为空"+appletCode);
                Map<String,Object> objectMap = checkApplets(appletCode,wxWechatDO.getApplets(),wxWechatDO.getAppletsSecret());
                if (objectMap!=null){
                    openId = objectMap.get("openid").toString();
                    logger.info("appletCode"+appletCode);
                    logger.info("openid"+openId);
                }
            }else {
                logger.info("appletCode为空"+appletCode);
                List<BasePatientWechatDo> patientWechatDo = patientWechatDao.findByWechatIdAndPatientId(wechatId,businessOrderDO.getPatient());
                if (patientWechatDo!=null&&patientWechatDo.size()!=0){
                    openId = patientWechatDo.get(0).getOpenid();
                }
            }
            String url = wxWechatDO.getBaseUrl();
            String notifyUrl =url;
            String totalFee =businessOrderDO.getPayPrice().intValue()+"";
            map = businessOrderService.unifiedorder(wechatId,businessOrderDO.getDescription(),totalFee, tradeType,openId,businessOrderDO.getOrderNo(),notifyUrl,businessOrderDO.getPatient());
        }
        return map;
    }
    public Map<String, Object> checkApplets(String code,String appid,String appSecret) throws Exception {
        HttpUtils httpUtils = new HttpUtils();
        Map<String, Object> param = new HashedMap();
        param.put("appid", appid);
        param.put("secret", appSecret);
        param.put("js_code", code);
        param.put("grant_type", "authorization_code");
        HttpResponse response = httpUtils.doGet("https://api.weixin.qq.com/sns/jscode2session", param);
        org.json.JSONObject rs = new org.json.JSONObject(response.getContent());
        Map<String, Object> res = new HashedMap();
        logger.info("checkApplets:"+response.getContent());
        if (rs.has("openid")){
            res.put("openid", rs.getString("openid"));
            res.put("sessionKey", rs.getString("session_key"));
        }
        return res;
    }
    /**
     * 获取诊断
     *
     * @param pyKey
     * @return
     * @throws Exception
     */
    public JSONArray getICD10(String pyKey,boolean demoFlag) throws Exception {
        JSONArray array = tnyyEntranceService.findIcd10(pyKey,demoFlag);
        return array;
    }
}

+ 622 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/TnyyEntranceService.java

@ -1,13 +1,48 @@
package com.yihu.jw.hospital.prescription.service.entrance;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.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;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
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.restmodel.hospital.prescription.*;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.utils.network.HttpResponse;
import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.signature.qual.IdentifierOrArray;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import static com.yihu.jw.util.common.PwdUtil.randomString;
/**
 * Created by wangzhinan on 2020/12/24.
 */
@ -15,8 +50,595 @@ import java.util.Map;
@Transactional
public class TnyyEntranceService {
    private static Logger logger = LoggerFactory.getLogger(TnyyEntranceService.class);
    private final static String url="http://10.9.1.247:10023/ykyy/createSQLQuery";
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private DictHospitalDeptDao hospitalDeptDao;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private BaseDoctorHospitalDao baseDoctorHospitalDao;
    @Autowired
    private BaseDoctorRoleDao baseDoctorRoleDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Autowired
    private YkDictIcd10Dao ykDictIcd10Dao;
    private final static String orgCode ="350211A5004";
    @Autowired
    private PatientMappingDao patientMappingDao;
    //同步科室
    public String updateTnyyDept() throws Exception {
        String sql = "select KSDM,KSMC,PYDM,PLSX,JGBM from GY_KSDM ";
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("updateTnyyDept:"+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){
            JSONArray array = rs.getJSONArray("detailModelList");
            logger.info("dept size:"+array.size());
            for (int i=0;i<array.size();i++){
                JSONObject deptObj = array.getJSONObject(i);
                String ksdm = deptObj.getString("KSDM");
                String jgbm = deptObj.getString("JGBM");
                String ksmc = deptObj.getString("KSMC");
                List<DictHospitalDeptDO> list = hospitalDeptDao.findByOrgCodeAndCode(jgbm,ksdm);
                if (list!=null&&list.size()!=0){
                    DictHospitalDeptDO dictHospitalDeptDO = list.get(0);
                    dictHospitalDeptDO.setCode(ksdm);
                    dictHospitalDeptDO.setName(ksmc);
                    dictHospitalDeptDO.setOrgCode(jgbm);
                    hospitalDeptDao.save(dictHospitalDeptDO);
                }else {
                    //新增科室
                    DictHospitalDeptDO dictHospitalDeptDO = new DictHospitalDeptDO();
                    dictHospitalDeptDO.setCode(ksdm);
                    dictHospitalDeptDO.setName(ksmc);
                    dictHospitalDeptDO.setOrgCode(jgbm);
                    dictHospitalDeptDO.setCreateTime(new Date());
                    dictHospitalDeptDO.setConsultDeptFlag("1");
                    hospitalDeptDao.save(dictHospitalDeptDO);
                }
            }
        }
        return "success";
    }
    //更新泰安医生信息
    public String updateTnyyDoctor(String idCard)throws Exception{
        String sql ="select sfzh,LXDH,YGDM,KSDM,YGXM,YGXB,CSNY,YSJJ from GY_YGDM where ZFPB=1 and sfzh is not null ";
        if (StringUtils.isNoneBlank(idCard)){
            sql +=" and sfzh ='"+idCard+"' ";
        }
        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){
            JSONArray array = rs.getJSONArray("detailModelList");
            logger.info("doctor size:"+array.size());
            if(array!=null&&array.size()>0) {
                for (int i = 0; i < array.size(); i++) {
                    JSONObject doctorJson = array.getJSONObject(i);
                    String idcard = doctorJson.getString("sfzh");
                    //过滤身份证脏数据
                    if(idcard.length()>=15){
                        List<BaseDoctorDO> doctorDOs = baseDoctorDao.findByIdcard(idcard);
                        if(doctorDOs!=null&&doctorDOs.size()>0){
                            BaseDoctorDO doctor = doctorDOs.get(0);
                            String salt = randomString(5);
                            String pw = idcard.substring(idcard.length() - 6);
                            doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                            doctor.setSalt(salt);
                            /*doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
                            doctor.setJobTitleName(doctorJson.getString("jobTitleName"));*/
//                            doctor.setExpertise(doctorJson.getString("expertise"));
//                            doctor.setIntroduce(doctorJson.getString("introduce"));
//                            doctor.setMobile(doctorJson.getString("mobile"));
                            BaseDoctorDO temp = baseDoctorDao.save(doctor);
                            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByOrgCodeAndDeptCodeAndDoctorCode(orgCode,doctorJson.getString("KSDM"),doctor.getId());
                            if(hospitalDOs!=null&&hospitalDOs.size()>0){
                                //机构信息部门信息
                                BaseDoctorHospitalDO hospitalDO = hospitalDOs.get(0);
                                hospitalDO.setDeptCode(doctorJson.getString("KSDM"));
                                hospitalDO.setDel("1");
                                baseDoctorHospitalDao.save(hospitalDO);
                            }
                        }else{
                            //新增医生
                            BaseDoctorDO doctor = new BaseDoctorDO();
                            doctor.setName(doctorJson.getString("YGXM"));
                            doctor.setIdcard(idcard);
                            doctor.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)));
                            doctor.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
                            doctor.setProvinceCode("350000");
                            doctor.setProvinceName("福建省");
                            doctor.setTownCode("350203");
                            doctor.setTownName("思明区");
                            doctor.setCityCode("350200");
                            doctor.setCityName("厦门市");
//                            doctor.setExpertise(doctorJson.getString("expertise"));
//                            doctor.setIntroduce(doctorJson.getString("introduce"));
//                            doctor.setMobile(doctorJson.getString("mobile"));
                            //认证信息设置
                            String salt = randomString(5);
                            String pw = idcard.substring(idcard.length() - 6);
                            doctor.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                            doctor.setSalt(salt);
                            doctor.setDel("1");
                            doctor.setEnabled(1);
                            doctor.setLocked(0);
                            doctor.setCreateTime(new Date());
                    /*        doctor.setJobTitleCode(doctorJson.getString("jobtitlecode"));
                            doctor.setJobTitleName(doctorJson.getString("jobTitleName"));*/
                            BaseDoctorDO temp = baseDoctorDao.save(doctor);
                            //机构信息部门信息
                            BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
                            hospitalDO.setDoctorCode(temp.getId());
                            hospitalDO.setOrgCode(orgCode);
                            hospitalDO.setOrgName("泰安中医院");
                            hospitalDO.setDeptCode(doctorJson.getString("KSDM"));
                            hospitalDO.setDel("1");
                            baseDoctorHospitalDao.save(hospitalDO);
                            //保存角色
                            BaseDoctorRoleDO role = new BaseDoctorRoleDO();
                            role.setDoctorCode(temp.getId());
                            role.setRoleCode("specialist");
                            baseDoctorRoleDao.save(role);
                            //保存mapping
                            DoctorMappingDO mappingDO = new DoctorMappingDO();
                            mappingDO.setIdcard(idcard);
                            mappingDO.setDoctor(temp.getId());
                            mappingDO.setDoctorName(temp.getName());
                            mappingDO.setOrgCode(orgCode);
                            mappingDO.setOrgName("泰安中医院");
                            mappingDO.setMappingCode(doctorJson.getString("YGDM"));
                            mappingDO.setMappingName(temp.getName());
                            mappingDO.setCreateTime(new Date());
                            doctorMappingDao.save(mappingDO);
                        }
                    }
                }
            }
        }
        return "success";
    }
    /**
     * 查询药品信息
     * @param ypdm
     * @param ypmc
     * @param kusl
     * @return
     */
    public JSONArray findTnYpxx(String ypdm,String ypmc,String kusl,String pydm ,String hisCode) throws Exception {
        String sql ="SELECT yp.YPXH,yp.XTSB,yp.YPMC,yp.YPGG,yp.YFGG,yp.BFGG,yp.YPSX,yp.TSYP,yp.YPDW,yp.ZXDW,yp.ZXBZ,yp.YFBZ,yp.YFDW,yp.BFBZ," +
                "yp.BFDW,yp.ZFPB,yp.YLXZ,yp.FYFS,yp.PYDM,yp.YPBH,yp.MESS,yp.GYFF,yp.TYPE,yp.YPDM,yp.YPJL,yp.JLDW,yp.YKZF,yp.YFZF,yp.ZXCD,yp.YCYL," +
                "kc.YPCD,kc.LSJG,kc.KCSL  FROM  YK_TYPK yp,YK_KCMX kc where 1=1 and kc.YPXH=yp.YPXH ";
        if (StringUtils.isNoneBlank(ypdm)){
            sql+=" and lower(YPDM) like '%"+ypdm.toLowerCase()+"%' ";
        }
        if (StringUtils.isNoneBlank(ypmc)){
            sql+=" and lower(YPMC) like '%"+ypmc.toLowerCase()+"%' ";
        }
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and lower(PYDM) like '%"+pydm.toLowerCase()+"%' ";
        }
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ypxx:"+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");
        }
       /* List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);*/
        return array;
    }
    /**
     * 获取频次
     * @return
     */
    public JSONArray findSypc(String pcbm) throws Exception {
        String sql = "select s.PCBM,s.PCMC,s.MRCS,s.MZCS,s.YFBM,s.JGRS  from GY_SYPC s where 1=1 ";
        if (StringUtils.isNoneBlank(pcbm)){
            sql+=" and lower(s.pcbm)='"+pcbm.toLowerCase()+"' ";
        }
        /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;*/
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("sypc:"+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;
    }
    /**
     * 获取用法
     * @return
     */
    public JSONArray findYpyf(String pydm) throws Exception {
        String sql = "select y.YPYF,y.PYDM,y.XMMC,y.XMLB,y.FYXH from ZY_YPYF y where 1=1  and y.PYDM is not null";
        if (StringUtils.isNoneBlank(pydm)){
            sql+=" and lower(y.PYDM)='"+pydm.toLowerCase()+"' ";
        }
        /*List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
        return list;*/
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("ypyf:"+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;
    }
    /**
     * 获取icd10
     * @return
     * @throws Exception
     */
    public JSONArray synYkICD10() throws Exception {
        String sql = "select i.JBXH,i.JBMC,i.PYDM, from GY_JBBM 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("JBXH"));
                dictIcd10DO.setName(object.getString("JBMC"));
                dictIcd10DO.setDescription(object.getString("PYDM"));
                ykDictIcd10Dao.save(dictIcd10DO);
            }
        }
        return array;
    }
    /**
     * 获取诊断
     * @param pyCode
     * @param demoFlag
     * @return
     * @throws Exception
     */
    public JSONArray findIcd10(String pyCode,boolean demoFlag) throws Exception {
        String sql = "select i.JBXH as code ,i.JBMC as name,i.PYDM as pydm, from GY_JBBM i ";
        JSONArray array = new JSONArray();
        if (StringUtils.isNoneBlank(pyCode)){
            sql +="  where lower(i.PYDM) like '%"+pyCode.toLowerCase()+"%'";
        }
        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");
        }
        return array;
    }
    /**
     * HIS就诊患者历史查询
     * @throws Exception
     */
    public JSONArray findV_ZKSG_HZCX_HIS(String brid,String conNo,String startTime,String endTime,String ksdm) throws Exception{
        String sql = "SELECT h.JZXH,h.GHXH,h.BRBH,h.KSDM,h.YSDM,h.ZYZD,h.KSSJ,h.JSSJ,h.JZZT,h.FZRQ,h.GHFZ,ks.KSMC,yg.YGXM  from YS_MZ_JZLS h,GY_KSDM ks,GY_YGDM yg WHERE yg.YGDM=h.YSDM and ks.KSDM=h.KSDM and  h.BRBH = "+brid+" ";
        if(!StringUtil.isBlank(conNo)){
            sql += " and h.JZXH = " + conNo;
        }
        if(!StringUtil.isBlank(startTime)){
            sql += " and  h.KSSJ  between "+startTime;
        }
        if(!StringUtil.isBlank(endTime)){
            sql += " and "+endTime;
        }if(!StringUtil.isBlank(ksdm)){
            sql += " and h.KSDM = " + ksdm;
        }
        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();
    }
    /**
     * 患者门诊就诊记录
     * 使用时间查询的话,很可能会超时。时间没有索引,所以超时时间需要加长
     *
     * @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, String ksdm) 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;
        }
//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
        JSONArray jsonArray = new JSONArray();
        jsonArray = findV_ZKSG_HZCX_HIS(patientMappingDO.getMappingCode(),conNo,startTime,endTime,ksdm);
        //查找眼科数据
        if (jsonArray.size() == 0) {
            return null;
        }
        List<WlyyOutpatientVO> wlyyOutpatientVOS = new ArrayList<>();
        for (int i = 0; i < jsonArray.size(); i++) {
            JSONObject jsonObjectMgsInfo = jsonArray.getJSONObject(i);
            if (null != jsonObjectMgsInfo) {
                WlyyOutpatientVO 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("YGXM") ? "" : jsonObjectMgsInfo.get("YGXM") + "");
//                wlyyOutpatientVO.setMjz(null == jsonObjectMgsInfo.get("MJZ") ? "" : jsonObjectMgsInfo.get("MJZ") + "");
                String icdName = null == jsonObjectMgsInfo.get("ZYZD") ? "" : jsonObjectMgsInfo.get("ZYZD") + "";
//                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_));
                List<WlyyInspectionVO> inspectionVOList = new ArrayList<>();
                /*JSONArray array = findV_ZKSG_JCCX(PAT_NO,wlyyOutpatientVO.getAdmNo(),demoFlag);
                for (int j=0;j<array.size();j++){
                    JSONObject object = array.getJSONObject(j);
                    String ksdm1 = object.getString("ksdm");//科室代码
                    String fymc = object.getString("fymc");//费用名称
                    String fydj = object.getString("fydj");//单价
                    String fysl = object.getString("fysl");//数量
                    String fyhj = object.getString("fyhj");//金额
                    String jzxh = object.getString("jzxh");//就诊序号
                    String zxks = object.getString("zxks");//执行科室
                    WlyyInspectionVO wlyyInspectionVO = new WlyyInspectionVO();
                    wlyyInspectionVO.setName(fymc);
                    wlyyInspectionVO.setDeptName(zxks);
                    wlyyInspectionVO.setDept(ksdm1);
                    wlyyInspectionVO.setQuantity(Integer.parseInt(fysl));
                    inspectionVOList.add(wlyyInspectionVO);
                }
                wlyyOutpatientVO.setInspectionVOS(inspectionVOList);*/
                wlyyOutpatientVOS.add(wlyyOutpatientVO);
            }
        }
        return wlyyOutpatientVOS;
    }
    /**
     * HIS处方记录
     * @throws Exception
     */
    public List<WlyyPrescriptionVO> findMS_CF01And02(String admNo, boolean demoFlag) throws Exception{
        List<WlyyPrescriptionVO> wlyyPrescriptionVOList = new ArrayList<>();
        //处方数据
        String msd01 = "SELECT d.CFLX,d.BRID,d.BRXM,d.FPHM,d.MZXH,d.JZKH,d.JZXH,d.CFSB,d.CFHM,d.KSDM  FROM MS_CF01 d WHERE d.JZXH = '"+admNo+"'";
        JSONObject rs = new JSONObject();
        String content="";
        Map<String,Object> params = new HashedMap();
        params.put("sql",msd01);
        HttpResponse response = HttpUtils.doGet(url,params);
        content = response.getContent();
        logger.info("response:"+content);
        rs = JSON.parseObject(content);
        Integer status = rs.getInteger("status");
        if(status!=null&&status == 200){
            JSONArray array =rs.getJSONArray("detailModelList");
            logger.info("precription:"+rs.getJSONArray("detailModelList"));
            for (int j=0;j<array.size();j++){
                WlyyPrescriptionVO wlyyPrescriptionVO = new WlyyPrescriptionVO();
                JSONObject object = array.getJSONObject(j);
                wlyyPrescriptionVO.setType(object.getInteger("CFLX"));/*
                wlyyPrescriptionVO.setOrderNo(object.getString("scddh"));*//*
                wlyyPrescriptionVO.setPayStatus(object.getInteger("fkzt"));*/
                wlyyPrescriptionVO.setPatientName(object.getString("BRXM"));
                String brid = object.getString("BRID");
                if (StringUtils.isNoneBlank(brid)){
                    PatientMappingDO mappingDO = patientMappingDao.findByMappingCode(brid);
                    if (mappingDO!=null){
                        wlyyPrescriptionVO.setPatientCode(mappingDO.getPatient());
                    }
                }
                wlyyPrescriptionVO.setSsc(object.getString("JZKH"));/*
                wlyyPrescriptionVO.setOrderId(object.getString("guid"));*/
                wlyyPrescriptionVO.setAdmNo(object.getString("JZXH"));
                wlyyPrescriptionVO.setRealOrder(object.getString("CFSB"));
                wlyyPrescriptionVO.setDept(object.getString("KSDM"));
                wlyyPrescriptionVO.setOriginRealOrder(object.getString("CFHM"));
                String msd02 = "SELECT d.YPXH,d.YPCD,d.YPSL,d.YPDJ,d.YFDW,d.YFDW,d.MRCS,d.YFBZ,d.YPYF,d.YYTS,d.SBXH,d.YFGG  FROM V_MS_DD02 d WHERE d.CFSB = '"+wlyyPrescriptionVO.getRealOrder()+"'";
                JSONObject rs1 =new JSONObject();
                Map<String,Object> params1 = new HashedMap();
                params1.put("sql",msd02);
                HttpResponse response1 = HttpUtils.doGet(url,params1);
                String content1 = response1.getContent();
                logger.info("response:"+content);
                rs1 = JSON.parseObject(content1);
                Integer status1 = rs1.getInteger("status");
                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS = new ArrayList<>();
                if(status1!=null&&status1 == 200){
                    JSONArray array1 =  rs1.getJSONArray("detailModelList");
                    logger.info("info"+rs1.getJSONArray("detailModelList"));
                    for (int i =0;i<array1.size();i++){
                        JSONObject object1 = array1.getJSONObject(i);
                        WlyyPrescriptionInfoVO prescriptionInfoVO = new WlyyPrescriptionInfoVO();
                        String sql = "SELECT YPXH ,YPMC  from YK_TYPK WHERE YPXH='"+object1.getString("YPXH")+"' ";
                        JSONObject rs4 = new JSONObject();
                        Map<String,Object> params4 = new HashedMap();
                        params4.put("sql",sql);
                        HttpResponse response4 = HttpUtils.doGet(url,params4);
                        String content4 = response4.getContent();
                        logger.info("response:"+content4);
                        rs4 = JSON.parseObject(content4);
                        Integer status4 = rs4.getInteger("status");
                        if(status4!=null&&status4 == 200){
                            JSONArray array4 =  rs4.getJSONArray("detailModelList");
                            logger.info("info"+rs4.getJSONArray("detailModelList"));
                            if (array4!=null&&array4.size()!=0){
                                JSONObject jsonObject = array4.getJSONObject(0);
                                prescriptionInfoVO.setDrugName(jsonObject.getString("YPMC"));
                            }
                        }
                        prescriptionInfoVO.setDrugNo(object1.getString("YPXH"));
                        prescriptionInfoVO.setDrugPlace(object1.getString("YPCD"));
                        prescriptionInfoVO.setQuantity(object1.getString("YPSL"));
                        prescriptionInfoVO.setPackRetprice(object1.getDouble("YPDJ"));
                        prescriptionInfoVO.setPackUnitName(object1.getString("YFDW"));
                        prescriptionInfoVO.setUnitName(object1.getString("YFDW"));
                        prescriptionInfoVO.setDosage(object1.getString("MRCS"));
                        prescriptionInfoVO.setPackQuantity(object1.getInteger("YFBZ"));
                        prescriptionInfoVO.setUsageCode(object1.getString("YPYF"));
                        prescriptionInfoVO.setDays(object1.getString("YYTS"));
                     /*   prescriptionInfoVO.setYpyf(object1.getInteger("ypyf"));*/
                        prescriptionInfoVO.setHisCode(object1.getInteger("SBXH"));
                        prescriptionInfoVO.setSpecification(object1.getString("YFGG"));
                        wlyyPrescriptionInfoVOS.add(prescriptionInfoVO);
                    }
                }
                wlyyPrescriptionVO.setInfoVOs(wlyyPrescriptionInfoVOS);
                List<WlyyPrescriptionDiagnosisVO> diagnosisVOS = new ArrayList<>();
                String mz = "SELECT ICD AS \"icd\",MSZD AS \"mszd\",JZXH AS \"jzxh\" FROM v_hlwys_mz_jbzd WHERE jzxh = '"+admNo+"'";
                JSONObject rs2 =new JSONObject();
                Map<String,Object> params2 = new HashedMap();
                params2.put("sql",mz);
                HttpResponse response2 = HttpUtils.doGet(url,params2);
                String content2 = response2.getContent();
                logger.info("response:"+content2);
                rs2 = JSON.parseObject(content2);
                Integer status2 = rs2.getInteger("status");
                if(status2!=null&&status2 == 200){
                    JSONArray array2 = rs2.getJSONArray("detailModelList");
                    for (int i=0;i<array2.size();i++){
                        JSONObject object2 = array2.getJSONObject(i);
                        WlyyPrescriptionDiagnosisVO diagnosisVO = new WlyyPrescriptionDiagnosisVO();
                        diagnosisVO.setCode(object2.getString("icd"));
                        diagnosisVO.setName(object2.getString("mszd"));
                        diagnosisVOS.add(diagnosisVO);
                    }
                }
                wlyyPrescriptionVO.setDiagnosisVOs(diagnosisVOS);
                wlyyPrescriptionVOList.add(wlyyPrescriptionVO);
            }
        }
        return wlyyPrescriptionVOList;
    }
    public List<Map<String,Object>> queryBySql(String sql){
        List<Map<String,Object>> mapList = jdbcTemplate.queryForList(sql);

+ 5 - 4
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/useragent/BaseUserAgent.java

@ -32,7 +32,7 @@ public class BaseUserAgent {
            return json.getString("uid");
        } catch (Exception e) {
            return null;
            return e.getMessage();
        }
    }
@ -52,7 +52,7 @@ public class BaseUserAgent {
            String uname = java.net.URLDecoder.decode(info,"UTF-8");
            return uname;
        } catch (Exception e) {
            return null;
            return e.getMessage();
        }
    }
@ -72,7 +72,7 @@ public class BaseUserAgent {
            return json.getString("roleid");
        } catch (Exception e) {
            return null;
            return e.getMessage();
        }
    }
@ -83,8 +83,9 @@ public class BaseUserAgent {
            JSONObject user = JSON.parseObject(userAgent);
            return user;
        }catch (Exception e){
            return null;
            e.printStackTrace();
        }
        return null;
    }
}

+ 1 - 1
gateway/ag-basic/pom.xml

@ -12,7 +12,7 @@
    <artifactId>ag-basic</artifactId>
    <version>${parent.version}</version>
    <packaging>war</packaging>
    <packaging>jar</packaging>
    <dependencies>
        <!-- 支持Tomcat启动 -->

+ 14 - 1
gateway/ag-basic/src/main/resources/application.yml

@ -208,4 +208,17 @@ spring:
    password: jkzlehr
  redis:
    host: 172.26.0.190 # Redis server host.
    port: 6379 # Redis server port.
    port: 6379 # Redis server port.
---
spring:
  profiles: tnJwprod
  datasource:
     url: jdbc:mysql://10.9.1.247:3306/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
     username: wlyy
     password: qY#j2n5O
  redis:
     host: 10.9.1.247 # Redis server host.
     port: 6380  # Redis server port.
     password: Kb6wKDQP1W4

+ 9 - 0
gateway/ag-basic/src/main/resources/bootstrap.yml

@ -112,3 +112,12 @@ spring:
    config:
      uri: ${wlyy-spring.config.uri:http://172.26.0.194:1221}
      label: ${wlyy-spring.config.label:jwdev}
---
spring:
  profiles: tnJwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}

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

@ -345,4 +345,33 @@ testPattern:
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
---
spring:
  profiles: tnJwprod
  datasource:
    url: jdbc:mysql://10.9.1.247:3306/base?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true&useSSL=false
    username: wlyy
    password: qY#j2n5O
  redis:
    host: 10.9.1.247 # Redis server host.
    port: 6380 # Redis server port.
    password: Kb6wKDQP1W4
  ##发现服务
iHealth:
  user-info-uri: http://www.xmtyw.cn/wlyy/iHealth/userInfo
zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://10.9.1.247:22122
wlyy:
  url: http://www.xmtyw.cn/wlyy/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: sd_tnzyy_wx  # base库中,wx_wechat 的id字段

+ 10 - 1
server/svr-authentication/src/main/resources/bootstrap.yml

@ -113,4 +113,13 @@ spring:
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.194:1221}
      label: ${wlyy.spring.config.label:jwdev}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: tnJwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}

+ 15 - 1
server/svr-configuration/src/main/resources/bootstrap.yml

@ -164,4 +164,18 @@ spring:
        git:
          uri: ${wlyy.spring.config.git.uri:http://192.168.1.220:10080/Amoy2/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:jwdev}
        default-label: ${wlyy.spring.config.git.label:jwdev}
---
spring:
  profiles: tnJwprod
##git配置
  cloud:
    config:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      server:
        git:
          uri: ${wlyy.spring.config.git.uri:http://127.0.0.1:3001/jkzl/wlyy2.0.config.git}
          basedir: /usr/local/wlyy2.0-config
        default-label: ${wlyy.spring.config.git.label:master}

+ 46 - 0
svr/svr-base/src/main/resources/application.yml

@ -540,3 +540,49 @@ wechat:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
---
spring:
  profiles: tnJwprod
  datasource:
    url: jdbc:mysql://10.9.1.247:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: wlyy
    password: qY#j2n5O
  elasticsearch:
    cluster-name: jkzl #集群名 默认elasticsearch
    cluster-nodes: 192.0.33.26:9200 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
    client-transport-sniff: false
    jest:
      uris: http://10.9.1.247:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://10.9.1.247:9103
    user: jkzl
    password: jkzlehr
  redis:
    host: 10.9.1.247 # Redis server host.
    port: 6380 # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: http://10.9.1.247:8888/
demo:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
wlyy:
  url: http://ehr.yihu.com/wlyy/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
im:
  im_list_get: http://10.9.1.247:3000/
---

+ 8 - 0
svr/svr-base/src/main/resources/bootstrap.yml

@ -94,3 +94,11 @@ spring:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.194:1221}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: tnJwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}

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

@ -26,7 +26,7 @@ public class TnyyController extends EnvelopRestEndpoint {
    @GetMapping(value = "/queryBySql")
    @ApiOperation(value = "视图统一查询")
    public ListEnvelop createSQLQuery(@ApiParam(name = "sql", value = "sql语句", required = true)
    public ListEnvelop queryBySql(@ApiParam(name = "sql", value = "sql语句", required = true)
                                      @RequestParam(value = "sql",required = true)String sql){
        return success(tnyyEntranceService.queryBySql(sql));
    }

+ 51 - 2
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -369,9 +369,9 @@ express:
---
# sql前置機
# sqlserverce测试环境
spring:
  profiles: sqlServerProd
  profiles: sqlServerTest
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://192.168.131.125:1433;DatabaseName=base
@ -386,6 +386,55 @@ spring:
    database-platform: org.hibernate.dialect.SQLServer2008Dialect
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.16.1.42:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.0.33.26:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890
---
# sqlserverce正式环境
spring:
  profiles: tnJwprod
  datasource:
    driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://10.9.1.246:1433;DatabaseName=tazyy
    username: sa
    password: jsjzx@1234
  jpa:
    properties:
      hibernate:
        default_schema: dbo
      naming:
        physical-strategy: com.ford.configuration.UpperTableStrategy
    database-platform: org.hibernate.dialect.SQLServer2008Dialect
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false

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

@ -339,3 +339,44 @@ express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code:
  sf_check_word:
---
spring:
  profiles: tnJwprod
  datasource:
    url: jdbc:mysql://10.9.1.247:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false #jdbc:mysql://192.0.33.27:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: wlyy
    password: qY#j2n5O
hlwyyEntrance:
  url: http://172.16.1.42:10023
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com #https://172.16.1.34
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://10.9.1.247:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://10.9.1.247:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: d24d1367-7f4f-43af-910e-a0a43799e040  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
  ids: sd_tnzyy_wx
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
jobs:
  schedule: 0 */30 * * * ?

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

@ -22,11 +22,9 @@ import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.InspectionService;
import com.yihu.jw.hospital.prescription.service.PrescriptionLogService;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.WorkTimeService;
import com.yihu.jw.hospital.prescription.service.*;
import com.yihu.jw.hospital.prescription.service.entrance.DoctorPreSignService;
import com.yihu.jw.hospital.prescription.service.entrance.TnyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.hospital.service.SystemMessage.HospitalSystemMessageService;
import com.yihu.jw.im.dao.ConsultDao;
@ -117,6 +115,10 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private ConsultDao consultDao;
    @Autowired
    private HospitalSystemMessageService hospitalSystemMessageService;
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private TnPrescriptionService tnPrescriptionService;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -141,7 +143,15 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                              @RequestParam(value = "cardNo",required = false)String cardNo) throws Exception {
        startTime = startTime+" 00:00:00";
        endTime =endTime+" 23:59:59";
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm,cardNo);
        List<WlyyOutpatientVO> vos = new ArrayList<>();
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm,cardNo);
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            vos = tnPrescriptionService.findOutpatientList(patient, cardNo,startTime, endTime, demoFlag,ksdm);
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
        return success(vos);
    }
    
@ -151,7 +161,14 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                         @RequestParam(value = "patient",required = false) String patient,
                                         @ApiParam(name = "conNo", value = "就诊次数")
                                         @RequestParam(value = "conNo",required = false) String conNo)throws Exception{
        WlyyOutpatientVO obj = prescriptionService.findOutpatientInfo(patient,conNo);
        WlyyOutpatientVO obj = new WlyyOutpatientVO();
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            obj = prescriptionService.findOutpatientInfo(patient,conNo);
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            obj = tnPrescriptionService.findOutpatientInfo(patient,conNo,demoFlag,null);
        }else {
            return ObjEnvelop.getError("尚未开发!");
        }
        return success(obj);
    }
    
@ -166,7 +183,15 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "admNo",required = false) String admNo,
            @ApiParam(name = "realOrder", value = "处方号")
            @RequestParam(value = "realOrder",required = false) String realOrder) throws Exception {
        List<WlyyPrescriptionVO> obj = prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
        List<WlyyPrescriptionVO> obj = new ArrayList<>();
        if (wxId.equalsIgnoreCase("xm_zsyy_wx")){
            obj= prescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            obj= tnPrescriptionService.findOriginPrescriptionList(registerSn, patNo, realOrder, admNo,demoFlag);
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
        return success(obj);
    }
    
@ -396,6 +421,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(prescriptionService.getICD10(pyKey));
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectIcd10Dict(pyKey));
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnyyEntranceService.findIcd10(pyKey,false));
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
@ -418,6 +445,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(prescriptionService.getDrugDictionary(drugNo,pyKey,winNo,groupNo));
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectDrugDict(pyKey));
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnyyEntranceService.findTnYpxx(drugNo,null,null,pyKey,null));
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
@ -434,6 +463,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(prescriptionService.getDrugUse(drugNo,pyKey));
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectMedicineUsed(pyKey));
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnyyEntranceService.findYpyf(pyKey));
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
@ -448,6 +479,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(prescriptionService.getDrugFrequency());
        }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
            return success(xzzxEntranceService.selectFrequencyDict());
        }else if (wxId.equalsIgnoreCase("sd_tnzyy_wx")){
            return success(tnyyEntranceService.findSypc(null));
        }else {
            return ListEnvelop.getError("尚未开发!");
        }

+ 52 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/tnyy/TnyyController.java

@ -0,0 +1,52 @@
package com.yihu.jw.hospital.endpoint.tnyy;
import com.yihu.jw.hospital.prescription.service.TnPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.TnyyEntranceService;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by Trick on 2020/1/19.
 */
@RestController
@RequestMapping(value ="/tnyy")
@Api(value = "泰安中医院", description = "泰安中医院", tags = {"泰安中医院"})
public class TnyyController extends EnvelopRestEndpoint {
    @Autowired
    private TnyyEntranceService tnyyEntranceService;
    @Autowired
    private TnPrescriptionService prescriptionService;
    @GetMapping(value = "/getDeptInfo")
    @ApiOperation(value = "获取部门信息", notes = "获取部门信息")
    public ObjEnvelop getDeptInfo(@ApiParam(name = "code", value = "code", required = false)
                                  @RequestParam(value = "code",required = false)String code)throws Exception{
        return ObjEnvelop.getSuccess("ok",tnyyEntranceService.updateTnyyDept());
    }
    @GetMapping(value = "/updateTnyyDoctor")
    @ApiOperation(value = "获取医生信息", notes = "获取医生信息")
    public ObjEnvelop updateTnyyDoctor(@ApiParam(name = "idcard", value = "idcard", required = false)
                                  @RequestParam(value = "idcard",required = false)String idcard)throws Exception{
        return ObjEnvelop.getSuccess("ok",tnyyEntranceService.updateTnyyDoctor(idcard));
    }
    @GetMapping(value = "/synYkICD10")
    @ApiOperation(value = "获取icd10信息", notes = "获取icd10信息")
    public ObjEnvelop synYkICD10()throws Exception{
        return ObjEnvelop.getSuccess("ok",prescriptionService.synYkICD10());
    }
}

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

@ -864,5 +864,96 @@ express:
  sf_check_word: QkeIfIvQdheqIv2cVSgAUnBU29lfNbVk
---
spring:
  profiles: tnJwprod
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://10.9.1.247:3306/base?useUnicode:true&characterEncoding=utf-8&autoReconnect=true&useSSL=false
    username: wlyy
    password: qY#j2n5O
#  elasticsearch:
#    cluster-name: jkzl #集群名 默认elasticsearch
#    cluster-nodes: 192.0.33.26:9200 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
#    client-transport-sniff: false
#    jest:
#      uris: http://192.0.33.26:9300
#      connection-timeout: 60000 # Connection timeout in milliseconds.
#      multi-threaded: true # Enable connection requests from multiple execution threads.
  activemq:
    broker-url: tcp://59.61.92.90:9103
    user: jkzl
    password: jkzlehr
  redis:
    host: 10.9.1.247 # Redis server host.
    port: 6380 # Redis server port.
    password: Kb6wKDQP1W4
fastDFS:
  fastdfs_file_url: https://hlwyy.xmzsh.com/fastdfs/
fast-dfs:
  tracker-server: 10.9.1.247:22122 #服务器地址
wechat:
  id: sd_tnzyy_wx  # base库中,wx_wechat 的id字段  # todo 待配置
  flag: true #演示环境  true走Mysql数据库  false走Oracle
# 短信验证码发送的客户端标识,居民端
sms:
  clientId: EwC0iRSrcP #todo 待配置
myFamily:
  qrCodeFailurTime: 2
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: true
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://10.9.1.247:3000/
  data_base_name: im
es:
  pwflag: 1 # 1需要密码,2不需要密码
  index:
    Statistics: hlw_quota_prod
  type:
    Statistics: hlw_quota_prod
  host:  http://10.9.1.247:9200
  tHost: 10.9.1.247:9300
  clusterName: jkzl
  user: lion
  password: jkzlehr
  securityUser: lion:jkzlehr
# 上传文件临时路径配置
FileTempPath:
  upload_temp_path : /var/local/temp
  image_path : /var/local/upload/images
  voice_path : /var/local/upload/voice
  chat_file_path : /var/local/upload/chat
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
qywx:
  url: https://hlwyy.xmzsh.com/hlwyy
  id: zsyy
express:
  sf_url: https://mrds-admin.sf-express.com:443
  sf_code: WH000102
  sf_check_word: TGUQASFNAZyjt9112
---

+ 9 - 1
svr/svr-internet-hospital/src/main/resources/bootstrap.yml

@ -88,4 +88,12 @@ spring:
  cloud:
    config:
      uri: ${wlyy.spring.config.uri:http://172.26.0.194:1221}
      label: ${wlyy.spring.config.label:jwdev}
      label: ${wlyy.spring.config.label:jwdev}
---
spring:
  profiles: tnJwprod
  cloud:
    config:
      uri: ${wlyy.pring.config.uri:http://127.0.0.1:1221}
      label: ${wlyy.spring.config.label:master}