Bläddra i källkod

Merge branch '20201014_xt_api_new_branch' of http://git.shengws.com/csx/XT_New into 20201014_xt_api_new_branch

XMLWAN 3 år sedan
förälder
incheckning
cb7dff396e

+ 13 - 22
controllers/his_api_controller.go Visa fil

95
 	beego.Router("/api/changemedtype/post", &HisApiController{}, "post:ChangeMedType")
95
 	beego.Router("/api/changemedtype/post", &HisApiController{}, "post:ChangeMedType")
96
 
96
 
97
 	beego.Router("/api/refunddetail/post", &HisApiController{}, "post:RefudDetail")
97
 	beego.Router("/api/refunddetail/post", &HisApiController{}, "post:RefudDetail")
98
-	
99
 
98
 
100
 }
99
 }
101
 
100
 
103
 	order_id, _ := c.GetInt64("order_id")
102
 	order_id, _ := c.GetInt64("order_id")
104
 	order, _ := service.GetHisOrderByID(order_id)
103
 	order, _ := service.GetHisOrderByID(order_id)
105
 	adminUser := c.GetAdminUserInfo()
104
 	adminUser := c.GetAdminUserInfo()
106
-	err := service.UpdataOrderStatus(order_id, order.Number, adminUser.CurrentOrgId)
107
-	if err == nil {
108
-		c.ServeSuccessJSON(map[string]interface{}{
109
-			"msg": "撤销成功",
110
-		})
111
-	} else {
112
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
113
-		return
114
-	}
105
+	service.UpdataOrderInfoStatus(order_id, order.Number, adminUser.CurrentOrgId)
106
+	c.ServeSuccessJSON(map[string]interface{}{
107
+		"msg": "撤销成功",
108
+	})
115
 }
109
 }
116
 
110
 
117
-
118
 func (c *HisApiController) Sscard() {
111
 func (c *HisApiController) Sscard() {
119
 	//r := CardInit()
112
 	//r := CardInit()
120
 	//if r == 0 {
113
 	//if r == 0 {
2797
 	var start_time int64
2790
 	var start_time int64
2798
 	var end_time int64
2791
 	var end_time int64
2799
 
2792
 
2800
-
2801
 	ids_str := c.GetString("ids")
2793
 	ids_str := c.GetString("ids")
2802
- 	ids_arr := strings.Split(ids_str,  ",")
2794
+	ids_arr := strings.Split(ids_str, ",")
2803
 	if tempOrder.ID == 0 {
2795
 	if tempOrder.ID == 0 {
2804
 		if settle_accounts_type == 1 { //日结
2796
 		if settle_accounts_type == 1 { //日结
2805
 			fmt.Println(reg_type)
2797
 			fmt.Println(reg_type)
2806
-			if reg_type == 11{
2798
+			if reg_type == 11 {
2807
 				fmt.Println(reg_type)
2799
 				fmt.Println(reg_type)
2808
-				prescriptions,_ = service.GetPrescriptionByIds(ids_arr,adminUser.CurrentOrgId)
2809
-			   }else{
2800
+				prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
2801
+			} else {
2810
 				prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, his_patient_id, recordDateTime, reg_type)
2802
 				prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, his_patient_id, recordDateTime, reg_type)
2811
-			   }
2803
+			}
2812
 		} else { //月结
2804
 		} else { //月结
2813
 			start_time_str := c.GetString("start_time")
2805
 			start_time_str := c.GetString("start_time")
2814
 			end_time_str := c.GetString("end_time")
2806
 			end_time_str := c.GetString("end_time")
4444
 	record_time := c.GetString("record_time")
4436
 	record_time := c.GetString("record_time")
4445
 	his_patient_id, _ := c.GetInt64("his_patient_id")
4437
 	his_patient_id, _ := c.GetInt64("his_patient_id")
4446
 
4438
 
4447
-	
4448
 	timeLayout := "2006-01-02"
4439
 	timeLayout := "2006-01-02"
4449
 	loc, _ := time.LoadLocation("Local")
4440
 	loc, _ := time.LoadLocation("Local")
4450
 	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
4441
 	settle_accounts_type, _ := c.GetInt64("settle_accounts_type")
4466
 	var end_time int64
4457
 	var end_time int64
4467
 
4458
 
4468
 	ids_str := c.GetString("ids")
4459
 	ids_str := c.GetString("ids")
4469
-	ids_arr := strings.Split(ids_str,  ",")
4460
+	ids_arr := strings.Split(ids_str, ",")
4470
 
4461
 
4471
 	fmt.Println(reg_type)
4462
 	fmt.Println(reg_type)
4472
 
4463
 
4473
 	if settle_accounts_type == 1 { //日结
4464
 	if settle_accounts_type == 1 { //日结
4474
 
4465
 
4475
-		if reg_type == 11{
4466
+		if reg_type == 11 {
4476
 
4467
 
4477
-			prescriptions,_ = service.GetPrescriptionByIds(ids_arr,adminUser.CurrentOrgId)
4478
-		}else{
4468
+			prescriptions, _ = service.GetPrescriptionByIds(ids_arr, adminUser.CurrentOrgId)
4469
+		} else {
4479
 			prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, his_patient_id, recordDateTime, reg_type)
4470
 			prescriptions, _ = service.GetSettleHisPrescription(adminUser.CurrentOrgId, id, his_patient_id, recordDateTime, reg_type)
4480
 		}
4471
 		}
4481
 
4472
 

+ 1 - 3
main.go Visa fil

3
 import (
3
 import (
4
 	_ "XT_New/routers"
4
 	_ "XT_New/routers"
5
 	"XT_New/service"
5
 	"XT_New/service"
6
-
7
 	"github.com/astaxie/beego"
6
 	"github.com/astaxie/beego"
8
 )
7
 )
9
 
8
 
17
 	//service.BeginAutoCreatePlanJob()
16
 	//service.BeginAutoCreatePlanJob()
18
 	//service.AutoClearSchedules()
17
 	//service.AutoClearSchedules()
19
 	//service.BeginAutoCreateStaffScheduleJob()
18
 	//service.BeginAutoCreateStaffScheduleJob()
20
-	//service.BeginAutoCreateDrugJob()
21
-	//service.BeginAutoCreateStockJob()
19
+	beego.BConfig.WebConfig.Session.SessionGCMaxLifetime = 60
22
 	beego.Run()
20
 	beego.Run()
23
 }
21
 }

+ 1 - 1
service/his_hospital_service.go Visa fil

116
 //	offset := (page - 1) * limit
116
 //	offset := (page - 1) * limit
117
 //	db := readDb.Model(&VMHospitalPatient{}).Where("user_org_id = ? AND status = 1", org_id)
117
 //	db := readDb.Model(&VMHospitalPatient{}).Where("user_org_id = ? AND status = 1", org_id)
118
 //	if len(keywords) > 0 {
118
 //	if len(keywords) > 0 {
119
-//		keywords = "%" + keywords + "%"
119
+//	wkkk	keywords = "%" + keywords + "%"
120
 //		db = db.Joins("JOIN xt_patients as p On xt_schedule.patient_id = p.id AND p.user_org_id = ? AND p.name like ?", org_id, keywords)
120
 //		db = db.Joins("JOIN xt_patients as p On xt_schedule.patient_id = p.id AND p.user_org_id = ? AND p.name like ?", org_id, keywords)
121
 //		db = db.Joins("JOIN his_prescription_info as info On xt_schedule.patient_id = info.patient_id  AND info.user_org_id = ? AND  info.record_date = ? AND info.prescription_number like ? AND info.p_type == 1", org_id, record_date, keywords)
121
 //		db = db.Joins("JOIN his_prescription_info as info On xt_schedule.patient_id = info.patient_id  AND info.user_org_id = ? AND  info.record_date = ? AND info.prescription_number like ? AND info.p_type == 1", org_id, record_date, keywords)
122
 //	}
122
 //	}

+ 0 - 2
service/his_project_service.go Visa fil

612
 	return
612
 	return
613
 }
613
 }
614
 
614
 
615
-
616
-
617
 // func GetPrescriptionByPatientId(patient_id int64, startime int64, p_type int64) (prescritpion []*models.HisPrescription, err error) {
615
 // func GetPrescriptionByPatientId(patient_id int64, startime int64, p_type int64) (prescritpion []*models.HisPrescription, err error) {
618
 // // 	err = XTReadDB().Model(&prescritpion).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
616
 // // 	err = XTReadDB().Model(&prescritpion).Preload("HisDoctorAdviceInfo", func(db *gorm.DB) *gorm.DB {
619
 // // 		return db.Where("status = 1 and user_org_id = ?", orgid).Preload("Drug", "status = 1")
617
 // // 		return db.Where("status = 1 and user_org_id = ?", orgid).Preload("Drug", "status = 1")

+ 12 - 5
service/his_service.go Visa fil

1027
 
1027
 
1028
 }
1028
 }
1029
 
1029
 
1030
+func UpdataOrderInfoStatus(id int64, number string, user_org_id int64) {
1031
+	err = writeDb.Model(&models.HisOrder{}).Where("status = 1 AND id = ? AND user_org_id = ?", id, user_org_id).Updates(map[string]interface{}{"mtime": time.Now().Unix(), "status": 0}).Error
1032
+	err = writeDb.Model(&models.HisOrderInfo{}).Where("status = 1 AND user_org_id = ? AND order_number = ?", user_org_id, number).Updates(map[string]interface{}{"mtime": time.Now().Unix(), "status": 0}).Error
1033
+
1034
+	return
1035
+
1036
+}
1037
+
1030
 func SaveHisPatient(his models.HisPatient) (err error) {
1038
 func SaveHisPatient(his models.HisPatient) (err error) {
1031
 	err = writeDb.Save(&his).Error
1039
 	err = writeDb.Save(&his).Error
1032
 	return
1040
 	return
1783
 	db = db.Preload("HisPatient", func(db *gorm.DB) *gorm.DB {
1791
 	db = db.Preload("HisPatient", func(db *gorm.DB) *gorm.DB {
1784
 		return db.Where("status = 1 AND user_org_id = ? AND record_date = ?", org_id, record_date).Preload("VMHisOrders", "user_org_id = ? AND status = 1 AND settle_accounts_date = ?", org_id, record_date)
1792
 		return db.Where("status = 1 AND user_org_id = ? AND record_date = ?", org_id, record_date).Preload("VMHisOrders", "user_org_id = ? AND status = 1 AND settle_accounts_date = ?", org_id, record_date)
1785
 	})
1793
 	})
1786
-	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND order_status <> 2", org_id, record_date)
1794
+	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND order_status <> 2 AND order_status <> 3", org_id, record_date)
1787
 	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND prescription_status <> 3", org_id, record_date).Find(&patients).Error
1795
 	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1 AND prescription_status <> 3", org_id, record_date).Find(&patients).Error
1788
 
1796
 
1789
 	for _, item := range patients {
1797
 	for _, item := range patients {
1801
 func GetNewAllChargeHisPatientList(org_id int64, keywords string, record_date int64) (patients []*NewTempPatients, err error) {
1809
 func GetNewAllChargeHisPatientList(org_id int64, keywords string, record_date int64) (patients []*NewTempPatients, err error) {
1802
 	db := readDb.Model(&NewTempPatients{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
1810
 	db := readDb.Model(&NewTempPatients{}).Where("xt_patients.user_org_id = ? AND xt_patients.status = 1", org_id)
1803
 	db = db.Preload("HisPatient", func(db *gorm.DB) *gorm.DB {
1811
 	db = db.Preload("HisPatient", func(db *gorm.DB) *gorm.DB {
1804
-		return db.Where("status = 1 AND user_org_id = ? AND record_date = ?", org_id, record_date).Preload("VMHisOrders", "user_org_id = ? AND status = 1 AND settle_accounts_date = ?", org_id, record_date)
1812
+		return db.Where("status = 1 AND user_org_id = ? AND record_date = ?", org_id, record_date).Preload("VMHisOrders", "user_org_id = ? AND status = 1 AND settle_accounts_date = ? ", org_id, record_date)
1805
 	})
1813
 	})
1806
 	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date)
1814
 	db = db.Preload("HisPrescription", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date)
1807
 	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date).Find(&patients).Error
1815
 	err = db.Preload("VMHisPrescriptionInfo", "user_org_id = ? AND status = 1 AND record_date = ? AND p_type <> 1", org_id, record_date).Find(&patients).Error
2046
 	return
2054
 	return
2047
 }
2055
 }
2048
 
2056
 
2049
-
2050
 func GetPrescriptionByIds(ids []string, org_id int64) (prescription []*models.HisPrescription, err error) {
2057
 func GetPrescriptionByIds(ids []string, org_id int64) (prescription []*models.HisPrescription, err error) {
2051
 	err = readDb.Model(&models.HisPrescription{}).
2058
 	err = readDb.Model(&models.HisPrescription{}).
2052
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
2059
 		Preload("HisAdditionalCharge", func(db *gorm.DB) *gorm.DB {
2060
 		}).Preload("TempHisOrder", func(db *gorm.DB) *gorm.DB {
2067
 		}).Preload("TempHisOrder", func(db *gorm.DB) *gorm.DB {
2061
 		return db.Where("status = 1 AND user_org_id = ?", org_id)
2068
 		return db.Where("status = 1 AND user_org_id = ?", org_id)
2062
 	}).
2069
 	}).
2063
-		Where("id in (?) AND user_org_id = ? AND status = 1", ids,org_id).
2070
+		Where("id in (?) AND user_org_id = ? AND status = 1", ids, org_id).
2064
 		Find(&prescription).Error
2071
 		Find(&prescription).Error
2065
-	
2072
+
2066
 	return
2073
 	return
2067
 }
2074
 }