Przeglądaj źródła

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

csx 4 lat temu
rodzic
commit
14f8eb7e63

+ 17 - 0
controllers/his_api_controller.go Wyświetl plik

625
 	remark := c.GetString("remark")
625
 	remark := c.GetString("remark")
626
 	breathingfloat, _ := strconv.ParseFloat(breathing, 64)
626
 	breathingfloat, _ := strconv.ParseFloat(breathing, 64)
627
 	fmt.Println("breathingfloat", breathingfloat)
627
 	fmt.Println("breathingfloat", breathingfloat)
628
+	sick, _ := c.GetInt64("sick")
629
+	diagnose, _ := c.GetInt64("diagnose")
628
 	timeLayout := "2006-01-02"
630
 	timeLayout := "2006-01-02"
629
 	loc, _ := time.LoadLocation("Local")
631
 	loc, _ := time.LoadLocation("Local")
630
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
632
 	theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
671
 		Breathing:               breathingfloat,
673
 		Breathing:               breathingfloat,
672
 		DoctorAdvice:            doctor_advice,
674
 		DoctorAdvice:            doctor_advice,
673
 		Remark:                  remark,
675
 		Remark:                  remark,
676
+		Sick:                    sick,
677
+		Diagnose:                diagnose,
674
 	}
678
 	}
675
 
679
 
676
 	err = service.SaveHisPatientCaseHistory(&caseHistory)
680
 	err = service.SaveHisPatientCaseHistory(&caseHistory)
1348
 			Idetinfo:    idetinfoStr,
1352
 			Idetinfo:    idetinfoStr,
1349
 			PatientId:   patient.ID,
1353
 			PatientId:   patient.ID,
1350
 			RecordDate:  theTime.Unix(),
1354
 			RecordDate:  theTime.Unix(),
1355
+			UserOrgId:   adminInfo.CurrentOrgId,
1356
+			AdminUserId: adminInfo.AdminUser.Id,
1357
+			IsReturn:    1,
1351
 		}
1358
 		}
1352
 		fmt.Println(his)
1359
 		fmt.Println(his)
1353
 
1360
 
1361
+		lastPatient, _ := service.GetLastPatient(adminInfo.CurrentOrgId)
1362
+		timeStr := time.Now().Format("2006-01-02")
1363
+		timeArr := strings.Split(timeStr, "-")
1364
+		var str = timeArr[0] + timeArr[1] + timeArr[2] + strconv.FormatInt(lastPatient.ID, 10)
1365
+
1366
+		hisPatient := models.HisPatient{
1367
+			Number: str,
1368
+		}
1369
+		err = service.UpdateHisPatient(lastPatient.ID, hisPatient)
1370
+
1354
 		if res.Output.Iinfo == nil || len(res.Output.Iinfo) == 0 {
1371
 		if res.Output.Iinfo == nil || len(res.Output.Iinfo) == 0 {
1355
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterOneException)
1372
 			c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeRegisterOneException)
1356
 			return
1373
 			return

+ 1 - 1
controllers/his_project_api_controller.go Wyświetl plik

1075
 	adminUserInfo := this.GetAdminUserInfo()
1075
 	adminUserInfo := this.GetAdminUserInfo()
1076
 	orgId := adminUserInfo.CurrentOrgId
1076
 	orgId := adminUserInfo.CurrentOrgId
1077
 	_, errcode := service.GetHisTemplateId(template_id, orgId)
1077
 	_, errcode := service.GetHisTemplateId(template_id, orgId)
1078
-	fmt.Println("errcode", errcode)
1078
+	//fmt.Println("errcode", errcode)
1079
 	if errcode == gorm.ErrRecordNotFound {
1079
 	if errcode == gorm.ErrRecordNotFound {
1080
 		template := models.XtHisTemplate{
1080
 		template := models.XtHisTemplate{
1081
 			TemplateId: template_id,
1081
 			TemplateId: template_id,

+ 6 - 0
controllers/stock_good_api_controller.go Wyświetl plik

37
 func (c *StockGoodApiController) CreateGoodType() {
37
 func (c *StockGoodApiController) CreateGoodType() {
38
 	type_name := c.GetString("type_name")
38
 	type_name := c.GetString("type_name")
39
 	remark := c.GetString("remark")
39
 	remark := c.GetString("remark")
40
+	out_stock := c.GetString("out_stock")
41
+	outStockInt, _ := strconv.ParseInt(out_stock, 10, 64)
40
 	adminUserInfo := c.GetAdminUserInfo()
42
 	adminUserInfo := c.GetAdminUserInfo()
41
 	totals := service.FindGoodTypeByName(type_name, adminUserInfo.CurrentOrgId)
43
 	totals := service.FindGoodTypeByName(type_name, adminUserInfo.CurrentOrgId)
42
 	if totals > 0 {
44
 	if totals > 0 {
56
 		OrgId:    adminUserInfo.CurrentOrgId,
58
 		OrgId:    adminUserInfo.CurrentOrgId,
57
 		Creater:  adminUserInfo.AdminUser.Id,
59
 		Creater:  adminUserInfo.AdminUser.Id,
58
 		Status:   1,
60
 		Status:   1,
61
+		OutStock: outStockInt,
59
 	}
62
 	}
60
 	err, types := service.AddSigleGoodType(&goodType)
63
 	err, types := service.AddSigleGoodType(&goodType)
61
 	if err == nil {
64
 	if err == nil {
72
 	type_name := c.GetString("type_name")
75
 	type_name := c.GetString("type_name")
73
 	remark := c.GetString("remark")
76
 	remark := c.GetString("remark")
74
 	good_type_code := c.GetString("type_code")
77
 	good_type_code := c.GetString("type_code")
78
+	out_stock := c.GetString("out_stock")
79
+	outStockInt, _ := strconv.ParseInt(out_stock, 10, 64)
75
 	adminUserInfo := c.GetAdminUserInfo()
80
 	adminUserInfo := c.GetAdminUserInfo()
76
 
81
 
77
 	//totals := service.FindGoodTypeByName(type_name, adminUserInfo.CurrentOrgId)
82
 	//totals := service.FindGoodTypeByName(type_name, adminUserInfo.CurrentOrgId)
90
 		OrgId:    adminUserInfo.CurrentOrgId,
95
 		OrgId:    adminUserInfo.CurrentOrgId,
91
 		Modifier: adminUserInfo.AdminUser.Id,
96
 		Modifier: adminUserInfo.AdminUser.Id,
92
 		Status:   1,
97
 		Status:   1,
98
+		OutStock: outStockInt,
93
 	}
99
 	}
94
 	err, types := service.ModifyGoodType(&goodType)
100
 	err, types := service.ModifyGoodType(&goodType)
95
 	if err == nil {
101
 	if err == nil {

+ 1 - 0
models/good_models.go Wyświetl plik

13
 	Status   int64  `gorm:"column:status" json:"status"`
13
 	Status   int64  `gorm:"column:status" json:"status"`
14
 	Type     int64  `gorm:"column:type" json:"type"`
14
 	Type     int64  `gorm:"column:type" json:"type"`
15
 	Number   int64  `gorm:"column:number" json:"number"`
15
 	Number   int64  `gorm:"column:number" json:"number"`
16
+	OutStock int64  `gorm:"column:out_stock" json:"out_stock" form:"out_stock"`
16
 }
17
 }
17
 
18
 
18
 func (GoodsType) TableName() string {
19
 func (GoodsType) TableName() string {

+ 3 - 1
models/his_models.go Wyświetl plik

259
 	Breathing               float64 `gorm:"column:breathing" json:"breathing" form:"breathing"`
259
 	Breathing               float64 `gorm:"column:breathing" json:"breathing" form:"breathing"`
260
 	DoctorAdvice            string  `gorm:"column:doctor_advice" json:"doctor_advice" form:"doctor_advice"`
260
 	DoctorAdvice            string  `gorm:"column:doctor_advice" json:"doctor_advice" form:"doctor_advice"`
261
 	Remark                  string  `gorm:"column:remark" json:"remark" form:"remark"`
261
 	Remark                  string  `gorm:"column:remark" json:"remark" form:"remark"`
262
+	Sick                    int64   `gorm:"column:sick" json:"sick" form:"sick"`
263
+	Diagnose                int64   `gorm:"column:diagnose" json:"diagnose" form:"diagnose"`
262
 }
264
 }
263
 
265
 
264
 func (HisPatientCaseHistory) TableName() string {
266
 func (HisPatientCaseHistory) TableName() string {
315
 	HisDoctorAdviceInfo    []*HisDoctorAdviceInfo    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
317
 	HisDoctorAdviceInfo    []*HisDoctorAdviceInfo    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"advices"`
316
 	HisPrescriptionProject []*HisPrescriptionProject `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
318
 	HisPrescriptionProject []*HisPrescriptionProject `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"project"`
317
 	HisAdditionalCharge    []*HisAdditionalCharge    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"addition"`
319
 	HisAdditionalCharge    []*HisAdditionalCharge    `gorm:"ForeignKey:PrescriptionId;AssociationForeignKey:ID" json:"addition"`
318
-	//VMHisPrescriptionInfo  VMHisPrescriptionInfo     `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,ScheduleDate" json:"info"`
320
+	VMHisPrescriptionInfo  HisPrescriptionInfo       `gorm:"ForeignKey:PatientId,RecordDate;AssociationForeignKey:PatientId,ScheduleDate" json:"info"`
319
 }
321
 }
320
 
322
 
321
 func (HisPrescription) TableName() string {
323
 func (HisPrescription) TableName() string {

+ 1 - 1
service/his_project_service.go Wyświetl plik

389
 
389
 
390
 func GetDoctorAdvicePrint(his_patient_id int64, recorddate int64, schIDs []string, orgid int64) (prescription []*models.HisPrescription, err error) {
390
 func GetDoctorAdvicePrint(his_patient_id int64, recorddate int64, schIDs []string, orgid int64) (prescription []*models.HisPrescription, err error) {
391
 
391
 
392
-	err = XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and id in(?) and  status = 1 ", his_patient_id, recorddate, schIDs).Preload("Patients", "status = 1 and user_org_id = ?", orgid).Preload("HisDoctorAdviceInfo", "status = 1 and user_org_id = ?", orgid).Preload("HisPrescriptionProject", "status = 1 and user_org_id = ?", orgid).Preload("XtHisAdditionalCharge", "status = 1 and user_org_id = ?", orgid).Find(&prescription).Error
392
+	err = XTReadDB().Model(&prescription).Where("patient_id = ? and record_date = ? and id in(?) and  status = 1 ", his_patient_id, recorddate, schIDs).Preload("Patients", "status = 1 and user_org_id = ?", orgid).Preload("HisDoctorAdviceInfo", "status = 1 and user_org_id = ?", orgid).Preload("HisPrescriptionProject", "status = 1 and user_org_id = ?", orgid).Preload("VMHisPrescriptionInfo", "status =1 and user_org_id = ?", orgid).Preload("XtHisAdditionalCharge", "status = 1 and user_org_id = ?", orgid).Find(&prescription).Error
393
 
393
 
394
 	return prescription, err
394
 	return prescription, err
395
 }
395
 }

+ 2 - 1
service/stock_service.go Wyświetl plik

133
 		"mtime":     time.Now().Unix(),
133
 		"mtime":     time.Now().Unix(),
134
 		"remark":    goodType.Remark,
134
 		"remark":    goodType.Remark,
135
 		"type_name": goodType.TypeName,
135
 		"type_name": goodType.TypeName,
136
+		"out_stock": goodType.OutStock,
136
 	}).Error
137
 	}).Error
137
 	return err, goodType
138
 	return err, goodType
138
 
139
 
279
 }
280
 }
280
 
281
 
281
 func FindAllGoodType(org_id int64) (goodType []*models.GoodsType, err error) {
282
 func FindAllGoodType(org_id int64) (goodType []*models.GoodsType, err error) {
282
-	err = readDb.Model(&models.GoodsType{}).Where("org_id = ? AND status = 1", org_id).Find(&goodType).Error
283
+	err = readDb.Model(&models.GoodsType{}).Where("org_id = ? AND status = 1 and out_stock = 1", org_id).Find(&goodType).Error
283
 	return goodType, err
284
 	return goodType, err
284
 }
285
 }
285
 
286