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
6835546947
16 changed files with 400 additions and 85 deletions
  1. 2 0
      business/base-service/src/main/java/com/yihu/jw/hospital/family/dao/WlyyPatientFamilyMemberDao.java
  2. 16 25
      business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java
  3. 22 3
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  4. 189 10
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/YkyyPrescriptionService.java
  5. 44 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java
  6. 0 2
      business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java
  7. 4 7
      business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java
  8. 33 0
      business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java
  9. 6 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  10. 1 1
      gateway/ag-basic/pom.xml
  11. 5 1
      gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java
  12. 9 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/model/WlyyUserSimple.java
  13. 11 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java
  14. 24 27
      svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/YkyyController.java
  15. 6 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  16. 28 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/YkyyPrescriptionEndpoint.java

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

@ -16,4 +16,6 @@ public interface WlyyPatientFamilyMemberDao extends PagingAndSortingRepository<W
    WlyyPatientFamilyMemberDO findByIdAndDel(String id);
    @Query("from WlyyPatientFamilyMemberDO t where t.cardNo=?1 and t.patient=?2  and t.isDel =1")
    WlyyPatientFamilyMemberDO findbyCardNoAndPatient(String idCard,String patient);
    @Query("from WlyyPatientFamilyMemberDO t where t.patient=?1  and t.isDel =1")
    List<WlyyPatientFamilyMemberDO> findbyPatient(String patient);
}

+ 16 - 25
business/base-service/src/main/java/com/yihu/jw/hospital/family/service/WlyyFamilyMemberService.java

@ -3,7 +3,6 @@ package com.yihu.jw.hospital.family.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.family.BasePatientMemberDictDO;
import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
@ -19,23 +18,17 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.base.BaseRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import jdk.management.resource.internal.inst.SocketOutputStreamRMHooks;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import org.apache.commons.lang.StringUtils;
import org.checkerframework.checker.units.qual.A;
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 javax.management.MXBean;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@ -286,7 +279,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
            mixEnvelop.setDetailModelList(resultList);
            if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByCode(medicare);
                if (null==patientMedicareCardDO){
                if (patientMedicareCardDO==null){
                    patientMedicareCardDO = new PatientMedicareCardDO();
                }
                if (null!=patientMedicareCardDO){
@ -313,6 +306,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        return mixEnvelop;
    }
    //眼科同步家人信息
    @Transactional
    public void saveYktFamily(String patientId) throws Exception{
        try {
            String userId="";
@ -325,11 +319,15 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
            if (StringUtils.isNotEmpty(res)){
                JSONObject jsonObject = JSONObject.parseObject(res);
                if ("200".equalsIgnoreCase(jsonObject.getString("code"))){
                    JSONObject data = JSONObject.parseObject(jsonObject.getString("data"));
                    JSONArray jsonArray = JSONArray.fromObject(data.get("list"));
                    JSONObject data = jsonObject.getJSONObject("data");
                    List<WlyyPatientFamilyMemberDO> patientFamilyMemberDOS = wlyyPatientFamilyMemberDao.findbyPatient(patientId);
                    if (patientFamilyMemberDOS!=null&&patientFamilyMemberDOS.size()>0){
                        wlyyPatientFamilyMemberDao.delete(patientFamilyMemberDOS);
                    }
                    com.alibaba.fastjson.JSONArray jsonArray = data.getJSONArray("list");
                    if(jsonArray!=null && jsonArray.size()>0) {
                        for (int i = 0; i < jsonArray.size(); i++) {
                            JSONObject jsonObject1 = JSONObject.parseObject(jsonArray.get(i).toString());
                            JSONObject jsonObject1 = jsonArray.getJSONObject(i);
                            System.out.println("==="+jsonArray.get(i).toString());
                            if (StringUtils.isNotEmpty(jsonObject1.getString("IDCARD"))){
                                System.out.println("同步的身份证号:"+jsonObject1.getString("IDCARD"));
@ -354,7 +352,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                                if(hisArray!=null&&hisArray.size()>0) {
                                    net.sf.json.JSONObject hisObject = net.sf.json.JSONObject.fromObject(hisArray.get(0).toString());
                                    PatientMappingDO patientMappingDO = patientMappingDao.findByIdcard(patientDO.getIdcard());
                                    if(null==patientMappingDO){
                                    if(patientMappingDO==null){
                                        patientMappingDO= new PatientMappingDO();
                                    }
                                    patientMappingDO.setPatientName(jsonObject1.getString("NAME"));
@ -365,12 +363,9 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                                    patientMappingDO.setIdcard(patientDO.getIdcard());
                                    patientMappingDao.save(patientMappingDO);
                                }
                                WlyyPatientFamilyMemberDO wlyyPatientFamilyMemberDO = wlyyPatientFamilyMemberDao.findbyCardNoAndPatient(patientDO.getIdcard(),patientId);
                                if (null==wlyyPatientFamilyMemberDO){
                                    wlyyPatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
                                }
                                WlyyPatientFamilyMemberDO wlyyPatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
                                BasePatientMemberDictDO basePatientMemberDictDO =basePatientMemberDictDao.findByRelationName(jsonObject1.getString("ILLNESS"));
                                if (null!=basePatientMemberDictDO){
                                if (basePatientMemberDictDO!=null){
                                    wlyyPatientFamilyMemberDO.setIsDel(1);
                                    wlyyPatientFamilyMemberDO.setPatient(patientId);
                                    wlyyPatientFamilyMemberDO.setClinicid(jsonObject1.getString("CLINICID"));
@ -388,7 +383,8 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                                        patientMedicareCardDO = new PatientMedicareCardDO();
                                    }
                                    patientMedicareCardDO.setCode(jsonObject1.getString("MEDICALCARD"));
                                    //patientMedicareCardDO.setType(medicareType);
                                    patientMedicareCardDO.setParentType("A");
                                    patientMedicareCardDO.setType("A_01");
                                    patientMedicareCardDO.setPatientCode(patientDO.getId());
                                    patientMedicareCardDO.setDel("1");
                                    basePatientMedicareCardDao.save(patientMedicareCardDO);
@ -404,14 +400,9 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
        }
    }
    //根据患者id查询关联家属
    @Transactional
    public List<Map<String,Object>> findFamilyByPatientId(String patientId) throws ParseException {
        if("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            try {
                saveYktFamily(patientId);
            }catch (Exception e){
                e.printStackTrace();
            }
            String sql = "select t.id as \"id\",t.card_type as \"cardType\", " +
                    "t.patient as \"patient\",b.name as \"name\",b.sex as \"sex\","+
                    "to_char(b.birthday,'yyyy-MM-dd') as\"birthday\",b.idcard as \"idcard\",t.clinicid as \"clinicid\"," +
@ -553,7 +544,7 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
                    if(null!=map.get("familyMember")){
                        List<PatientMedicareCardDO> list1 = basePatientMedicareCardDao.findByPatientCode(map.get("familyMember").toString());
                        if (null!=list1&&list.size()>0){
                        if (list1!=null&&list1.size()!=0){
                            map.put("card",list1.get(0));
                        }else {
                            map.put("card","");

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

@ -79,7 +79,6 @@ import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
import com.yihu.jw.utils.GenerateUserSig;
import com.yihu.jw.utils.Pkis.PKIService_PortType;
import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
import com.yihu.jw.utils.StringUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
@ -105,7 +104,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.Banner;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -485,7 +483,21 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        sql += " AND o.outpatient_type != '2' ORDER BY o.create_time DESC ";
        logger.info("sql="+sql);
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, size);
        for(Map<String, Object> map:list){
            String outpatientId = map.get("id").toString();
            String outPatientStatus = map.get("status")==null?"":map.get("status").toString();
            String consultSql = "select t.id as \"id\" from wlyy_consult t where t.relation_code ='"+outpatientId+"'";
            List<Map<String, Object>> consultList = hibenateUtils.createSQLQuery(consultSql);
            if (consultList!=null&&consultList.size()!=0){
                if (outPatientStatus.equalsIgnoreCase("0")&&consultList!=null&&consultList.size()>0&&null!=consultList.get(0).get("id")){
                    map.put("haveConsult","1");
                }else {
                    map.put("haveConsult","0");
                }
            }else {
                map.put("haveConsult","0");
            }
        }
        return MixEnvelop.getSuccessListWithPage(BaseHospitalRequestMapping.Prescription.api_success, list, page, size, count);
    }
@ -5596,6 +5608,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        Map<String, Object> rs = new HashedMap();
        BasePatientDO basePatientDO = basePatientDao.findById(patient);
        PatientMedicareCardDO patientMedicareCardDO = basePatientMedicareCardDao.findByTypeAndPatientCodeAndDel("A_01", patient, "1");
        List<BasePatientWechatDo> patientWechatDos = patientWechatDao.findByWechatIdAndPatientId(wechatId,patient);
        rs.put("id", patient);
        rs.put("name", basePatientDO.getName());
        rs.put("sex", basePatientDO.getSex());
@ -5615,6 +5628,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        } else {
            rs.put("ssc", "");
        }
        if (patientWechatDos!=null&&patientWechatDos.size()!=0){
            BasePatientWechatDo patientWechatDo =patientWechatDos.get(0);
            rs.put("openid",patientWechatDo.getOpenid());
        }else {
            rs.put("openid","");
        }
        return rs;
    }

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

@ -4,12 +4,23 @@ 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.area.BaseDrugStoreDO;
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.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
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.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionExpressageDO;
@ -17,22 +28,26 @@ import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.consult.dao.HospitalWaitingRoomDao;
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.YkyyEntranceService;
import com.yihu.jw.hospital.prescription.service.useragent.BaseUserAgent;
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.order.pay.wx.WeChatConfig;
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.util.common.IdCardUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WechatDao;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -59,8 +74,6 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    @Autowired
    private BasePatientDao basePatientDao;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
    @Autowired
    private HospitalWaitingRoomDao hospitalWaitingRoomDao;
@ -83,9 +96,23 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private BaseUserAgent userAgent;
    @Autowired
    private BaseDrugStoreDao baseDrugStoreDao;
    @Autowired
    private BasePatientMedicareCardDao basePatientMedicareCardDao;
    @Autowired
    private PatientMappingDao patientMappingDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private DictHospitalDeptDao dictHospitalDeptDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    @Autowired
    private BaseDoctorRoleDao doctorRoleDao;
    @Autowired
    private DoctorMappingDao doctorMappingDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -109,9 +136,39 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
     * @return
     * @throws Exception
     */
    public  List<WlyyOutpatientVO> findOutpatientList(String patient, String startTime, String endTime, boolean demoFlag,String ksdm)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 =patientMappingService.findYkyyPatNoByPatient(patient,demoFlag);
        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;
        }
@ -120,6 +177,93 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    }
    public void synDoctorInfo(String idcard) throws Exception {
        JSONArray jsonArray = ykyyEntranceService.findHisDoctor(idcard);
        if (jsonArray!=null&&jsonArray.size()!=0){
            for (int i=0;i<jsonArray.size();i++){
                JSONObject jsonObject = jsonArray.getJSONObject(i);
                String idCard= jsonObject.getString("idcard");
                String code = jsonObject.getString("code");
                String name = jsonObject.getString("name");
                String expertise = jsonObject.getString("expertise");
                String introduce = jsonObject.getString("introduce");
                String mobile = jsonObject.getString("mobile");
                String jobTitleCode = jsonObject.getString("jobTitleCode");
                String jobTitleName = jsonObject.getString("jobTitleName");
                String dept = jsonObject.getString("dept");
                String deptName = jsonObject.getString("deptName");
                List<BaseDoctorDO> doctorDOS =doctorDao.findByIdcard(idcard);
                if (doctorDOS!=null&&doctorDOS.size()!=0){
                    BaseDoctorDO doctorDO = doctorDOS.get(0);
                    doctorDO.setIdcard(idcard);
                    doctorDO.setName(name);
                    doctorDO.setExpertise(expertise);
                    doctorDO.setIntroduce(introduce);
                    doctorDO.setMobile(mobile);
                    doctorDO.setJobTitleCode(jobTitleCode);
                    doctorDO.setJobTitleName(jobTitleName);
                    DictHospitalDeptDO dictHospitalDeptDO = dictHospitalDeptDao.findByCode(dept);
                    List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDeptCodeAndDoctorCode(dept,doctorDO.getId());
                    for (BaseDoctorHospitalDO doctorHospitalDO:doctorHospitalDOS){
                        doctorHospitalDO.setDeptCode(dept);
                        doctorHospitalDO.setDeptName(deptName);
                        doctorHospitalDao.save(doctorHospitalDO);
                    }
                    doctorDao.save(doctorDO);
                }else {
                    BaseDoctorDO doctorDO = new BaseDoctorDO();
                    doctorDO.setIdcard(idCard);
                    doctorDO.setName(name);
                    doctorDO.setExpertise(expertise);
                    doctorDO.setIntroduce(introduce);
                    doctorDO.setMobile(mobile);
                    doctorDO.setJobTitleCode(jobTitleCode);
                    doctorDO.setJobTitleName(jobTitleName);
                    doctorDO.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(idcard)));
                    doctorDO.setBirthday(IdCardUtil.getBirthdayForIdcard(idcard));
                    String salt = randomString(5);
                    String pw = idcard.substring(idcard.length() - 6);
                    doctorDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
                    doctorDO.setSalt(salt);
                    doctorDO.setDel("1");
                    doctorDO.setEnabled(1);
                    doctorDO.setLocked(0);
                    doctorDO.setCreateTime(new Date());
                    doctorDO = doctorDao.save(doctorDO);
                    //机构信息部门信息
                    BaseDoctorHospitalDO hospitalDO = new BaseDoctorHospitalDO();
                    hospitalDO.setDoctorCode(doctorDO.getId());
                    hospitalDO.setOrgCode("350211A5004");
                    hospitalDO.setOrgName("厦门大学附属厦门眼科中心");
                    hospitalDO.setDeptCode(dept);
                    hospitalDO.setDeptName(deptName);
                    hospitalDO.setDel("1");
                    doctorHospitalDao.save(hospitalDO);
                    BaseDoctorRoleDO role = new BaseDoctorRoleDO();
                    role.setDoctorCode(doctorDO.getId());
                    role.setRoleCode("specialist");
                    doctorRoleDao.save(role);
                    DoctorMappingDO mappingDO = new DoctorMappingDO();
                    mappingDO.setIdcard(idcard);
                    mappingDO.setDoctor(doctorDO.getId());
                    mappingDO.setOrgCode("350211A5004");
                    mappingDO.setOrgName("厦门大学附属厦门眼科中心");
                    mappingDO.setMappingCode(code);
                    mappingDO.setMappingName(name);
                    mappingDO.setDoctorName(name);
                    mappingDO.setMappingDeptName(deptName);
                    mappingDO.setMappingDept(dept);
                    mappingDO.setMappingJob(jobTitleCode);
                    mappingDO.setMappingJobName(jobTitleName);
                    mappingDO.setCreateTime(new Date());
                    doctorMappingDao.save(mappingDO);
                }
            }
        }
    }
    /**
     *
     */
@ -548,9 +692,9 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
    public JSONArray findPatientCard(String patient)throws Exception{
        BasePatientDO patientDO = basePatientDao.findById(patient);
        if (patientDO!=null){
            JSONArray res = ykyyEntranceService.findHisCard(patientDO.getIdcard(),demoFlag);
            //JSONArray res = ykyyEntranceService.findHisCard(patientDO.getIdcard(),demoFlag);
            JSONArray rs = new JSONArray();
            if(res !=null){
            /*if(res !=null){
                for (int i =0;i<res.size();i++){
                    JSONObject object = (JSONObject) res.get(i);
                    JSONObject jsonObject = new JSONObject();
@ -562,8 +706,43 @@ public class YkyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
                    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 rs;
        }
        return null;

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

@ -3,7 +3,6 @@ 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.sun.org.apache.bcel.internal.generic.NEW;
import com.yihu.jw.dict.dao.DictDoctorDutyDao;
import com.yihu.jw.dict.dao.DictHospitalDeptDao;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
@ -21,7 +20,6 @@ import com.yihu.jw.entity.base.score.BaseEvaluateScoreDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.mapping.PatientMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.entity.hospital.survey.WlyySurveyQuestionDO;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateDao;
import com.yihu.jw.evaluate.score.dao.BaseEvaluateScoreDao;
import com.yihu.jw.hospital.dict.YkDictIcd10Dao;
@ -43,11 +41,9 @@ import com.yihu.utils.network.HttpUtils;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -1580,7 +1576,7 @@ public class YkyyEntranceService {
        }else if (!StringUtils.isNotBlank(medicare)&&StringUtils.isNotBlank(mzhm)){
            sql+=" and x.mzhm = '"+mzhm+"' ";
        }else {
            sql+=" and x.brid is is null";
            sql+=" and x.brid is null";
        }
        net.sf.json.JSONArray array = new net.sf.json.JSONArray();
        Map<String,Object> params = new HashedMap();
@ -2666,4 +2662,47 @@ public class YkyyEntranceService {
        }
        return result;
    }
    /**
     * 根据卡号获取病人hisCode
     * @param cardNo
     * @return
     * @throws Exception
     */
    public JSONArray findPatientCodeByCardNo(String cardNo,boolean demoFlag) throws Exception {
        String sql = "select x.brid as \"brid\" ,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 o.card_no = '"+cardNo+"'";
        JSONArray array = new JSONArray();
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("idcard:"+sql);
        if (demoFlag){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("pat_no","P5616242-0");
            jsonObject.put("card_no","D40136791");
            jsonObject.put("card_stat","激活");
            jsonObject.put("op_date","2020-06-25 08:46:40");
            jsonObject.put("card_type","2");
            jsonObject.put("card_type_name","社保卡");
            array.add(jsonObject);
        }else {
            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 String findInfoBysql(String sql) throws Exception {
        Map<String,Object> params = new HashedMap();
        params.put("sql",sql);
        logger.info("sql:"+sql);
        HttpResponse response = HttpUtils.doGet(url,params);
        String content = response.getContent();
        return content;
    }
}

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

@ -824,10 +824,8 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
            }
            if (businessOrderDO!=null&&!businessOrderDO.getOrderCategory().equalsIgnoreCase("5")&&businessOrderDO.getStatus()!=1){
                if (null != hospitalSysDictDO && "0".equalsIgnoreCase(hospitalSysDictDO.getDictValue())) {
                } else {
                    ykyyService.updateYktOrderStatus(businessOrderDO.getOrderNo(),"1");
                }
            }
            businessOrderDO.setStatus(1);

+ 4 - 7
business/base-service/src/main/java/com/yihu/jw/patient/service/BasePatientService.java

@ -3,7 +3,6 @@ package com.yihu.jw.patient.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.patient.PatientMedicareCardDO;
import com.yihu.jw.hospital.ykyy.service.YkyyService;
@ -22,7 +21,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.sound.sampled.Mixer;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@ -243,11 +241,6 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
    public Boolean updatePatientPw(String id,String pw,String orgPw){
        BasePatientDO patientDO = basePatientDao.findOne(id);
        String orgPwMd5 = MD5.md5Hex(orgPw + "{" + patientDO.getSalt() + "}");
        if(!orgPwMd5.equals(patientDO.getPassword())){
            return false;
        }
        //认证信息设置
        if ("xm_ykyy_wx".equalsIgnoreCase(wxId)){
            String response =ykyyService.updatePatientPassword(patientDO.getMobile(),pw,"");
@ -263,6 +256,10 @@ public class BasePatientService<T, R extends CrudRepository> extends BaseJpaServ
                return true;
            }
        }
        String orgPwMd5 = MD5.md5Hex(orgPw + "{" + patientDO.getSalt() + "}");
        if(!orgPwMd5.equals(patientDO.getPassword())){
            return false;
        }
        String salt = randomString(5);
        patientDO.setPassword(MD5.md5Hex(pw + "{" + salt + "}"));
        patientDO.setSalt(salt);

+ 33 - 0
business/base-service/src/main/java/com/yihu/jw/wlyy/service/WlyyBusinessService.java

@ -20,6 +20,7 @@ import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.hospital.mapping.dao.DoctorMappingDao;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.org.dao.BaseOrgDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.dao.BasePatientMedicareCardDao;
@ -83,6 +84,8 @@ public class WlyyBusinessService {
    @Autowired
    private BasePatientMedicareCardDao patientMedicareCardDao;
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    /**
@ -306,6 +309,36 @@ public class WlyyBusinessService {
                        }
                    }
                }
            }else if (wxId.equalsIgnoreCase("xm_xzzx_wx")){
                JSONArray array = xzzxEntranceService.selectPateintCard(patientId);
                for (int i=0;i<array.size();i++){
                    JSONObject jsonObject = array.getJSONObject(i);
                    String cardType = jsonObject.getString("CARD_TYPE");
                    String cardNo = jsonObject.getString("CARD_NO");
                    String cardTypeName = jsonObject.getString("CARD_TYPE_HIS");
                    PatientMedicareCardDO patientMedicareCardDO = patientMedicareCardDao.findByCode(cardNo);
                    if (patientMedicareCardDO==null){
                        patientMedicareCardDO = new PatientMedicareCardDO();
                        patientMedicareCardDO.setCode(cardNo);
                        patientMedicareCardDO.setParentType("A");
                        if (cardType.equalsIgnoreCase("01")){
                            patientMedicareCardDO.setType("A_01");
                            patientCardNo = cardNo;
                        }else {
                            patientMedicareCardDO.setType("A_03");
                        }
                        patientMedicareCardDO.setPatientCode(patientId);
                        patientMedicareCardDO.setOrgCode("350211A1002");
                        patientMedicareCardDO.setCityCode("350200");
                        patientMedicareCardDO.setDel("1");
                        patientMedicareCardDO.setRemark(cardTypeName);
                        patientMedicareCardDao.save(patientMedicareCardDO);
                    }else {
                        if (patientMedicareCardDO.getType().equalsIgnoreCase("A_01")){
                            patientCardNo = patientMedicareCardDO.getCode();
                        }
                    }
                }
            }else {
                //TODO
            }

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

@ -52,6 +52,10 @@ public class BaseHospitalRequestMapping {
         * 查询单条门诊记录接口
         */
        public static final String findOutpatientInfo ="/findOutpatientInfo";
        /**
         * 同步医生信息
         */
        public static final String synDoctorInfo = "/synDoctorInfo";
        /**
         * 查询单条复诊信息全部接口
         */
@ -524,6 +528,8 @@ public class BaseHospitalRequestMapping {
        //=====================start=======================================
        public static final String yktPay ="/yktPay";
        public static final String getSql = "/getSql";
        /**
         * 获取门诊记录
         */

+ 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启动 -->

+ 5 - 1
gateway/ag-basic/src/main/java/com/yihu/jw/gateway/filter/BasicZuulFilter.java

@ -140,6 +140,7 @@ public class BasicZuulFilter extends ZuulFilter {
    public void decrypt(RequestContext ctx,HttpServletRequest request) throws Exception {
        String url = request.getRequestURI();
        String method = request.getMethod();
        if (method.equalsIgnoreCase("GET")){
            Map<String, List<String>> map = ctx.getRequestQueryParams();
@ -172,7 +173,10 @@ public class BasicZuulFilter extends ZuulFilter {
                JSONObject jsonObject = JSONObject.parseObject(jsonobject);
                for(String str:jsonObject.keySet()){
                    String value = jsonObject.getString(str);
                    body+=str+"="+ URLEncoder.encode(value)+"&";
                    if (!StringUtils.isEmpty(value)){
                        value = URLEncoder.encode(value);
                    }
                    body+=str+"="+ value+"&";
                }
                String newBody = body.substring(0,body.length()-1);
                logger.info("newBody" + newBody);

+ 9 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/model/WlyyUserSimple.java

@ -1,7 +1,6 @@
package com.yihu.jw.security.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
import java.util.Date;
@ -46,6 +45,7 @@ WlyyUserSimple implements Serializable {
    private String tokenType;
    private int expiresIn;
    private String state;
    private String openid; //患者openid
    public String getId() {
        return id;
@ -163,4 +163,12 @@ WlyyUserSimple implements Serializable {
    public void setState(String state) {
        this.state = state;
    }
    public String getOpenid() {
        return openid;
    }
    public void setOpenid(String openid) {
        this.openid = openid;
    }
}

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

@ -1808,6 +1808,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                                        basePatientDao.save(basePatientDO);
                                    }
                                }
                            }else {
                                BasePatientDO basePatientDO1 = basePatientDOS.get(0);
                                basePatientDO1.setUserId(userId);
                                basePatientDao.save(basePatientDO1);
                            }
                        }
                    }
@ -1855,6 +1859,7 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        wlyyUserSimple.setUser(parameters.get("username"));
        wlyyUserSimple.setState(parameters.get("state"));
        String openid = parameters.get("openid");
        wlyyUserSimple.setOpenid(openid);
        //更新患者openId
        BaseLoginLogDO baseLoginLogDO = new BaseLoginLogDO();
@ -1976,6 +1981,12 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                            String idCard = jsonObject.getString("idCard");
                            String verifyCode = jsonObject.getString("verifyCode");
                            String yktDoctorId= jsonObject.getString("id");
                            BaseDoctorDO doctorDOs = doctorDao.findByIdcard(idCard);
                            if (doctorDOs!=null){
                                doctorDOs.setVerifyCode(verifyCode);
                                doctorDOs.setYktDoctorId(yktDoctorId);
                                doctorDao.save(doctorDOs);
                            }
                            if (idCard==null||idCard==""){
                                logger.info("身份证为空");
                            }else {

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

@ -1,7 +1,5 @@
package com.yihu.jw.entrance.controller;
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.doctor.dao.BaseDoctorDao;
@ -12,21 +10,20 @@ 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.MixEnvelop;
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.EntityUtils;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Date;
@ -128,8 +125,8 @@ public class YkyyController extends EnvelopRestEndpoint {
        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@ykzxtest where bmc = 'MS_CF01'";
            String cfhmSql="select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@ykzxtest where bmc = 'MS_CF01_CFHM'";
            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;
@ -137,14 +134,14 @@ public class YkyyController extends EnvelopRestEndpoint {
            if (cfsbList!=null&&cfsbList.size()!=0){
                cfsb = Long.parseLong(cfsbList.get(0).get("total").toString());
                System.out.println("cfsb:"+cfsb);
                String updateCfsb = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'MS_CF01'";
                String updateCfsb = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_CF01'";
                hibenateUtils.updateBySql(updateCfsb);
            }
            if (cfhmList!=null&&cfhmList.size()!=0){
                cfhm = Long.parseLong(cfhmList.get(0).get("total").toString());
                System.out.println("cfhm:"+cfhm);
                String updateCfhm = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'MS_CF01_CFHM'";
                String updateCfhm = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_CF01_CFHM'";
                hibenateUtils.updateBySql(updateCfhm);
            }
            hlwCf01VO.setCFSB(cfsb.intValue());
@ -157,12 +154,12 @@ public class YkyyController extends EnvelopRestEndpoint {
            envelop.setObj(object1);
        }else if (table.equalsIgnoreCase("HLW_CF02")){
            HlwCf02DO hlwCf02VO =  JSONObject.toJavaObject(object,HlwCf02DO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@ykzxtest where bmc = 'MS_CF02'";
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_CF02'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long sbxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateSbxh = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'MS_CF02'";
                String updateSbxh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_CF02'";
                hibenateUtils.updateBySql(updateSbxh);
            }
            JSONObject object1 = new JSONObject();
@ -174,12 +171,12 @@ public class YkyyController extends EnvelopRestEndpoint {
        }else if(table.equalsIgnoreCase("HlwYsMzJbzdDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwYsMzJbzdDO hlwYsMzJbzdDO =  JSONObject.toJavaObject(object,HlwYsMzJbzdDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ys@ykzxtest where bmc = 'YS_MZ_JBZD'";
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ys@xec_link where bmc = 'YS_MZ_JBZD'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long jlbh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                jlbh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateJlbh = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'YS_MZ_JBZD'";
                String updateJlbh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'YS_MZ_JBZD'";
                hibenateUtils.updateBySql(updateJlbh);
            }
            JSONObject object1 = new JSONObject();
@ -190,12 +187,12 @@ public class YkyyController extends EnvelopRestEndpoint {
        }else if(table.equalsIgnoreCase("HlwGhmxDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwGhmxDO hlwGhmxDO =  JSONObject.toJavaObject(object,HlwGhmxDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@ykzxtest where bmc = 'MS_GHMX'";
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_GHMX'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long sbxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateSbxh = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'MS_GHMX'";
                String updateSbxh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_GHMX'";
                hibenateUtils.updateBySql(updateSbxh);
            }
            JSONObject object1 = new JSONObject();
@ -207,12 +204,12 @@ public class YkyyController extends EnvelopRestEndpoint {
        }else if(table.equalsIgnoreCase("HlwYsMzJzLsDO")){
            // portal_his.gy_identity_ms@xec_link
            HlwYsMzJzLsDO hlwYsMzJzLsDO =  JSONObject.toJavaObject(object,HlwYsMzJzLsDO.class);
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ys@ykzxtest where bmc = 'YS_MZ_JZLS'";
            String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ys@xec_link where bmc = 'YS_MZ_JZLS'";
            List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
            Long jzxh = 0L;
            if (sbxhList!=null&&sbxhList.size()!=0){
                jzxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                String updateJzxh = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'YS_MZ_JZLS'";
                String updateJzxh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'YS_MZ_JZLS'";
                hibenateUtils.updateBySql(updateJzxh);
            }
            JSONObject object1 = new JSONObject();
@ -254,13 +251,13 @@ public class YkyyController extends EnvelopRestEndpoint {
        ListEnvelop mixEnvelop = new ListEnvelop();
        if (surveys!=null){
            for (YkEmrJcsqDO ykEmrJcsqDO:surveys){
                String sqdhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_emr@ykzxtest where bmc = 'EMR_JCSQ'";
                String sqdhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_emr@xec_link where bmc = 'EMR_JCSQ'";
                List<Map<String,Object>> sqdhList = hibenateUtils.createSQLQuery(sqdhSql);
                Long sqdh = 0L;
                if (sqdhList!=null&&sqdhList.size()!=0){
                    sqdh = Long.parseLong(sqdhList.get(0).get("total").toString());
                    System.out.println("sqdh:"+sqdh);
                    String updatesqdh = "update portal_his.gy_identity_emr@ykzxtest set dqz=dqz+1 where bmc = 'EMR_JCSQ'";
                    String updatesqdh = "update portal_his.gy_identity_emr@xec_link set dqz=dqz+1 where bmc = 'EMR_JCSQ'";
                    hibenateUtils.updateBySql(updatesqdh);
                }
                ykEmrJcsqDO.setSqdh(sqdh.intValue());
@ -273,13 +270,13 @@ public class YkyyController extends EnvelopRestEndpoint {
                ykEmrJcsqDO.setJsbz(0);
                totalprice =ykEmrJcsqDO.getXmdj().multiply(new BigDecimal(ykEmrJcsqDO.getSqsl()));
                System.out.println("totalprice"+totalprice);
                String yjxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@ykzxtest where bmc = 'MS_YJ01'";
                String yjxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_YJ01'";
                List<Map<String,Object>> yjxhList = hibenateUtils.createSQLQuery(yjxhSql);
                Long yjxh = 0L;
                if (yjxhList!=null&&yjxhList.size()!=0){
                    yjxh = Long.parseLong(yjxhList.get(0).get("total").toString());
                    System.out.println("yjxh:"+yjxh);
                    String updateyjxh = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'MS_YJ01'";
                    String updateyjxh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_YJ01'";
                    hibenateUtils.updateBySql(updateyjxh);
                    ykEmrJcsqDO.setYjxh(yjxh.intValue());
                }
@ -316,13 +313,13 @@ public class YkyyController extends EnvelopRestEndpoint {
                    int i = 0;
                    //明细可能会有多条
                    for (Map<String,Object> map:sbxlMap){
                        String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@ykzxtest where bmc = 'MS_YJ02'";
                        String sbxhSql =" select dqz + 1 as \"total\"  from portal_his.gy_identity_ms@xec_link where bmc = 'MS_YJ02'";
                        List<Map<String,Object>> sbxhList = hibenateUtils.createSQLQuery(sbxhSql);
                        Long sbxh = 0L;
                        if (sbxhList!=null&&sbxhList.size()!=0){
                            sbxh = Long.parseLong(sbxhList.get(0).get("total").toString());
                            System.out.println("sbxh:"+sbxh);
                            String updateyjxh = "update portal_his.gy_identity_ms@ykzxtest set dqz=dqz+1 where bmc = 'MS_YJ02'";
                            String updateyjxh = "update portal_his.gy_identity_ms@xec_link set dqz=dqz+1 where bmc = 'MS_YJ02'";
                            hibenateUtils.updateBySql(updateyjxh);
                        }
                        YkMsYj02DO ykMsYj02DO = new YkMsYj02DO();
@ -334,7 +331,7 @@ public class YkyyController extends EnvelopRestEndpoint {
                        ykMsYj02DO.setYjzx(i==0?1:0);
                        i++;
                        String fyxhSql ="select t.xmlx as \"xmlx\",t.fydj as \"fydj\",t.fygb as \"fygb\"" +
                                " from portal_his.GY_YLSF@ykzxtest t " +
                                " from portal_his.GY_YLSF@xec_link t " +
                                " where t.fyxh = '"+map.get("fyxh").toString()+"'";
                        List<Map<String,Object>> fyxhList = hibenateUtils.createSQLQuery(fyxhSql);

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

@ -17,6 +17,7 @@ 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.file_upload.FileUploadService;
import com.yihu.jw.hospital.family.service.WlyyFamilyMemberService;
import com.yihu.jw.hospital.mapping.dao.PatientMappingDao;
import com.yihu.jw.hospital.message.service.SystemMessageService;
import com.yihu.jw.hospital.prescription.dao.OutpatientDao;
@ -130,6 +131,8 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	private PrescriptionDao prescriptionDao;
	@Autowired
	private EntranceService entranceService;
	@Autowired
	private WlyyFamilyMemberService familyMemberService;
	@Value("${fastDFS.fastdfs_file_url}")
@ -607,7 +610,9 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
		BasePatientDO result = basePatientService.findByIdAndDel(patient);
		//---居民性别取身份证字段--
		result.setSex(Integer.parseInt(IdCardUtil.getSexForIdcard_new(result.getIdcard())));
		if (wxId.equalsIgnoreCase("xm_ykyy_wx")){
			familyMemberService.saveYktFamily(patient);
		}
		return success(result);
	}
	

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

@ -101,11 +101,26 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
                                          @ApiParam(name = "endTime", value = "结束时间")
                                          @RequestParam(value = "endTime",required = false) String endTime,
                                          @ApiParam(name = "ksdm", value = "科室代码")
                                              @RequestParam(value = "ksdm",required = false) String ksdm) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient, startTime, endTime, demoFlag,ksdm);
                                              @RequestParam(value = "ksdm",required = false) String ksdm,
                                                      @ApiParam(name = "cardNo", value = "就诊卡号")
                                                      @RequestParam(value = "cardNo",required = false) String cardNo) throws Exception {
        List<WlyyOutpatientVO> vos = prescriptionService.findOutpatientList(patient,cardNo, startTime, endTime, demoFlag,ksdm);
        return success(vos);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.synDoctorInfo)
    @ApiOperation(value = " 同步医生")
    public ObjEnvelop synDoctorInfo(@ApiParam(name = "idcard", value = "身份证")
                                         @RequestParam(value = "idcard",required = false) String idcard)throws Exception{
        ObjEnvelop obj =  new ObjEnvelop();
        prescriptionService.synDoctorInfo(idcard);
        obj.setStatus(200);
        obj.setMessage("同步成功");
        return success(obj);
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findOutpatientInfo)
    @ApiOperation(value = " 查询单条门诊就诊记录")
    public ObjEnvelop findOutpatientInfo(@ApiParam(name = "patient", value = "居民id")
@ -264,4 +279,15 @@ public class YkyyPrescriptionEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.YkyyPrescription.getSql)
    @ApiOperation(value = "通用sql", notes = "通用sql")
    public ObjEnvelop findInfoBysql(@ApiParam(name = "sql", value = "sql")
                                    @RequestParam(value = "sql", required = true)String sql)throws Exception {
        try {
            return success("ok",ykyyEntranceService.findInfoBysql(sql));
        } catch (Exception e) {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
}