瀏覽代碼

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

liubing 4 年之前
父節點
當前提交
7372eb10f6

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

@ -1257,10 +1257,16 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                " d.job_title_name AS \"jobTitleName\"," +
                " d.charge_type AS \"chargeType\"," +
                " d.outpatient_type AS \"outpatientType\"," +
                " d.consult_status AS \"consultStatus\"" +
                " d.consult_status AS \"consultStatus\"," +
                " h.dept_code AS \"deptCode\","+
                " h.dept_name AS \"deptName\","+
                " h.org_code AS \"orgCode\","+
                " h.org_name AS \"orgName\","+
                " t.photo AS \"hosptialphoto\""+
                " FROM " +
                " base_doctor d " +
                " JOIN base_doctor_hospital h ON h.doctor_code = d.id " +
                " left join base_org t on t.id = h.org_code" +
                " WHERE  " +
                " 1=1 and d.del=1 ";
        Map<String, Object> params = new HashedMap();

+ 38 - 2
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/XzzxEntranceService.java

@ -1282,14 +1282,14 @@ public class XzzxEntranceService{
    }
    /**
     * 互联网医院开处方信息更新到his
     * 互联网医院删除处方信息更新到his
     * @param IoFlag  门诊住院标志
     * @param PayCardNo 就诊卡号
     * @param NullahNumber 挂号流水号
     * @param ApplyDept 执行科室
     * @param ApplyDoctor 开单医生
     * @param ExecuteDept 执行科室(药房)
     * @param presNo 必填,医嘱号
     * @param PresNo 必填,医嘱号
     * @return
     * @throws Exception
     */
@ -2952,6 +2952,42 @@ public Map checkSyncHis(String IoFlag,String PayCardNo,String NullahNumber,Strin
        }
        return jsonObject;
    }
    /**
     * 删除处方信息
     * @param realOrder his处方号
     * @return
     * @throws Exception
     */
    public JSONObject deletePrescriptionToEntrance(String realOrder) throws Exception {
        Map<String,String> params = new HashedMap();
        WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findByRealOrder(realOrder);
        if (null!=wlyyPrescriptionDO){
            params.put("IoFlag","0");
            WlyyOutpatientDO wlyyOutpatientDO = outpatientDao.findById(wlyyPrescriptionDO.getOutpatientId());
            if (null!=wlyyOutpatientDO){
                params.put("PayCardNo",wlyyOutpatientDO.getCardNo());
                params.put("NullahNumber",wlyyOutpatientDO.getRegisterNo());
                params.put("ApplyDept",wlyyOutpatientDO.getDept());
            }
            DoctorMappingDO doctorMappingDO = doctorMappingDao.findByDoctor(wlyyPrescriptionDO.getDoctor());
            if (null!=doctorMappingDO){
                params.put("ApplyDoctor",doctorMappingDO.getMappingCode());
            }
            params.put("ExecuteDept","50100");
            params.put("PresNo",realOrder);
        }
        JSONObject jsonObject = new JSONObject();
        String response = "";
        String url = entranceUrl+"delHisPrescriptionByHisNo";
        logger.info("params"+params.toString());
        response = httpClientUtil.httpPost(url,params);
        logger.info("删除处方信息"+response);
        JSONObject object = JSONObject.parseObject(response);
        if(object.getInteger("status")==200){
            jsonObject = object.getJSONObject("obj");
        }
        return jsonObject;
    }
//=====================hospital应用调用entrance应用============end=================

+ 15 - 14
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -642,7 +642,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                " a.create_time AS \"create_time\", " +
                " e.content AS \"content\", " +
                " d.idcard AS \"docIdCard\", " +
                " d.relation_code AS \"relationCode\" "+
                " e.relation_code AS \"relationCode\" "+
                "FROM " +
                " base_evaluate_score a " +
                "JOIN base_evaluate e ON a.id = e.relation_code " +
@ -672,11 +672,9 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
            Map<String,Object> info =list.get(i);
            Boolean errorFlag = false;
            JSONObject jb = new JSONObject();
            String interId = "";
            try{
                String interId = "";
                String idCard = info.get("docIdCard") == null ? "0":info.get("docIdCard").toString();
                if( info.get("docIdCard") == null){
                    interId = "0";
@ -704,16 +702,19 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                logger.error(e.toString());
            }
            if(!errorFlag){
                JSONArray jsonArray = new JSONArray();
                jsonArray.add(jb);
                res = postToInter(token,api, jsonArray,url);
                JSONObject resJson = (JSONObject) JSONObject.parse(res);
                if("200".equals(resJson.get("msg").toString())){
                    success++;
                }else{
                    saveErrorLog(upid,"7",info.get("id").toString(),res,2);
                    error++;
                if (!interId.equalsIgnoreCase("0")&&!interId.equalsIgnoreCase("")){
                    JSONArray jsonArray = new JSONArray();
                    jsonArray.add(jb);
                    res = postToInter(token,api, jsonArray,url);
                    JSONObject resJson = (JSONObject) JSONObject.parse(res);
                    if("200".equals(resJson.get("msg").toString())){
                        success++;
                    }else{
                        saveErrorLog(upid,"7",info.get("id").toString(),res,2);
                        error++;
                    }
                }
            }
        }
        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。";

+ 12 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -244,6 +244,10 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
     * 上线下线状态
     */
    private String online;//1上线0下线
    /**
     * ca标识
     */
    private Integer caFlag;
    @Column(name = "popularity")
    public Integer getPopularity() {
@ -620,4 +624,12 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
        this.online = online;
    }
    @Column(name = "ca_flag")
    public Integer getCaFlag() {
        return caFlag;
    }
    public void setCaFlag(Integer caFlag) {
        this.caFlag = caFlag;
    }
}

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

@ -411,6 +411,8 @@ public class BaseHospitalRequestMapping {
        public static final String findDictByName = "/findDictByName";
        public static final String updatePatientDiagnosis = "/updatePatientDiagnosis";
        //删除his处方信息
        public static final String delHisPrescriptionByHisNo = "/delHisPrescriptionByHisNo";
        public static final String getJcmb="/getJcmb";
        public static final String getJymb="/getJymb";

+ 4 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/dao/doctor/BaseDoctorDao.java

@ -2,6 +2,7 @@ package com.yihu.jw.security.dao.doctor;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
@ -27,4 +28,7 @@ public interface BaseDoctorDao extends PagingAndSortingRepository<BaseDoctorDO,
    List<BaseDoctorDO> findByMobile(String mobile);
    @Query("from BaseDoctorDO d where  d.del ='1'")
    List<BaseDoctorDO> findByDel();
}

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

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.google.code.kaptcha.util.Config;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.login.BaseLoginLogDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.restmodel.ResultStatus;
@ -35,6 +36,7 @@ import org.apache.commons.collections.map.HashedMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.http.*;
import org.springframework.security.authentication.AuthenticationManager;
@ -136,6 +138,10 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    private BasePatientDao basePatientDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Value("${wechat.id}")
    private String wechatId;
    @Autowired
    private XzzxService xzzxService;
    @PostConstruct
    private void init() {
@ -925,8 +931,16 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
    @RequestMapping(value = "/oauth/getCaQRCode", method = RequestMethod.GET)
    public ObjEnvelop getCaQRCode(){
        logger.info("/oauth/getCaQRCode");
        String sys ="JKZLHLWYLJKGLPT";
        return ObjEnvelop.getSuccess("success", oauthCaConfigSerivce.getQRCode(sys));
        if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
            String sys ="JKZLHLWYLJKGLPT";
            return ObjEnvelop.getSuccess("success", oauthCaConfigSerivce.getQRCode(sys));
        }else if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
            String sys ="2017070411003376";
            return ObjEnvelop.getSuccess("success", xzzxService.getQRCode(sys));
        }else {
            return ObjEnvelop.getSuccess("success", null);
        }
    }
    /**
@ -942,18 +956,39 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id is null");
        }
        String username = null;
        JSONObject rs = new JSONObject();
        if (wechatId.equalsIgnoreCase("xm_zsyy_wx")){
            rs = oauthCaConfigSerivce.getQueryQRCode(qrcode);
            JSONObject data = rs.getJSONObject("data");
            String qrCodeStatus = data.getString("qrCodeStatus");
            if(!"LoginQrCodeBeenScan".equals(qrCodeStatus)){
                return ObjEnvelop.getSuccess("error",rs);
            }
            username = data.getString("userIdCardNum");
        }else if (wechatId.equalsIgnoreCase("xm_xzzx_wx")){
            rs = xzzxService.getTokeninfo("2017070411003376",qrcode);
            JSONObject jsonObject = rs.getJSONObject("data");
            logger.info("查询登录信息"+rs);
            String qrCodeStatus = rs.getString("status");
            if(!"0".equals(qrCodeStatus)){
                return ObjEnvelop.getSuccess("error",rs);
            }
            username = jsonObject.getString("userIdcardNum");
            jsonObject.put("qrCodeStatus","LoginQrCodeBeenScan");
            rs.put("code",1000);
        }
        JSONObject rs = oauthCaConfigSerivce.getQueryQRCode(qrcode);
        JSONObject data = rs.getJSONObject("data");
        String qrCodeStatus = data.getString("qrCodeStatus");
        if(!"LoginQrCodeBeenScan".equals(qrCodeStatus)){
            return ObjEnvelop.getSuccess("error",rs);
        if (org.apache.commons.lang.StringUtils.isNotBlank(username)){
            BaseDoctorDO doctorDO = doctorDao.findByIdcard(username);
            doctorDO.setCaFlag(1);
            doctorDao.save(doctorDO);
        }
        ClientDetails authenticatedClient = clientDetailsService.loadClientByClientId(client_id);
        Map<String, String> parameters = new HashedMap();
        parameters.put("username",data.getString("userIdCardNum"));
        parameters.put("username",username);
        parameters.put("login_type","2");
        parameters.put("grant_type", "ihealthDcotor");

+ 3 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthCaConfigSerivce.java

@ -26,7 +26,8 @@ public class OauthCaConfigSerivce {
    private OauthCaConfigDao oauthCaConfigDao;
    /**
     * 生成二维码
     *
     * 中山生成二维码
     * @param sys
     * @return
     */
@ -44,6 +45,7 @@ public class OauthCaConfigSerivce {
        return null;
    }
    /**
     * 查询二维码授权结果
     * @param qrcode

+ 162 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/XzzxService.java

@ -0,0 +1,162 @@
package com.yihu.jw.security.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.ca.OauthCaConfigDO;
import com.yihu.jw.security.dao.OauthCaConfigDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorHospitalDao;
import com.yihu.jw.util.http.HttpClientUtil;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 心脏中心医院
 * Created by wangzhinan on 2020/10/20.
 *
 * @author yeshijie.
 */
@Service
public class XzzxService {
    private Logger logger = LoggerFactory.getLogger(XzzxService.class);
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private OauthCaConfigDao oauthCaConfigDao;
    @Autowired
    private BaseDoctorDao doctorDao;
    @Autowired
    private BaseDoctorHospitalDao doctorHospitalDao;
    /**
     * OAuth登陆-认证请求接口
     * @param sys
     * @return
     */
    public String getQRCode(String sys) {
        try {
            logger.info("生成二维码 getQRCode :"+sys);
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/oauth/authorize?responseType=code&clientId="+sys;
            }
            String response = httpClientUtil.get(url,"utf-8");
            JSONObject rs = new JSONObject();
            JSONObject data = new JSONObject();
            String res = "";
            if (StringUtils.isNotBlank(response)){
                JSONObject object = JSONObject.parseObject(response);
                String status = object.getString("status");
                if (status.equalsIgnoreCase("0")){
                    JSONObject jsonObject = object.getJSONObject("data");
                    String imgBase64 = jsonObject.getString("imgBase64");
                    data.put("resultCode",0);
                    data.put("resultMsg","Success");
                    data.put("qrCodeImg",imgBase64);
                    data.put("qrCode",jsonObject.getString("requestId"));
                    rs.put("code",1000);
                    rs.put("msg","成功");
                    rs.put("data",data);
                }else {
                    rs.put("code",-1);
                    rs.put("msg",object.getString("message"));
                }
            }
            return rs.toJSONString();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    /**
     * OAuth登陆-获取用户信息
     * @param clientId
     * @param requestId
     * @return
     */
    public JSONObject getTokeninfo(String clientId,String requestId){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/oauth/tokeninfo?clientId="+clientId+"&requestId="+requestId+"";
            }
            String response = httpClientUtil.get(url,"utf-8");
            logger.info("验证二维码 getQueryQRCode :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    public String synDoctorToCa(String clientId,String requestId,String doctorId){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/doctor/synDoctor";
            }
            if (StringUtils.isNotBlank(doctorId)){
                BaseDoctorDO doctorDO = doctorDao.findById(doctorId);
                List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorId);
                JSONObject body = new JSONObject();
                JSONObject head = new JSONObject();
                head.put("clientId","2017070411003376");
                head.put("clientSecret","2017070411003360");
                body.put("head",head);
                JSONObject by= new JSONObject();
                by.put("uid",doctorDO.getIdcard());
                by.put("uidCardType","SF");
                by.put("doctorName",doctorDO.getName());
                by.put("phone",doctorDO.getMobile());
                if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                    by.put("department",doctorHospitalDOS.get(0).getOrgName());
                    by.put("department",doctorHospitalDOS.get(0).getDeptName());
                }
                body.put("body",by);
                String response = httpClientUtil.sendPost(url,body.toJSONString());
                logger.info("同步医生信息"+response);
                return  response;
            }else {
                List<BaseDoctorDO> doctorDOList = doctorDao.findByDel();
                for (BaseDoctorDO doctorDO:doctorDOList){
                    List<BaseDoctorHospitalDO> doctorHospitalDOS = doctorHospitalDao.findByDoctorCode(doctorDO.getId());
                    JSONObject body = new JSONObject();
                    JSONObject head = new JSONObject();
                    head.put("clientId","2017070411003376");
                    head.put("clientSecret","2017070411003360");
                    body.put("head",head);
                    JSONObject by= new JSONObject();
                    by.put("uid",doctorDO.getIdcard());
                    by.put("uidCardType","SF");
                    by.put("doctorName",doctorDO.getName());
                    by.put("phone",doctorDO.getMobile());
                    if (doctorHospitalDOS!=null&&doctorHospitalDOS.size()!=0){
                        by.put("orgName",doctorHospitalDOS.get(0).getOrgName());
                        by.put("department",doctorHospitalDOS.get(0).getDeptName());
                    }
                    body.put("body",by);
                    String response = httpClientUtil.sendPost(url,body.toJSONString());
                    logger.info("同步医生信息"+response);
                }
            }
            return null;
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}

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

@ -78,6 +78,9 @@ wlyy:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
---
spring:
  profiles: jwtest
@ -104,6 +107,9 @@ testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
---
spring:
  profiles: jwOracleTest
@ -141,6 +147,9 @@ testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
---
spring:
  profiles: iottest
@ -167,6 +176,9 @@ testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
---
spring:
  profiles: iotyanshi
@ -192,6 +204,8 @@ wlyy:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
---
spring:
  profiles: jwprod
@ -217,6 +231,8 @@ wlyy:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_zsyy_wx  # base库中,wx_wechat 的id字段
---
## 心脏中心外网
spring:
@ -243,6 +259,8 @@ wlyy:
testPattern:
  sign: 2
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_xzzx_wx  # base库中,wx_wechat 的id字段
---
## 卫计委
spring:
@ -269,6 +287,8 @@ wlyy:
testPattern:
  sign: 1
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_ihealth_wx  # base库中,wx_wechat 的id字段
---
spring:
@ -294,6 +314,8 @@ wlyy:
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
---
@ -320,4 +342,7 @@ wlyy:
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
  remote_inner_url: 172.16.100.240:10023/open/fileUpload/upload_stream
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段

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

@ -434,9 +434,8 @@ public class XzzxCotroller extends EnvelopRestEndpoint {
     * @param ApplyDept 执行科室
     * @param ApplyDoctor 开单医生
     * @param ExecuteDept 执行科室(药房)
     * @param prescriptionInfoDOS
     */
    @PostMapping(value = "/savePrescriptionToHospital")
    @PostMapping(value = "/delHisPrescriptionByHisNo")
    @ApiOperation(value = "删除处方信息", notes = "删除处方信息")
    public ObjEnvelop delHisPrescriptionByHisNo(@ApiParam(name = "IoFlag", value = "门诊住院标志", required = false)
                                                 @RequestParam(value = "IoFlag",required = false)String IoFlag,

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

@ -2181,4 +2181,13 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return prescriptionService.updatePatientDiagnosis(outpatientId,icd10,icd10Name);
    }
    @PostMapping(value = BaseHospitalRequestMapping.Prescription.delHisPrescriptionByHisNo)
    @ApiOperation(value = "删除his处方信息")
    public ObjEnvelop delHisPrescriptionByHisNo(
            @ApiParam(name = "realOrder", value = "realOrder")
            @RequestParam(value = "realOrder",defaultValue = "",required = true) String realOrder) throws Exception {
        ObjEnvelop objEnvelop = new ObjEnvelop();
        objEnvelop.setObj(xzzxEntranceService.deletePrescriptionToEntrance(realOrder));
        return objEnvelop;
    }
}