Browse Source

又合并冲突

master
zy_Java 4 years ago
parent
commit
741fa7f37f
  1. 46
      src/main/java/com/ccsens/carbasics/api/DebugController.java
  2. 9
      src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java
  3. 65
      src/main/resources/mapper_dao/FirstAidDao.xml

46
src/main/java/com/ccsens/carbasics/api/DebugController.java

@ -23,8 +23,9 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
@Api(tags = "DEBUG" , description = "DebugController | ")
@RestController
@ -40,30 +41,27 @@ public class DebugController {
})
@RequestMapping(value="",method = {RequestMethod.GET, RequestMethod.POST},produces = {"application/json;charset=UTF-8"})
public JsonResponse debug() throws Exception {
String sql = "insert into t_qcp_car_record(id,car_id, type, car_value, time) values(1, 2, 1, {}, {})";
String format = StrFormatter.format(sql, 1, 1);
String fullPath = "";
InputStream is = new FileInputStream(fullPath);
Workbook workbook;
if (fullPath.endsWith(Constant.XLS)) {
workbook = new HSSFWorkbook(is);
} else {
workbook = new XSSFWorkbook(is);
}
//获取sheet
Sheet sheet = workbook.getSheetAt(0);
//循环读取每一行
return JsonResponse.newInstance().ok("测试");
}
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
//获取当前行
Row row = sheet.getRow(i);
if (ObjectUtil.isNull(row)) {
continue;
public void sql() throws Exception{
String sql = "insert into t_qcp_car_record(id,car_id, type, car_value, time) values({}, 2, 1, {}, {});";
BufferedReader reader = new BufferedReader(new FileReader("D:\\data.txt"));
BufferedWriter writer = new BufferedWriter(new FileWriter("D:\\sql.txt", true));
try{
String line;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
while ((line=reader.readLine()) != null) {
String[] arr = line.split(",");
Date date = sdf.parse(arr[0]);
String format = StrFormatter.format(sql, snowflake.nextId(), arr[1], date.getTime());
writer.write(format);
writer.newLine();
}
//获取题目信息
String questionName = StringUtil.replaceStrSpace(ExcelUtil.getCellValue(row.getCell(1)));
} finally {
reader.close();
writer.close();
}
return JsonResponse.newInstance().ok("测试");
}
}

9
src/main/java/com/ccsens/carbasics/bean/vo/PatientVo.java

@ -31,12 +31,17 @@ public class PatientVo {
private byte demonstrate;
@ApiModelProperty("病例状态 0:创建 1:急救审核通过 2:急救审核拒绝 3出院审核通过 4出院审核拒绝 5:申请修改 6:申请拒绝")
private byte dataStatus;
@ApiModelProperty("模板类型 0:神内 1:神外")
private byte type;
@ApiModelProperty("急救:发病时间 转归:出院时间")
private String record1;
@ApiModelProperty("急救:到院时间 转归:离院方式")
private String record2;
@ApiModelProperty("项目ID")
private Long projectId;
@ApiModelProperty("疑似病例")
private String probableCase;
@ApiModelProperty("录入人ID")
private Long recordUserId;
@ApiModelProperty("参与者")
private List<FirstAidLogVo.Member> doctors;
}

65
src/main/resources/mapper_dao/FirstAidDao.xml

@ -4,49 +4,46 @@
<select id="querySelf" resultType="com.ccsens.carbasics.bean.vo.PatientVo$QueryPatientList">
select a.id as firstAidId, a.name, a.gender, a.age, a.data_status as dataStatus,
a.value_type as demonstrate, a.type as type, r1.answer as record1, r2.answer as record2
a.value_type as demonstrate, a.type as type, r1.answer as record1, r2.answer as record2,
a.project_id as projectId, m.record_user_id as recordUserId, r3.answer as probableCase
from
t_qcp_first_aid a
left join t_qcp_first_aid_member m
on a.id = m.first_aid_id and m.rec_status = 0
<choose>
<when test="param.type == 0">
and m.create_user_id = #{userId}
</when>
<when test="param.type == 1">
and m.record_user_id in (1000, 0)
</when>
</choose>
count(a.id) as total,
count(r.id) as rongshuan,
max(r.answer - a.arrive_hospital_time)/60000 as max,
min(r.answer - a.arrive_hospital_time)/60000 as min,
avg(r.answer - a.arrive_hospital_time)/60000 as avg,
count(if(r.answer - a.arrive_hospital_time &lt;= 3600000, 1, null)) as dabiao
from t_qcp_first_aid a left join t_qcp_patient p on a.patient_id = p.id
left join t_qcp_first_aid_record r on a.id = r.first_aid_id and r.question_code = 'JMRSSJ' and r.rec_status = 0
where p.hospital_id = #{hospitalId} and a.rec_status = 0 and p.rec_status = 0
<if test="param.startTime != null and param.startTime != 0">
and unix_timestamp(a.created_at)*1000 &gt;= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != 0">
and unix_timestamp(a.created_at)*1000 &lt;= #{param.endTime}
(select a.* from t_qcp_first_aid a, t_organization_project o where a.hospital_id = o.organization_id and o.project_id = #{param.projectId} and a.rec_status = 0 and o.rec_status = 0 )a
left join t_qcp_first_aid_member m
on a.id = m.first_aid_id and m.rec_status = 0
left join t_qcp_first_aid_record r
on a.id = r.first_aid_id
and r.question_code = 'CYQK-CYSJ' and r.rec_status = 0
left join t_qcp_first_aid_record r1 on a.id = r1.first_aid_id and r1.rec_status = 0
<choose>
<when test="param.firstAidType == 0">and r1.question_code='JBXX-FBSJ'</when>
<when test="param.firstAidType == 1">and r1.question_code='CYQK-CYSJ'</when>
</choose>
left join t_qcp_first_aid_record r2 on a.id = r2.first_aid_id and r2.rec_status = 0
<choose>
<when test="param.firstAidType == 0">and r2.question_code='JBXX-DYSJ'</when>
<when test="param.firstAidType == 1">and r2.question_code='CYQK-LYFS'</when>
</choose>
left join t_qcp_first_aid_record r3 on a.id = r3.first_aid_id and r3.question_code='CJBL-YSBL' and r3.rec_status = 0
where
<choose>
<when test="param.firstAidType == 0">r.id is null</when>
<when test="param.firstAidType == 1"> r.id is not null</when>
<otherwise>r.id is null</otherwise>
</choose>
<if test="param.name != null and param.name != ''">
and a.name like concat('%', #{param.name}, '%')
</if>
<choose>
<when test="param.type == 0">
and DATE_FORMAT(a.created_at,'%Y-%m') = FROM_UNIXTIME(r.answer/1000,'%Y-%m')
GROUP BY DATE_FORMAT(a.created_at,'%Y-%m')
and m.create_user_id = #{userId}
</when>
<when test="param.type == 1">
and m.record_user_id in (#{userId}, 0)
</when>
<otherwise>
and concat(DATE_FORMAT(a.created_at,'%Y-'), week(a.created_at)) = concat(DATE_FORMAT(from_unixtime(r.answer/1000),'%Y-'), week(from_unixtime(r.answer/1000)))
GROUP BY DATE_FORMAT(a.created_at,'%Y-%m')
</otherwise>
</choose>
</select>
<select id="getIdByProjectId" resultType="com.ccsens.carbasics.bean.po.FirstAid">
SELECT
*

Loading…
Cancel
Save