|  | @ -25,6 +25,7 @@ import org.springframework.orm.jpa.JpaTransactionManager;
 | 
												
													
														
															|  | import org.springframework.stereotype.Service;
 |  | import org.springframework.stereotype.Service;
 | 
												
													
														
															|  | import org.springframework.transaction.TransactionDefinition;
 |  | import org.springframework.transaction.TransactionDefinition;
 | 
												
													
														
															|  | import org.springframework.transaction.TransactionStatus;
 |  | import org.springframework.transaction.TransactionStatus;
 | 
												
													
														
															|  | 
 |  | import org.springframework.transaction.annotation.Transactional;
 | 
												
													
														
															|  | import org.springframework.transaction.support.DefaultTransactionDefinition;
 |  | import org.springframework.transaction.support.DefaultTransactionDefinition;
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | import java.util.*;
 |  | import java.util.*;
 | 
												
											
												
													
														
															|  | @ -249,7 +250,7 @@ public class DoctorSchemeService {
 | 
												
													
														
															|  |             doctorSchemeBloodSugger.setAlertTag(datalist.getJSONObject(i).getShort("alertTag"));
 |  |             doctorSchemeBloodSugger.setAlertTag(datalist.getJSONObject(i).getShort("alertTag"));
 | 
												
													
														
															|  |             doctorSchemeBloodSugger.setContent(content);
 |  |             doctorSchemeBloodSugger.setContent(content);
 | 
												
													
														
															|  |             doctorSchemeBloodSugger.setCreateTime(DateUtil.getNowTimestamp());
 |  |             doctorSchemeBloodSugger.setCreateTime(DateUtil.getNowTimestamp());
 | 
												
													
														
															|  |             doctorSchemeBloodSugger.setDel(new Short("0"));
 |  | 
 | 
												
													
														
															|  | 
 |  |             doctorSchemeBloodSugger.setDel(0);
 | 
												
													
														
															|  |             results.add(doctorSchemeBloodSugger);
 |  |             results.add(doctorSchemeBloodSugger);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -308,7 +309,7 @@ public class DoctorSchemeService {
 | 
												
													
														
															|  |             doctorSchemeBloodPressure.setAlertTag(datalist.getJSONObject(i).getShort("alertTag"));
 |  |             doctorSchemeBloodPressure.setAlertTag(datalist.getJSONObject(i).getShort("alertTag"));
 | 
												
													
														
															|  |             doctorSchemeBloodPressure.setContent(content);
 |  |             doctorSchemeBloodPressure.setContent(content);
 | 
												
													
														
															|  |             doctorSchemeBloodPressure.setCreateTime(DateUtil.getNowTimestamp());
 |  |             doctorSchemeBloodPressure.setCreateTime(DateUtil.getNowTimestamp());
 | 
												
													
														
															|  |             doctorSchemeBloodPressure.setDel(new Short("0"));
 |  | 
 | 
												
													
														
															|  | 
 |  |             doctorSchemeBloodPressure.setDel(0);
 | 
												
													
														
															|  |             results.add(doctorSchemeBloodPressure);
 |  |             results.add(doctorSchemeBloodPressure);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -326,20 +327,23 @@ public class DoctorSchemeService {
 | 
												
													
														
															|  |      * @param type
 |  |      * @param type
 | 
												
													
														
															|  |      * @throws Exception
 |  |      * @throws Exception
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  | 
 |  |     @Transactional
 | 
												
													
														
															|  |     public void savePatientScheme(String doctorcode, String schemecode, String type,String patientcodes) throws Exception {
 |  |     public void savePatientScheme(String doctorcode, String schemecode, String type,String patientcodes) throws Exception {
 | 
												
													
														
															|  |         List<String> patientcodeList = new ArrayList<>();
 |  |         List<String> patientcodeList = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         JSONObject dataObj = JSON.parseObject(patientcodes);
 |  | 
 | 
												
													
														
															|  |         JSONArray codes = dataObj.getJSONArray("patientcodes");
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if (codes == null || codes.size() == 0) {
 |  | 
 | 
												
													
														
															|  |             throw new Exception("居民列表不能为空");
 |  | 
 | 
												
													
														
															|  |         }
 |  | 
 | 
												
													
														
															|  | 
 |  |         String[] codes = patientcodes.split(",");
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         for (int i = 0; i < codes.size(); i++) {
 |  | 
 | 
												
													
														
															|  |             patientcodeList.add(codes.get(i).toString());
 |  | 
 | 
												
													
														
															|  | 
 |  |         if(patientcodes.contains(",")){
 | 
												
													
														
															|  | 
 |  |             for (String code : codes) {
 | 
												
													
														
															|  | 
 |  |                 patientcodeList.add(code);
 | 
												
													
														
															|  | 
 |  |             }
 | 
												
													
														
															|  | 
 |  |         }else{
 | 
												
													
														
															|  | 
 |  |             patientcodeList.add(patientcodes);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if (!patientcodeList.isEmpty()) {
 |  |         if (!patientcodeList.isEmpty()) {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             //使用事务控制批量更新
 |  |             //使用事务控制批量更新
 | 
												
											
												
													
														
															|  | @ -348,22 +352,21 @@ public class DoctorSchemeService {
 | 
												
													
														
															|  |             TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
 |  |             TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
 | 
												
													
														
															|  |             try {
 |  |             try {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 for (String patientcode : patientcodeList) {
 |  |                 for (String patientcode : patientcodeList) {
 | 
												
													
														
															|  |                     PatientSchemeList patientSchemeListObj = new PatientSchemeList();
 |  | 
 | 
												
													
														
															|  |                     patientSchemeListDao.delByPatientCodeAndSchemeCode(patientcode, Integer.parseInt(type), schemecode);
 |  |                     patientSchemeListDao.delByPatientCodeAndSchemeCode(patientcode, Integer.parseInt(type), schemecode);
 | 
												
													
														
															|  | 
 |  |                     PatientSchemeList patientSchemeListObj = new PatientSchemeList();
 | 
												
													
														
															|  |                     patientSchemeListObj.setCode(UUID.randomUUID().toString());
 |  |                     patientSchemeListObj.setCode(UUID.randomUUID().toString());
 | 
												
													
														
															|  |                     patientSchemeListObj.setPatientcode(patientcode);
 |  |                     patientSchemeListObj.setPatientcode(patientcode);
 | 
												
													
														
															|  |                     patientSchemeListObj.setSchemecode(schemecode);
 |  |                     patientSchemeListObj.setSchemecode(schemecode);
 | 
												
													
														
															|  |                     patientSchemeListObj.setDoctorcode(doctorcode);
 |  |                     patientSchemeListObj.setDoctorcode(doctorcode);
 | 
												
													
														
															|  |                     Short _type = new Short(type);
 |  | 
 | 
												
													
														
															|  |                     patientSchemeListObj.setType(_type);
 |  | 
 | 
												
													
														
															|  | 
 |  |                     patientSchemeListObj.setType(Integer.parseInt(type));
 | 
												
													
														
															|  |                     patientSchemeListObj.setCreateTime(DateUtil.getNowTimestamp());
 |  |                     patientSchemeListObj.setCreateTime(DateUtil.getNowTimestamp());
 | 
												
													
														
															|  |                     patientSchemeListDao.save(patientSchemeListObj);
 |  |                     patientSchemeListDao.save(patientSchemeListObj);
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |                 //事务提交
 |  |                 //事务提交
 | 
												
													
														
															|  |                 transactionManager.commit(status);
 |  |                 transactionManager.commit(status);
 | 
												
													
														
															|  |             } catch (Exception ex) {
 |  |             } catch (Exception ex) {
 | 
												
													
														
															|  | 
 |  |                 System.out.println(ex.getMessage());
 | 
												
													
														
															|  |                 //报错事务回滚
 |  |                 //报错事务回滚
 | 
												
													
														
															|  |                 transactionManager.rollback(status);
 |  |                 transactionManager.rollback(status);
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
											
												
													
														
															|  | @ -380,11 +383,11 @@ public class DoctorSchemeService {
 | 
												
													
														
															|  |      * @param enddate
 |  |      * @param enddate
 | 
												
													
														
															|  |      * @return
 |  |      * @return
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  |     public JSONArray getSlowDiseaseTeaminfos(String teamCode, int getcolor, int getstands, int gethealthindex, String startdate, String enddate) throws Exception{
 |  | 
 | 
												
													
														
															|  | 
 |  |     public JSONObject getSlowDiseaseTeaminfos(String teamCode, int getcolor, int getstands, int gethealthindex, String startdate, String enddate) throws Exception{
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode);
 |  |         List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         JSONArray result = new JSONArray();
 |  | 
 | 
												
													
														
															|  | 
 |  |         JSONObject result = new JSONObject();
 | 
												
													
														
															|  |         JSONObject green = new JSONObject();//绿标
 |  |         JSONObject green = new JSONObject();//绿标
 | 
												
													
														
															|  |         JSONObject yellow = new JSONObject();//黄标
 |  |         JSONObject yellow = new JSONObject();//黄标
 | 
												
													
														
															|  |         JSONObject red = new JSONObject();//红标
 |  |         JSONObject red = new JSONObject();//红标
 | 
												
											
												
													
														
															|  | @ -414,10 +417,10 @@ public class DoctorSchemeService {
 | 
												
													
														
															|  |         List<String> bloodsugar_patientcodes = new ArrayList<>();
 |  |         List<String> bloodsugar_patientcodes = new ArrayList<>();
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if(!patients.isEmpty()){
 |  |         if(!patients.isEmpty()){
 | 
												
													
														
															|  |             for (Patient patient : red_patients) {
 |  | 
 | 
												
													
														
															|  | 
 |  |             for (Patient patient : patients) {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 //获取居民颜色标签
 |  |                 //获取居民颜色标签
 | 
												
													
														
															|  |                 if(1 == getcolor){
 |  | 
 | 
												
													
														
															|  | 
 |  |                 if(1 == getcolor && patient.getDiseaseCondition() != null){
 | 
												
													
														
															|  |                     switch (patient.getDiseaseCondition()){
 |  |                     switch (patient.getDiseaseCondition()){
 | 
												
													
														
															|  |                         case 0:
 |  |                         case 0:
 | 
												
													
														
															|  |                             green_patients.add(patient);
 |  |                             green_patients.add(patient);
 | 
												
											
												
													
														
															|  | @ -434,15 +437,18 @@ public class DoctorSchemeService {
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 //获取预警居民CODES
 |  |                 //获取预警居民CODES
 | 
												
													
														
															|  |                 if(1 == getstands && 1 == patient.getStandardStatus()){
 |  | 
 | 
												
													
														
															|  | 
 |  |                 if(1 == getstands && (patient.getStandardStatus() !=null && patient.getStandardStatus() ==1)){
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                     if( 1 == patient.getDisease() || 3 == patient.getDisease()){
 |  | 
 | 
												
													
														
															|  |                         bloodpressure_patientcodes.add(patient.getCode());
 |  | 
 | 
												
													
														
															|  |                     }
 |  | 
 | 
												
													
														
															|  | 
 |  |                     if(patient.getDisease() != null){
 | 
												
													
														
															|  | 
 |  |                         if( 1 == patient.getDisease() || 3 == patient.getDisease()){
 | 
												
													
														
															|  | 
 |  |                             bloodpressure_patientcodes.add(patient.getCode());
 | 
												
													
														
															|  | 
 |  |                         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                     if( 2 == patient.getDisease() || 3 == patient.getDisease()){
 |  | 
 | 
												
													
														
															|  |                         bloodsugar_patientcodes.add(patient.getCode());
 |  | 
 | 
												
													
														
															|  | 
 |  |                         if( 2 == patient.getDisease() || 3 == patient.getDisease()){
 | 
												
													
														
															|  | 
 |  |                             bloodsugar_patientcodes.add(patient.getCode());
 | 
												
													
														
															|  | 
 |  |                         }
 | 
												
													
														
															|  |                     }
 |  |                     }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
											
												
													
														
															|  | @ -450,19 +456,19 @@ public class DoctorSchemeService {
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if(1 == getcolor){
 |  |         if(1 == getcolor){
 | 
												
													
														
															|  |             green.put("greencount",green_patients.size());
 |  | 
 | 
												
													
														
															|  |             yellow.put("yellowcount",yellow_patients.size());
 |  | 
 | 
												
													
														
															|  |             red.put("redcount",red_patients.size());
 |  | 
 | 
												
													
														
															|  |             result.add(green);
 |  | 
 | 
												
													
														
															|  |             result.add(yellow);
 |  | 
 | 
												
													
														
															|  |             result.add(red);
 |  | 
 | 
												
													
														
															|  | 
 |  |             result.put("greencount",green_patients.size());
 | 
												
													
														
															|  | 
 |  |             result.put("yellowcount",yellow_patients.size());
 | 
												
													
														
															|  | 
 |  |             result.put("redcount",red_patients.size());
 | 
												
													
														
															|  | 
 |  | //            result.add(green);
 | 
												
													
														
															|  | 
 |  | //            result.add(yellow);
 | 
												
													
														
															|  | 
 |  | //            result.add(red);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if(1 == getstands){
 |  |         if(1 == getstands){
 | 
												
													
														
															|  |             pressure_standard.put("pressure_standard",bloodpressure_patientcodes);
 |  | 
 | 
												
													
														
															|  |             sugar_standard.put("sugar_standard",bloodsugar_patientcodes);
 |  | 
 | 
												
													
														
															|  |             result.add(pressure_standard);
 |  | 
 | 
												
													
														
															|  |             result.add(sugar_standard);
 |  | 
 | 
												
													
														
															|  | 
 |  |             result.put("pressure_standard",bloodpressure_patientcodes);
 | 
												
													
														
															|  | 
 |  |             result.put("sugar_standard",bloodsugar_patientcodes);
 | 
												
													
														
															|  | 
 |  | //            result.add(pressure_standard);
 | 
												
													
														
															|  | 
 |  | //            result.add(sugar_standard);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -498,15 +504,15 @@ public class DoctorSchemeService {
 | 
												
													
														
															|  |                 }
 |  |                 }
 | 
												
													
														
															|  |             }
 |  |             }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             pressure_count.put("pressure_count",pressure);
 |  | 
 | 
												
													
														
															|  |             pressure_unusual_ount.put("pressure_unusual_count",pressure_unusual);
 |  | 
 | 
												
													
														
															|  |             sugar_count.put("sugar_count",sugar);
 |  | 
 | 
												
													
														
															|  |             sugar_unusual_count.put("sugar_unusual_count",sugar_unusual);
 |  | 
 | 
												
													
														
															|  | 
 |  |             result.put("pressure_count",pressure);
 | 
												
													
														
															|  | 
 |  |             result.put("pressure_unusual_count",pressure_unusual);
 | 
												
													
														
															|  | 
 |  |             result.put("sugar_count",sugar);
 | 
												
													
														
															|  | 
 |  |             result.put("sugar_unusual_count",sugar_unusual);
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |             result.add(pressure_count);
 |  | 
 | 
												
													
														
															|  |             result.add(pressure_unusual_ount);
 |  | 
 | 
												
													
														
															|  |             result.add(sugar_count);
 |  | 
 | 
												
													
														
															|  |             result.add(sugar_unusual_count);
 |  | 
 | 
												
													
														
															|  | 
 |  | //            result.add(pressure_count);
 | 
												
													
														
															|  | 
 |  | //            result.add(pressure_unusual_ount);
 | 
												
													
														
															|  | 
 |  | //            result.add(sugar_count);
 | 
												
													
														
															|  | 
 |  | //            result.add(sugar_unusual_count);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
											
												
													
														
															|  | @ -519,14 +525,16 @@ public class DoctorSchemeService {
 | 
												
													
														
															|  |      * @param schemecode
 |  |      * @param schemecode
 | 
												
													
														
															|  |      * @param type
 |  |      * @param type
 | 
												
													
														
															|  |      */
 |  |      */
 | 
												
													
														
															|  | 
 |  |     @Transactional
 | 
												
													
														
															|  |     public void delDoctorScheme(String doctorcode, String schemecode, String type) throws Exception{
 |  |     public void delDoctorScheme(String doctorcode, String schemecode, String type) throws Exception{
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if("1".equals(type)){
 |  |         if("1".equals(type)){
 | 
												
													
														
															|  |             doctroSchemeBloodSuggerDao.updateDel(1,doctorcode,schemecode);
 |  | 
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  | 
 |  |             doctroSchemeBloodSuggerDao.updateDelStatus(1,doctorcode,schemecode);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  | 
 |  | 
 | 
												
													
														
															|  |         if("2".equals(type)){
 |  |         if("2".equals(type)){
 | 
												
													
														
															|  |             doctoreSchemeBloodPressureDao.updateDel(1,doctorcode,schemecode);
 |  | 
 | 
												
													
														
															|  | 
 |  |             doctoreSchemeBloodPressureDao.updateDelStatus(1,doctorcode,schemecode);
 | 
												
													
														
															|  |         }
 |  |         }
 | 
												
													
														
															|  |     }
 |  |     }
 | 
												
													
														
															|  | }
 |  | }
 |