Browse Source

健康体检列表按时间倒序

yeshijie 8 years ago
parent
commit
0f51c7695d

+ 15 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwArchivesService.java

@ -12,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
/**
@ -52,6 +54,7 @@ public class JwArchivesService {
                    if("1".equals(data.optString("CODE")))
                    {
                        JSONArray jsonArray = data.getJSONArray("DATA");
                        List<JSONObject> jsonValues = new ArrayList<JSONObject>();
                        for (int i = 0; i < jsonArray.length(); i++) {
                            JSONObject jsonObject = jsonArray.getJSONObject(i);
                            JSONObject mjson = new JSONObject();
@ -59,7 +62,18 @@ public class JwArchivesService {
                            mjson.put("orgName",jsonObject.get("ORG_NAME").toString());
                            mjson.put("medicalNo",medicalNo);
                            mjson.put("medicalTime",jsonObject.get("MEDICAL_TIME").toString());
                            re.put(mjson);
                            jsonValues.add(mjson);
                        }
                        Collections.sort( jsonValues, new Comparator<JSONObject>() {
                            @Override
                            public int compare(JSONObject a, JSONObject b) {
                                String valA = a.get("medicalTime").toString();
                                String valB = b.get("medicalTime").toString();
                                return valB.compareTo(valA);
                            }
                        });
                        for (JSONObject temp:jsonValues){
                            re.put(temp);
                        }
                    }
                    else{