|
@@ -41,7 +41,27 @@ public class DTPService {
|
|
|
public List<PageData> findForList(final PageData pd) throws Exception {
|
|
|
return (List<PageData>) daoSupport.findForList("DTPMapper.RecipeRegisterList", pd);
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 处方列表
|
|
|
+ *
|
|
|
+ * @param pd
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public PageData getLastRecipe(final PageData pd) throws Exception {
|
|
|
+ PageData pd3= new PageData();
|
|
|
+ PageData pdObj= (PageData) daoSupport.findForObject("DTPCFDJMapper.selectOneByPatientId", pd);
|
|
|
+ if(StringUtils.isNotNull(pdObj)){
|
|
|
+ pd3.put("recipe",pdObj);
|
|
|
+ PageData pd2=new PageData();
|
|
|
+ pd2.put("prescriptionNumber",pdObj.get("prescriptionNumber"));
|
|
|
+ List<PageData> pdObjList= (List<PageData>) daoSupport.findForList("DTPCFDJMapper.selectListRecordByPrescriptionNumber", pd2);
|
|
|
+ if(pdObjList.size()>0){
|
|
|
+ pd3.put("recipeList", pdObjList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return pd3;
|
|
|
+ }
|
|
|
/**
|
|
|
* 处方信息
|
|
|
*
|
|
@@ -66,18 +86,18 @@ public class DTPService {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public PageData save(final PageData pd) throws Exception {
|
|
|
pd.put("createTime", DateUtils.getTime());//处方表 处方单号时间
|
|
|
- Object prescriptionNumber = pd.get("prescriptionNumber");
|
|
|
- Object prescriptionImg = pd.get("prescriptionImg");
|
|
|
- Object prescriptionDate =pd.get("prescriptionDate");
|
|
|
+ String prescriptionNumber = (String) pd.get("prescriptionNumber");
|
|
|
+ String prescriptionImg = (String) pd.get("prescriptionImg");
|
|
|
+ String prescriptionDate = (String) pd.get("prescriptionDate");
|
|
|
if (StringUtils.isEmpty(prescriptionNumber.toString())) {
|
|
|
pd.put("prescriptionNumber", IdUtils.fastSimpleUUID());//处方表 处方单号 如果没有就自动生成
|
|
|
if( StringUtils.isEmpty(prescriptionImg.toString())){
|
|
|
pd.put("status",5);//待上传处方
|
|
|
}
|
|
|
- if( StringUtils.isNotEmpty(prescriptionImg.toString())){
|
|
|
+ if( StringUtils.isNotEmpty(prescriptionImg)){
|
|
|
pd.put("status",6);//待绑定患者6
|
|
|
}
|
|
|
- if( StringUtils.isEmpty(prescriptionDate.toString())){
|
|
|
+ if( StringUtils.isEmpty(prescriptionDate)){
|
|
|
pd.put("prescriptionDate", DateUtils.getTime());
|
|
|
}
|
|
|
|
|
@@ -146,7 +166,126 @@ public class DTPService {
|
|
|
return resultpageData;
|
|
|
}
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 处方登记 添加
|
|
|
+ *
|
|
|
+ * @param pd
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public int saveCFDJ(final PageData pd) throws Exception {
|
|
|
+
|
|
|
+
|
|
|
+ Object drugList = pd.get("drugData");//获取药品信息列表
|
|
|
+ String Id = IdUtils.fastSimpleUUID();//生成处方单号
|
|
|
+ List<PageData> addList = new ArrayList<>();
|
|
|
|
|
|
+ if (StringUtils.isNotNull(drugList)) {
|
|
|
+ try {
|
|
|
+ // 将 JSON 字符串转换为 List<Map<String, Object>>
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ List<Map<String, Object>> rowsdrugList = objectMapper.readValue(drugList.toString(), List.class);
|
|
|
+ // 遍历列表并调用插入数据接口
|
|
|
+ if (rowsdrugList.size() > 0) {
|
|
|
+ for (Map<String, Object> lxr : rowsdrugList) {
|
|
|
+ PageData pageData = new PageData();
|
|
|
+
|
|
|
+ // 设置固定或默认值
|
|
|
+ pageData.put("createdBy", getSysUser().getLoginName());
|
|
|
+ pageData.put("createdTime", DateUtils.getTime());
|
|
|
+ pageData.put("storeId", getSysUser().getDeptId());
|
|
|
+
|
|
|
+ // 从 lxr 获取数据并映射到数据库字段
|
|
|
+ pageData.put("mdmCode", lxr.get("mdmCode"));
|
|
|
+ pageData.put("productName", lxr.get("productName"));
|
|
|
+ pageData.put("genericName", lxr.get("genericName"));
|
|
|
+ pageData.put("specification", lxr.get("specification"));
|
|
|
+ pageData.put("manufacturerShortName", lxr.get("manufacturerShortName"));
|
|
|
+ pageData.put("administrationMethod", lxr.get("administrationMethod"));
|
|
|
+ pageData.put("packageQuantity", 1);
|
|
|
+ pageData.put("singleDoseValue", 1);
|
|
|
+ pageData.put("singleDoseUnit", lxr.get("singleDoseUnit"));
|
|
|
+ pageData.put("dosageFrequency", lxr.get("dosageFrequency"));
|
|
|
+ pageData.put("dosageFrequencyDays", 1);
|
|
|
+ pageData.put("dvalueDays", 1);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // 添加其他可能需要的字段(如果有的话)
|
|
|
+ pageData.put("medicationRoute", lxr.get("medicationRoute"));
|
|
|
+// pageData.put("sales", lxr.get("sales"));
|
|
|
+ pageData.put("prescriptionNumber", Id);
|
|
|
+ pageData.put("prescriptionDate", DateUtils.getTime());
|
|
|
+ pageData.put("hospital", lxr.get("hospital"));
|
|
|
+ pageData.put("prescribingDoctor", lxr.get("prescribingDoctor"));
|
|
|
+ pageData.put("department", lxr.get("department"));
|
|
|
+ pageData.put("attendingPhysician", lxr.get("attendingPhysician"));
|
|
|
+ pageData.put("clinicalDiagnosis", lxr.get("clinicalDiagnosis"));
|
|
|
+ pageData.put("registrant", lxr.get("registrant"));
|
|
|
+ pageData.put("registrationDate", DateUtils.getTime());
|
|
|
+// pageData.put("saleDate", lxr.get("saleDate"));
|
|
|
+// pageData.put("pharmacyName", lxr.get("pharmacyName"));
|
|
|
+// pageData.put("updatedBy", lxr.get("updatedBy"));
|
|
|
+// pageData.put("updatedTime", lxr.get("updatedTime"));
|
|
|
+// pageData.put("remarks", lxr.get("remarks"));
|
|
|
+ addList.add(pageData);
|
|
|
+ }
|
|
|
+ final HashMap<String, Object> addMap = new HashMap<String, Object>();
|
|
|
+ addMap.put("dataList", addList);
|
|
|
+ int resultDrug= dao.executeBatch("DTPCFDJMapper.batchAddDrugPurchaseRecord", addMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 从表单数据填充
|
|
|
+ pd.put("prescriptionNumber", Id); // 处方单表id主键,Id 应该是某个方式生成的唯一标识符
|
|
|
+ pd.put("storeId", getSysUser().getDeptId());
|
|
|
+ pd.put("storeName", getSysUser().getDeptId()); // 假设 getDeptName() 可以获取部门名称
|
|
|
+ pd.put("createdBy", getSysUser().getUserId());
|
|
|
+ pd.put("createTime", DateUtils.getTime());
|
|
|
+
|
|
|
+ // 直接从表单数据填充
|
|
|
+ pd.put("hospital", pd.get("hospital"));
|
|
|
+ pd.put("prescribingDoctor", pd.get("prescribingDoctor"));
|
|
|
+ pd.put("department", pd.get("department"));
|
|
|
+ pd.put("prescriptionDiagnosis", pd.get("prescriptionDiagnosis"));
|
|
|
+ pd.put("attendingDoctor", pd.get("attendingDoctor"));
|
|
|
+ pd.put("clinicalDiagnosis", pd.get("clinicalDiagnosis"));
|
|
|
+ pd.put("prescriptionImageUrl", pd.get("prescriptionImageUrl"));
|
|
|
+ pd.put("prescriptionIssueDate", pd.get("prescriptionIssueDate"));
|
|
|
+ pd.put("invoiceImageUrl", pd.get("invoiceImageUrl"));
|
|
|
+ pd.put("invoiceCode", pd.get("invoiceCode"));
|
|
|
+ pd.put("saleDate", pd.get("saleDate"));
|
|
|
+ pd.put("registrationDate", pd.get("registrationDate"));
|
|
|
+ pd.put("registerPharmacistName", pd.get("registerPharmacistName"));
|
|
|
+ pd.put("registrant", pd.get("registrant"));
|
|
|
+ pd.put("reviewingName", pd.get("reviewingName"));
|
|
|
+
|
|
|
+ // 患者信息
|
|
|
+ pd.put("patientId", pd.get("patientId"));
|
|
|
+ pd.put("patientName", pd.get("patientName"));
|
|
|
+ String sex= (String) pd.get("gender");
|
|
|
+
|
|
|
+ if(sex.equals("男")){
|
|
|
+ pd.put("gender", 1);
|
|
|
+ }
|
|
|
+ if(sex.equals("女")){
|
|
|
+ pd.put("gender", 0);
|
|
|
+ }
|
|
|
+ pd.put("age", pd.get("age"));
|
|
|
+
|
|
|
+ int result = daoSupport.save("DTPCFDJMapper.insertPrescriptionRegistration", pd);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 处方删除
|