wangjun пре 4 година
родитељ
комит
26891d7506

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

@ -225,8 +225,6 @@ public class WlyyFamilyMemberService extends BaseJpaService<WlyyPatientFamilyMem
                    sex =1 ;
                }else if (familySex.equalsIgnoreCase("女")){
                    sex = 2 ;
                }else {
                    sex = 3;
                }
            }else {
                mixEnvelop.setStatus(408);

+ 83 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/httplog/service/WlyyHttpLogService.java

@ -4,16 +4,31 @@ import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.sound.sampled.Mixer;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service
public class WlyyHttpLogService  extends BaseJpaService<WlyyHttpLogDO, WlyyHttpLogDao> {
    @Autowired
    private WlyyHttpLogDao wlyyHttpLogDao;
    @Value("${wechat.id}")
    private String wxId;
    @Autowired
    private HibenateUtils hibenateUtils;
    @Value("${wechat.flag}")
    private boolean flag;
    //保存http日志接口
    public  void  saveHttpLog(String code,String name,String patient,String doctor,String request,String response,String status ){
        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO();
@ -27,4 +42,72 @@ public class WlyyHttpLogService  extends BaseJpaService<WlyyHttpLogDO, WlyyHttpL
        wlyyHttpLogDO.setCreateTime(new Date());
        wlyyHttpLogDao.save(wlyyHttpLogDO);
    }
    public MixEnvelop findLog(String startTime, String endTime, String faceName, String patient, String doctor, Integer page, Integer pageSize){
        MixEnvelop mixEnvelop = new MixEnvelop();
        String sql = "select t.id as \"id\"," +
                "t.code as \"code\"," +
                "t.name as \"name\"," +
                "t.patient as \"patient\"," +
                "t.doctor as \"doctor\"," +
                "t.request as \"request\"," +
                "t.response as \"response\"," +
                "t.status as \"status\",";
        if("xm_ykyy_wx".equals(wxId)){
            if (flag){
                sql+="date_format(t.create_time, '%Y-%m-%d %H:%i:%s')  as \"createTime\",";
            }else {
                sql+="  to_char(t.create_time,'yyyy-MM-dd HH24:mi:ss') as \"createTime\",";
            }
        }else{
            sql+="date_format(t.create_time, '%Y-%m-%d %H:%i:%s')  as \"createTime\",";
        }
        sql+=" a.name as \"patientName\"," +
                "b.name as \"doctorName\"" +
                " from wlyy_http_log t left join base_patient a on t.patient = a.id " +
                " left join base_doctor b on t.doctor = b.id where 1=1 ";
        if (StringUtils.isNotBlank(endTime)){
            if("xm_ykyy_wx".equals(wxId)){
                if (flag){
                    sql+=" and t.create_time > '"+startTime+"'";
                }else {
                    sql+=" and t.create_time > to_date('" + startTime + "', 'yyyy-mm-dd hh24:mi:ss') ";
                }
            }else{
                sql+=" and t.create_time > '"+startTime+"'";
            }
        }
        if (StringUtils.isNotBlank(endTime)){
            if("xm_ykyy_wx".equals(wxId)){
                if (flag){
                    sql+="  and t.create_time<'" + endTime + "'";
                }else {
                    sql+="  and t.create_time< to_date('" + endTime + "','yyyy-mm-dd hh24:mi:ss')";
                }
            }else{
                sql+="  and t.create_time<'" + endTime + "'";
            }
        }
        if (StringUtils.isNotBlank(faceName)){
            sql+=" and t.name like '%"+faceName+"%'";
        }
        if (StringUtils.isNotBlank(patient)){
            sql+=" and a.name like '%"+patient+"%'";
        }
        if (StringUtils.isNotBlank(doctor)){
            sql+=" and b.name like '%"+doctor+"%'";
        }
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,page,pageSize);
        String sqlcount = "SELECT COUNT(1) AS \"total\" FROM ("+sql+") q";
        Long count = 0L;
        List<Map<String,Object>> total = hibenateUtils.createSQLQuery(sqlcount);
        if(total!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(total.get(0).get("total"));
        }
        mixEnvelop.setTotalCount(count.intValue());
        mixEnvelop.setDetailModelList(list);
        mixEnvelop.setPageSize(pageSize);
        mixEnvelop.setCurrPage(page);
        return mixEnvelop;
    }
}

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

@ -6577,7 +6577,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        WlyyOutpatientDO outpatientDO = objectMapper.readValue(outpatientJson, WlyyOutpatientDO.class);
        WlyyOutpatientDO one = outpatientDao.findOne(outpatientDO.getId());
        if (StringUtils.isNotBlank(one.getDoctor())&&(one.getStatus().equalsIgnoreCase("1")||one.getStatus().equalsIgnoreCase("2"))) {
        if (StringUtils.isNotBlank(one.getDoctor())) {
            throw new RuntimeException("已有医生接诊");
        }
        one.setDoctor(outpatientDO.getDoctor());

+ 20 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -1071,5 +1071,24 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
        wlyyHttpLogService.saveHttpLog(code,name,patient,doctor,request,respone,status);
        return success("添加成功");
    }
    @PostMapping(value = "/findHttpLog")
    @ApiOperation(value = "查询接口操作日志")
    public MixEnvelop findHttpLog(@ApiParam(name = "startTime", value = "startTime")
                                    @RequestParam(value = "startTime", required = false) String startTime,
                                    @ApiParam(name = "endTime", value = "endTime")
                                    @RequestParam(value = "endTime", required = false) String endTime,
                               @ApiParam(name = "interfaceName", value = "interfaceName")
                                   @RequestParam(value = "interfaceName", required = false) String interfaceName,
                                    @ApiParam(name = "patient", value = "patient")
                                    @RequestParam(value = "patient", required = false) String patient,
                                    @ApiParam(name = "doctor", value = "doctor")
                                    @RequestParam(value = "doctor", required = false) String doctor,
                               @ApiParam(name = "page", value = "page")
                                   @RequestParam(value = "page", required = false) Integer page,
                               @ApiParam(name = "pageSize", value = "pageSize")
                                   @RequestParam(value = "pageSize", required = false) Integer pageSize
    ) {
        return wlyyHttpLogService.findLog(startTime,endTime,interfaceName,patient,doctor,page,pageSize);
    }
}