|
@ -8,7 +8,6 @@ import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.PatientDisease;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.entity.patient.vo.PatientCodeDeviceType;
|
|
|
import com.yihu.wlyy.logs.BusinessLogs;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorDao;
|
|
|
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
|
|
@ -22,6 +21,7 @@ import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.service.app.team.AdminTeamService;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import com.yihu.wlyy.util.IdCardUtil;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.json.JSONArray;
|
|
|
import org.json.JSONObject;
|
|
@ -71,6 +71,8 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
SignPatientLabelDao labelDao;
|
|
|
@Autowired
|
|
|
SignFamilyRenewDao signFamilyRenewDao;
|
|
|
@Autowired
|
|
|
SignPatientLabelInfoDao signPatientLabelInfoDao;
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
|
|
@ -4486,4 +4488,108 @@ public class SignPatientLabelInfoService extends BaseService {
|
|
|
|
|
|
return result.size() > 0 ? new JSONArray(result.values()) : new JSONArray();
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 设置患者标签
|
|
|
*
|
|
|
* @param patient 患者名称
|
|
|
* @param health 健康情况标签
|
|
|
* @param disease 疾病类型标签
|
|
|
* @param custom 自定义标签
|
|
|
* @return
|
|
|
*/
|
|
|
public int resetPatientLabels(String patient,String health, String disease, String custom) {
|
|
|
|
|
|
Patient p = patientDao.findByCode(patient);
|
|
|
|
|
|
//1.清空居民标签
|
|
|
String delSql = " DELETE FROM wlyy_sign_patient_label_info WHERE patient ='"+patient+"'";
|
|
|
jdbcTemplate.execute(delSql);
|
|
|
//2.新增健康情况标签
|
|
|
String healths[] = health.split(",");
|
|
|
//获取所有健康情况标签
|
|
|
List<Map<String,Object>> healthList = getLabelsByType("2");
|
|
|
//减低循环层级
|
|
|
Map<String,Map<String,Object>> healthMap = new HashedMap();
|
|
|
for(Map<String,Object> map : healthList){
|
|
|
String code = (String)map.get("code");
|
|
|
healthMap.put(code,map);
|
|
|
}
|
|
|
|
|
|
if(healths!=null&&healths.length>0){
|
|
|
for(int i=0;i<healths.length;i++){
|
|
|
SignPatientLabelInfo info = new SignPatientLabelInfo();
|
|
|
info.setCzrq(new Date());
|
|
|
info.setLabelType("2");
|
|
|
info.setPatient(patient);
|
|
|
info.setPname(p.getName());
|
|
|
info.setLabel(healths[i]);
|
|
|
info.setStatus(1);
|
|
|
String name = (String)healthMap.get(healths[i]).get("name");
|
|
|
info.setLabelName(name);
|
|
|
signPatientLabelInfoDao.save(info);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//2.新增疾病标签
|
|
|
String diseases[] = disease.split(",");
|
|
|
//获取所有健康情况标签
|
|
|
List<Map<String,Object>> diseaseList = getLabelsByType("3");
|
|
|
//减低循环层级
|
|
|
Map<String,Map<String,Object>> diseaseMap = new HashedMap();
|
|
|
for(Map<String,Object> map : diseaseList){
|
|
|
String code = (String)map.get("code");
|
|
|
diseaseMap.put(code,map);
|
|
|
}
|
|
|
|
|
|
if(diseases!=null&&diseases.length>0){
|
|
|
for(int i=0;i<diseases.length;i++){
|
|
|
SignPatientLabelInfo info = new SignPatientLabelInfo();
|
|
|
info.setCzrq(new Date());
|
|
|
info.setLabelType("3");
|
|
|
info.setPatient(patient);
|
|
|
info.setPname(p.getName());
|
|
|
info.setLabel(diseases[i]);
|
|
|
String name = (String)diseaseMap.get(diseases[i]).get("name");
|
|
|
info.setLabelName(name);
|
|
|
info.setStatus(1);
|
|
|
signPatientLabelInfoDao.save(info);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
//3.新增自定义标签
|
|
|
String customs[] = custom.split(",");
|
|
|
//获取所有健康情况标签
|
|
|
List<Map<String,Object>> customList = getLabelsByType("4");
|
|
|
//减低循环层级
|
|
|
Map<String,Map<String,Object>> customMap = new HashedMap();
|
|
|
for(Map<String,Object> map : customList){
|
|
|
String code = (String)map.get("code");
|
|
|
customMap.put(code,map);
|
|
|
}
|
|
|
|
|
|
if(customs!=null&&customs.length>0){
|
|
|
for(int i=0;i<customs.length;i++){
|
|
|
SignPatientLabelInfo info = new SignPatientLabelInfo();
|
|
|
info.setCzrq(new Date());
|
|
|
info.setLabelType("4");
|
|
|
info.setPatient(patient);
|
|
|
info.setPname(p.getName());
|
|
|
info.setLabel(customs[i]);
|
|
|
String name = (String)customMap.get(customs[i]).get("name");
|
|
|
info.setLabelName(name);
|
|
|
info.setStatus(1);
|
|
|
signPatientLabelInfoDao.save(info);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
public List<Map<String,Object>> getLabelsByType(String labelType){
|
|
|
String sql = " SELECT b.label_code AS code ,b.label_name AS name FROM wlyy_sign_patient_label b WHERE b.label_type= ?";
|
|
|
return jdbcTemplate.queryForList(sql,new Object[]{labelType});
|
|
|
}
|
|
|
}
|