test_user 1 month ago
parent
commit
68d2fdd3ad
3 changed files with 13 additions and 8 deletions
  1. 5 2
      controllers/sg/his_api_controller.go
  2. 7 5
      service/gdyb_service.go
  3. 1 1
      service/his_service.go

+ 5 - 2
controllers/sg/his_api_controller.go View File

38
 	"syscall"
38
 	"syscall"
39
 	"time"
39
 	"time"
40
 	"unsafe"
40
 	"unsafe"
41
+	"github.com/go-ole/go-ole"
42
+
41
 )
43
 )
42
 
44
 
43
 type HisApiController struct {
45
 type HisApiController struct {
4613
 
4615
 
4614
 	//ids := c.GetString("ids")
4616
 	//ids := c.GetString("ids")
4615
 	//id_arr := strings.Split(ids, ",")
4617
 	//id_arr := strings.Split(ids, ",")
4616
-	now := time.Now()
4617
-	timestamp := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local).Unix()
4618
+	//now := time.Now()
4619
+	timestamp := 1729526400
4618
 	flows, _ := service.GetNewDrugFlowInforTen(timestamp, c.GetAdminUserInfo().CurrentOrgId)
4620
 	flows, _ := service.GetNewDrugFlowInforTen(timestamp, c.GetAdminUserInfo().CurrentOrgId)
4619
 	admin_user_id, _ := c.GetInt64("admin_user_id")
4621
 	admin_user_id, _ := c.GetInt64("admin_user_id")
4620
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
4622
 	roles, _ := service.GetAdminUserInfoByID(c.GetAdminUserInfo().CurrentOrgId, admin_user_id)
4763
 									item.IsChange = 1
4765
 									item.IsChange = 1
4764
 									item.BgBchno = bg_number
4766
 									item.BgBchno = bg_number
4765
 									service.SaveDF2(item)
4767
 									service.SaveDF2(item)
4768
+									return
4766
 								} else {
4769
 								} else {
4767
 									err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
4770
 									err = append(err, item.HisDoctorAdviceInfo.AdviceName+",销售变更失败:"+res3.ErrMsg)
4768
 								}
4771
 								}

+ 7 - 5
service/gdyb_service.go View File

8747
 	inputData["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
8747
 	inputData["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
8748
 
8748
 
8749
 	inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
8749
 	inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
8750
-	//inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
8750
+	inputData["drug_trac_codg"] = struct3505.DrugTracCodg          // 人员编号 (来自1101接口返回)
8751
 	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
8751
 	inputData["drug_prod_barc"] = struct3505.DrugProdBarc          // 人员编号 (来自1101接口返回)
8752
 	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
8752
 	inputData["shelf_posi"] = struct3505.ShelfPosi                 // 人员编号 (来自1101接口返回)
8753
 	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
8753
 	inputData["sel_retn_cnt"] = struct3505.SelRetnCnt              // 人员编号 (来自1101接口返回)
8754
 	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
8754
 	inputData["sel_retn_time"] = struct3505.SelRetnTime            // 人员编号 (来自1101接口返回)
8755
 	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
8755
 	inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
8756
 	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
8756
 	inputData["memo"] = struct3505.Memo                            // 人员编号 (来自1101接口返回)
8757
-
8757
+	//drug_trac_cod .g
8758
 	feedetail := make([]map[string]interface{}, 0)
8758
 	feedetail := make([]map[string]interface{}, 0)
8759
 
8759
 
8760
 	codes := strings.Split(struct3505.DrugTracCodg, ",")
8760
 	codes := strings.Split(struct3505.DrugTracCodg, ",")
8761
 	for _, item := range codes {
8761
 	for _, item := range codes {
8762
-		druginputData := make(map[string]interface{})
8763
-		druginputData["drug_trac_codg"] = item
8764
-		feedetail = append(feedetail, druginputData)
8762
+		if len(item) > 0{
8763
+			druginputData := make(map[string]interface{})
8764
+			druginputData["drug_trac_codg"] = item
8765
+			feedetail = append(feedetail, druginputData)
8766
+		}
8765
 	}
8767
 	}
8766
 	inputData["drugtracinfo"] = feedetail
8768
 	inputData["drugtracinfo"] = feedetail
8767
 	input["selinfo"] = inputData
8769
 	input["selinfo"] = inputData

+ 1 - 1
service/his_service.go View File

1770
 	return
1770
 	return
1771
 }
1771
 }
1772
 
1772
 
1773
-func GetNewDrugFlowInforTen(system_time int64,org_id int64) (flows []*models.DrugFlow, err error) {
1773
+func GetNewDrugFlowInforTen(system_time int,org_id int64) (flows []*models.DrugFlow, err error) {
1774
 	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.consumable_type = 3 and xt_drug_flow.is_sale = 0 and xt_drug_flow.system_time = ?", org_id,system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1774
 	err = readDb.Model(&models.DrugFlow{}).Joins("join his_doctor_advice_info info on info.patient_id = xt_drug_flow.patient_id and info.drug_id = xt_drug_flow.drug_id and info.record_date = xt_drug_flow.system_time").Where("xt_drug_flow.user_org_id = ? and xt_drug_flow.status = 1 and xt_drug_flow.consumable_type = 3 and xt_drug_flow.is_sale = 0 and xt_drug_flow.system_time = ?", org_id,system_time).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
1775
 		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1775
 		return db.Where("status = 1 and drug_code <> ''").Preload("BaseDrugLib", "status=1")
1776
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error
1776
 	}).Preload("NewDrugWarehouseInfo", "status = 1").Find(&flows).Error