|
@ -4,10 +4,12 @@ package com.yihu.wlyy.service.app.health.bank;/**
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.yihu.wlyy.entity.device.PatientDevice;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
|
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
import com.yihu.wlyy.service.app.device.PatientDeviceService;
|
|
import com.yihu.wlyy.service.app.device.PatientDeviceService;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
@ -52,6 +54,8 @@ public class CreditLogService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private SystemDictDao systemDictDao;
|
|
private SystemDictDao systemDictDao;
|
|
|
|
@Autowired
|
|
|
|
private PatientDeviceDao patientDeviceDao;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private SignFamilyDao signFamilyDao;
|
|
private SignFamilyDao signFamilyDao;
|
|
@ -87,7 +91,7 @@ public class CreditLogService {
|
|
if (name == null || name == ""){
|
|
if (name == null || name == ""){
|
|
sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"')";
|
|
sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"')";
|
|
} else if (name != null) {
|
|
} else if (name != null) {
|
|
sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"') AND name = '"+name+"'";
|
|
|
|
|
|
sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"') AND name LIKE '%"+name+"%'";
|
|
}
|
|
}
|
|
List<SignFamily> signFamilyList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily.class));
|
|
List<SignFamily> signFamilyList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily.class));
|
|
List<String> patientIds = new ArrayList<>();
|
|
List<String> patientIds = new ArrayList<>();
|
|
@ -255,7 +259,7 @@ public class CreditLogService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject selectByAccount(JSONObject object,Integer page,Integer size){
|
|
public JSONObject selectByAccount(JSONObject object,Integer page,Integer size){
|
|
String signSql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND patient = '"+object.getString("patientId") +"'";
|
|
|
|
|
|
String signSql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND patient = '"+object.getString("patientId") +"' AND status = 1";
|
|
List<SignFamily> signFamilyList1 = jdbcTemplate.query(signSql,new BeanPropertyRowMapper(SignFamily.class));
|
|
List<SignFamily> signFamilyList1 = jdbcTemplate.query(signSql,new BeanPropertyRowMapper(SignFamily.class));
|
|
String sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +signFamilyList1.get(0).getDoctor() + "' OR doctor_health = '" + signFamilyList1.get(0).getDoctor() +"')";
|
|
String sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +signFamilyList1.get(0).getDoctor() + "' OR doctor_health = '" + signFamilyList1.get(0).getDoctor() +"')";
|
|
List<SignFamily> signFamilyList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily.class));
|
|
List<SignFamily> signFamilyList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily.class));
|
|
@ -299,11 +303,12 @@ public class CreditLogService {
|
|
* @param size
|
|
* @param size
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public JSONObject selectByActivityRanking1(String activityId,Integer page,Integer size){
|
|
|
|
|
|
public JSONObject selectByActivityRanking1(String activityId,String patientId,Integer page,Integer size){
|
|
String response = null;
|
|
String response = null;
|
|
String url =getBaseUrl() + "selectByActivityRanking1";
|
|
String url =getBaseUrl() + "selectByActivityRanking1";
|
|
Map<String,String> params = new HashMap<>();
|
|
Map<String,String> params = new HashMap<>();
|
|
params.put("activityId",activityId);
|
|
params.put("activityId",activityId);
|
|
|
|
params.put("patientId",patientId);
|
|
params.put("page",page.toString());
|
|
params.put("page",page.toString());
|
|
params.put("size",size.toString());
|
|
params.put("size",size.toString());
|
|
JSONObject object1 = null;
|
|
JSONObject object1 = null;
|
|
@ -313,8 +318,8 @@ public class CreditLogService {
|
|
JSONArray array = object1.getJSONArray("detailModelList");
|
|
JSONArray array = object1.getJSONArray("detailModelList");
|
|
for (int i = 0;array != null && i<array.size();i++){
|
|
for (int i = 0;array != null && i<array.size();i++){
|
|
JSONObject object2 = array.getJSONObject(i);
|
|
JSONObject object2 = array.getJSONObject(i);
|
|
String patientId = object2.getString("patientId");
|
|
|
|
Patient patient = patientDao.findByCode(patientId);
|
|
|
|
|
|
String patientId1 = object2.getString("patientId");
|
|
|
|
Patient patient = patientDao.findByCode(patientId1);
|
|
object2.put("patient",patient);
|
|
object2.put("patient",patient);
|
|
}
|
|
}
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
@ -403,14 +408,14 @@ public class CreditLogService {
|
|
if (name == null || name ==""){
|
|
if (name == null || name ==""){
|
|
sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"')";
|
|
sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"')";
|
|
} else if (name != null) {
|
|
} else if (name != null) {
|
|
sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"') AND name = '"+name+"'";
|
|
|
|
|
|
sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND ( doctor = '" +doctorId + "' OR doctor_health = '" + doctorId +"') AND name LIKE '%"+name+"%'";
|
|
}
|
|
}
|
|
|
|
|
|
List<SignFamily> signFamilyList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily.class));
|
|
List<SignFamily> signFamilyList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily.class));
|
|
List<String> patientOpenIds = new ArrayList<>();
|
|
List<String> patientOpenIds = new ArrayList<>();
|
|
if (signFamilyList != null && signFamilyList.size() != 0){
|
|
if (signFamilyList != null && signFamilyList.size() != 0){
|
|
for (SignFamily signFamily:signFamilyList){
|
|
for (SignFamily signFamily:signFamilyList){
|
|
patientOpenIds.add(signFamily.getOpenid());
|
|
|
|
|
|
patientOpenIds.add(signFamily.getPatient());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
JSONObject object = new JSONObject();
|
|
JSONObject object = new JSONObject();
|
|
@ -458,13 +463,38 @@ public class CreditLogService {
|
|
patientIds.add(signFamily.getPatient());
|
|
patientIds.add(signFamily.getPatient());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
int deviceType = object.getInteger("deviceType");//设备类型 1血糖仪,2血压仪
|
|
|
|
int bindStatus = object.getInteger("bindStatus");//绑定状态 0:绑定,1:未绑定
|
|
|
|
List<String> ids = new ArrayList<>();
|
|
|
|
for (int i=0;i<patientIds.size();i++){
|
|
|
|
if (bindStatus == 0){
|
|
|
|
String sql1 = "select * from wlyy_patient_device where user = '"+patientIds.get(i)+"' AND category_code = "+deviceType+" AND del = " + bindStatus;
|
|
|
|
List<PatientDevice> patientDevices = jdbcTemplate.query(sql1,new BeanPropertyRowMapper(PatientDevice.class));
|
|
|
|
if (patientDevices != null && patientDevices.size() != 0){
|
|
|
|
ids.add(patientDevices.get(0).getUser());
|
|
|
|
}
|
|
|
|
}else if (bindStatus == 1){
|
|
|
|
String sql1 = "select * from wlyy_patient_device where user = '"+patientIds.get(i)+"' AND category_code = "+deviceType+" AND del = " + bindStatus;
|
|
|
|
List<PatientDevice> patientDevices = jdbcTemplate.query(sql1,new BeanPropertyRowMapper(PatientDevice.class));
|
|
|
|
if (patientDevices == null || patientDevices.size() ==0){
|
|
|
|
ids.add(patientIds.get(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JSONArray patientList = new JSONArray();
|
|
|
|
for (int i =0 ;i<ids.size();i++){
|
|
|
|
Patient patient = patientDao.findByCode(ids.get(i));
|
|
|
|
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(patient);
|
|
|
|
patientList.add(jsonObject);
|
|
|
|
}
|
|
JSONObject object1 = new JSONObject();
|
|
JSONObject object1 = new JSONObject();
|
|
JSONArray array = object.getJSONArray("deviceTypes");
|
|
|
|
object1.put("patientIds",patientIds.toArray());
|
|
|
|
|
|
object1.put("patients",patientList);
|
|
object1.put("bindStatus",object.getInteger("bindStatus"));
|
|
object1.put("bindStatus",object.getInteger("bindStatus"));
|
|
object1.put("deviceTypes",array);
|
|
|
|
|
|
object1.put("deviceType",deviceType);
|
|
|
|
object1.put("ruleId",object.get("ruleId"));
|
|
object1.put("page",page);
|
|
object1.put("page",page);
|
|
object1.put("size",size);
|
|
object1.put("size",size);
|
|
|
|
|
|
String response = null;
|
|
String response = null;
|
|
String url =getBaseUrl() + "findAccounByCondition";
|
|
String url =getBaseUrl() + "findAccounByCondition";
|
|
JSONObject object2 = null;
|
|
JSONObject object2 = null;
|