|
@ -72,7 +72,7 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
* @param type
|
|
|
* @return
|
|
|
*/
|
|
|
public JSONArray getPrescriptionInfos(String type,String state,String startDate,String endDate,String diagnosisCode,String patient){
|
|
|
public JSONArray getPrescriptionInfos(String type,String state,String startDate,String endDate,String patient){
|
|
|
|
|
|
if(StringUtils.isNotBlank(type)){
|
|
|
if("1".equals(type)){
|
|
@ -166,4 +166,53 @@ public class PrescriptionInfoService extends BaseService {
|
|
|
public void upLoadPrescriotionState(){
|
|
|
|
|
|
}
|
|
|
|
|
|
public JSONArray getDoctorPrescription(String doctor,String state,String diseases,String startDate,String endDate ){
|
|
|
|
|
|
StringBuffer pre_sql = new StringBuffer("SELECT " +
|
|
|
" p.`name`, " +
|
|
|
" TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age, " +
|
|
|
" p.sex, " +
|
|
|
" pr.`status`, " +
|
|
|
" pr.`code`, " +
|
|
|
" pr.create_time AS createTime, " +
|
|
|
" pr.doctor " +
|
|
|
" FROM " +
|
|
|
" wlyy_prescription pr " +
|
|
|
" LEFT JOIN wlyy_patient p ON pr.patient = p.`code` " );
|
|
|
List<Object> params = new ArrayList<>();
|
|
|
//先判断疾病类型是否为空
|
|
|
if(StringUtils.isNotBlank(diseases)){
|
|
|
//疾病类型不为空,关联查询疾病类型表
|
|
|
pre_sql.append(" ,wlyy_prescription_diagnosis s " +
|
|
|
" WHERE s.prescription_code = pr.code " +
|
|
|
" AND pr.doctor =? AND s.code = ?");
|
|
|
params.add(doctor);
|
|
|
params.add(diseases);
|
|
|
setSQL(pre_sql,params,state,startDate,endDate);
|
|
|
}else{
|
|
|
//查询所有疾病类型表
|
|
|
pre_sql.append(" WHERE pr.doctor =?");
|
|
|
params.add(doctor);
|
|
|
setSQL(pre_sql,params,state,startDate,endDate);
|
|
|
}
|
|
|
List<Map<String,Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(),params.toArray());
|
|
|
return new JSONArray(rs);
|
|
|
}
|
|
|
|
|
|
public void setSQL(StringBuffer pre_sql,List<Object> params,String state,String startDate,String endDate){
|
|
|
if(StringUtils.isNotBlank(state)){
|
|
|
pre_sql.append(" AND pr.status = ?");
|
|
|
params.add(state);
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(startDate)){
|
|
|
pre_sql.append(" AND pr.create_time >= ?");
|
|
|
params.add(startDate);
|
|
|
}
|
|
|
if(StringUtils.isNotBlank(endDate)){
|
|
|
pre_sql.append(" AND pr.create_time <= ?");
|
|
|
params.add(endDate);
|
|
|
}
|
|
|
pre_sql.append(" ORDER BY pr.create_time DESC");
|
|
|
}
|
|
|
}
|