|
@ -6,9 +6,12 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
|
import com.yihu.wlyy.entity.patient.PatientFamilyMember;
|
|
|
import com.yihu.wlyy.entity.patient.SignFamily;
|
|
|
import com.yihu.wlyy.repository.dict.SystemDictDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.PatientFamilyMemberDao;
|
|
|
import com.yihu.wlyy.repository.patient.SignFamilyDao;
|
|
|
import com.yihu.wlyy.repository.statistics.WlyySignFamilyCodeDao;
|
|
|
import com.yihu.wlyy.util.HttpClientUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@ -19,7 +22,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.transaction.Transactional;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@ -49,6 +51,10 @@ public class TaskService {
|
|
|
private PatientDao patientDao;
|
|
|
@Autowired
|
|
|
private PatientFamilyMemberDao patientFamilyMemberDao;
|
|
|
@Autowired
|
|
|
private SignFamilyDao signFamilyDao;
|
|
|
@Autowired
|
|
|
private WlyySignFamilyCodeDao signFamilyCodeDao;
|
|
|
|
|
|
|
|
|
/**
|
|
@ -124,7 +130,14 @@ public class TaskService {
|
|
|
*/
|
|
|
public JSONObject attendTask(JSONObject object) throws Exception {
|
|
|
String response = null;
|
|
|
Patient patient = patientDao.findByCode(object.getString("patientId"));
|
|
|
String patientId = object.getString("patientId");
|
|
|
SignFamily signFamily = signFamilyDao.findByPatient(patientId);
|
|
|
if (signFamily == null){
|
|
|
throw new Exception("该居民尚未签约,不能报名!");
|
|
|
}else if (signFamily!=null&&!signFamily.getExpensesStatus().equalsIgnoreCase("0")){
|
|
|
throw new Exception("该居民尚未缴费,不能报名!");
|
|
|
}
|
|
|
Patient patient = patientDao.findByCode(patientId);
|
|
|
String unionId = object.getString("unionId");
|
|
|
Patient patient1 = patientDao.findByUnionid(unionId);
|
|
|
if (patient1 != null){
|
|
@ -162,16 +175,25 @@ public class TaskService {
|
|
|
if (patients != null && patients.size()!=0){
|
|
|
patient = patients.get(0);
|
|
|
}
|
|
|
List<Patient> patientList = new ArrayList<>();
|
|
|
JSONArray array = new JSONArray();
|
|
|
/* List<Patient> patientList = new ArrayList<>();*/
|
|
|
JSONObject object = new JSONObject();
|
|
|
if (patient != null){
|
|
|
patientList.add(patient);
|
|
|
SignFamily signFamily1 = signFamilyDao.findByPatient(patient.getCode());
|
|
|
JSONObject object2 = (JSONObject) JSONObject.toJSON(patient);
|
|
|
object2.put("hospital",signFamily1.getHospitalName());
|
|
|
array.add(object2);
|
|
|
/*patientList.add(patient);*/
|
|
|
List<PatientFamilyMember> patientFamilyMemberList = patientFamilyMemberDao.findByPatient(patient.getCode());
|
|
|
for (PatientFamilyMember patientFamilyMember:patientFamilyMemberList){
|
|
|
Patient patient1 = patientDao.findByCode(patientFamilyMember.getFamilyMember());
|
|
|
patientList.add(patient1);
|
|
|
SignFamily signFamily = signFamilyDao.findByPatient(patient.getCode());
|
|
|
JSONObject object1 = (JSONObject) JSONObject.toJSON(patient);
|
|
|
object1.put("hospital",signFamily.getHospitalName());
|
|
|
array.add(object1);
|
|
|
/*patientList.add(patient1);*/
|
|
|
}
|
|
|
object.put("patientList",patientList);
|
|
|
object.put("patientList",array);
|
|
|
object.put("total",patientFamilyMemberList.size());
|
|
|
object.put("page",1);
|
|
|
object.put("size",100);
|