|
@ -184,7 +184,7 @@ public class DoctorSchemeService {
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 医生保存居民的血糖监测方案
|
|
|
* 医生保存血糖监测方案
|
|
|
* @param data
|
|
|
* @throws Exception
|
|
|
*/
|
|
@ -193,7 +193,6 @@ public class DoctorSchemeService {
|
|
|
JSONObject dataObj = JSON.parseObject(data);
|
|
|
|
|
|
List<DoctorSchemeBloodSugger> results = new ArrayList<>();
|
|
|
List<String> patientcodeList = new ArrayList<>();
|
|
|
|
|
|
String code = dataObj.getString("code");
|
|
|
|
|
@ -205,11 +204,6 @@ public class DoctorSchemeService {
|
|
|
String content = dataObj.getString("content");
|
|
|
String doctorcode = dataObj.getString("doctorcode");
|
|
|
JSONArray datalist = dataObj.getJSONArray("list");
|
|
|
JSONArray patientcodes = dataObj.getJSONArray("patientcodes");
|
|
|
|
|
|
for (int i = 0; i < patientcodes.size(); i++) {
|
|
|
patientcodeList.add(datalist.getJSONObject(i).toString());
|
|
|
}
|
|
|
|
|
|
|
|
|
for (int i = 0; i < datalist.size(); i++) {
|
|
@ -247,40 +241,11 @@ public class DoctorSchemeService {
|
|
|
}
|
|
|
|
|
|
if(!results.isEmpty()) {
|
|
|
|
|
|
//使用事务控制批量更新
|
|
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
|
|
def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); // 事物隔离级别,开启新事务
|
|
|
TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
|
|
|
try {
|
|
|
|
|
|
for (DoctorSchemeBloodSugger doctorSchemeBloodSugger : results) {
|
|
|
doctoreSchemeBloodSuggerDao.save(doctorSchemeBloodSugger);
|
|
|
}
|
|
|
|
|
|
PatientSchemeList patientSchemeListObj = new PatientSchemeList();
|
|
|
for (String patientcode : patientcodeList) {
|
|
|
patientSchemeListDao.delByPatientCodeAndSchemeCode(patientcode,1,code);
|
|
|
patientSchemeListObj.setCode(UUID.randomUUID().toString());
|
|
|
patientSchemeListObj.setPatientcode(patientcode);
|
|
|
patientSchemeListObj.setSchemecode(code);
|
|
|
patientSchemeListObj.setDoctorcode(doctorcode);
|
|
|
Short _type = new Short("1");
|
|
|
patientSchemeListObj.setType(_type);
|
|
|
patientSchemeListObj.setCreateTime(DateUtil.getNowTimestamp());
|
|
|
patientSchemeListDao.save(patientSchemeListObj);
|
|
|
}
|
|
|
|
|
|
//事务提交
|
|
|
transactionManager.commit(status);
|
|
|
} catch (Exception ex) {
|
|
|
//报错事务回滚
|
|
|
transactionManager.rollback(status);
|
|
|
}
|
|
|
doctoreSchemeBloodSuggerDao.save(results);
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 医生保存居民的血压监测方案
|
|
|
* 医生保存血压监测方案
|
|
|
* @param data
|
|
|
* @throws Exception
|
|
|
*/
|
|
@ -289,7 +254,6 @@ public class DoctorSchemeService {
|
|
|
JSONObject dataObj = JSON.parseObject(data);
|
|
|
|
|
|
List<DoctorSchemeBloodPressure> results = new ArrayList<>();
|
|
|
List<String> patientcodeList = new ArrayList<>();
|
|
|
|
|
|
String code = dataObj.getString("code");
|
|
|
|
|
@ -303,10 +267,6 @@ public class DoctorSchemeService {
|
|
|
JSONArray datalist = dataObj.getJSONArray("list");
|
|
|
JSONArray patientcodes = dataObj.getJSONArray("patientcodes");
|
|
|
|
|
|
for (int i = 0; i < patientcodes.size(); i++) {
|
|
|
patientcodeList.add(datalist.getJSONObject(i).toString());
|
|
|
}
|
|
|
|
|
|
|
|
|
for (int i = 0; i < datalist.size(); i++) {
|
|
|
DoctorSchemeBloodPressure doctorSchemeBloodPressure = new DoctorSchemeBloodPressure();
|
|
@ -337,6 +297,34 @@ public class DoctorSchemeService {
|
|
|
}
|
|
|
|
|
|
if(!results.isEmpty()) {
|
|
|
doctoreSchemeBloodPressureDao.save(results);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 医生保存居民监测方案
|
|
|
*
|
|
|
* @param doctorcode
|
|
|
* @param schemecode
|
|
|
* @param patientcodes
|
|
|
* @param type
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void savePatientScheme(String doctorcode, String schemecode, String type,String patientcodes) throws Exception {
|
|
|
List<String> patientcodeList = new ArrayList<>();
|
|
|
|
|
|
JSONObject dataObj = JSON.parseObject(patientcodes);
|
|
|
JSONArray codes = dataObj.getJSONArray("patientcodes");
|
|
|
|
|
|
if (codes == null || codes.size() == 0) {
|
|
|
throw new Exception("居民列表不能为空");
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < codes.size(); i++) {
|
|
|
patientcodeList.add(codes.getJSONObject(i).toString());
|
|
|
}
|
|
|
|
|
|
if (!patientcodeList.isEmpty()) {
|
|
|
|
|
|
//使用事务控制批量更新
|
|
|
DefaultTransactionDefinition def = new DefaultTransactionDefinition();
|
|
@ -344,23 +332,18 @@ public class DoctorSchemeService {
|
|
|
TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
|
|
|
try {
|
|
|
|
|
|
for (DoctorSchemeBloodPressure doctorSchemeBloodPressure : results) {
|
|
|
doctoreSchemeBloodPressureDao.save(doctorSchemeBloodPressure);
|
|
|
}
|
|
|
|
|
|
PatientSchemeList patientSchemeListObj = new PatientSchemeList();
|
|
|
for (String patientcode : patientcodeList) {
|
|
|
patientSchemeListDao.delByPatientCodeAndSchemeCode(patientcode,0,code);
|
|
|
patientSchemeListDao.delByPatientCodeAndSchemeCode(patientcode, Integer.parseInt(type), schemecode);
|
|
|
patientSchemeListObj.setCode(UUID.randomUUID().toString());
|
|
|
patientSchemeListObj.setPatientcode(patientcode);
|
|
|
patientSchemeListObj.setSchemecode(code);
|
|
|
patientSchemeListObj.setSchemecode(schemecode);
|
|
|
patientSchemeListObj.setDoctorcode(doctorcode);
|
|
|
Short _type = new Short("2");
|
|
|
Short _type = new Short(type);
|
|
|
patientSchemeListObj.setType(_type);
|
|
|
patientSchemeListObj.setCreateTime(DateUtil.getNowTimestamp());
|
|
|
patientSchemeListDao.save(patientSchemeListObj);
|
|
|
}
|
|
|
|
|
|
//事务提交
|
|
|
transactionManager.commit(status);
|
|
|
} catch (Exception ex) {
|