优化缺陷列表:状态为作废或为空或已封存的不查询等

master
hujl 4 years ago
parent a84bef66bf
commit ac8dd7d172

@ -6,11 +6,16 @@
*/
package com.emr.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.emr.entity.*;
import com.emr.service.Emr_DictionaryService;
import com.emr.service.Emr_Fault_DetailService;
import com.emr.service.Emr_Fault_TypeService;
import com.emr.service.PowerUserService;
import com.emr.util.ThreadExcelUtils;
import com.google.common.base.Function;
import com.google.common.collect.Maps;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
@ -32,10 +37,6 @@ import java.util.*;
@Controller
@RequestMapping("fault")
public class faultController {
@Value("${backFee}")
private String backFee;
@Autowired
private Emr_Fault_DetailService emrFaultDetailService;
@ -61,8 +62,8 @@ public class faultController {
@RequestMapping(value = "/exportExcel")
public void exportExcel(HttpServletResponse response, Emr_Fault_Vo emrFaultVo) throws Exception {
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
String[] header = {"病历清单id","住院号","住院次数","姓名","出院科室","出院日期","归档状态","评分","退回总次数","退回总费用(元)","当前退回次数","退回费用","退回人","退回时间","回退内容","缺陷选项","缺陷评分","缺陷内容","创建人","创建时间"};
String[] fileNames = {"ArchiveDetailId","inpNo","visitId","name","deptName","dischargeDateTime","archivestate","price","totalBackNum","totalBackFee","backNum","backFee","updater","updateTime","backContent","assortName","score","content","creater","createTime"};
String[] header = {"病历清单id","住院号","住院次数","姓名","出院科室","出院日期","归档状态","评分","主管医生","退回总次数","退回总费用(元)","当前退回次数","退回费用","退回人","退回时间","回退内容","缺陷选项","缺陷评分","缺陷内容","创建人","创建时间"};
String[] fileNames = {"archiveDetailId","inpNo","visitId","name","deptName","dischargeDateTime","archivestate","price","doctorInCharge","totalBackNum","totalBackFee","backNum","backFee","updater","updateTime","backContent","assortName","score","content","creater","createTime"};
//文件名
String fileName = "缺陷信息数据" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xls";
//构造excel的数据
@ -71,23 +72,17 @@ public class faultController {
List<Emr_Fault_Vo> list = emrFaultDetailService.selByCol(emrFaultVo);
//获取病案退回是第几次 updater为退回人
List<Emr_Fault_Vo> backList =emrFaultDetailService.faultBackScoreList(emrFaultVo);
//获取病案信息
String priceVal="";
if(backFee!=null && backFee!=""){
priceVal=backFee;
}else{
//默认退回一次扣30元
priceVal="30";
}
emrFaultVo.setBackFee(priceVal);
//退回总次数、总费用和总评分
List<Emr_Fault_Vo> masterList=emrFaultDetailService.masterTotalList(emrFaultVo);
if(list!=null && list.size()>0){
if(backList!=null && backList.size()>0){
if(masterList!=null && masterList.size()>0){
//缺陷列表
for (Emr_Fault_Vo faultInfo : list) {
//退回总次数、总费用和总评分
for (Emr_Fault_Vo masertInfo : masterList) {
if(faultInfo.getArchiveDetailId().equals(masertInfo.getArchiveDetailId())) {
faultInfo.setBackFee(masertInfo.getBackFee());
faultInfo.setInpNo(masertInfo.getInpNo());
faultInfo.setVisitId(masertInfo.getVisitId());
faultInfo.setName(masertInfo.getName());
@ -97,10 +92,12 @@ public class faultController {
faultInfo.setPrice(masertInfo.getScore());
faultInfo.setTotalBackNum(masertInfo.getTotalBackNum());
faultInfo.setTotalBackFee(masertInfo.getTotalBackFee());
}
//else{
//匹配不到退回相关的ArchiveDetailId
//}
}
//获取病案退回是第几次 updater为退回人
for (Emr_Fault_Vo backInfo : backList) {
if(faultInfo.getArchiveDetailId().equals(backInfo.getArchiveDetailId())) {
if(backInfo.getCreateTime()!=null && backInfo.getCreateTime()!=""){
@ -116,7 +113,6 @@ public class faultController {
faultInfo.setUpdater(backInfo.getCreater());
faultInfo.setUpdateTime(backInfo.getCreateTime());
faultInfo.setContent(backInfo.getContent());
}
}
else if(faultInfo.getEndDateTo()!=null && faultInfo.getEndDateTo()!=""){
@ -135,11 +131,9 @@ public class faultController {
}
}
}
}
}
}
}
}
}
@ -492,7 +486,6 @@ public class faultController {
@ResponseBody
@RequestMapping(value = "/masterTotalList")
public OffsetLimitPage masterTotalList(HttpServletRequest request, HttpServletResponse response, Emr_Fault_Vo emrFaultVo, Integer offset, Integer limit) {
emrFaultVo.setBackFee(backFee);
OffsetLimitPage result = emrFaultDetailService.masterTotalList(emrFaultVo, offset, limit);
return result;

@ -22,6 +22,7 @@ import com.google.common.base.Function;
import com.google.common.collect.Maps;
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 org.springframework.util.CollectionUtils;
@ -35,6 +36,9 @@ import java.util.Map;
@Service
public class Emr_Fault_DetailServiceImpl implements Emr_Fault_DetailService {
@Value("${backFee}")
private String backFee;
@Autowired
private Emr_Fault_DetailMapper emrFaultDetailMapper;
@ -312,67 +316,54 @@ public class Emr_Fault_DetailServiceImpl implements Emr_Fault_DetailService {
@Override
public List<Emr_Fault_Vo> masterTotalList(Emr_Fault_Vo emrFaultVo) {
List<Emr_Fault_Vo> list= emrFaultDetailMapper.masterTotalList(emrFaultVo);
JSONArray powerUsers = powerUserService.getPowerUserList("1");
List<JSONObject> powerUserList = JSONArray.parseArray(powerUsers.toJSONString(), JSONObject.class);
if (powerUserList != null){
Map<String,JSONObject> mappedMovies = Maps.uniqueIndex(powerUserList, new Function<JSONObject,String>() {
@Override
public String apply(JSONObject temp) {
return temp.getString("userName");
}});
for (Emr_Fault_Vo emr_fault_vo : list) {
//主管医生
JSONObject userInfo = mappedMovies.get(emr_fault_vo.getDoctorInCharge());
if (userInfo==null){
emr_fault_vo.setDoctorInCharge(emr_fault_vo.getDoctorInCharge());
}else {
emr_fault_vo.setDoctorInCharge(userInfo.getString("name"));
}
//退回人
userInfo = mappedMovies.get(emr_fault_vo.getCreater());
if (userInfo==null){
emr_fault_vo.setCreater(emr_fault_vo.getCreater());
}else {
emr_fault_vo.setCreater(userInfo.getString("name"));
}
}
//获取病案信息
String priceVal="";
if(backFee!=null && backFee!=""){
priceVal=backFee;
}else{
//默认退回一次扣30元
priceVal="30";
}
return list;
}
@Override
public OffsetLimitPage masterTotalList(Emr_Fault_Vo emrFaultVo, Integer offset, Integer limit) {
PageHelper.offsetPage(offset, limit);
List<Emr_Fault_Vo> list = emrFaultDetailMapper.masterTotalList(emrFaultVo);
if(list!=null && list.size()>0){
emrFaultVo.setBackFee(backFee);
List<Emr_Fault_Vo> list= emrFaultDetailMapper.masterTotalList(emrFaultVo);
if(list!=null && list.size()>0) {
JSONArray powerUsers = powerUserService.getPowerUserList("1");
List<JSONObject> powerUserList = JSONArray.parseArray(powerUsers.toJSONString(), JSONObject.class);
if (powerUserList != null){
Map<String,JSONObject> mappedMovies = Maps.uniqueIndex(powerUserList, new Function<JSONObject,String>() {
if (powerUserList != null) {
Map<String, JSONObject> mappedMovies = Maps.uniqueIndex(powerUserList, new Function<JSONObject, String>() {
@Override
public String apply(JSONObject temp) {
return temp.getString("userName");
}});
}
});
for (Emr_Fault_Vo emr_fault_vo : list) {
// emr_fault_vo.setBackFee(priceVal);
//主管医生
JSONObject userInfo = mappedMovies.get(emr_fault_vo.getDoctorInCharge());
if (userInfo==null){
if (userInfo == null) {
emr_fault_vo.setDoctorInCharge(emr_fault_vo.getDoctorInCharge());
}else {
} else {
emr_fault_vo.setDoctorInCharge(userInfo.getString("name"));
}
//退回人
userInfo = mappedMovies.get(emr_fault_vo.getCreater());
if (userInfo==null){
if (userInfo == null) {
emr_fault_vo.setCreater(emr_fault_vo.getCreater());
}else {
} else {
emr_fault_vo.setCreater(userInfo.getString("name"));
}
}
}
}
return list;
}
@Override
public OffsetLimitPage masterTotalList(Emr_Fault_Vo emrFaultVo, Integer offset, Integer limit) {
PageHelper.offsetPage(offset, limit);
List<Emr_Fault_Vo> list =masterTotalList(emrFaultVo);
return new OffsetLimitPage((Page) list);
}
@ -452,74 +443,7 @@ public class Emr_Fault_DetailServiceImpl implements Emr_Fault_DetailService {
@Override
public OffsetLimitPage faultBackScoreList(Emr_Fault_Vo emrFaultVo, Integer offset, Integer limit) {
PageHelper.offsetPage(offset, limit);
List<Emr_Fault_Vo> list = emrFaultDetailMapper.faultBackScoreList(emrFaultVo);
if(list!=null && list.size()>0){
Archive_Master_Following archiveMasterFollowing=new Archive_Master_Following();
archiveMasterFollowing.setFollowingType("9");
//根据条件查询跟随流程记录的退回次数排序列表remark暂存退回次数
List<Archive_Master_Following> followList =archiveMasterFollowingMapper.selByCol(archiveMasterFollowing);
if(followList!=null && followList.size()>0){
//Boolean bol=false;
JSONArray powerUsers = powerUserService.getPowerUserList("1");
List<JSONObject> powerUserList = JSONArray.parseArray(powerUsers.toJSONString(), JSONObject.class);
if (powerUserList != null){
Map<String,JSONObject> mappedMovies = Maps.uniqueIndex(powerUserList, new Function<JSONObject,String>() {
@Override
public String apply(JSONObject temp) {
return temp.getString("userName");
}});
for (Emr_Fault_Vo emr_fault_vo : list) {
/*JSONObject userInfo = mappedMovies.get(emr_fault_vo.getDoctorInCharge());
if (userInfo==null){
emr_fault_vo.setDoctorInCharge(emr_fault_vo.getDoctorInCharge());
}else {
emr_fault_vo.setDoctorInCharge(userInfo.getString("name"));
}*/
JSONObject userInfo = mappedMovies.get(emr_fault_vo.getCreater());
if (userInfo==null){
emr_fault_vo.setCreater(emr_fault_vo.getCreater());
}else {
emr_fault_vo.setCreater(userInfo.getString("name"));
}
//退回次数
for(int i=0;i<followList.size();i++){
if(emr_fault_vo.getArchiveDetailId().equals(followList.get(i).getMasterId()) && emr_fault_vo.getCreateTime()!=null && emr_fault_vo.getCreateTime()!="" && followList.get(i).getHandleTime()!=null && followList.get(i).getHandleTime()!="") {
//a早于b返回true
try {
if (compare(emr_fault_vo.getCreateTime(), followList.get(i).getHandleTime())) {
emr_fault_vo.setBackNum(followList.get(i).getRemark());
if(i!=0) {
emr_fault_vo.setStartDateTo(followList.get(i - 1).getHandleTime());
if (StringUtils.isNotBlank(followList.get(i).getHandleTime())) {
emr_fault_vo.setEndDateTo(followList.get(i).getHandleTime());
} else {
emr_fault_vo.setEndDateTo(followList.get(i - 1).getHandleTime());
}
}else{
//第一次签收
emr_fault_vo.setStartDateTo("2000-01-01 01:00:00");
emr_fault_vo.setEndDateTo(followList.get(i).getHandleTime());
}
break;
}
} catch (ParseException e) {
e.printStackTrace();
}
}else{
emr_fault_vo.setBackNum("异常");
}
}
}
}
}else{
//跟随流程表必须有病案室退回科主任记录否则list为空
list=null;
}
}
List<Emr_Fault_Vo> list =faultBackScoreList(emrFaultVo);
return new OffsetLimitPage((Page) list);
}

@ -70,22 +70,22 @@ public class DatelUtils {
public static Archive_Master_Vo setMaterVoFun(Archive_Master_Vo archiveMasterVo) throws Exception {
//判断复制时段类型
String endDateStr="";
if(org.apache.commons.lang3.StringUtils.isNotBlank(archiveMasterVo.getLockinfo())){
if(StringUtils.isNotBlank(archiveMasterVo.getLockinfo())){
//day_7 month_day_15 month_1 month_3
if(org.apache.commons.lang3.StringUtils.isNotBlank(archiveMasterVo.getStartDate()) && org.apache.commons.lang3.StringUtils.isBlank(archiveMasterVo.getEndDate())){
if(StringUtils.isNotBlank(archiveMasterVo.getStartDate()) && StringUtils.isBlank(archiveMasterVo.getEndDate())){
//复印时间的截至日期,不得超过
endDateStr=getDateFun(archiveMasterVo.getLockinfo(),archiveMasterVo.getStartDate(),"A",0);
archiveMasterVo.setEndDate(endDateStr);
}else if(org.apache.commons.lang3.StringUtils.isNotBlank(archiveMasterVo.getStartDate()) && org.apache.commons.lang3.StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
}else if(StringUtils.isNotBlank(archiveMasterVo.getStartDate()) &&StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
endDateStr=getDateFun(archiveMasterVo.getLockinfo(),archiveMasterVo.getStartDate(),"A",0);
if(!compareDate(archiveMasterVo.getStartDate(),endDateStr)){
archiveMasterVo.setEndDate(endDateStr);
}
}else if(org.apache.commons.lang3.StringUtils.isBlank(archiveMasterVo.getStartDate()) && org.apache.commons.lang3.StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
}else if(StringUtils.isBlank(archiveMasterVo.getStartDate()) && StringUtils.isNotBlank(archiveMasterVo.getEndDate())){
//反向扣除s
endDateStr=getDateFun(archiveMasterVo.getLockinfo(),archiveMasterVo.getEndDate(),"B",0);
archiveMasterVo.setStartDate(endDateStr);
}else if(org.apache.commons.lang3.StringUtils.isBlank(archiveMasterVo.getStartDate()) && org.apache.commons.lang3.StringUtils.isBlank(archiveMasterVo.getEndDate())){
}else if(StringUtils.isBlank(archiveMasterVo.getStartDate()) && StringUtils.isBlank(archiveMasterVo.getEndDate())){
//系统时间
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String nowDate= String.valueOf(sdf.format(new Date()));

@ -85,7 +85,7 @@
on f.archive_detail_id=m.id
LEFT JOIN emr_fault_type t
on f.assort_id=convert(varchar(50),t.id)
<where> 1=1 and ArchiveState!='作废'
<where> 1=1 and ArchiveState not in('作废','已封存') and assort_id is not null and assort_id!=''
<if test="archiveDetailId != null and archiveDetailId != '' ">
and f.archive_detail_id = #{archiveDetailId,jdbcType=NVARCHAR}
</if>
@ -769,7 +769,7 @@
on a.master_id=m.id
LEFT JOIN (select code,name from emr_dictionary where parent_id=(select id from emr_dictionary where typeCode='dept_code' )) d
on m.dept_name=d.code
<where> 1=1 and m.ArchiveState!='作废' and m.Is_Valid!=1 and m.ArchiveState!='已封存'
<where> 1=1 and m.ArchiveState not in('作废','已封存','') and m.ArchiveState is not null and m.Is_Valid!=1
<if test="inpNo != null and inpNo != ''">
and m.inp_no like '%'+#{inpNo,jdbcType=NCHAR}+'%'
</if>
@ -834,10 +834,10 @@
)a
left join(
select m.id,m.inp_no,m.visit_id,m.name,m.discharge_date_time,m.dept_name,m.ArchiveState, score,m.DOCTOR_IN_CHARGE
from Archive_Master m where ArchiveState!='作废'
from Archive_Master m where 1=1 and ArchiveState not in('作废','已封存','') and ArchiveState is not null and Is_Valid!=1
)m
on a.archive_detail_id=m.id
<where> 1=1 and m.ArchiveState!='作废'
<where> 1=1 and ArchiveState not in('作废','已封存','') and ArchiveState is not null
<if test="archiveDetailId != null and archiveDetailId != ''">
and a.archive_detail_id=#{archiveDetailId,jdbcType=NCHAR}
</if>

Loading…
Cancel
Save