|
|
@@ -0,0 +1,138 @@
|
|
|
+package org.jeecg;
|
|
|
+
|
|
|
+import org.jeecg.modules.medical.entity.AfterwardsAudit;
|
|
|
+import org.jeecg.modules.medical.entity.AfterwardsAuditDetail;
|
|
|
+import org.jeecg.modules.medical.service.IAfterwardsAuditDetailService;
|
|
|
+import org.jeecg.modules.medical.service.IAfterwardsAuditService;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.Random;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author soft01
|
|
|
+ * @time 2023/5/28 21:41
|
|
|
+ * @description '生成一些模拟数据'
|
|
|
+ * @parentProject medical-java
|
|
|
+ */
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,classes = JeecgSystemApplication.class)
|
|
|
+public class AfterwardsAuditDataTest {
|
|
|
+
|
|
|
+ //就诊类别;住院(hosp)/门诊(outpatient)
|
|
|
+ public static final String TREATMENTTYPE = "hops";
|
|
|
+ public static final String NOTICE_TYPE = "after";
|
|
|
+
|
|
|
+ public static final String medicalDeptCode = "1001"; //部门代码
|
|
|
+ public static final String deptName = "儿科"; //科室
|
|
|
+
|
|
|
+ public static final String doctorName = "章邯";
|
|
|
+ public static final String doctorId = "1001001";
|
|
|
+
|
|
|
+ // 患者信息
|
|
|
+ public static final String patientId = "A1001";
|
|
|
+ public static final String patientName = "魏冉";
|
|
|
+
|
|
|
+ public static final String ZYH = "H001"; // 住院号
|
|
|
+
|
|
|
+ // 医嘱/处方号
|
|
|
+ public static final String prescriptionNumber = "P001";
|
|
|
+
|
|
|
+ // 项目类型 medicine;consumable;diagnoses;
|
|
|
+ public static final String PROJECTTYPE = "medicine";
|
|
|
+ public static final String PROJECTCODE = "8001";
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAfterwardsAuditService afterwardsAuditService;
|
|
|
+ @Autowired
|
|
|
+ private IAfterwardsAuditDetailService afterwardsAuditDetailService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void generateAfterwardsAuditData() {
|
|
|
+ // 写主表
|
|
|
+ AfterwardsAudit extracted = writeMaster();
|
|
|
+ // 写从表
|
|
|
+ writeSlave(extracted.getId(), 5);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void writeSlave(Integer id, int number) {
|
|
|
+ for (int i = 0; i < number; i++) {
|
|
|
+ AfterwardsAuditDetail aad = new AfterwardsAuditDetail();
|
|
|
+ aad.setAfterwardsAuditId(id);
|
|
|
+ aad.setMedicalInsRuleInfoId(1);
|
|
|
+ aad.setMedicalInsRuleInfoCode("1");
|
|
|
+ aad.setMedicalInsRuleInfoName("前");
|
|
|
+ aad.setTreatmentType(TREATMENTTYPE);
|
|
|
+ aad.setReminderLevel("1");
|
|
|
+ aad.setViolationLevel(1);
|
|
|
+ aad.setNoticeType(NOTICE_TYPE);
|
|
|
+ aad.setMedicalDeptCode(medicalDeptCode);
|
|
|
+ aad.setMedicalDeptName(deptName);
|
|
|
+ aad.setDoctorName(doctorName);
|
|
|
+ aad.setDoctorId(doctorId);
|
|
|
+
|
|
|
+ aad.setPatientId(patientId);
|
|
|
+ aad.setPatientName(patientName);
|
|
|
+
|
|
|
+ aad.setOutpatientNumber(aad.getOutpatientNumber());
|
|
|
+ aad.setPrescriptionNumber(prescriptionNumber);
|
|
|
+ aad.setProjectType(PROJECTTYPE);
|
|
|
+ aad.setProejctCode(PROJECTCODE);
|
|
|
+
|
|
|
+ aad.setQuantity(new BigDecimal("1"));
|
|
|
+ aad.setMedicalProjectCode("1");
|
|
|
+ aad.setMedicalProjectName("1");
|
|
|
+
|
|
|
+ aad.setAmount(BigDecimal.valueOf(AfterwardsAuditDataTest.getRandom()));
|
|
|
+
|
|
|
+ aad.setCreateBy("admin");
|
|
|
+ aad.setCreateTime(new Date());
|
|
|
+ afterwardsAuditDetailService.save(aad);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ AfterwardsAudit writeMaster() {
|
|
|
+ AfterwardsAudit aa = new AfterwardsAudit();
|
|
|
+ aa.setTreatmentType(TREATMENTTYPE);
|
|
|
+ aa.setNoticeType(NOTICE_TYPE);
|
|
|
+ aa.setMedicalDeptCode(medicalDeptCode);
|
|
|
+ aa.setMedicalDeptName(deptName);
|
|
|
+ aa.setDoctorName(doctorName);
|
|
|
+ aa.setDoctorId(doctorId);
|
|
|
+ aa.setPatientId(patientId);
|
|
|
+ aa.setPatientName(patientName);
|
|
|
+
|
|
|
+ aa.setOutpatientNumber(ZYH);
|
|
|
+ aa.setPrescriptionNumber(prescriptionNumber);
|
|
|
+ aa.setFeedbackResult("SUCCESS");
|
|
|
+ aa.setFeedbackCode("0000");
|
|
|
+
|
|
|
+ aa.setCreateBy("admin");
|
|
|
+ aa.setCreateTime(new Date());
|
|
|
+
|
|
|
+ afterwardsAuditService.save(aa);
|
|
|
+ return aa;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+
|
|
|
+ getRandom();
|
|
|
+ }
|
|
|
+
|
|
|
+ private static double getRandom() {
|
|
|
+ Random a = new Random(150);
|
|
|
+ int i = a.nextInt(200);
|
|
|
+ double v = a.nextDouble();
|
|
|
+ System.out.println(i + v);
|
|
|
+ return i + v;
|
|
|
+ }
|
|
|
+}
|