Browse Source

官网接口修改

wangjun 3 years ago
parent
commit
bb8bb74a30

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

@ -3730,7 +3730,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        Map<String, Object> rs = new HashedMap();
        if (doctorDO != null) {
            rs.put("doctor", doctor);
            rs.put("doctorSex", doctorDO.getSex().toString());
            rs.put("doctorSex", doctorDO.getSex());
            if (StringUtils.isNoneBlank(doctorDO.getIdcard())) {
                rs.put("doctorAge", IdCardUtil.getAgeForIdcard(doctorDO.getIdcard()));
            } else {

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

@ -21,6 +21,7 @@ import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Connection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -418,4 +419,128 @@ public class XzyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO,
        }
        return null;
    }
    /***
     * 自动签名授权-请求自动签名授权接口
     * @param openId 患者姓名
     * @param sysTag 患者年
     * @return
     */
    public JSONObject selfSignRequest(String openId,String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            String clientId= "";
            String clientSecret = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/selfSign/request";
                clientId=oauthCaConfigDO.getClientId();
                clientSecret=oauthCaConfigDO.getClientSecret();
            }
            JSONObject object = new JSONObject();
            JSONObject msg = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("clientId",clientId);
            head.put("clientSecret",clientSecret);
            msg.put("head",head);
            JSONObject body = new JSONObject();
            body.put("sysTag",sysTag);
            body.put("openId",openId);
            msg.put("body",body);
            object.put("msg",msg);
            object.put("signType",0);
            logger.info("请求参数:"+object);
            String response = httpClientUtil.sendPost(url,object.toJSONString());
            logger.info("请求自动签名授权接口 :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    /***
     * 自动签名授权-获取授权结果
     * @param baseDoctorDO
     * @param sysTag
     * @return
     */
    public JSONObject selfSignGetResult(BaseDoctorDO baseDoctorDO, String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            String clientId= "";
            String clientSecret = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/selfSign/getResult";
                clientId=oauthCaConfigDO.getClientId();
                clientSecret=oauthCaConfigDO.getClientSecret();
            }
            JSONObject object = new JSONObject();
            JSONObject msg = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("clientId",clientId);
            head.put("clientSecret",clientSecret);
            msg.put("head",head);
            JSONObject body = new JSONObject();
            body.put("sysTag",sysTag);
            body.put("openId",baseDoctorDO.getOpenid());
            msg.put("body",body);
            object.put("msg",msg);
            object.put("signType",0);
            logger.info("请求参数:"+object);
            String response = httpClientUtil.sendPost(url,object.toJSONString());
            JSONObject jsonRes=JSONObject.parseObject(response);
            JSONObject jsonObject = jsonRes.getJSONObject("data");
            Integer grantStep = jsonObject.getInteger("grantStep");
            if(1==grantStep){
                baseDoctorDO.setIsSign("1");
                baseDoctorDO.setLastSignTime(new Date());
                baseDoctorDao.save(baseDoctorDO);
            }
            logger.info("获取授权结果 :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
    /***
     * 自动签名授权-退出授权接口
     * @param openId
     * @param sysTag
     * @return
     */
    public JSONObject selfSignQuit(String openId,String sysTag){
        try {
            OauthCaConfigDO oauthCaConfigDO = oauthCaConfigDao.findOne("oauth_ca_config");
            String url = "";
            String clientId= "";
            String clientSecret = "";
            if (oauthCaConfigDO!=null){
                url=oauthCaConfigDO.getUrl()+"/gateway/selfSign/quit";
                clientId=oauthCaConfigDO.getClientId();
                clientSecret=oauthCaConfigDO.getClientSecret();
            }
            JSONObject object = new JSONObject();
            JSONObject msg = new JSONObject();
            JSONObject head = new JSONObject();
            head.put("clientId",clientId);
            head.put("clientSecret",clientSecret);
            msg.put("head",head);
            JSONObject body = new JSONObject();
            body.put("sysTag",sysTag);
            body.put("openId",openId);
            msg.put("body",body);
            object.put("msg",msg);
            object.put("signType",0);
            logger.info("请求参数:"+object);
            String response = httpClientUtil.sendPost(url,object.toJSONString());
            logger.info("退出授权接口 :"+response);
            return JSONObject.parseObject(response);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }
}

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

@ -2380,6 +2380,7 @@ public class XzzxEntranceService{
        String response="";
        String idCard = patientDO.getIdcard();
        String url = entranceUrl+"findPatientCard?idCard="+idCard;
        String mappingCode="";
        response = httpClientUtil.get(url,"GBK");
        JSONObject object = JSONObject.parseObject(response);
        if(object.getInteger("status")==200){
@ -2398,10 +2399,11 @@ public class XzzxEntranceService{
                }else {
                    patientMappingDO.setMappingCode(object1.getString("SICKID"));
                }
                mappingCode=object1.getString("SICKID");
                patientMappingDO = patientMappingDao.save(patientMappingDO);
            }
        }
        return patientMappingDO.getMappingCode();
        return mappingCode;
    }
    public String updatePatientMapping(String patient,String cardNo){
        BasePatientDO patientDO = patientDao.findById(patient);

+ 6 - 0
business/sms-service/pom.xml

@ -61,5 +61,11 @@
            <artifactId>tencentcloud-sdk-java</artifactId>
            <version>3.1.272</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-redis</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>

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

@ -292,6 +292,25 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
    private String doctorLon;//医生当前定位地址经度
    private String doctorLocateAddress;//医生定位地址
    private String levelName;
    private String isSign;
    private Date lastSignTime;
    @Column(name = "is_sign")
    public String getIsSign() {
        return isSign;
    }
    public void setIsSign(String isSign) {
        this.isSign = isSign;
    }
    @Column(name = "last_sign_time")
    public Date getLastSignTime() {
        return lastSignTime;
    }
    public void setLastSignTime(Date lastSignTime) {
        this.lastSignTime = lastSignTime;
    }
    @Transient
    public String getLevelName() {
        return levelName;

+ 11 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeArticleDictDO.java

@ -59,6 +59,17 @@ public class KnowledgeArticleDictDO extends UuidIdentityEntity {
	private Date checkTime;
	private Integer releaseStatus;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date releaseTime;
	@Column(name = "release_time")
	public Date getReleaseTime() {
		return releaseTime;
	}
	public void setReleaseTime(Date releaseTime) {
		this.releaseTime = releaseTime;
	}
	@Column(name = "check_time")
	public Date getCheckTime() {
		return checkTime;

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

@ -215,11 +215,8 @@ public class BaseRequestMapping {
        public static final String PREFIX  = "/baseMenuDict";
        public static final String createMenuDict  = "/createMenuDict";
        public static final String STATUS  = "/status";
        public static final String IS_NAME_EXIST  = "/isNameExist";
        public static final String MOVE_UP  = "/moveUp";
        public static final String MOVE_DOWN  = "/moveDown";
        public static final String GET_TREE  = "/getTree";
        public static final String FIND_ALL  = "/findAll";
        public static final String findOneMenuDict  = "/findOneMenuDict";
        public static final String deleteMenuDict  = "/deleteMenuDict";
    }
@ -244,7 +241,6 @@ public class BaseRequestMapping {
        public static final String linkShow  = "/linkShow";
        public static final String MOVELinkUP  = "/moveLinkUp";
        public static final String MOVELinkDOWN  = "/moveLinkDown";
        public static final String GET_TREE  = "/getTree";
        public static final String findLinkDictALL  = "/findLinkDictALL";
        public static final String findOneLink  = "/findOneLink";
        public static final String deleteLink  = "/deleteLink";
@ -256,10 +252,8 @@ public class BaseRequestMapping {
        public static final String PREFIX  = "/baseLinkDict";
        public static final String createMenuShow = "/createMenuShow";
        public static final String menuShowstatus  = "/menuShowstatus";
        public static final String IS_NAME_EXIST  = "/isNameExist";
        public static final String MOVEMenuShowUP  = "/moveMenuShowUp";
        public static final String MOVEMenuShowDOWN  = "/moveMenuShowDown";
        public static final String GET_TREE  = "/getTree";
        public static final String findMenuShow  = "/findMenuShow";
        public static final String findMenuShowDict  = "/findMenuShowDict";
        public static final String findRoleMenuTree  = "/findRoleMenuTree";

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

@ -292,16 +292,28 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        baseLoginLogDO.setUserAgent(userAgent);
        baseLoginLogDO.setLoginType(loginType);
        baseLoginLogService.save(baseLoginLogDO);
        if ("2".equalsIgnoreCase(loginType)){
            if ("xm_xzzx_wx".equalsIgnoreCase(wechatId)){
                BaseDoctorDO baseDoctorDO =doctorDao.findById(wlyyUserSimple.getId());
                if (baseDoctorDO!=null){
                    int defaultMinute=360;
                    WlyyHospitalSysDictDO wlyyHospitalSysDictDO=wlyyhospitalSysdictDao.findDictById("singTimeControl");
                    if (wlyyHospitalSysDictDO!=null){
                        defaultMinute=Integer.parseInt(wlyyHospitalSysDictDO.getDictValue());
                    }
                    long nowTime = new Date().getTime();
                    long lastSignTime = baseDoctorDO.getLastSignTime()==null?new Date().getTime():baseDoctorDO.getLastSignTime().getTime();
                    if ((nowTime-lastSignTime)>defaultMinute*60*1000){
                        baseDoctorDO.setIsSign("0");
                    }
                    doctorDao.save(baseDoctorDO);
                }
            }
        }
        return getResponse(wlyyUserSimple);
    }
    public static void main(String[] args) throws Exception{
        String encodedText = "OiF6sj1G11jLgHrvgPVUilE9IGeqgNZs2EFh%2FiCyFd9uhZqC5vl%2BwyrVXVM9jAEgRvxbi3jYK%2BmFvmRa5s1EQg%3D%3D";
        encodedText = URLDecoder.decode(encodedText,"utf-8");
        String str =  AES.decrypt("3bdc154ed1e44a9c9f44451a16d8e0aa",encodedText);
        System.out.println(str);
    }
    /**
     * 单点登陆第二步 - token验证
@ -1383,6 +1395,16 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
        if (org.apache.commons.lang.StringUtils.isNotBlank(username)){
            BaseDoctorDO doctorDO = doctorDao.findByIdcard(username);
            int defaultMinute=360;
            WlyyHospitalSysDictDO wlyyHospitalSysDictDO=wlyyhospitalSysdictDao.findDictById("singTimeControl");
            if (wlyyHospitalSysDictDO!=null){
                defaultMinute=Integer.parseInt(wlyyHospitalSysDictDO.getDictValue());
            }
            long nowTime = new Date().getTime();
            long lastSignTime = doctorDO.getLastSignTime()==null?new Date().getTime():doctorDO.getLastSignTime().getTime();
            if ((nowTime-lastSignTime)>defaultMinute*60*1000){
                doctorDO.setIsSign("0");
            }
            doctorDO.setOpenid(openId);
            doctorDO.setCaFlag(1);
            doctorDao.save(doctorDO);

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/dao/menu/BaseLinkDictDao.java

@ -14,7 +14,7 @@ public interface BaseLinkDictDao extends PagingAndSortingRepository<BaseLinkDict
    Integer getMinSort();
    @Modifying
    @Query("update BaseLinkDictDO p set p.isDel=?2 where p.id=?1")
    @Query("update BaseLinkDictDO p set p.status=?2 where p.id=?1")
    void updateStatus(String id,String status);
    @Modifying

+ 6 - 10
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/article/ArticleEndpoint.java

@ -159,12 +159,10 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	@ApiOperation(value = "保存/更新文章")
	public Envelop saveArticle(
			@ApiParam(name = "jsonData", value = "Json数据", required = true)
			@RequestParam String jsonData,
			@ApiParam(name = "menuId", value = "菜单id", required = true)
			@RequestParam String menuId)throws Exception {
			@RequestParam String jsonData)throws Exception {
		try {
			knowledgeArticleService.saveArticle(jsonData,menuId);
			knowledgeArticleService.saveArticle(jsonData);
			return success("操作成功");
		}catch (Exception e){
			return failedException(e);
@ -324,15 +322,13 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
	}
	@PostMapping(value = BaseHospitalRequestMapping.KnowledgeArticle.setArticleUsed)
	@ApiOperation(value = "设置文章为常用/不常用")
	@ApiOperation(value = "发布文章")
	public ObjEnvelop setArticleUsed(@ApiParam(name = "id", value = "文章id")
									  @RequestParam(value = "id",required = true)String id,
									  @ApiParam(name = "used", value = "常用")
									  @RequestParam(value = "used",required = false)Integer used,
									 @ApiParam(name = "doctor", value = "医生code")
										 @RequestParam(value = "doctor",required = false)String doctor)throws Exception {
									  @ApiParam(name = "status", value = "1发布0未发布")
									  @RequestParam(value = "status",required = false)Integer status)throws Exception {
		try {
			return success(knowledgeArticleService.setUsed(id,used,doctor));
			return success(knowledgeArticleService.releaseArticle(id,status));
		}catch (Exception e){
			return failedObjEnvelopException(e);
		}

+ 6 - 3
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/doctor/BaseDoctorEndpoint.java

@ -501,11 +501,14 @@ public class BaseDoctorEndpoint extends EnvelopRestEndpoint {
    }
    @GetMapping(value = BaseRequestMapping.BaseDoctor.resetDoctorPwd)
    @ApiOperation(value = "医生充值密码")
    @ApiOperation(value = "医生重置密码")
    public Envelop resetDoctorPwd(
            @ApiParam(name = "doctor", value = "", required = false)
            @RequestParam(value = "doctor", required = true)String doctor) {
        return success(baseDoctorService.resetDoctorPwd(doctor));
        try {
            return success(baseDoctorService.resetDoctorPwd(doctor));
        }catch (Exception e){
           return failedException(e);
        }
    }
}

+ 55 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/Xzyy/XzyyController.java

@ -1,5 +1,8 @@
package com.yihu.jw.hospital.endpoint.Xzyy;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.hospital.prescription.service.XzyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.XzzxEntranceService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -25,6 +28,10 @@ public class XzyyController extends EnvelopRestEndpoint {
    @Autowired
    private XzzxEntranceService xzzxEntranceService;
    @Autowired
    private BaseDoctorDao baseDoctorDao;
    @Autowired
    private XzyyPrescriptionService xzyyPrescriptionService;
    /**
     * 查询患者就诊卡
@ -181,5 +188,53 @@ public class XzyyController extends EnvelopRestEndpoint {
                                     @RequestParam(value = "eventNo",required = false)String eventNo)throws Exception{
        return ObjEnvelop.getSuccess("ok",xzzxEntranceService.selectHistoryEmrRecord(templateId,patientId,eventNo));
    }
    /**
     * 请求自动签名授权接口
     * @param sysTag
     * @param doctorId
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/selfSignRequest")
    @ApiOperation(value = "请求自动签名授权接口", notes = "请求自动签名授权接口")
    public ObjEnvelop selfSignRequest(@ApiParam(name = "sysTag", value = "默认his", required = false)
                                           @RequestParam(value = "sysTag",required = false)String sysTag,
                                           @ApiParam(name = "doctorId", value = "医生id", required = false)
                                           @RequestParam(value = "doctorId",required = false)String doctorId)throws Exception{
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
        return ObjEnvelop.getSuccess("ok", xzyyPrescriptionService.selfSignRequest(baseDoctorDO.getOpenid(),sysTag));
    }
    /**
     * 请求自动签名授权接口
     * @param sysTag
     * @param doctorId
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/selfSignResult")
    @ApiOperation(value = "获取授权结果", notes = "获取授权结果")
    public ObjEnvelop selfSignResult(@ApiParam(name = "sysTag", value = "默认his", required = false)
                                      @RequestParam(value = "sysTag",required = false)String sysTag,
                                      @ApiParam(name = "doctorId", value = "医生id", required = false)
                                      @RequestParam(value = "doctorId",required = false)String doctorId)throws Exception{
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
        return ObjEnvelop.getSuccess("ok", xzyyPrescriptionService.selfSignGetResult(baseDoctorDO,sysTag));
    }
    /**
     * 请求自动签名授权接口
     * @param sysTag
     * @param doctorId
     * @return
     * @throws Exception
     */
    @GetMapping(value = "/selfSignQuit")
    @ApiOperation(value = "退出授权接口", notes = "退出授权接口")
    public ObjEnvelop selfSignQuit(@ApiParam(name = "sysTag", value = "默认his", required = false)
                                      @RequestParam(value = "sysTag",required = false)String sysTag,
                                      @ApiParam(name = "doctorId", value = "医生id", required = false)
                                      @RequestParam(value = "doctorId",required = false)String doctorId)throws Exception{
        BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(doctorId);
        return ObjEnvelop.getSuccess("ok", xzyyPrescriptionService.selfSignQuit(baseDoctorDO.getOpenid(),sysTag));
    }
}