| 
															
																@ -4,16 +4,31 @@ import com.yihu.jw.entity.hospital.family.WlyyPatientFamilyMemberDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO; 
															 | 
															
															 | 
															
																import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao; 
															 | 
															
															 | 
															
																import com.yihu.jw.hospital.family.dao.WlyyPatientFamilyMemberDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao; 
															 | 
															
															 | 
															
																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 com.yihu.mysql.query.BaseJpaService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import org.apache.commons.lang3.StringUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.beans.factory.annotation.Autowired; 
															 | 
															
															 | 
															
																import org.springframework.beans.factory.annotation.Autowired; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import org.springframework.beans.factory.annotation.Value; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import org.springframework.stereotype.Service; 
															 | 
															
															 | 
															
																import org.springframework.stereotype.Service; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import javax.sound.sampled.Mixer; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																import java.util.Date; 
															 | 
															
															 | 
															
																import java.util.Date; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import java.util.List; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																import java.util.Map; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																@Service 
															 | 
															
															 | 
															
																@Service 
															 | 
														
													
												
													
														
															| 
															 | 
															
																public class WlyyHttpLogService  extends BaseJpaService<WlyyHttpLogDO, WlyyHttpLogDao> { 
															 | 
															
															 | 
															
																public class WlyyHttpLogService  extends BaseJpaService<WlyyHttpLogDO, WlyyHttpLogDao> { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    @Autowired 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    private WlyyHttpLogDao wlyyHttpLogDao; 
															 | 
															
															 | 
															
																    private WlyyHttpLogDao wlyyHttpLogDao; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Value("${wechat.id}") 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private String wxId; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Autowired 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private HibenateUtils hibenateUtils; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    @Value("${wechat.flag}") 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    private boolean flag; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    //保存http日志接口 
															 | 
															
															 | 
															
																    //保存http日志接口 
															 | 
														
													
												
													
														
															| 
															 | 
															
																    public  void  saveHttpLog(String code,String name,String patient,String doctor,String request,String response,String status ){ 
															 | 
															
															 | 
															
																    public  void  saveHttpLog(String code,String name,String patient,String doctor,String request,String response,String status ){ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO(); 
															 | 
															
															 | 
															
																        WlyyHttpLogDO wlyyHttpLogDO = new WlyyHttpLogDO(); 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@ -27,4 +42,72 @@ public class WlyyHttpLogService  extends BaseJpaService<WlyyHttpLogDO, WlyyHttpL 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        wlyyHttpLogDO.setCreateTime(new Date()); 
															 | 
															
															 | 
															
																        wlyyHttpLogDO.setCreateTime(new Date()); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																        wlyyHttpLogDao.save(wlyyHttpLogDO); 
															 | 
															
															 | 
															
																        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; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																} 
															 | 
															
															 | 
															
																} 
															 |