huangwenjie 5 lat temu
rodzic
commit
9aa21272cb

+ 12 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/httplog/dao/WlyyHttpLogDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.hospital.httplog.dao;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2019/6/25.
 */
public interface WlyyHttpLogDao extends PagingAndSortingRepository<WlyyHttpLogDO, String>, JpaSpecificationExecutor<WlyyHttpLogDO> {
}

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

@ -13,6 +13,7 @@ import com.yihu.jw.entity.hospital.consult.WlyyHospitalWaitingRoomDO;
import com.yihu.jw.entity.hospital.dict.WlyyChargeDictDO;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.doctor.WlyyPatientRegisterTimeDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.mapping.DoctorMappingDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.consult.dao.DoctorClinicRoomConsultDao;
@ -21,6 +22,7 @@ import com.yihu.jw.hospital.dict.WlyyChargeDictDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.doctor.dao.DoctorWorkTimeDao;
import com.yihu.jw.hospital.doctor.dao.PatientRegisterTimeDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.mapping.service.DoctorMappingService;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
import com.yihu.jw.hospital.prescription.dao.*;
@ -105,6 +107,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    private DoctorWorkTimeDao doctorWorkTimeDao;
    @Autowired
    private PatientRegisterTimeDao patientRegisterTimeDao;
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -258,6 +262,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //居民详情
        BasePatientDO basePatientDO = basePatientDao.findById(outpatientDO.getPatient());
        rs.put("patientName",basePatientDO.getName());
        rs.put("photo",basePatientDO.getPhoto());
        rs.put("patientId",basePatientDO.getId());
        rs.put("idCard",basePatientDO.getIdcard());
        rs.put("sex", basePatientDO.getSex());
@ -310,6 +315,14 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("expressageLogs",null);
        }
        //预约记录
        List<WlyyPatientRegisterTimeDO> timeDOs = patientRegisterTimeDao.findByOutpatientId(outpatientId);
        if(timeDOs!=null&&timeDOs.size()>0){
            rs.put("register",timeDOs.get(0));
        }else{
            rs.put("register",null);
        }
        return rs;
    }
@ -522,6 +535,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public Boolean createRoom(WlyyOutpatientDO outpatientDO,Date reservationTime){
        WlyyHospitalWaitingRoomDO waitingRoom = new WlyyHospitalWaitingRoomDO();
        waitingRoom.setDept(outpatientDO.getDept());
        waitingRoom.setDeptName(outpatientDO.getDeptName());
        waitingRoom.setHospital(outpatientDO.getHospital());
        waitingRoom.setHospitalName(outpatientDO.getHospitalName());
        waitingRoom.setConsultType(1);
        waitingRoom.setPatientId(outpatientDO.getPatient());
        waitingRoom.setPatientName(outpatientDO.getPatientName());
@ -753,6 +772,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        if(doctorMappingDO==null){
            throw new RuntimeException("未找到医生映射信息");
        }
        net.sf.json.JSONObject rs = entranceService.BS10111(outpatientDO.getCardNo(),doctorMappingDO.getMappingCode(),outpatientDO.getDept(),null,outpatientDO.getWinNo(),demoFlag);
        String rsCode = (String)rs.get("@RESULT");
        if("0".equals(rsCode)){
@ -762,7 +782,17 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            String conNo = (String)rs.get("@times");
            outpatientDO.setCardNo(conNo);
        }
        //保存日志
        WlyyHttpLogDO log = new WlyyHttpLogDO();
        log.setCode("registerOutPatient");
        log.setName("挂号");
        log.setPatient(outpatientDO.getPatient());
        log.setDoctor(doctor);
        log.setResponse(rs.toString());
        log.setRequest("outPatientId="+outPatientId+"&doctor="+doctor);
        log.setStatus(rsCode);
        log.setCreateTime(new Date());
        wlyyHttpLogDao.save(log);
        return rs;
    }
@ -923,8 +953,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                
                //调用his开方接口
                net.sf.json.JSONObject jsonObject = entranceService.BS10112(jsonData.toJSONString(),demoFlag);
                //判断返回结果
                String rs = jsonObject.getString("@RESULT");
                //保存日志
                WlyyHttpLogDO log = new WlyyHttpLogDO();
                log.setCode("makeDiagnosis");
                log.setName("下诊断");
                log.setPatient(outpatientDO.getPatient());
                log.setDoctor(outpatientDO.getDoctor());
                log.setResponse(jsonObject.toString());
                log.setRequest(jsonData.toJSONString());
                log.setStatus(rs);
                log.setCreateTime(new Date());
                wlyyHttpLogDao.save(log);
                if("0".equals(rs)){
                    String admNo = jsonObject.getString("@ADM_NO");
                    String realOrder = jsonObject.getString("@real_order");
@ -1420,6 +1464,98 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<WlyyHospitalSysDictDO> findCancelReasonList(){
        return sysDictDao.findByDictName("PatientCancel");
    }
    /**
     * 獲取快速咨詢時間
     * @return
     */
    public List<Map<String,Object>> findFastRegisterDate(){
        int days = 7;
        String AMStartTime ="8:00";
        String AMEndTime ="12:00";
        String PMStartTime ="14:00";
        String PMEndTime ="17:00";
        //设置上午过号时间
        Calendar scTime = Calendar.getInstance();
        scTime.setTime(new Date());
        Calendar ecTime = Calendar.getInstance();
        ecTime.setTime(new Date());
        List<Map<String,Object>> times = new ArrayList<>();
        for(int i=0;i<days;i++){
            //設置上午時段
            Map<String,Object> time = new HashedMap();
            time.put("timeType","1");
            time.put("date",DateUtil.dateToStr(scTime.getTime(),"yyyy-MM-dd"));
            time.put("weekDay",scTime.get(Calendar.DAY_OF_WEEK));
            String ts[] = AMStartTime.split(":");
            scTime.set(scTime.get(Calendar.YEAR),scTime.get(Calendar.MONTH),scTime.get(Calendar.DAY_OF_MONTH),Integer.parseInt(ts[0]),Integer.parseInt(ts[1]),00);
            time.put("startTime",DateUtil.dateToStr(scTime.getTime(),"yyyy-MM-dd HH:mm:ss"));
            String ts2[] = AMEndTime.split(":");
            scTime.set(scTime.get(Calendar.YEAR),scTime.get(Calendar.MONTH),scTime.get(Calendar.DAY_OF_MONTH),Integer.parseInt(ts2[0]),Integer.parseInt(ts2[1]),00);
            time.put("endTime",DateUtil.dateToStr(scTime.getTime(),"yyyy-MM-dd HH:mm:ss"));
            times.add(time);
            //設置下午時段
            Map<String,Object> time2 = new HashedMap();
            time2.put("timeType","2");
            time2.put("date",DateUtil.dateToStr(scTime.getTime(),"yyyy-MM-dd"));
            time2.put("weekDay",scTime.get(Calendar.DAY_OF_WEEK));
            String pts[] = PMStartTime.split(":");
            scTime.set(scTime.get(Calendar.YEAR),scTime.get(Calendar.MONTH),scTime.get(Calendar.DAY_OF_MONTH),Integer.parseInt(pts[0]),Integer.parseInt(pts[1]),00);
            time2.put("startTime",DateUtil.dateToStr(scTime.getTime(),"yyyy-MM-dd HH:mm:ss"));
            String pts2[] = PMEndTime.split(":");
            scTime.set(scTime.get(Calendar.YEAR),scTime.get(Calendar.MONTH),scTime.get(Calendar.DAY_OF_MONTH),Integer.parseInt(pts2[0]),Integer.parseInt(pts2[1]),00);
            time2.put("endTime",DateUtil.dateToStr(scTime.getTime(),"yyyy-MM-dd HH:mm:ss"));
            times.add(time2);
            //生成下一天
            scTime.add(Calendar.DAY_OF_MONTH,1);
        }
        if(DateUtil.strToDate(DateUtil.getTimeShort(),DateUtil.HH_MM).after(DateUtil.strToDate(AMEndTime,DateUtil.HH_MM))) {
            times.remove(0);
        }
        if(DateUtil.strToDate(DateUtil.getTimeShort(),DateUtil.HH_MM).after(DateUtil.strToDate(PMEndTime,DateUtil.HH_MM))) {
            times.remove(0);
        }
        return times;
    }
    /**
     * 获取快速咨询时间分段
     * @param startTime
     * @param endTime
     * @return
     */
    public List<Map<String,Object>> findByTimeSlot(String startTime,String endTime){
        int interval = 30;
        List<Map<String,Object>> times = new ArrayList<>();
        //设置上午过号时间
        Calendar scTime = Calendar.getInstance();
        scTime.setTime(DateUtil.stringToDate(startTime,"yyyy-MM-dd HH:mm:ss"));
        Calendar ecTime = Calendar.getInstance();
        ecTime.setTime(DateUtil.stringToDate(endTime,"yyyy-MM-dd HH:mm:ss"));
        while (scTime.getTime().before(ecTime.getTime())){
            if(new Date().before(scTime.getTime())){
                Map<String,Object> time = new HashedMap();
                time.put("startTime",DateUtil.dateToStr(scTime.getTime(),"yyyy-MM-dd HH:mm:ss"));
                scTime.add(Calendar.MINUTE,interval);
                time.put("endTime",DateUtil.dateToStr(scTime.getTime(),"yyyy-MM-dd HH:mm:ss"));
                times.add(time);
            }else{
                scTime.add(Calendar.MINUTE,interval);
            }
        }
        return times;
    }
    
    /**
     * 根据疾病名称,热门部门查询医生

+ 90 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/httplog/WlyyHttpLogDO.java

@ -0,0 +1,90 @@
package com.yihu.jw.entity.hospital.httplog;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2019/6/25.
 */
@Entity
@Table(name = "wlyy_http_log")
public class WlyyHttpLogDO extends UuidIdentityEntity {
    private String code;//接口名称',
    private String name;//接口描述',
    private String patient;//居民code',
    private String doctor;//医生code',
    private String request;//请求参数',
    private String response;//返回参数',
    private String status;//状态0成功,其他失败',
    private Date createTime;//创建时间',
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getRequest() {
        return request;
    }
    public void setRequest(String request) {
        this.request = request;
    }
    public String getResponse() {
        return response;
    }
    public void setResponse(String response) {
        this.response = response;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 15 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyOutpatientDO.java

@ -169,6 +169,11 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
     * 患者取消类型详细说明
     */
    private String patientCancelRemark;
    /**
     * 预约时间
     */
    private Date registerDate;
    /**
	 * -1 取消;0 候诊中 ;1 就诊中 ;2 已诊
	 */
@ -436,4 +441,14 @@ public class WlyyOutpatientDO extends UuidIdentityEntity {
    public void setPatientCancelRemark(String patientCancelRemark) {
        this.patientCancelRemark = patientCancelRemark;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name="register_date")
    public Date getRegisterDate() {
        return registerDate;
    }
    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }
}

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

@ -162,6 +162,15 @@ public class BaseHospitalRequestMapping {
         * 居民取消原因字典
         */
        public static final String findCancelReasonList="/findCancelReasonList";
        /**
         * 獲取快速咨詢時間
         */
        public static final String findFastRegisterDate="/findFastRegisterDate";
        /**
         * 获取快速咨询时间分段
         */
        public static final String findByTimeSlot="/findByTimeSlot";
        //=================end=======================================
        /**

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

@ -172,6 +172,10 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    @ApiModelProperty(value = "创建时间", example = "模块1")
    private Date createTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @ApiModelProperty(value = "预约时间", example = "模块1")
    private Date registerDate;
    /**
	 * -1 取消;0 候诊中 ;1 就诊中 ;2 已诊
	 */
@ -380,4 +384,12 @@ public class WlyyOutpatientVO extends UuidIdentityVO {
    public void setType(String type) {
        this.type = type;
    }
    public Date getRegisterDate() {
        return registerDate;
    }
    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }
}

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

@ -70,7 +70,7 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
     * 频率
     */
    @ApiModelProperty(value = "频率", example = "模块1")
    private String usage;
    private String usageCode;
    @ApiModelProperty(value = "频率名稱", example = "模块1")
    private String usageName;
@ -167,11 +167,12 @@ public class WlyyPrescriptionInfoVO extends UuidIdentityVOWithOperator {
        this.unit = unit;
    }
    public String getUsage() {
        return usage;
    public String getUsageCode() {
        return usageCode;
    }
    public void setUsage(String usage) {
        this.usage = usage;
    public void setUsageCode(String usageCode) {
        this.usageCode = usageCode;
    }
    public String getSupplyCode() {

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

@ -123,12 +123,9 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
            parameters.put("grant_type", "password");
            //解密密码
            if (parameters.get("password") != null) {
//                RSAPrivateKey rsaPrivateKey = (RSAPrivateKey)httpSession.getAttribute("privateKey");
//                KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
//                parameters.put("password", RSAUtils.decryptByPrivateKey(parameters.get("password"), rsaPrivateKey));
//                String password = com.yihu.jw.security.utils.RSAUtils.decryptBase64(parameters.get("password"), keyPair);
//                parameters.put("password", password);
//                parameters.put("password", RSAUtils.decryptByPrivateKey(parameters.get("password"), rsaPrivateKey));
                KeyPair keyPair = (KeyPair) httpSession.getAttribute("privateKey");
                String password = com.yihu.jw.security.utils.RSAUtils.decryptBase64(parameters.get("password"), keyPair);
                parameters.put("password", password);
            } else {
                parameters.put("grant_type", "ihealthCode");
            }

+ 0 - 2
server/svr-authentication/src/main/resources/bootstrap.yml

@ -6,7 +6,6 @@ spring:
      failFast: true
      username: jw
      password: jkzl
#发现服务
eureka:
  client:
@ -18,7 +17,6 @@ eureka:
    prefer-ip-address: false
    instance-id: ${spring.cloud.client.ipAddress}:${server.port}
---
spring:
  profiles: jwdev

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

@ -374,7 +374,20 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        return success(prescriptionService.findCancelReasonList());
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findFastRegisterDate)
    @ApiOperation(value = "獲取快速咨詢時間", notes = "獲取快速咨詢時間")
    public ListEnvelop findFastRegisterDate(){
        return success(prescriptionService.findFastRegisterDate());
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.findByTimeSlot)
    @ApiOperation(value = "获取快速咨询时间分段", notes = "获取快速咨询时间分段")
    public ListEnvelop findByTimeSlot(@ApiParam(name = "startTime", value = "开始时间")
                                      @RequestParam(value = "startTime", required = false)String startTime,
                                      @ApiParam(name = "endTime", value = "结束时间")
                                      @RequestParam(value = "endTime", required = false)String endTime) {
        return success(prescriptionService.findByTimeSlot(startTime,endTime));
    }
    //===========