|
|
|
@ -270,15 +270,11 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Archive_Master_Vo> selectBeHospitalByColumn(Archive_Master_Vo archiveMasterVo, Integer offset, Integer limit) {
|
|
|
|
|
//判断并设置查询是否打印权限
|
|
|
|
|
//setIdByPrintNum(archiveMasterVo);
|
|
|
|
|
//根据条件查询记录
|
|
|
|
|
if(null != offset && null != limit) {
|
|
|
|
|
PageHelper.offsetPage(offset, limit);
|
|
|
|
|
}
|
|
|
|
|
List<Archive_Master_Vo> list = archiveMasterMapper.selectByColumn(archiveMasterVo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取科室列表
|
|
|
|
|
Emr_Dictionary dic = new Emr_Dictionary();
|
|
|
|
|
dic.setEffective(1);
|
|
|
|
@ -622,42 +618,91 @@ public class Archive_MasterServiceImpl implements Archive_MasterService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Archive_Master_Vo> selectByUnfileAndColumn(Archive_Master_Vo archiveMasterVo,Integer offset, Integer limit) {
|
|
|
|
|
//判断并设置查询是否打印权限
|
|
|
|
|
//setIdByPrintNum(archiveMasterVo);
|
|
|
|
|
//根据条件查询记录
|
|
|
|
|
if(null != offset && null != limit) {
|
|
|
|
|
PageHelper.offsetPage(offset, limit);
|
|
|
|
|
}
|
|
|
|
|
List<Archive_Master_Vo> list = archiveMasterMapper.selectByUnfileNew(archiveMasterVo);
|
|
|
|
|
//获取科室列表
|
|
|
|
|
Emr_Dictionary dic = new Emr_Dictionary();
|
|
|
|
|
dic.setEffective(1);
|
|
|
|
|
dic.setTypecode("dept_code");
|
|
|
|
|
//科室列表
|
|
|
|
|
List<Emr_Dictionary> dicList = emrDictionaryService.dicByTypeCode(dic);
|
|
|
|
|
for (Archive_Master_Vo archiveMaster:list)
|
|
|
|
|
//转换科室
|
|
|
|
|
for (int k = 0; k < dicList.size(); k++) {
|
|
|
|
|
if(StringUtils.isNotBlank(archiveMaster.getDeptName())){
|
|
|
|
|
String deptName = archiveMaster.getDeptName();
|
|
|
|
|
|
|
|
|
|
if (deptName.equals(dicList.get(k).getCode())) {
|
|
|
|
|
//出院科室
|
|
|
|
|
deptName = deptName.replace(deptName, dicList.get(k).getName());
|
|
|
|
|
archiveMaster.setDeptName(deptName);
|
|
|
|
|
}
|
|
|
|
|
Map<String, Emr_Dictionary> codeMap = ListUtils.toMap(dicList, Emr_Dictionary::getCode);
|
|
|
|
|
Setters.<Archive_Master_Vo>instance().list(list).cycleSetProperties(p -> {
|
|
|
|
|
String deptCode = p.getDeptName();
|
|
|
|
|
String deptAdmissionCode = p.getDeptAdmissionTo();
|
|
|
|
|
if(StringUtils.isNotBlank(deptCode) && codeMap.containsKey(deptCode)){
|
|
|
|
|
String deptName = codeMap.get(deptCode).getName();
|
|
|
|
|
p.setDeptName(deptName);
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(archiveMaster.getDeptAdmissionTo())){
|
|
|
|
|
String dept2 = archiveMaster.getDeptAdmissionTo();
|
|
|
|
|
if(dept2 != null && dept2.equals(dicList.get(k).getCode())) {
|
|
|
|
|
//入院科室dept_admission_to
|
|
|
|
|
dept2 = dept2.replace(dept2, dicList.get(k).getName());
|
|
|
|
|
archiveMaster.setDeptAdmissionTo(dept2);
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isNotBlank(deptAdmissionCode) && codeMap.containsKey(deptAdmissionCode)){
|
|
|
|
|
String deptAdmissionTo = codeMap.get(deptAdmissionCode).getName();
|
|
|
|
|
p.setDeptAdmissionTo(deptAdmissionTo);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//masterIds集合
|
|
|
|
|
List<String> masterIds = ListUtils.distinctSelect(list, Archive_Master_Vo::getId);
|
|
|
|
|
//转成逗号拼接
|
|
|
|
|
String ids = String.join(",", masterIds);
|
|
|
|
|
//获取医生缺陷数量
|
|
|
|
|
List<Archive_Master_Vo> doctorDefectNum = archiveMasterMapper.getDoctorDefectNum(ids);
|
|
|
|
|
//医生是否有缺陷
|
|
|
|
|
Map<String, Archive_Master_Vo> doctorMap = ListUtils.toMap(doctorDefectNum, Archive_Master_Vo::getArchiveDetailId);
|
|
|
|
|
Setters.<Archive_Master_Vo>instance().list(list).cycleSetProperties(p -> {
|
|
|
|
|
String doctorId = p.getId();
|
|
|
|
|
if (doctorMap.containsKey(doctorId)){
|
|
|
|
|
String faultDoctorNum = doctorMap.get(doctorId).getFaultDoctorNum();
|
|
|
|
|
p.setFaultDoctorNum(faultDoctorNum);
|
|
|
|
|
p.setNumb(1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//获取护士缺陷数量
|
|
|
|
|
List<Archive_Master_Vo> nurseDefectNum = archiveMasterMapper.getNurseDefectNum(ids);
|
|
|
|
|
//护士是否有缺陷
|
|
|
|
|
Map<String, Archive_Master_Vo> nurseMap = ListUtils.toMap(nurseDefectNum, Archive_Master_Vo::getArchiveDetailId);
|
|
|
|
|
//判断是否有缺陷就填入
|
|
|
|
|
Setters.<Archive_Master_Vo>instance().list(list).cycleSetProperties(p -> {
|
|
|
|
|
String nurseId = p.getId();
|
|
|
|
|
if (nurseMap.containsKey(nurseId)){
|
|
|
|
|
String faultNurseNum = nurseMap.get(nurseId).getFaultNurseNum();
|
|
|
|
|
p.setFaultNurseNum(faultNurseNum);
|
|
|
|
|
p.setNumb(1);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//设置医生、护士名称和打印标识、科室、是否退回医生、是否退回护士
|
|
|
|
|
setNameAndPrintFlagNew(archiveMasterVo, list);
|
|
|
|
|
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>() {
|
|
|
|
|
@Override
|
|
|
|
|
public String apply(JSONObject temp) {
|
|
|
|
|
return temp.getString("userName");
|
|
|
|
|
}});
|
|
|
|
|
|
|
|
|
|
for (Archive_Master_Vo emr_fault_vo : list) {
|
|
|
|
|
// emr_fault_vo.setBackFee(priceVal);
|
|
|
|
|
//主管医生
|
|
|
|
|
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"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//设置医生、护士名称和打印标识
|
|
|
|
|
setNameAndPrintFlag(archiveMasterVo, list);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|